@abtnode/ux 1.16.17-beta-09df289d → 1.16.17-beta-4f13d99d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/blocklet/publish/create-project.js +33 -21
- package/es/blocklet/publish/create-release.js +131 -37
- package/es/blocklet/publish/project-list.js +26 -2
- package/es/blocklet/publish/release-list.js +21 -0
- package/es/blocklet/router/util.js +2 -1
- package/es/blocklet/storage/connect-to.js +7 -3
- package/es/blocklet/storage/item.js +2 -1
- package/es/locales/en.js +3 -1
- package/es/locales/zh.js +3 -1
- package/es/team/members/toggle-user-approval.js +4 -1
- package/es/util/spaces.js +19 -5
- package/lib/blocklet/publish/create-project.js +33 -21
- package/lib/blocklet/publish/create-release.js +126 -38
- package/lib/blocklet/publish/project-list.js +26 -2
- package/lib/blocklet/publish/release-list.js +21 -0
- package/lib/blocklet/router/util.js +2 -1
- package/lib/blocklet/storage/connect-to.js +6 -2
- package/lib/blocklet/storage/item.js +2 -1
- package/lib/locales/en.js +3 -1
- package/lib/locales/zh.js +3 -1
- package/lib/team/members/toggle-user-approval.js +4 -1
- package/lib/util/spaces.js +20 -5
- package/package.json +18 -18
package/es/util/spaces.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import isUrl from 'is-url';
|
|
2
2
|
import { BLOCKLET_CONFIGURABLE_KEY } from '@blocklet/constant';
|
|
3
3
|
import { isObject } from 'lodash';
|
|
4
|
+
import { joinURL } from 'ufo';
|
|
4
5
|
import { api } from './api';
|
|
5
6
|
|
|
6
7
|
/* eslint-disable import/prefer-default-export */
|
|
7
|
-
const joinUrl = require('url-join');
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @FIXME 希望之后放在 sdk 中 @jianchao
|
|
@@ -17,7 +17,7 @@ export function getBackupFilesUrlFromEndpoint(endpoint) {
|
|
|
17
17
|
const strArray = endpoint.replace(/\/$/, '').split('/');
|
|
18
18
|
const spaceDid = strArray.at(-4);
|
|
19
19
|
const appDid = strArray.at(-2);
|
|
20
|
-
return
|
|
20
|
+
return joinURL(prefix, 'space', spaceDid, 'apps', appDid, `explorer?key=/apps/${appDid}/.did-objects/${appDid}/`);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -30,7 +30,7 @@ export function getDIDSpaceUrlFromEndpoint(endpoint) {
|
|
|
30
30
|
const prefix = endpoint.replace(/\/api\/space\/.+/, '');
|
|
31
31
|
const strArray = endpoint.replace(/\/$/, '').split('/');
|
|
32
32
|
const spaceDid = strArray.at(-4);
|
|
33
|
-
return
|
|
33
|
+
return joinURL(prefix, 'space', spaceDid);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -88,6 +88,19 @@ export function getSpaceGatewayFromEndpoint(endpoint) {
|
|
|
88
88
|
return endpoint?.replace(/\/api\/space\/.+/, '');
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
/**
|
|
92
|
+
* @description
|
|
93
|
+
* @export
|
|
94
|
+
* @param {string} url
|
|
95
|
+
* @return {string}
|
|
96
|
+
*/
|
|
97
|
+
export function extraDIDSpacesCoreUrl(url) {
|
|
98
|
+
const Url = new URL(url);
|
|
99
|
+
// @note: 去除查询参数的那部分字符串
|
|
100
|
+
const didSpacesCoreUrl = joinURL(Url.origin, Url.pathname);
|
|
101
|
+
return didSpacesCoreUrl;
|
|
102
|
+
}
|
|
103
|
+
|
|
91
104
|
/**
|
|
92
105
|
* @description
|
|
93
106
|
* @export
|
|
@@ -99,7 +112,8 @@ export async function isValidSpaceGatewayUrl(spaceGatewayUrl) {
|
|
|
99
112
|
if (!isUrl(spaceGatewayUrl)) {
|
|
100
113
|
return false;
|
|
101
114
|
}
|
|
102
|
-
const
|
|
115
|
+
const didSpacesCoreUrl = extraDIDSpacesCoreUrl(spaceGatewayUrl);
|
|
116
|
+
const didConnectTokenUrl = joinURL(didSpacesCoreUrl, 'space/api/did/one-click-authorization/token');
|
|
103
117
|
const {
|
|
104
118
|
status,
|
|
105
119
|
data
|
|
@@ -147,7 +161,7 @@ export function getSpaceNftDisplayUrlFromEndpoint(endpoint) {
|
|
|
147
161
|
const prefix = endpoint.replace(/\/api\/space\/.+/, '');
|
|
148
162
|
const strArray = endpoint.replace(/\/$/, '').split('/');
|
|
149
163
|
const spaceDid = strArray.at(-4);
|
|
150
|
-
return
|
|
164
|
+
return joinURL(prefix, `/api/space/nft/display?spaceDid=${spaceDid}`);
|
|
151
165
|
}
|
|
152
166
|
|
|
153
167
|
/**
|
|
@@ -10,13 +10,13 @@ var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
|
10
10
|
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
11
11
|
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
12
12
|
var _Breadcrumbs = _interopRequireDefault(require("@mui/material/Breadcrumbs"));
|
|
13
|
+
var _InputAdornment = _interopRequireDefault(require("@mui/material/InputAdornment"));
|
|
13
14
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
14
15
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
15
16
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
16
17
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
17
18
|
var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
|
|
18
19
|
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
19
|
-
var _didAddress = _interopRequireDefault(require("../../did-address"));
|
|
20
20
|
var _node = require("../../contexts/node");
|
|
21
21
|
var _blocklet = require("../../contexts/blocklet");
|
|
22
22
|
var _session = require("../../contexts/session");
|
|
@@ -80,6 +80,14 @@ function CreateProject(_ref) {
|
|
|
80
80
|
setOpenConnect(false);
|
|
81
81
|
};
|
|
82
82
|
const onCreate = () => {
|
|
83
|
+
if (!blockletDid) {
|
|
84
|
+
_Toast.default.error(t('blocklet.publish.errorTip.noDid'));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (!blockletTitle) {
|
|
88
|
+
_Toast.default.error(t('blocklet.publish.errorTip.noTitle'));
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
83
91
|
setLoading(true);
|
|
84
92
|
api.createProject({
|
|
85
93
|
input: {
|
|
@@ -113,26 +121,29 @@ function CreateProject(_ref) {
|
|
|
113
121
|
style: {
|
|
114
122
|
maxWidth: 500
|
|
115
123
|
},
|
|
116
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
124
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
125
|
+
required: true,
|
|
117
126
|
sx: {
|
|
118
|
-
mb:
|
|
127
|
+
mb: 4
|
|
119
128
|
},
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
129
|
+
label: "Blocklet DID",
|
|
130
|
+
fullWidth: true,
|
|
131
|
+
readonly: true,
|
|
132
|
+
autoComplete: "off",
|
|
133
|
+
variant: "outlined",
|
|
134
|
+
onClick: () => !blockletDid && setOpenConnect(true),
|
|
135
|
+
InputProps: {
|
|
136
|
+
'data-cy': 'export-blocklet-did',
|
|
137
|
+
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputAdornment.default, {
|
|
138
|
+
position: "end",
|
|
139
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
140
|
+
onClick: () => setOpenConnect(true),
|
|
141
|
+
children: t(blockletDid ? 'common.update' : 'common.create')
|
|
142
|
+
})
|
|
143
|
+
})
|
|
144
|
+
},
|
|
145
|
+
helperText: "",
|
|
146
|
+
value: blockletDid || ''
|
|
136
147
|
}), openConnect && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
|
|
137
148
|
open: true,
|
|
138
149
|
popup: true,
|
|
@@ -155,10 +166,11 @@ function CreateProject(_ref) {
|
|
|
155
166
|
success: t('blocklet.publish.connect.success')
|
|
156
167
|
}
|
|
157
168
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
169
|
+
required: true,
|
|
158
170
|
label: "Blocklet ".concat(t('common.title')),
|
|
159
171
|
autoComplete: "off",
|
|
160
172
|
variant: "outlined",
|
|
161
|
-
|
|
173
|
+
InputProps: {
|
|
162
174
|
'data-cy': 'export-blocklet-title'
|
|
163
175
|
},
|
|
164
176
|
fullWidth: true,
|
|
@@ -186,7 +198,7 @@ function CreateProject(_ref) {
|
|
|
186
198
|
})]
|
|
187
199
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
188
200
|
variant: "contained",
|
|
189
|
-
disabled: loading
|
|
201
|
+
disabled: loading,
|
|
190
202
|
onClick: onCreate,
|
|
191
203
|
children: t('common.create')
|
|
192
204
|
})]
|
|
@@ -18,6 +18,7 @@ var _Breadcrumbs = _interopRequireDefault(require("@mui/material/Breadcrumbs"));
|
|
|
18
18
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
19
19
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
20
20
|
var _DeleteOutline = _interopRequireDefault(require("@mui/icons-material/DeleteOutline"));
|
|
21
|
+
var _InputAdornment = _interopRequireDefault(require("@mui/material/InputAdornment"));
|
|
21
22
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
22
23
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
23
24
|
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
@@ -29,6 +30,7 @@ var _bundleAvatar = _interopRequireDefault(require("../bundle-avatar"));
|
|
|
29
30
|
var _node = require("../../contexts/node");
|
|
30
31
|
var _blocklet = require("../../contexts/blocklet");
|
|
31
32
|
var _emptySpinner = _interopRequireDefault(require("../../empty-spinner"));
|
|
33
|
+
var _util = require("../../util");
|
|
32
34
|
var _resource = _interopRequireDefault(require("./resource"));
|
|
33
35
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
34
36
|
var _templateObject;
|
|
@@ -41,10 +43,49 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
41
43
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
42
44
|
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
43
45
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
44
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
46
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
47
|
+
const allowedFileTypes = ['image/*', '.jpg', '.jpeg', '.png', '.gif', '.svg'];
|
|
48
|
+
const maxFileSize = 1024 * 1024 * 10; // 10 MB
|
|
49
|
+
|
|
50
|
+
// eslint-disable-next-line import/no-unresolved
|
|
45
51
|
const UploaderComponent = /*#__PURE__*/(0, _react.lazy)(() => Promise.resolve().then(() => _interopRequireWildcard(require('@blocklet/uploader/react'))).then(res => ({
|
|
46
52
|
default: res.Uploader
|
|
47
53
|
})));
|
|
54
|
+
const validateParams = (params, status, t) => {
|
|
55
|
+
const errors = [];
|
|
56
|
+
if (!params.blockletTitle) {
|
|
57
|
+
errors.push({
|
|
58
|
+
param: 'blockletTitle',
|
|
59
|
+
message: t('blocklet.publish.errorTip.noTitle')
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (!params.blockletVersion) {
|
|
63
|
+
errors.push({
|
|
64
|
+
param: 'blockletVersion',
|
|
65
|
+
message: t('blocklet.publish.errorTip.noVersion')
|
|
66
|
+
});
|
|
67
|
+
} else if (!_semver.default.valid(params.blockletVersion)) {
|
|
68
|
+
errors.push({
|
|
69
|
+
param: 'blockletVersion',
|
|
70
|
+
message: 'Invalid Blocklet Version'
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (status === _constant.PROJECT.RELEASE_STATUS.published) {
|
|
74
|
+
if (!params.blockletDescription) {
|
|
75
|
+
errors.push({
|
|
76
|
+
param: 'blockletDescription',
|
|
77
|
+
message: t('blocklet.publish.errorTip.noDescription')
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (!params.note) {
|
|
81
|
+
errors.push({
|
|
82
|
+
param: 'note',
|
|
83
|
+
message: t('blocklet.publish.errorTip.noNote')
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return errors.length ? errors : null;
|
|
88
|
+
};
|
|
48
89
|
const addComponentTabs = _ref => {
|
|
49
90
|
let {
|
|
50
91
|
tabs,
|
|
@@ -73,9 +114,13 @@ const addComponentTabs = _ref => {
|
|
|
73
114
|
value: key
|
|
74
115
|
});
|
|
75
116
|
};
|
|
76
|
-
const pickParams = release =>
|
|
117
|
+
const pickParams = release => {
|
|
118
|
+
const params = (0, _pick.default)(release, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'note']);
|
|
119
|
+
params.blockletScreenshots || (params.blockletScreenshots = []);
|
|
120
|
+
return params;
|
|
121
|
+
};
|
|
77
122
|
function CreateRelease(_ref2) {
|
|
78
|
-
var _tabs
|
|
123
|
+
var _tabs$, _params$blockletIntro, _params$note;
|
|
79
124
|
let rest = Object.assign({}, (_objectDestructuringEmpty(_ref2), _ref2));
|
|
80
125
|
const navigate = (0, _reactRouterDom.useNavigate)();
|
|
81
126
|
const {
|
|
@@ -89,6 +134,7 @@ function CreateRelease(_ref2) {
|
|
|
89
134
|
blocklet
|
|
90
135
|
} = (0, _blocklet.useBlockletContext)();
|
|
91
136
|
const [params, setParams] = (0, _useSetState.default)(null);
|
|
137
|
+
const [paramsErrTip, setParamsErrTip] = (0, _react.useState)({});
|
|
92
138
|
const [loading, setLoading] = (0, _react.useState)(false);
|
|
93
139
|
const [release, setRelease] = (0, _react.useState)(null);
|
|
94
140
|
const {
|
|
@@ -128,7 +174,7 @@ function CreateRelease(_ref2) {
|
|
|
128
174
|
setParams(pickParams(data));
|
|
129
175
|
}).catch(err => {
|
|
130
176
|
setLoading(false);
|
|
131
|
-
_Toast.default.error(
|
|
177
|
+
_Toast.default.error((0, _util.formatError)(err));
|
|
132
178
|
});
|
|
133
179
|
};
|
|
134
180
|
const getRelease = () => {
|
|
@@ -144,7 +190,7 @@ function CreateRelease(_ref2) {
|
|
|
144
190
|
setRelease(res === null || res === void 0 ? void 0 : res.release);
|
|
145
191
|
}).catch(err => {
|
|
146
192
|
setLoading(false);
|
|
147
|
-
_Toast.default.error(
|
|
193
|
+
_Toast.default.error((0, _util.formatError)(err));
|
|
148
194
|
});
|
|
149
195
|
};
|
|
150
196
|
const getData = () => {
|
|
@@ -164,28 +210,21 @@ function CreateRelease(_ref2) {
|
|
|
164
210
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
165
211
|
|
|
166
212
|
const onRelease = status => {
|
|
167
|
-
|
|
168
|
-
|
|
213
|
+
const errors = validateParams(params, status, t);
|
|
214
|
+
if (errors) {
|
|
215
|
+
_Toast.default.error(errors.map(x => x.message).join('; '));
|
|
216
|
+
setParamsErrTip(errors.reduce((acc, x) => _objectSpread(_objectSpread({}, acc), {}, {
|
|
217
|
+
[x.param]: x.message
|
|
218
|
+
}), {}));
|
|
169
219
|
return;
|
|
170
220
|
}
|
|
171
|
-
if (!params.blockletVersion) {
|
|
172
|
-
_Toast.default.error(t('blocklet.publish.errorTip.noVersion'));
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
if (status === _constant.PROJECT.RELEASE_STATUS.published) {
|
|
176
|
-
if (!params.blockletDescription) {
|
|
177
|
-
_Toast.default.error(t('blocklet.publish.errorTip.noDescription'));
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
if (!params.note) {
|
|
181
|
-
_Toast.default.error(t('blocklet.publish.errorTip.noNote'));
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
221
|
const _params = _objectSpread({}, params);
|
|
186
222
|
_params.blockletVersion = _semver.default.valid(_params.blockletVersion);
|
|
187
223
|
if (!_params.blockletVersion) {
|
|
188
224
|
_Toast.default.error('Invalid Blocklet Version');
|
|
225
|
+
setParamsErrTip({
|
|
226
|
+
blockletVersion: 'Invalid Blocklet Version'
|
|
227
|
+
});
|
|
189
228
|
return;
|
|
190
229
|
}
|
|
191
230
|
_params.blockletTitle = (_params.blockletTitle || '').trim();
|
|
@@ -214,7 +253,7 @@ function CreateRelease(_ref2) {
|
|
|
214
253
|
});
|
|
215
254
|
}
|
|
216
255
|
}).catch(err => {
|
|
217
|
-
_Toast.default.error(
|
|
256
|
+
_Toast.default.error((0, _util.formatError)(err));
|
|
218
257
|
});
|
|
219
258
|
};
|
|
220
259
|
if (!params && loading) {
|
|
@@ -304,7 +343,7 @@ function CreateRelease(_ref2) {
|
|
|
304
343
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
305
344
|
label: "Blocklet ".concat(t('common.title')),
|
|
306
345
|
placeholder: "Blocklet ".concat(t('common.title')),
|
|
307
|
-
|
|
346
|
+
InputProps: {
|
|
308
347
|
'data-cy': 'blocklet-title',
|
|
309
348
|
readOnly
|
|
310
349
|
},
|
|
@@ -313,14 +352,19 @@ function CreateRelease(_ref2) {
|
|
|
313
352
|
fullWidth: true,
|
|
314
353
|
value: params.blockletTitle || '',
|
|
315
354
|
onChange: e => {
|
|
355
|
+
setParamsErrTip({
|
|
356
|
+
blockletTitle: ''
|
|
357
|
+
});
|
|
316
358
|
setParams({
|
|
317
359
|
blockletTitle: e.target.value
|
|
318
360
|
});
|
|
319
|
-
}
|
|
361
|
+
},
|
|
362
|
+
error: !!paramsErrTip.blockletTitle,
|
|
363
|
+
helperText: paramsErrTip.blockletTitle || ''
|
|
320
364
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
321
365
|
label: "Blocklet ".concat(t('common.description')),
|
|
322
366
|
placeholder: "Blocklet ".concat(t('common.description')),
|
|
323
|
-
|
|
367
|
+
InputProps: {
|
|
324
368
|
'data-cy': 'blocklet-description',
|
|
325
369
|
readOnly
|
|
326
370
|
},
|
|
@@ -329,31 +373,45 @@ function CreateRelease(_ref2) {
|
|
|
329
373
|
fullWidth: true,
|
|
330
374
|
value: params.blockletDescription || '',
|
|
331
375
|
onChange: e => {
|
|
376
|
+
setParamsErrTip({
|
|
377
|
+
blockletDescription: ''
|
|
378
|
+
});
|
|
332
379
|
setParams({
|
|
333
380
|
blockletDescription: e.target.value
|
|
334
381
|
});
|
|
335
382
|
},
|
|
383
|
+
error: !!paramsErrTip.blockletDescription,
|
|
384
|
+
helperText: paramsErrTip.blockletDescription || '',
|
|
336
385
|
sx: {
|
|
337
386
|
mt: 3
|
|
338
387
|
}
|
|
339
388
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
340
389
|
label: "Blocklet ".concat(t('common.introduction')),
|
|
341
390
|
placeholder: "Blocklet ".concat(t('common.introduction')),
|
|
342
|
-
|
|
391
|
+
InputProps: {
|
|
343
392
|
'data-cy': 'export-blocklet-introduction',
|
|
344
|
-
readOnly
|
|
393
|
+
readOnly,
|
|
394
|
+
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_InputAdornment.default, {
|
|
395
|
+
position: "end",
|
|
396
|
+
children: [(params === null || params === void 0 ? void 0 : (_params$blockletIntro = params.blockletIntroduction) === null || _params$blockletIntro === void 0 ? void 0 : _params$blockletIntro.length) || 0, " / ", _constant.PROJECT.MAX_INTRO_LENGTH]
|
|
397
|
+
})
|
|
345
398
|
},
|
|
346
399
|
autoComplete: "off",
|
|
347
400
|
variant: "outlined",
|
|
348
401
|
fullWidth: true,
|
|
349
402
|
multiline: true,
|
|
350
|
-
|
|
403
|
+
minRows: 4,
|
|
351
404
|
value: params.blockletIntroduction || '',
|
|
352
405
|
onChange: e => {
|
|
406
|
+
setParamsErrTip({
|
|
407
|
+
blockletIntroduction: ''
|
|
408
|
+
});
|
|
353
409
|
setParams({
|
|
354
|
-
blockletIntroduction: e.target.value
|
|
410
|
+
blockletIntroduction: e.target.value.slice(0, _constant.PROJECT.MAX_INTRO_LENGTH)
|
|
355
411
|
});
|
|
356
412
|
},
|
|
413
|
+
error: !!paramsErrTip.blockletIntroduction,
|
|
414
|
+
helperText: paramsErrTip.blockletIntroduction || '',
|
|
357
415
|
sx: {
|
|
358
416
|
mt: 3
|
|
359
417
|
}
|
|
@@ -374,7 +432,7 @@ function CreateRelease(_ref2) {
|
|
|
374
432
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
375
433
|
label: "Blocklet ".concat(t('common.version')),
|
|
376
434
|
placeholder: "Blocklet ".concat(t('common.version')),
|
|
377
|
-
|
|
435
|
+
InputProps: {
|
|
378
436
|
'data-cy': 'blocklet-version',
|
|
379
437
|
readOnly
|
|
380
438
|
},
|
|
@@ -383,27 +441,41 @@ function CreateRelease(_ref2) {
|
|
|
383
441
|
fullWidth: true,
|
|
384
442
|
value: params.blockletVersion,
|
|
385
443
|
onChange: e => {
|
|
444
|
+
setParamsErrTip({
|
|
445
|
+
blockletVersion: ''
|
|
446
|
+
});
|
|
386
447
|
setParams({
|
|
387
448
|
blockletVersion: e.target.value
|
|
388
449
|
});
|
|
389
|
-
}
|
|
450
|
+
},
|
|
451
|
+
error: !!paramsErrTip.blockletVersion,
|
|
452
|
+
helperText: paramsErrTip.blockletVersion || ''
|
|
390
453
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
391
454
|
label: t('blocklet.publish.releaseNote'),
|
|
392
455
|
autoComplete: "off",
|
|
393
456
|
variant: "outlined",
|
|
394
|
-
|
|
457
|
+
InputProps: {
|
|
395
458
|
'data-cy': 'release-note',
|
|
396
|
-
readOnly
|
|
459
|
+
readOnly,
|
|
460
|
+
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_InputAdornment.default, {
|
|
461
|
+
position: "end",
|
|
462
|
+
children: [(params === null || params === void 0 ? void 0 : (_params$note = params.note) === null || _params$note === void 0 ? void 0 : _params$note.length) || 0, " / ", _constant.PROJECT.MAX_NOTE_LENGTH]
|
|
463
|
+
})
|
|
397
464
|
},
|
|
398
465
|
fullWidth: true,
|
|
399
466
|
multiline: true,
|
|
400
|
-
|
|
467
|
+
minRows: 4,
|
|
401
468
|
value: params.note,
|
|
402
469
|
onChange: e => {
|
|
470
|
+
setParamsErrTip({
|
|
471
|
+
note: ''
|
|
472
|
+
});
|
|
403
473
|
setParams({
|
|
404
|
-
note: e.target.value
|
|
474
|
+
note: e.target.value.slice(0, _constant.PROJECT.MAX_NOTE_LENGTH)
|
|
405
475
|
});
|
|
406
476
|
},
|
|
477
|
+
error: !!paramsErrTip.note,
|
|
478
|
+
helperText: paramsErrTip.note || '',
|
|
407
479
|
sx: {
|
|
408
480
|
mt: 3
|
|
409
481
|
}
|
|
@@ -503,11 +575,19 @@ function CreateRelease(_ref2) {
|
|
|
503
575
|
setParams({
|
|
504
576
|
blockletLogo: result.data.filename
|
|
505
577
|
});
|
|
578
|
+
uploaderLogoRef.current.close();
|
|
506
579
|
},
|
|
507
|
-
plugins: [
|
|
580
|
+
plugins: [],
|
|
508
581
|
apiPathProps: {
|
|
509
582
|
uploader: uploadLogoPrefix,
|
|
510
583
|
disableMediaKitPrefix: true
|
|
584
|
+
},
|
|
585
|
+
coreProps: {
|
|
586
|
+
restrictions: {
|
|
587
|
+
allowedFileTypes,
|
|
588
|
+
maxFileSize,
|
|
589
|
+
maxNumberOfFiles: 1
|
|
590
|
+
}
|
|
511
591
|
}
|
|
512
592
|
}, "uploader-screenshot"), /*#__PURE__*/(0, _jsxRuntime.jsx)(UploaderComponent, {
|
|
513
593
|
id: "\u200Buploader-screenshot",
|
|
@@ -520,11 +600,19 @@ function CreateRelease(_ref2) {
|
|
|
520
600
|
setParams({
|
|
521
601
|
blockletScreenshots
|
|
522
602
|
});
|
|
603
|
+
uploaderScreenshotRef.current.close();
|
|
523
604
|
},
|
|
524
|
-
plugins: [
|
|
605
|
+
plugins: [],
|
|
525
606
|
apiPathProps: {
|
|
526
607
|
uploader: uploadScreenshotPrefix,
|
|
527
608
|
disableMediaKitPrefix: true
|
|
609
|
+
},
|
|
610
|
+
coreProps: {
|
|
611
|
+
restrictions: {
|
|
612
|
+
allowedFileTypes,
|
|
613
|
+
maxFileSize,
|
|
614
|
+
maxNumberOfFiles: 5 - screenshotUrls.length
|
|
615
|
+
}
|
|
528
616
|
}
|
|
529
617
|
}, "uploader-screenshot")]
|
|
530
618
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
@@ -559,7 +647,7 @@ function CreateRelease(_ref2) {
|
|
|
559
647
|
}
|
|
560
648
|
CreateRelease.propTypes = {};
|
|
561
649
|
CreateRelease.defaultProps = {};
|
|
562
|
-
const Main = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .sticky-header {\n margin-top: -12px;\n padding: 12px 0;\n position: sticky;\n top: 0;\n z-index: 99;\n display: flex;\n align-items: center;\n justify-content: space-between;\n background-color: #fff;\n padding-bottom: 12px;\n border-bottom: ", ";\n }\n .screenshot {\n margin-bottom: 16px;\n max-width: 200px;\n max-height: 140px;\n width: 200px;\n height: 140px;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #eee;\n margin-right: 16px;\n position: relative;\n .action {\n visibility: hidden;\n position: absolute;\n top: 0px;\n right: 0px;\n background-color: rgba(0, 0, 0, 0.2);\n color: rgba(255, 255, 255, 0.8);\n }\n &:hover .action {\n visibility: visible;\n }\n }\n .screenshot img {\n width: 100%; /* \u56FE\u50CF\u5BBD\u5EA6\u586B\u5145\u5BB9\u5668 */\n height: auto; /* \u56FE\u50CF\u9AD8\u5EA6\u81EA\u9002\u5E94 */\n }\n .section {\n max-width: 800px;\n &.full-width {\n max-width: 100%;\n }\n .MuiTypography-h3 {\n font-size: 1.1rem;\n font-weight: 700;\n }\n .left {\n flex-shrink: 0;\n width: 140px;\n }\n .MuiTabs-root {\n margin-top: 8px;\n transform: translateX(-16px);\n .MuiButtonBase-root .text {\n color: ", ";\n }\n .MuiButtonBase-root.Mui-selected .text {\n color: ", ";\n }\n }\n .MuiTabs-indicator {\n display: none;\n }\n .MuiTypography-subtitle1 {\n width: 120px;\n font-weight: 700;\n font-size: 1rem;\n ", " {\n width: 80px;\n }\n }\n }\n .MuiButtonBase-root {\n a {\n color: inherit;\n }\n }\n"])), _ref3 => {
|
|
650
|
+
const Main = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .sticky-header {\n margin-top: -12px;\n padding: 12px 0;\n position: sticky;\n top: 0;\n z-index: 99;\n display: flex;\n align-items: center;\n justify-content: space-between;\n background-color: #fff;\n padding-bottom: 12px;\n border-bottom: ", ";\n }\n .screenshot {\n margin-bottom: 16px;\n max-width: 200px;\n max-height: 140px;\n width: 200px;\n height: 140px;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #eee;\n margin-right: 16px;\n position: relative;\n .action {\n visibility: hidden;\n position: absolute;\n top: 0px;\n right: 0px;\n background-color: rgba(0, 0, 0, 0.2);\n color: rgba(255, 255, 255, 0.8);\n }\n &:hover .action {\n visibility: visible;\n }\n }\n .screenshot img {\n width: 100%; /* \u56FE\u50CF\u5BBD\u5EA6\u586B\u5145\u5BB9\u5668 */\n height: auto; /* \u56FE\u50CF\u9AD8\u5EA6\u81EA\u9002\u5E94 */\n }\n .section {\n max-width: 800px;\n &.full-width {\n max-width: 100%;\n }\n .MuiTypography-h3 {\n font-size: 1.1rem;\n font-weight: 700;\n }\n .left {\n flex-shrink: 0;\n width: 140px;\n }\n .MuiTabs-root {\n margin-top: 8px;\n transform: translateX(-16px);\n .MuiButtonBase-root .text {\n color: ", ";\n }\n .MuiButtonBase-root.Mui-selected .text {\n color: ", ";\n }\n }\n .MuiTabs-indicator {\n display: none;\n }\n .MuiTypography-subtitle1 {\n width: 120px;\n font-weight: 700;\n font-size: 1rem;\n ", " {\n width: 80px;\n }\n }\n }\n .MuiButtonBase-root {\n a {\n color: inherit;\n }\n }\n .MuiInputBase-multiline .MuiInputAdornment-positionEnd {\n align-self: flex-end;\n .MuiTypography-root {\n font-size: 0.8rem;\n }\n font-size: 0.8rem;\n }\n"])), _ref3 => {
|
|
563
651
|
let {
|
|
564
652
|
theme
|
|
565
653
|
} = _ref3;
|
|
@@ -14,6 +14,8 @@ var _Delete = _interopRequireDefault(require("@mui/icons-material/Delete"));
|
|
|
14
14
|
var _Datatable = _interopRequireDefault(require("@arcblock/ux/lib/Datatable"));
|
|
15
15
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
16
16
|
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
17
|
+
var _Tag = _interopRequireDefault(require("@arcblock/ux/lib/Tag"));
|
|
18
|
+
var _RelativeTime = _interopRequireDefault(require("@arcblock/ux/lib/RelativeTime"));
|
|
17
19
|
var _blocklet = require("../../contexts/blocklet");
|
|
18
20
|
var _node = require("../../contexts/node");
|
|
19
21
|
var _emptySpinner = _interopRequireDefault(require("../../empty-spinner"));
|
|
@@ -114,7 +116,7 @@ function ProjectList() {
|
|
|
114
116
|
});
|
|
115
117
|
}
|
|
116
118
|
const columns = [{
|
|
117
|
-
label:
|
|
119
|
+
label: 'Blocklet',
|
|
118
120
|
name: 'blockletTitle',
|
|
119
121
|
options: {
|
|
120
122
|
customBodyRenderLite: rawIndex => {
|
|
@@ -126,7 +128,7 @@ function ProjectList() {
|
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
}, {
|
|
129
|
-
label:
|
|
131
|
+
label: 'DID',
|
|
130
132
|
name: 'blockletDid',
|
|
131
133
|
options: {
|
|
132
134
|
customBodyRender: e => {
|
|
@@ -137,6 +139,28 @@ function ProjectList() {
|
|
|
137
139
|
});
|
|
138
140
|
}
|
|
139
141
|
}
|
|
142
|
+
}, {
|
|
143
|
+
label: 'Version',
|
|
144
|
+
name: 'blockletVersion',
|
|
145
|
+
options: {
|
|
146
|
+
customBodyRender: value => {
|
|
147
|
+
return value ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tag.default, {
|
|
148
|
+
type: "success",
|
|
149
|
+
children: value
|
|
150
|
+
}) : '';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}, {
|
|
154
|
+
label: t('common.updatedAt'),
|
|
155
|
+
name: 'updatedAt',
|
|
156
|
+
options: {
|
|
157
|
+
customBodyRender: value => {
|
|
158
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RelativeTime.default, {
|
|
159
|
+
value: Number(value),
|
|
160
|
+
locale: locale
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
140
164
|
}, {
|
|
141
165
|
label: t('common.actions'),
|
|
142
166
|
name: 'actions',
|
|
@@ -21,6 +21,8 @@ var _constant = require("@abtnode/constant");
|
|
|
21
21
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
22
22
|
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
23
23
|
var _Tag = _interopRequireDefault(require("@arcblock/ux/lib/Tag"));
|
|
24
|
+
var _RelativeTime = _interopRequireDefault(require("@arcblock/ux/lib/RelativeTime"));
|
|
25
|
+
var _constant2 = require("@blocklet/constant");
|
|
24
26
|
var _blocklet = require("../../contexts/blocklet");
|
|
25
27
|
var _node = require("../../contexts/node");
|
|
26
28
|
var _emptySpinner = _interopRequireDefault(require("../../empty-spinner"));
|
|
@@ -196,6 +198,21 @@ function ReleaseList() {
|
|
|
196
198
|
});
|
|
197
199
|
}
|
|
198
200
|
}
|
|
201
|
+
}, {
|
|
202
|
+
label: t('common.lastPublishedAt'),
|
|
203
|
+
name: 'updatedAt',
|
|
204
|
+
options: {
|
|
205
|
+
customBodyRenderLite: rawIndex => {
|
|
206
|
+
const release = releases[rawIndex];
|
|
207
|
+
if (release.status !== _constant2.PROJECT.RELEASE_STATUS.published) {
|
|
208
|
+
return '';
|
|
209
|
+
}
|
|
210
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RelativeTime.default, {
|
|
211
|
+
value: Number(release.updatedAt),
|
|
212
|
+
locale: locale
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
199
216
|
}, {
|
|
200
217
|
label: t('common.actions'),
|
|
201
218
|
name: 'actions',
|
|
@@ -204,11 +221,15 @@ function ReleaseList() {
|
|
|
204
221
|
const release = releases[rawIndex];
|
|
205
222
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
206
223
|
display: "flex",
|
|
224
|
+
alignItems: "center",
|
|
207
225
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
208
226
|
color: "primary",
|
|
209
227
|
"aria-label": "download",
|
|
210
228
|
disabled: release.status !== 'published',
|
|
211
229
|
children: release.status === 'published' ? /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
230
|
+
style: {
|
|
231
|
+
display: 'flex'
|
|
232
|
+
},
|
|
212
233
|
href: (0, _urlJoin.default)("".concat(_constant.WELLKNOWN_SERVICE_PATH_PREFIX, "/api/project/").concat(blocklet.meta.did, "/").concat(project.id, "/").concat(release.id, "/download/").concat((release.files || [])[0])),
|
|
213
234
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Download.default, {
|
|
214
235
|
sx: {
|
|
@@ -7,6 +7,7 @@ exports.validateSite = exports.validateRule = exports.validatePathPrefix = expor
|
|
|
7
7
|
var _constant = require("@abtnode/constant");
|
|
8
8
|
var _isPathPrefixEqual = _interopRequireDefault(require("@abtnode/util/lib/is-path-prefix-equal"));
|
|
9
9
|
var _constant2 = require("@blocklet/constant");
|
|
10
|
+
var _hasStartEngine = _interopRequireDefault(require("@blocklet/meta/lib/has-start-engine"));
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
12
|
/* eslint-disable import/prefer-default-export */
|
|
12
13
|
|
|
@@ -86,7 +87,7 @@ const validatePathPrefix = _ref => {
|
|
|
86
87
|
} = _ref;
|
|
87
88
|
// validate children
|
|
88
89
|
if (curBlocklet) {
|
|
89
|
-
let exist = (curBlocklet.children || []).find(x => (0, _isPathPrefixEqual.default)(x.mountPoint, params.pathPrefix));
|
|
90
|
+
let exist = (curBlocklet.children || []).find(x => (0, _hasStartEngine.default)(x.meta) && (0, _isPathPrefixEqual.default)(x.mountPoint, params.pathPrefix));
|
|
90
91
|
if (curBlocklet.meta.group !== 'gateway' && params.pathPrefix === '/') {
|
|
91
92
|
exist = '/';
|
|
92
93
|
}
|
|
@@ -126,6 +126,7 @@ function ConnectTo(_ref) {
|
|
|
126
126
|
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
127
127
|
open: false
|
|
128
128
|
}));
|
|
129
|
+
setUrl(null);
|
|
129
130
|
setAuthorizeFromNftConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
130
131
|
open: false
|
|
131
132
|
}));
|
|
@@ -195,7 +196,9 @@ function ConnectTo(_ref) {
|
|
|
195
196
|
const handleUseSpaceGatewayConnect = async () => {
|
|
196
197
|
try {
|
|
197
198
|
setLoading(true);
|
|
198
|
-
const
|
|
199
|
+
const tempUrl = url.startsWith('http') ? url : "https://".concat(url);
|
|
200
|
+
const fullUrl = (0, _spaces.extraDIDSpacesCoreUrl)(tempUrl);
|
|
201
|
+
const spaceDid = new URL(tempUrl).searchParams.get('spaceDid');
|
|
199
202
|
if (!(await (0, _spaces.isValidSpaceGatewayUrl)(fullUrl))) {
|
|
200
203
|
throw new Error(t('storage.spaces.gateway.add.invalidUrl'));
|
|
201
204
|
}
|
|
@@ -213,7 +216,8 @@ function ConnectTo(_ref) {
|
|
|
213
216
|
scopes: blockletInfo.scopes,
|
|
214
217
|
appUrl: blockletInfo.appUrl,
|
|
215
218
|
referrer: blockletInfo.referrer,
|
|
216
|
-
nodeDid: info.did
|
|
219
|
+
nodeDid: info.did,
|
|
220
|
+
spaceDid
|
|
217
221
|
}
|
|
218
222
|
}));
|
|
219
223
|
setOpen(false);
|