@abtnode/ux 1.16.25-next-bc2f4c63 → 1.16.25
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/actions.js +11 -1
- package/es/blocklet/component/add-component-core.js +5 -0
- package/es/blocklet/component/component-cell.js +2 -1
- package/es/blocklet/icons.js +3 -1
- package/es/blocklet/overview.js +13 -7
- package/es/blocklet/publish/create-release.js +150 -43
- package/es/blocklet/publish/index.js +0 -4
- package/es/blocklet/publish/project-list.js +133 -29
- package/es/blocklet/publish/release-list.js +18 -4
- package/es/blocklet/publish/resource.js +35 -32
- package/es/blocklet/router/rule-list.js +2 -1
- package/es/locales/ar.js +13 -8
- package/es/locales/de.js +13 -8
- package/es/locales/en.js +12 -7
- package/es/locales/es.js +13 -8
- package/es/locales/fr.js +13 -8
- package/es/locales/hi.js +13 -8
- package/es/locales/i18n.db +0 -0
- package/es/locales/id.js +13 -8
- package/es/locales/ja.js +13 -8
- package/es/locales/ko.js +13 -8
- package/es/locales/pt.js +13 -8
- package/es/locales/ru.js +13 -8
- package/es/locales/th.js +13 -8
- package/es/locales/vi.js +13 -8
- package/es/locales/zh-tw.js +13 -8
- package/es/locales/zh.js +17 -12
- package/es/team/members/connections.js +2 -1
- package/es/team/members/member.js +2 -1
- package/lib/blocklet/actions.js +14 -2
- package/lib/blocklet/component/add-component-core.js +1 -1
- package/lib/blocklet/component/component-cell.js +2 -1
- package/lib/blocklet/icons.js +3 -1
- package/lib/blocklet/overview.js +13 -7
- package/lib/blocklet/publish/create-release.js +154 -43
- package/lib/blocklet/publish/index.js +0 -4
- package/lib/blocklet/publish/project-list.js +133 -29
- package/lib/blocklet/publish/release-list.js +18 -4
- package/lib/blocklet/publish/resource.js +34 -31
- package/lib/blocklet/router/rule-list.js +2 -1
- package/lib/locales/ar.js +13 -8
- package/lib/locales/de.js +13 -8
- package/lib/locales/en.js +12 -7
- package/lib/locales/es.js +13 -8
- package/lib/locales/fr.js +13 -8
- package/lib/locales/hi.js +13 -8
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +13 -8
- package/lib/locales/ja.js +13 -8
- package/lib/locales/ko.js +13 -8
- package/lib/locales/pt.js +13 -8
- package/lib/locales/ru.js +13 -8
- package/lib/locales/th.js +13 -8
- package/lib/locales/vi.js +13 -8
- package/lib/locales/zh-tw.js +13 -8
- package/lib/locales/zh.js +17 -12
- package/lib/team/members/connections.js +2 -1
- package/lib/team/members/member.js +2 -1
- package/package.json +16 -16
- package/es/blocklet/publish/create-project.js +0 -205
- package/lib/blocklet/publish/create-project.js +0 -215
package/lib/blocklet/overview.js
CHANGED
|
@@ -54,18 +54,21 @@ function BlockletOverview() {
|
|
|
54
54
|
const infoRows = [appDid ? {
|
|
55
55
|
name: t('blocklet.appId'),
|
|
56
56
|
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_didAddress.default, {
|
|
57
|
-
did: appDid
|
|
57
|
+
did: appDid,
|
|
58
|
+
showQrcode: true
|
|
58
59
|
})
|
|
59
60
|
} : null, appPid ? {
|
|
60
61
|
name: t('blocklet.appPid'),
|
|
61
62
|
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_didAddress.default, {
|
|
62
|
-
did: appPid
|
|
63
|
+
did: appPid,
|
|
64
|
+
showQrcode: true
|
|
63
65
|
})
|
|
64
66
|
} : null, (migratedFrom === null || migratedFrom === void 0 ? void 0 : migratedFrom.length) > 1 ? {
|
|
65
67
|
name: t('blocklet.alsoKnownAs'),
|
|
66
68
|
value: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
67
69
|
children: [(showAllDIDs ? migratedFrom.slice(1) : migratedFrom.slice(1, 2)).map(x => /*#__PURE__*/(0, _jsxRuntime.jsx)(_didAddress.default, {
|
|
68
|
-
did: x.appDid
|
|
70
|
+
did: x.appDid,
|
|
71
|
+
showQrcode: true
|
|
69
72
|
})), migratedFrom.length > 2 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
70
73
|
style: {
|
|
71
74
|
marginLeft: '18px'
|
|
@@ -90,7 +93,8 @@ function BlockletOverview() {
|
|
|
90
93
|
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_didAddress.default, {
|
|
91
94
|
external: true,
|
|
92
95
|
href: (0, _util2.getExplorerLink)(blocklet === null || blocklet === void 0 || (_blocklet$controller = blocklet.controller) === null || _blocklet$controller === void 0 ? void 0 : _blocklet$controller.chainHost, blocklet === null || blocklet === void 0 || (_blocklet$controller2 = blocklet.controller) === null || _blocklet$controller2 === void 0 ? void 0 : _blocklet$controller2.nftId, 'asset'),
|
|
93
|
-
did: blocklet === null || blocklet === void 0 || (_blocklet$controller3 = blocklet.controller) === null || _blocklet$controller3 === void 0 ? void 0 : _blocklet$controller3.nftId
|
|
96
|
+
did: blocklet === null || blocklet === void 0 || (_blocklet$controller3 = blocklet.controller) === null || _blocklet$controller3 === void 0 ? void 0 : _blocklet$controller3.nftId,
|
|
97
|
+
showQrcode: true
|
|
94
98
|
})
|
|
95
99
|
} : null, {
|
|
96
100
|
name: t('blocklet.installedAt'),
|
|
@@ -101,8 +105,9 @@ function BlockletOverview() {
|
|
|
101
105
|
}, {
|
|
102
106
|
name: t('common.owner'),
|
|
103
107
|
value: (_blocklet$settings = blocklet.settings) !== null && _blocklet$settings !== void 0 && _blocklet$settings.owner ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_didAddress.default, {
|
|
104
|
-
did: blocklet.settings.owner.did
|
|
105
|
-
|
|
108
|
+
did: blocklet.settings.owner.did,
|
|
109
|
+
showQrcode: true
|
|
110
|
+
}) : '-'
|
|
106
111
|
}, {
|
|
107
112
|
name: t('blocklet.config.walletType.name'),
|
|
108
113
|
value: WalletType[chainType || 'arcblock'] || chainType
|
|
@@ -114,7 +119,8 @@ function BlockletOverview() {
|
|
|
114
119
|
infoRows.push({
|
|
115
120
|
name: t('common.serverDid'),
|
|
116
121
|
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_didAddress.default, {
|
|
117
|
-
did: nodeInfo.did
|
|
122
|
+
did: nodeInfo.did,
|
|
123
|
+
showQrcode: true
|
|
118
124
|
})
|
|
119
125
|
}, {
|
|
120
126
|
name: t('common.serverVersion'),
|
|
@@ -21,6 +21,7 @@ var _DeleteOutline = _interopRequireDefault(require("@mui/icons-material/DeleteO
|
|
|
21
21
|
var _InputAdornment = _interopRequireDefault(require("@mui/material/InputAdornment"));
|
|
22
22
|
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
23
23
|
var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
|
|
24
|
+
var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
|
|
24
25
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
25
26
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
26
27
|
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
@@ -30,6 +31,7 @@ var _Alert = _interopRequireDefault(require("@arcblock/ux/lib/Alert"));
|
|
|
30
31
|
var _constant = require("@blocklet/constant");
|
|
31
32
|
var _constant2 = require("@abtnode/constant");
|
|
32
33
|
var _bundleAvatar = _interopRequireDefault(require("../bundle-avatar"));
|
|
34
|
+
var _session = require("../../contexts/session");
|
|
33
35
|
var _node = require("../../contexts/node");
|
|
34
36
|
var _blocklet = require("../../contexts/blocklet");
|
|
35
37
|
var _emptySpinner = _interopRequireDefault(require("../../empty-spinner"));
|
|
@@ -126,8 +128,8 @@ const pickParams = (release, app) => {
|
|
|
126
128
|
if (!params.blockletComponents) {
|
|
127
129
|
params.blockletComponents = (app.children || []).map(x => ({
|
|
128
130
|
did: x.meta.did,
|
|
129
|
-
included:
|
|
130
|
-
required:
|
|
131
|
+
included: false,
|
|
132
|
+
required: false
|
|
131
133
|
}));
|
|
132
134
|
} else {
|
|
133
135
|
params.blockletComponents = params.blockletComponents.map(x => _objectSpread(_objectSpread({}, x), {}, {
|
|
@@ -143,11 +145,15 @@ function CreateRelease(_ref2) {
|
|
|
143
145
|
const {
|
|
144
146
|
projectId,
|
|
145
147
|
releaseId: inputReleaseId,
|
|
146
|
-
componentDid
|
|
148
|
+
componentDid = ''
|
|
147
149
|
} = (0, _reactRouterDom.useParams)();
|
|
148
150
|
const {
|
|
149
|
-
t
|
|
151
|
+
t,
|
|
152
|
+
locale
|
|
150
153
|
} = (0, _context.useLocaleContext)();
|
|
154
|
+
const {
|
|
155
|
+
api: sessionApi
|
|
156
|
+
} = (0, _session.useSessionContext)();
|
|
151
157
|
const {
|
|
152
158
|
blocklet
|
|
153
159
|
} = (0, _blocklet.useBlockletContext)();
|
|
@@ -161,10 +167,14 @@ function CreateRelease(_ref2) {
|
|
|
161
167
|
} = (0, _node.useNodeContext)();
|
|
162
168
|
const uploaderLogoRef = (0, _react.useRef)(null);
|
|
163
169
|
const uploaderScreenshotRef = (0, _react.useRef)(null);
|
|
164
|
-
const [projectType, setProjectType] = (0, _react.useState)();
|
|
165
170
|
const [installResourceTip, setInstallResourceTip] = (0, _react.useState)();
|
|
171
|
+
const [openConnect, setOpenConnect] = (0, _react.useState)(false);
|
|
166
172
|
const releaseId = inputReleaseId === 'create' ? '' : inputReleaseId;
|
|
167
173
|
const mode = inputReleaseId === 'create' ? 'create' : 'edit';
|
|
174
|
+
const projectType = (0, _react.useMemo)(() => {
|
|
175
|
+
var _params$blockletCompo;
|
|
176
|
+
return params !== null && params !== void 0 && (_params$blockletCompo = params.blockletComponents) !== null && _params$blockletCompo !== void 0 && _params$blockletCompo.some(x => x.included) ? 'pack' : 'resource';
|
|
177
|
+
}, [params === null || params === void 0 ? void 0 : params.blockletComponents]);
|
|
168
178
|
const tabs = [];
|
|
169
179
|
const resourceComponents = ((blocklet === null || blocklet === void 0 ? void 0 : blocklet.children) || []).filter(x => {
|
|
170
180
|
var _x$meta$resource;
|
|
@@ -181,10 +191,11 @@ function CreateRelease(_ref2) {
|
|
|
181
191
|
const [tab, setTab] = (0, _react.useState)((_tabs$ = tabs[0]) === null || _tabs$ === void 0 ? void 0 : _tabs$.value);
|
|
182
192
|
const isPublished = (release === null || release === void 0 ? void 0 : release.status) === 'published';
|
|
183
193
|
const readOnly = isPublished;
|
|
184
|
-
const getProject =
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
194
|
+
const getProject = () => {
|
|
195
|
+
if (!projectId) {
|
|
196
|
+
_Toast.default.error(t('blocklet.publish.errorTip.noDid'));
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
188
199
|
api.getProject({
|
|
189
200
|
input: {
|
|
190
201
|
did: blocklet.meta.did,
|
|
@@ -193,17 +204,16 @@ function CreateRelease(_ref2) {
|
|
|
193
204
|
}).then(res => {
|
|
194
205
|
setLoading(false);
|
|
195
206
|
const data = res.project || {};
|
|
196
|
-
if (typeOnly) {
|
|
197
|
-
setProjectType(data.type);
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
207
|
if (!data.blockletVersion) {
|
|
201
208
|
data.blockletVersion = '1.0.0';
|
|
202
209
|
} else if (_semver.default.valid(data.blockletVersion)) {
|
|
203
210
|
data.blockletVersion = _semver.default.inc(data.blockletVersion, 'patch');
|
|
204
211
|
}
|
|
205
|
-
|
|
206
|
-
|
|
212
|
+
const theParams = pickParams(data, blocklet);
|
|
213
|
+
if (theParams.blockletTitle === projectId.slice(0, 8)) {
|
|
214
|
+
theParams.blockletTitle = '';
|
|
215
|
+
}
|
|
216
|
+
setParams(theParams);
|
|
207
217
|
}).catch(err => {
|
|
208
218
|
setLoading(false);
|
|
209
219
|
_Toast.default.error((0, _util.formatError)(err));
|
|
@@ -232,19 +242,18 @@ function CreateRelease(_ref2) {
|
|
|
232
242
|
return;
|
|
233
243
|
}
|
|
234
244
|
getRelease();
|
|
235
|
-
getProject({
|
|
236
|
-
typeOnly: true
|
|
237
|
-
});
|
|
245
|
+
// getProject({ typeOnly: true });
|
|
238
246
|
}
|
|
239
247
|
if (mode === 'create') {
|
|
240
248
|
getProject();
|
|
241
249
|
}
|
|
242
250
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
243
251
|
}, [mode, releaseId]);
|
|
244
|
-
(0, _react.useEffect)(() => {
|
|
245
|
-
getData();
|
|
246
|
-
}, [getData]);
|
|
247
252
|
const onRelease = status => {
|
|
253
|
+
if (!projectId) {
|
|
254
|
+
_Toast.default.error(t('blocklet.publish.errorTip.noDid'));
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
248
257
|
const errors = validateParams(params, status, t);
|
|
249
258
|
if (errors) {
|
|
250
259
|
_Toast.default.error(errors.map(x => x.message).join('; '));
|
|
@@ -266,11 +275,7 @@ function CreateRelease(_ref2) {
|
|
|
266
275
|
_params.blockletDescription = (_params.blockletDescription || '').trim();
|
|
267
276
|
_params.blockletIntroduction = (_params.blockletIntroduction || '').trim();
|
|
268
277
|
_params.note = (_params.note || '').trim();
|
|
269
|
-
|
|
270
|
-
_params.blockletComponents = (_params.blockletComponents || []).filter(x => x.included).map(x => (0, _pick.default)(x, ['did', 'required'])).map(JSON.stringify);
|
|
271
|
-
} else {
|
|
272
|
-
delete _params.blockletComponents;
|
|
273
|
-
}
|
|
278
|
+
_params.blockletComponents = (_params.blockletComponents || []).filter(x => x.included).map(x => (0, _pick.default)(x, ['did', 'required'])).map(JSON.stringify);
|
|
274
279
|
setCreateLoading(status);
|
|
275
280
|
setLoading(true);
|
|
276
281
|
api.createRelease({
|
|
@@ -309,12 +314,98 @@ function CreateRelease(_ref2) {
|
|
|
309
314
|
}
|
|
310
315
|
});
|
|
311
316
|
};
|
|
317
|
+
const handleDidConnectShow = e => {
|
|
318
|
+
e.preventDefault();
|
|
319
|
+
e.stopPropagation();
|
|
320
|
+
if (!params.blockletTitle) {
|
|
321
|
+
setParamsErrTip({
|
|
322
|
+
blockletTitle: t('blocklet.publish.errorTip.noTitle')
|
|
323
|
+
});
|
|
324
|
+
_Toast.default.error(t('blocklet.publish.errorTip.noTitle'));
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
if (projectId === '0') {
|
|
328
|
+
setOpenConnect(true);
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
const handleDidConnectClose = () => {
|
|
332
|
+
setOpenConnect(false);
|
|
333
|
+
};
|
|
334
|
+
const handleChangeSelectedComponents = data => {
|
|
335
|
+
setParams({
|
|
336
|
+
blockletComponents: data
|
|
337
|
+
});
|
|
338
|
+
};
|
|
339
|
+
const handleCreateBlockletDidError = err => {
|
|
340
|
+
_Toast.default.error(err.message);
|
|
341
|
+
setOpenConnect(false);
|
|
342
|
+
};
|
|
343
|
+
const handleCreate = nextProjectDid => {
|
|
344
|
+
var _params$blockletCompo2;
|
|
345
|
+
if (!nextProjectDid) {
|
|
346
|
+
_Toast.default.error(t('blocklet.publish.errorTip.noDid'));
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
setLoading(true);
|
|
350
|
+
api.createProject({
|
|
351
|
+
input: {
|
|
352
|
+
did: blocklet.meta.did,
|
|
353
|
+
blockletTitle: params.blockletTitle || nextProjectDid.slice(0, 9),
|
|
354
|
+
blockletDid: nextProjectDid,
|
|
355
|
+
type: ((_params$blockletCompo2 = params.blockletComponents) === null || _params$blockletCompo2 === void 0 ? void 0 : _params$blockletCompo2.length) > 0 ? 'pack' : 'resource',
|
|
356
|
+
componentDid
|
|
357
|
+
}
|
|
358
|
+
}).then(() => {
|
|
359
|
+
setLoading(false);
|
|
360
|
+
navigate("/.well-known/service/admin/publish/".concat(nextProjectDid, "/create"), {
|
|
361
|
+
replace: true
|
|
362
|
+
});
|
|
363
|
+
}).catch(err => {
|
|
364
|
+
setLoading(false);
|
|
365
|
+
_Toast.default.error(err.message);
|
|
366
|
+
});
|
|
367
|
+
};
|
|
368
|
+
const handleCreateBlockletDidSuccess = result => {
|
|
369
|
+
var _result$blockletWalle;
|
|
370
|
+
const did = result === null || result === void 0 || (_result$blockletWalle = result.blockletWallet) === null || _result$blockletWalle === void 0 ? void 0 : _result$blockletWalle.address;
|
|
371
|
+
if (!did) {
|
|
372
|
+
_Toast.default.error('Empty Blocklet DID');
|
|
373
|
+
} else {
|
|
374
|
+
handleCreate(did);
|
|
375
|
+
}
|
|
376
|
+
setOpenConnect(false);
|
|
377
|
+
};
|
|
378
|
+
(0, _react.useEffect)(() => {
|
|
379
|
+
getData();
|
|
380
|
+
}, [getData]);
|
|
312
381
|
if (!params && loading) {
|
|
313
382
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_emptySpinner.default, {});
|
|
314
383
|
}
|
|
315
384
|
if (!params) {
|
|
316
385
|
return null;
|
|
317
386
|
}
|
|
387
|
+
const connect = openConnect ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
|
|
388
|
+
open: true,
|
|
389
|
+
popup: true,
|
|
390
|
+
onClose: handleDidConnectClose,
|
|
391
|
+
action: "gen-blocklet-key-pair",
|
|
392
|
+
locale: locale,
|
|
393
|
+
checkFn: sessionApi.get,
|
|
394
|
+
saveConnect: false,
|
|
395
|
+
forceConnected: false,
|
|
396
|
+
checkTimeout: 5 * 60 * 1000,
|
|
397
|
+
onSuccess: handleCreateBlockletDidSuccess,
|
|
398
|
+
onError: handleCreateBlockletDidError,
|
|
399
|
+
extraParams: {
|
|
400
|
+
did: blocklet.meta.did
|
|
401
|
+
},
|
|
402
|
+
messages: {
|
|
403
|
+
title: t('blocklet.publish.connect.title'),
|
|
404
|
+
scan: t('blocklet.publish.connect.scan'),
|
|
405
|
+
confirm: t('blocklet.publish.connect.confirm'),
|
|
406
|
+
success: t('blocklet.publish.connect.success')
|
|
407
|
+
}
|
|
408
|
+
}) : null;
|
|
318
409
|
const uploadLogoPrefix = "".concat(_constant2.WELLKNOWN_SERVICE_PATH_PREFIX, "/api/project/").concat(blocklet.meta.did, "/").concat(projectId, "/logo/upload");
|
|
319
410
|
const uploadScreenshotPrefix = "".concat(_constant2.WELLKNOWN_SERVICE_PATH_PREFIX, "/api/project/").concat(blocklet.meta.did, "/").concat(projectId, "/screenshot/upload");
|
|
320
411
|
const logoUrl = params !== null && params !== void 0 && params.blockletLogo ? "".concat(uploadLogoPrefix, "/").concat(params.blockletLogo) : "".concat(_constant2.WELLKNOWN_SERVICE_PATH_PREFIX, "/static/images/logo.png");
|
|
@@ -374,7 +465,7 @@ function CreateRelease(_ref2) {
|
|
|
374
465
|
marginRight: 8
|
|
375
466
|
},
|
|
376
467
|
onClick: () => setInstallResourceTip(blockletMetaUrl),
|
|
377
|
-
children: t('
|
|
468
|
+
children: t('blocklet.publish.copyInstallUrl')
|
|
378
469
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.default, {
|
|
379
470
|
fullWidth: true,
|
|
380
471
|
maxWidth: "sm",
|
|
@@ -414,7 +505,7 @@ function CreateRelease(_ref2) {
|
|
|
414
505
|
}
|
|
415
506
|
}
|
|
416
507
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Main, _objectSpread(_objectSpread({}, rest), {}, {
|
|
417
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
508
|
+
children: [connect, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
418
509
|
className: "sticky-header",
|
|
419
510
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Breadcrumbs.default, {
|
|
420
511
|
className: "breadcrumbs",
|
|
@@ -468,14 +559,8 @@ function CreateRelease(_ref2) {
|
|
|
468
559
|
})]
|
|
469
560
|
})]
|
|
470
561
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
471
|
-
children: [
|
|
472
|
-
|
|
473
|
-
style: {
|
|
474
|
-
width: '100%'
|
|
475
|
-
},
|
|
476
|
-
children: t('blocklet.publish.packTip')
|
|
477
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
478
|
-
pt: 3
|
|
562
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
563
|
+
pt: 5
|
|
479
564
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
480
565
|
display: "flex",
|
|
481
566
|
className: "section",
|
|
@@ -509,6 +594,30 @@ function CreateRelease(_ref2) {
|
|
|
509
594
|
},
|
|
510
595
|
error: !!paramsErrTip.blockletTitle,
|
|
511
596
|
helperText: paramsErrTip.blockletTitle || ''
|
|
597
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
598
|
+
required: true,
|
|
599
|
+
label: "Blocklet DID",
|
|
600
|
+
fullWidth: true,
|
|
601
|
+
readonly: true,
|
|
602
|
+
disabled: projectId !== '0',
|
|
603
|
+
autoComplete: "off",
|
|
604
|
+
variant: "outlined",
|
|
605
|
+
onClick: handleDidConnectShow,
|
|
606
|
+
InputProps: {
|
|
607
|
+
'data-cy': 'export-blocklet-did',
|
|
608
|
+
endAdornment: projectId === '0' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputAdornment.default, {
|
|
609
|
+
position: "end",
|
|
610
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
611
|
+
onClick: handleDidConnectShow,
|
|
612
|
+
children: t('common.create')
|
|
613
|
+
})
|
|
614
|
+
})
|
|
615
|
+
},
|
|
616
|
+
helperText: "",
|
|
617
|
+
value: projectId === '0' ? '' : projectId,
|
|
618
|
+
sx: {
|
|
619
|
+
mt: 3
|
|
620
|
+
}
|
|
512
621
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
513
622
|
label: "Blocklet ".concat(t('common.description')),
|
|
514
623
|
placeholder: "Blocklet ".concat(t('common.description')),
|
|
@@ -795,7 +904,7 @@ function CreateRelease(_ref2) {
|
|
|
795
904
|
children: resourceContent
|
|
796
905
|
})]
|
|
797
906
|
})]
|
|
798
|
-
}),
|
|
907
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
799
908
|
display: "flex",
|
|
800
909
|
mt: 3,
|
|
801
910
|
className: "section full-width",
|
|
@@ -812,14 +921,16 @@ function CreateRelease(_ref2) {
|
|
|
812
921
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_selectComponents.default, {
|
|
813
922
|
disabled: loading || readOnly,
|
|
814
923
|
app: blocklet,
|
|
815
|
-
value: params.blockletComponents,
|
|
816
|
-
onChange:
|
|
817
|
-
setParams({
|
|
818
|
-
blockletComponents: data
|
|
819
|
-
});
|
|
820
|
-
}
|
|
924
|
+
value: params.blockletComponents || [],
|
|
925
|
+
onChange: handleChangeSelectedComponents
|
|
821
926
|
})
|
|
822
927
|
})]
|
|
928
|
+
}), projectType === 'pack' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
|
|
929
|
+
type: "info",
|
|
930
|
+
style: {
|
|
931
|
+
width: '100%'
|
|
932
|
+
},
|
|
933
|
+
children: t('blocklet.publish.packTip')
|
|
823
934
|
})]
|
|
824
935
|
})]
|
|
825
936
|
}));
|
|
@@ -11,7 +11,6 @@ var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
|
11
11
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
12
12
|
var _blocklet = require("../../contexts/blocklet");
|
|
13
13
|
var _projectList = _interopRequireDefault(require("./project-list"));
|
|
14
|
-
var _createProject = _interopRequireDefault(require("./create-project"));
|
|
15
14
|
var _releaseList = _interopRequireDefault(require("./release-list"));
|
|
16
15
|
var _createRelease = _interopRequireDefault(require("./create-release"));
|
|
17
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -57,9 +56,6 @@ function BlockletPublish(_ref) {
|
|
|
57
56
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
|
|
58
57
|
path: "/",
|
|
59
58
|
element: /*#__PURE__*/(0, _jsxRuntime.jsx)(_projectList.default, {})
|
|
60
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
|
|
61
|
-
path: "/create",
|
|
62
|
-
element: /*#__PURE__*/(0, _jsxRuntime.jsx)(_createProject.default, {})
|
|
63
59
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
|
|
64
60
|
path: "/:projectId",
|
|
65
61
|
element: /*#__PURE__*/(0, _jsxRuntime.jsx)(_releaseList.default, {})
|
|
@@ -7,15 +7,22 @@ exports.default = ProjectList;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactRouterDom = require("react-router-dom");
|
|
9
9
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
|
+
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
10
11
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
11
12
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
13
|
+
var _Add = _interopRequireDefault(require("@mui/icons-material/Add"));
|
|
12
14
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
15
|
+
var _LibraryAdd = _interopRequireDefault(require("@mui/icons-material/LibraryAdd"));
|
|
13
16
|
var _Delete = _interopRequireDefault(require("@mui/icons-material/Delete"));
|
|
17
|
+
var _InstallDesktop = _interopRequireDefault(require("@mui/icons-material/InstallDesktop"));
|
|
18
|
+
var _Download = _interopRequireDefault(require("@mui/icons-material/Download"));
|
|
19
|
+
var _constant = require("@abtnode/constant");
|
|
14
20
|
var _Datatable = _interopRequireDefault(require("@arcblock/ux/lib/Datatable"));
|
|
15
21
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
16
22
|
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
17
23
|
var _Tag = _interopRequireDefault(require("@arcblock/ux/lib/Tag"));
|
|
18
24
|
var _RelativeTime = _interopRequireDefault(require("@arcblock/ux/lib/RelativeTime"));
|
|
25
|
+
var _material = require("@mui/material");
|
|
19
26
|
var _blocklet = require("../../contexts/blocklet");
|
|
20
27
|
var _node = require("../../contexts/node");
|
|
21
28
|
var _emptySpinner = _interopRequireDefault(require("../../empty-spinner"));
|
|
@@ -23,13 +30,15 @@ var _didAddress = _interopRequireDefault(require("../../did-address"));
|
|
|
23
30
|
var _confirm = _interopRequireDefault(require("../../confirm"));
|
|
24
31
|
var _bundleAvatar = _interopRequireDefault(require("../bundle-avatar"));
|
|
25
32
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
|
-
var _templateObject;
|
|
33
|
+
var _window$env, _templateObject;
|
|
27
34
|
/* eslint-disable react/no-unstable-nested-components */
|
|
28
35
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
36
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
30
37
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
31
38
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
39
|
+
const serverEndpoint = (_window$env = window.env) === null || _window$env === void 0 ? void 0 : _window$env.serverEndpoint;
|
|
32
40
|
function ProjectList() {
|
|
41
|
+
const navigate = (0, _reactRouterDom.useNavigate)();
|
|
33
42
|
const {
|
|
34
43
|
t,
|
|
35
44
|
locale
|
|
@@ -61,6 +70,11 @@ function ProjectList() {
|
|
|
61
70
|
_Toast.default.error(err.message);
|
|
62
71
|
});
|
|
63
72
|
};
|
|
73
|
+
const handleNewBlocklet = () => {
|
|
74
|
+
navigate('/.well-known/service/admin/publish/0/create', {
|
|
75
|
+
replace: true
|
|
76
|
+
});
|
|
77
|
+
};
|
|
64
78
|
const onDeleteProject = project => {
|
|
65
79
|
setDeleteConfirm(project);
|
|
66
80
|
};
|
|
@@ -87,7 +101,15 @@ function ProjectList() {
|
|
|
87
101
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
88
102
|
|
|
89
103
|
if (!projects && loading) {
|
|
90
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
104
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
105
|
+
sx: {
|
|
106
|
+
display: 'flex',
|
|
107
|
+
justifyContent: 'center',
|
|
108
|
+
alignItems: 'center',
|
|
109
|
+
marginTop: '40px'
|
|
110
|
+
},
|
|
111
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_emptySpinner.default, {})
|
|
112
|
+
});
|
|
91
113
|
}
|
|
92
114
|
if (!projects) {
|
|
93
115
|
return null;
|
|
@@ -112,12 +134,10 @@ function ProjectList() {
|
|
|
112
134
|
mb: 3
|
|
113
135
|
},
|
|
114
136
|
children: t('blocklet.publish.createBlockletTip')
|
|
115
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
children: t('blocklet.publish.createBlocklet')
|
|
120
|
-
})
|
|
137
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
138
|
+
onClick: handleNewBlocklet,
|
|
139
|
+
variant: "contained",
|
|
140
|
+
children: t('blocklet.publish.createBlocklet')
|
|
121
141
|
})]
|
|
122
142
|
});
|
|
123
143
|
}
|
|
@@ -202,34 +222,118 @@ function ProjectList() {
|
|
|
202
222
|
options: {
|
|
203
223
|
customBodyRenderLite: rawIndex => {
|
|
204
224
|
const project = projects[rawIndex];
|
|
205
|
-
|
|
225
|
+
let installUrl = '';
|
|
226
|
+
let downloadUrl = '';
|
|
227
|
+
if (project.lastReleaseId) {
|
|
228
|
+
const blockletMetaUrl = (0, _urlJoin.default)(serverEndpoint, "/api/project/".concat(blocklet.meta.did, "/").concat(project.id, "/").concat(project.lastReleaseId, "/release/blocklet.json"));
|
|
229
|
+
const url = new URL(serverEndpoint);
|
|
230
|
+
url.pathname = (0, _urlJoin.default)(url.pathname, '/launch-blocklet/agreement');
|
|
231
|
+
url.searchParams.set('blocklet_meta_url', blockletMetaUrl);
|
|
232
|
+
installUrl = url.href;
|
|
233
|
+
downloadUrl = (0, _urlJoin.default)("".concat(_constant.WELLKNOWN_SERVICE_PATH_PREFIX, "/api/project/").concat(blocklet.meta.did, "/").concat(project.id, "/").concat(project.lastReleaseId, "/download/").concat((project.lastReleaseFiles || [])[0]));
|
|
234
|
+
}
|
|
235
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
206
236
|
display: "flex",
|
|
207
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
237
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Link, {
|
|
238
|
+
to: "".concat(project.id, "/create"),
|
|
239
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
240
|
+
title: t('blocklet.publish.createRelease'),
|
|
241
|
+
placement: "top",
|
|
242
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
243
|
+
color: "primary",
|
|
244
|
+
"aria-label": "create",
|
|
245
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_LibraryAdd.default, {
|
|
246
|
+
sx: {
|
|
247
|
+
fontSize: 18
|
|
248
|
+
}
|
|
249
|
+
})
|
|
250
|
+
})
|
|
251
|
+
})
|
|
252
|
+
}), !!project.lastReleaseId && project.type === 'pack' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
253
|
+
title: t('blocklet.publish.install', {
|
|
254
|
+
name: project.blockletTitle
|
|
255
|
+
}),
|
|
256
|
+
placement: "top",
|
|
257
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
258
|
+
color: "secondary",
|
|
259
|
+
"aria-label": "create",
|
|
260
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
261
|
+
style: {
|
|
262
|
+
display: 'flex'
|
|
263
|
+
},
|
|
264
|
+
href: installUrl,
|
|
265
|
+
target: "_blank",
|
|
266
|
+
rel: "noreferrer",
|
|
267
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InstallDesktop.default, {
|
|
268
|
+
sx: {
|
|
269
|
+
fontSize: 18
|
|
270
|
+
}
|
|
271
|
+
})
|
|
272
|
+
})
|
|
273
|
+
})
|
|
274
|
+
}), !!project.lastReleaseId && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
275
|
+
title: t('blocklet.publish.download', {
|
|
276
|
+
name: project.blockletTitle
|
|
277
|
+
}),
|
|
278
|
+
placement: "top",
|
|
279
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
280
|
+
color: "primary",
|
|
281
|
+
"aria-label": "create",
|
|
282
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
283
|
+
style: {
|
|
284
|
+
display: 'flex'
|
|
285
|
+
},
|
|
286
|
+
href: downloadUrl,
|
|
287
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Download.default, {
|
|
288
|
+
sx: {
|
|
289
|
+
fontSize: 18
|
|
290
|
+
}
|
|
291
|
+
})
|
|
292
|
+
})
|
|
293
|
+
})
|
|
294
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
295
|
+
title: t('blocklet.publish.delete', {
|
|
296
|
+
name: project.blockletTitle
|
|
297
|
+
}),
|
|
298
|
+
placement: "top",
|
|
299
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
300
|
+
color: "primary",
|
|
301
|
+
"aria-label": "delete",
|
|
302
|
+
onClick: () => onDeleteProject(project),
|
|
303
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Delete.default, {
|
|
304
|
+
sx: {
|
|
305
|
+
fontSize: 18
|
|
306
|
+
}
|
|
307
|
+
})
|
|
215
308
|
})
|
|
216
|
-
})
|
|
309
|
+
})]
|
|
217
310
|
});
|
|
218
311
|
}
|
|
219
312
|
}
|
|
220
313
|
}].filter(Boolean);
|
|
221
314
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Main, {
|
|
222
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
})
|
|
315
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
316
|
+
display: "flex",
|
|
317
|
+
justifyContent: "space-between",
|
|
318
|
+
alignItems: "center",
|
|
319
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
320
|
+
sx: {
|
|
321
|
+
fontSize: '1.2rem',
|
|
322
|
+
fontWeight: 'bold'
|
|
323
|
+
},
|
|
324
|
+
children: t('blocklet.publish.productListTitle')
|
|
325
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
326
|
+
onClick: handleNewBlocklet,
|
|
327
|
+
variant: "contained",
|
|
328
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Add.default, {
|
|
329
|
+
style: {
|
|
330
|
+
fontSize: '1.3em',
|
|
331
|
+
marginRight: 4
|
|
332
|
+
}
|
|
333
|
+
}), t('blocklet.publish.createBlocklet')]
|
|
334
|
+
})]
|
|
335
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
336
|
+
mt: 3
|
|
233
337
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Datatable.default, {
|
|
234
338
|
className: "main-table",
|
|
235
339
|
locale: locale,
|