@abtnode/ux 1.16.11-beta-069c3537 → 1.16.11-beta-f74663ac
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/lib/actions.js +5 -4
- package/lib/blocklet/access/config-access.js +3 -3
- package/lib/blocklet/actions.js +18 -9
- package/lib/blocklet/add-cert.js +3 -3
- package/lib/blocklet/component/add.js +3 -3
- package/lib/blocklet/component/delete.js +32 -7
- package/lib/blocklet/component/environment.js +11 -11
- package/lib/blocklet/component/expiration.js +11 -14
- package/lib/blocklet/component/index.js +161 -26
- package/lib/blocklet/component/navigation/navigation-dialog.js +5 -10
- package/lib/blocklet/component/setting.js +2 -2
- package/lib/blocklet/component/space-connector.js +5 -5
- package/lib/blocklet/component/space-selector.js +3 -3
- package/lib/blocklet/component/start.js +108 -0
- package/lib/blocklet/component/store-blocklet-list.js +2 -2
- package/lib/blocklet/config-navigation.js +10 -19
- package/lib/blocklet/configuration.js +7 -7
- package/lib/blocklet/install-from-url.js +1 -1
- package/lib/blocklet/migration.js +5 -5
- package/lib/blocklet/notification/email.js +3 -3
- package/lib/blocklet/oauth/auth0.js +3 -3
- package/lib/blocklet/overview.js +1 -7
- package/lib/blocklet/preferences/app-sk.js +3 -3
- package/lib/blocklet/purchase/component-purchase.js +7 -7
- package/lib/blocklet/router/action/add-domain-alias.js +2 -2
- package/lib/blocklet/router/action/add-rule.js +2 -2
- package/lib/blocklet/router/action/delete-domain-alias.js +2 -2
- package/lib/blocklet/router/action/delete-rule.js +2 -2
- package/lib/blocklet/router/action/update-rule.js +2 -2
- package/lib/blocklet/router/rule-actions.js +3 -0
- package/lib/blocklet/router/rule-list.js +1 -1
- package/lib/blocklet/storage/action.js +146 -0
- package/lib/blocklet/storage/backups.js +256 -0
- package/lib/blocklet/storage/connect-to.js +368 -0
- package/lib/blocklet/storage/connected.js +134 -0
- package/lib/blocklet/storage/delete.js +38 -24
- package/lib/blocklet/storage/disconnect.js +78 -0
- package/lib/blocklet/storage/index.js +12 -421
- package/lib/blocklet/storage/item.js +511 -84
- package/lib/blocklet/transfer-owner.js +1 -1
- package/lib/blocklet/version.js +1 -8
- package/lib/contexts/audit-log.js +2 -2
- package/lib/exchange-passport.js +4 -3
- package/lib/hooks/blocklet.js +4 -4
- package/lib/hooks/use-backup-progress.js +41 -0
- package/lib/hooks/use-blocklet-info-for-connect-did-spaces.js +59 -0
- package/lib/hooks/use-navigation.js +1 -1
- package/lib/icons/empty-spaces-nft.svg +9 -0
- package/lib/icons/space-connected.svg +3 -0
- package/lib/icons/space-disconnect.svg +3 -0
- package/lib/locales/en.js +52 -30
- package/lib/locales/zh.js +77 -50
- package/lib/logs/download.js +2 -2
- package/lib/store/delete.js +2 -2
- package/lib/team/members/index.js +3 -3
- package/lib/team/members/member.js +2 -8
- package/lib/team/members/passport-issuances.js +2 -8
- package/lib/team/members/passports.js +2 -8
- package/lib/team/members/toggle-user-approval.js +2 -2
- package/lib/team/passports/color.js +2 -2
- package/lib/team/passports/detail.js +4 -4
- package/lib/team/passports/index.js +6 -7
- package/lib/team/passports/trusted-factories.js +3 -3
- package/lib/team/passports/trusted-factory.js +28 -21
- package/lib/team/passports/trusted-issuer.js +3 -3
- package/lib/team/passports/trusted-issuers.js +4 -4
- package/lib/util/index.js +21 -16
- package/lib/util/mode.js +3 -3
- package/lib/util/spaces.js +27 -0
- package/package.json +16 -17
- package/lib/blocklet/storage/add.js +0 -157
- package/lib/blocklet/storage/connect.js +0 -226
- package/lib/blocklet/storage/switch-did-spaces.js +0 -315
- package/lib/toast.js +0 -86
package/lib/actions.js
CHANGED
|
@@ -56,7 +56,7 @@ function Actions(_ref) {
|
|
|
56
56
|
"aria-haspopup": "true",
|
|
57
57
|
"data-cy": "actions-menu-icon",
|
|
58
58
|
onClick: onOpen,
|
|
59
|
-
size: "
|
|
59
|
+
size: "small",
|
|
60
60
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MoreHoriz.default, {})
|
|
61
61
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Menu.default, {
|
|
62
62
|
id: "actions-menu",
|
|
@@ -82,13 +82,14 @@ function Actions(_ref) {
|
|
|
82
82
|
return /*#__PURE__*/(0, _react.createElement)(_MenuItem.default, _objectSpread(_objectSpread({}, opts), {}, {
|
|
83
83
|
disabled: disabled,
|
|
84
84
|
dense: true,
|
|
85
|
-
onClick: e => {
|
|
85
|
+
onClick: async e => {
|
|
86
|
+
await _onClick(e);
|
|
86
87
|
onClose();
|
|
87
|
-
_onClick(e);
|
|
88
88
|
}
|
|
89
89
|
// eslint-disable-next-line react/no-array-index-key
|
|
90
90
|
,
|
|
91
|
-
key: index
|
|
91
|
+
key: index,
|
|
92
|
+
"data-cy": "actions-menu-".concat(index)
|
|
92
93
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemIcon.default, {
|
|
93
94
|
style: {
|
|
94
95
|
minWidth: 24,
|
|
@@ -26,10 +26,10 @@ var _context = require("@arcblock/ux/lib/Locale/context");
|
|
|
26
26
|
var _Dialog = _interopRequireDefault(require("@arcblock/ux/lib/Dialog"));
|
|
27
27
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
28
28
|
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
29
|
+
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
29
30
|
var _node = require("../../contexts/node");
|
|
30
31
|
var _team = require("../../contexts/team");
|
|
31
32
|
var _util2 = require("../../util");
|
|
32
|
-
var _toast = _interopRequireDefault(require("../../toast"));
|
|
33
33
|
var _config = _interopRequireDefault(require("../../who-can-access/config"));
|
|
34
34
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
35
35
|
var _templateObject, _templateObject2;
|
|
@@ -160,12 +160,12 @@ function ConfigAccess(_ref) {
|
|
|
160
160
|
whoCanAccess: value
|
|
161
161
|
}
|
|
162
162
|
});
|
|
163
|
-
|
|
163
|
+
_Toast.default.success(t('blocklet.config.access.updatedTip'));
|
|
164
164
|
onClose();
|
|
165
165
|
setLoading(false);
|
|
166
166
|
} catch (err) {
|
|
167
167
|
setLoading(false);
|
|
168
|
-
|
|
168
|
+
_Toast.default.error((0, _util2.formatError)(err));
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
171
|
const disabled = loading || whoCanAccess === CONFIG_ROLE && !roles.length;
|
package/lib/blocklet/actions.js
CHANGED
|
@@ -28,12 +28,13 @@ var _util = require("@blocklet/meta/lib/util");
|
|
|
28
28
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
29
29
|
var _constant = require("@blocklet/constant");
|
|
30
30
|
var _constant2 = require("@abtnode/constant");
|
|
31
|
-
var
|
|
31
|
+
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
32
32
|
var _util2 = require("../util");
|
|
33
33
|
var _util3 = require("./util");
|
|
34
34
|
var _node = require("../contexts/node");
|
|
35
35
|
var _confirm = _interopRequireDefault(require("../confirm"));
|
|
36
36
|
var _icons = _interopRequireDefault(require("./icons"));
|
|
37
|
+
var _blocklet = require("../contexts/blocklet");
|
|
37
38
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
38
39
|
var _templateObject;
|
|
39
40
|
const _excluded = ["blocklet", "onStart", "onComplete", "variant", "hasPermission", "useBlockletUrlEvaluation"];
|
|
@@ -49,6 +50,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
49
50
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
50
51
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
51
52
|
function BlockletActions(_ref) {
|
|
53
|
+
var _blocklet$controller, _blocklet$controller$, _blocklet$controller2, _blocklet$controller3;
|
|
52
54
|
let {
|
|
53
55
|
blocklet,
|
|
54
56
|
onStart,
|
|
@@ -72,7 +74,14 @@ function BlockletActions(_ref) {
|
|
|
72
74
|
loading: recommendedUrlLoading,
|
|
73
75
|
recommendedUrl
|
|
74
76
|
} = useBlockletUrlEvaluation(blocklet);
|
|
77
|
+
const {
|
|
78
|
+
nftState
|
|
79
|
+
} = (0, _blocklet.useBlockletContext)();
|
|
75
80
|
const inProgress = (0, _util.isInProgress)(blocklet.status);
|
|
81
|
+
let disableStart = (blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$controller = blocklet.controller) === null || _blocklet$controller === void 0 ? void 0 : (_blocklet$controller$ = _blocklet$controller.status) === null || _blocklet$controller$ === void 0 ? void 0 : _blocklet$controller$.value) === _constant.BLOCKLET_CONTROLLER_STATUS.suspended;
|
|
82
|
+
if (!(nftState !== null && nftState !== void 0 && nftState.expired) && (blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$controller2 = blocklet.controller) === null || _blocklet$controller2 === void 0 ? void 0 : (_blocklet$controller3 = _blocklet$controller2.status) === null || _blocklet$controller3 === void 0 ? void 0 : _blocklet$controller3.reason) === _constant.SUSPENDED_REASON.expired) {
|
|
83
|
+
disableStart = false;
|
|
84
|
+
}
|
|
76
85
|
const {
|
|
77
86
|
inService
|
|
78
87
|
} = node;
|
|
@@ -93,6 +102,10 @@ function BlockletActions(_ref) {
|
|
|
93
102
|
await fn(params);
|
|
94
103
|
} else if (action === 'start') {
|
|
95
104
|
var _blocklet$settings;
|
|
105
|
+
if (!(0, _util.hasRunnableComponent)(blocklet)) {
|
|
106
|
+
_Toast.default.error(t('blocklet.noComponent'));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
96
109
|
if (!inService && !skipSetup && !((_blocklet$settings = blocklet.settings) !== null && _blocklet$settings !== void 0 && _blocklet$settings.initialized)) {
|
|
97
110
|
// 跳转到 setup 流程界面时携带 serverUrl 查询参数
|
|
98
111
|
const serverUrl = (0, _util3.getServerUrl)(node.info);
|
|
@@ -105,10 +118,6 @@ function BlockletActions(_ref) {
|
|
|
105
118
|
});
|
|
106
119
|
return;
|
|
107
120
|
}
|
|
108
|
-
if (!(0, _util.hasRunnableComponent)(blocklet)) {
|
|
109
|
-
_toast.default.error(t('blocklet.noComponent'));
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
121
|
const input = {
|
|
113
122
|
did: blocklet.meta.did
|
|
114
123
|
};
|
|
@@ -130,7 +139,7 @@ function BlockletActions(_ref) {
|
|
|
130
139
|
}
|
|
131
140
|
|
|
132
141
|
if (action === 'reload') {
|
|
133
|
-
|
|
142
|
+
_Toast.default.success(t('blocklet.reloadSuccess'));
|
|
134
143
|
}
|
|
135
144
|
onComplete({
|
|
136
145
|
action,
|
|
@@ -297,7 +306,7 @@ function BlockletActions(_ref) {
|
|
|
297
306
|
icon: _icons.default.Start,
|
|
298
307
|
name: t('common.start'),
|
|
299
308
|
handler: createHandler('start', node.api.startBlocklet),
|
|
300
|
-
disabled: blocklet.status === 'running' || blocklet.status === 'corrupted' || missingRequiredConfigs.length > 0 || (0, _util2.isDownloading)(blocklet.status) || blocklet.mode === _constant.BLOCKLET_MODES.DEVELOPMENT || recommendedUrlLoading || inProgress
|
|
309
|
+
disabled: disableStart || blocklet.status === 'running' || blocklet.status === 'corrupted' || missingRequiredConfigs.length > 0 || (0, _util2.isDownloading)(blocklet.status) || blocklet.mode === _constant.BLOCKLET_MODES.DEVELOPMENT || recommendedUrlLoading || inProgress
|
|
301
310
|
}, {
|
|
302
311
|
action: 'stop',
|
|
303
312
|
icon: _icons.default.Stop,
|
|
@@ -309,13 +318,13 @@ function BlockletActions(_ref) {
|
|
|
309
318
|
icon: _icons.default.Restart,
|
|
310
319
|
name: t('common.restart'),
|
|
311
320
|
handler: createHandler('restart', node.api.restartBlocklet, true),
|
|
312
|
-
disabled: blocklet.status !== 'running' || blocklet.mode === _constant.BLOCKLET_MODES.DEVELOPMENT
|
|
321
|
+
disabled: disableStart || blocklet.status !== 'running' || blocklet.mode === _constant.BLOCKLET_MODES.DEVELOPMENT
|
|
313
322
|
}, {
|
|
314
323
|
action: 'reload',
|
|
315
324
|
icon: _icons.default.Reload,
|
|
316
325
|
name: t('common.reload'),
|
|
317
326
|
handler: createHandler('reload', node.api.reloadBlocklet),
|
|
318
|
-
disabled: blocklet.status !== 'running' || blocklet.mode === _constant.BLOCKLET_MODES.DEVELOPMENT
|
|
327
|
+
disabled: disableStart || blocklet.status !== 'running' || blocklet.mode === _constant.BLOCKLET_MODES.DEVELOPMENT
|
|
319
328
|
}, (0, _util2.isDownloading)(blocklet.status) ? cancelDownloadAction : removeAction, {
|
|
320
329
|
separator: true
|
|
321
330
|
}, {
|
package/lib/blocklet/add-cert.js
CHANGED
|
@@ -12,7 +12,7 @@ var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularPr
|
|
|
12
12
|
var _Alert = _interopRequireDefault(require("@arcblock/ux/lib/Alert"));
|
|
13
13
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
14
14
|
var _constant = require("@blocklet/constant");
|
|
15
|
-
var
|
|
15
|
+
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
16
16
|
var _confirm = _interopRequireDefault(require("../confirm"));
|
|
17
17
|
var _node = require("../contexts/node");
|
|
18
18
|
var _blocklet = require("../contexts/blocklet");
|
|
@@ -68,9 +68,9 @@ function Add(props) {
|
|
|
68
68
|
if (cert.domain === domain) {
|
|
69
69
|
setIssuing(false);
|
|
70
70
|
if (type === 'success') {
|
|
71
|
-
|
|
71
|
+
_Toast.default.success("The ".concat(cert.domain, " certificate is issued successfully"));
|
|
72
72
|
} else if (type === 'error') {
|
|
73
|
-
|
|
73
|
+
_Toast.default.error("Failed to issue certificate for ".concat(cert.domain));
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
};
|
|
@@ -33,9 +33,9 @@ var _AnimationWaiter = _interopRequireDefault(require("@arcblock/ux/lib/Animatio
|
|
|
33
33
|
var _launchResultMessage = _interopRequireDefault(require("@blocklet/launcher-layout/lib/launch-result-message"));
|
|
34
34
|
var _util = require("@blocklet/meta/lib/util");
|
|
35
35
|
var _urlPathFriendly = _interopRequireDefault(require("@blocklet/meta/lib/url-path-friendly"));
|
|
36
|
+
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
36
37
|
var _node = require("../../contexts/node");
|
|
37
38
|
var _util2 = require("../../util");
|
|
38
|
-
var _toast = _interopRequireDefault(require("../../toast"));
|
|
39
39
|
var _schemaForm = _interopRequireDefault(require("../../schema-form"));
|
|
40
40
|
var _required = _interopRequireDefault(require("../../form/required"));
|
|
41
41
|
var _purchase = require("../purchase");
|
|
@@ -334,7 +334,7 @@ function AddComponent(_ref2) {
|
|
|
334
334
|
}
|
|
335
335
|
} catch (err) {
|
|
336
336
|
const errMsg = (0, _util2.formatError)(err);
|
|
337
|
-
|
|
337
|
+
_Toast.default.error(errMsg);
|
|
338
338
|
console.error('installComponent error: ', err);
|
|
339
339
|
setInstallErrorResult(errMsg);
|
|
340
340
|
} finally {
|
|
@@ -377,7 +377,7 @@ function AddComponent(_ref2) {
|
|
|
377
377
|
const _onCancel = () => {
|
|
378
378
|
setActiveStepByIndex(x => x - 1);
|
|
379
379
|
};
|
|
380
|
-
const onGeneratePurchaseData =
|
|
380
|
+
const onGeneratePurchaseData = () => {
|
|
381
381
|
const {
|
|
382
382
|
pathPrefix: mountPoint,
|
|
383
383
|
bundleDid,
|
|
@@ -30,7 +30,10 @@ function DeleteComponent(_ref) {
|
|
|
30
30
|
component,
|
|
31
31
|
remove,
|
|
32
32
|
disabled,
|
|
33
|
-
tip
|
|
33
|
+
tip,
|
|
34
|
+
showConfirm,
|
|
35
|
+
hideBtn,
|
|
36
|
+
onCancel: _onCancel
|
|
34
37
|
} = _ref;
|
|
35
38
|
const {
|
|
36
39
|
t
|
|
@@ -44,9 +47,8 @@ function DeleteComponent(_ref) {
|
|
|
44
47
|
setDeleteSetting(null);
|
|
45
48
|
};
|
|
46
49
|
const componentDisabled = disabled || loading;
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
onClick: () => setDeleteSetting({
|
|
50
|
+
const doShowConfirm = () => {
|
|
51
|
+
setDeleteSetting({
|
|
50
52
|
title: "".concat(t('common.delete'), " ").concat(component.meta.title || component.meta.name),
|
|
51
53
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
52
54
|
description: (params, setParams) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Typography.default, {
|
|
@@ -78,8 +80,25 @@ function DeleteComponent(_ref) {
|
|
|
78
80
|
removeType: 'keepData'
|
|
79
81
|
},
|
|
80
82
|
onConfirm: deleteComponent,
|
|
81
|
-
onCancel: () =>
|
|
82
|
-
|
|
83
|
+
onCancel: () => {
|
|
84
|
+
setDeleteSetting(null);
|
|
85
|
+
_onCancel();
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
(0, _react.useEffect)(() => {
|
|
90
|
+
if (showConfirm) {
|
|
91
|
+
doShowConfirm();
|
|
92
|
+
} else {
|
|
93
|
+
setLoading(false);
|
|
94
|
+
setDeleteSetting(null);
|
|
95
|
+
}
|
|
96
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
97
|
+
}, [showConfirm]);
|
|
98
|
+
const btn = /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledButton, {
|
|
99
|
+
size: "small",
|
|
100
|
+
disabled: componentDisabled,
|
|
101
|
+
onClick: () => doShowConfirm,
|
|
83
102
|
"data-cy": "delete-component-btn",
|
|
84
103
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Delete.default, {
|
|
85
104
|
disabled: componentDisabled
|
|
@@ -92,7 +111,7 @@ function DeleteComponent(_ref) {
|
|
|
92
111
|
})
|
|
93
112
|
});
|
|
94
113
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
95
|
-
children: [btnWithToolTip, deleteSetting && /*#__PURE__*/(0, _jsxRuntime.jsx)(_confirm.default, {
|
|
114
|
+
children: [!hideBtn && btnWithToolTip, deleteSetting && /*#__PURE__*/(0, _jsxRuntime.jsx)(_confirm.default, {
|
|
96
115
|
title: deleteSetting.title,
|
|
97
116
|
description: deleteSetting.description,
|
|
98
117
|
confirm: deleteSetting.confirm,
|
|
@@ -106,12 +125,18 @@ function DeleteComponent(_ref) {
|
|
|
106
125
|
DeleteComponent.propTypes = {
|
|
107
126
|
component: _propTypes.default.object.isRequired,
|
|
108
127
|
remove: _propTypes.default.func,
|
|
128
|
+
onCancel: _propTypes.default.func,
|
|
109
129
|
disabled: _propTypes.default.bool,
|
|
130
|
+
showConfirm: _propTypes.default.bool,
|
|
131
|
+
hideBtn: _propTypes.default.bool,
|
|
110
132
|
tip: _propTypes.default.string
|
|
111
133
|
};
|
|
112
134
|
DeleteComponent.defaultProps = {
|
|
113
135
|
remove: async () => {},
|
|
114
136
|
disabled: false,
|
|
137
|
+
showConfirm: false,
|
|
138
|
+
hideBtn: false,
|
|
139
|
+
onCancel: () => {},
|
|
115
140
|
tip: ''
|
|
116
141
|
};
|
|
117
142
|
const StyledButton = (0, _styled.default)(_IconButton.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.Mui-disabled {\n opacity: 0.5;\n }\n"])));
|
|
@@ -13,8 +13,8 @@ var _Alert = _interopRequireDefault(require("@mui/material/Alert"));
|
|
|
13
13
|
var _constant = require("@blocklet/constant");
|
|
14
14
|
var _util = require("@blocklet/meta/lib/util");
|
|
15
15
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
16
|
+
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
16
17
|
var _clickToCopy = _interopRequireDefault(require("../../click-to-copy"));
|
|
17
|
-
var _toast = _interopRequireDefault(require("../../toast"));
|
|
18
18
|
var _node = require("../../contexts/node");
|
|
19
19
|
var _tableIcons = _interopRequireDefault(require("../../table-icons"));
|
|
20
20
|
var _table = _interopRequireDefault(require("../../table"));
|
|
@@ -61,7 +61,7 @@ function ComponentEnvironment(_ref) {
|
|
|
61
61
|
t
|
|
62
62
|
} = (0, _react.useContext)(_context.LocaleContext);
|
|
63
63
|
const dids = [...ancestors.map(x => x.meta.did), blocklet.meta.did];
|
|
64
|
-
const onConfigChanged = () =>
|
|
64
|
+
const onConfigChanged = () => _Toast.default.success(t('blocklet.config.changedTip'));
|
|
65
65
|
const isConfigEditable = x => x.custom;
|
|
66
66
|
if ((0, _util2.isInstalling)(blocklet.status)) {
|
|
67
67
|
return null;
|
|
@@ -71,11 +71,11 @@ function ComponentEnvironment(_ref) {
|
|
|
71
71
|
}
|
|
72
72
|
const onAddConfig = async data => {
|
|
73
73
|
if (!data.key.trim() || !data.value.trim()) {
|
|
74
|
-
|
|
74
|
+
_Toast.default.error(t('blocklet.config.environment.keyValueRequired'));
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
if (data.key.startsWith('BLOCKLET_') || data.key.startsWith('COMPONENT_')) {
|
|
78
|
-
|
|
78
|
+
_Toast.default.error(t('blocklet.config.environment.invalidKey'));
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
data.custom = true;
|
|
@@ -92,24 +92,24 @@ function ComponentEnvironment(_ref) {
|
|
|
92
92
|
const onEditConfig = async (newData, oldData) => {
|
|
93
93
|
// only required field can't be empty
|
|
94
94
|
if (newData.required && (!newData.key.trim() || !newData.value.trim())) {
|
|
95
|
-
|
|
95
|
+
_Toast.default.error(t('blocklet.config.environment.keyValueRequired'));
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
if (newData.key.startsWith('BLOCKLET_') && !_constant.BLOCKLET_CONFIGURABLE_KEY[newData.key]) {
|
|
99
|
-
|
|
99
|
+
_Toast.default.error(t('blocklet.config.environment.invalidKey'));
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
102
|
if (newData.key === _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE) {
|
|
103
103
|
const errMessage = (0, _util2.isValidClusterSize)(newData);
|
|
104
104
|
if (errMessage) {
|
|
105
|
-
|
|
105
|
+
_Toast.default.error(errMessage);
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
const configs = [newData];
|
|
110
110
|
if (newData.key !== oldData.key) {
|
|
111
111
|
if (!newData.custom) {
|
|
112
|
-
|
|
112
|
+
_Toast.default.error('Only key of custom env can be changed');
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
configs.push({
|
|
@@ -128,16 +128,16 @@ function ComponentEnvironment(_ref) {
|
|
|
128
128
|
onConfigChanged(result.blocklet);
|
|
129
129
|
}
|
|
130
130
|
} catch (err) {
|
|
131
|
-
|
|
131
|
+
_Toast.default.error((0, _util2.formatError)(err));
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
134
|
const onDeleteConfig = async data => {
|
|
135
135
|
if (data.required) {
|
|
136
|
-
|
|
136
|
+
_Toast.default.error(t('blocklet.config.environment.deleteForbidden'));
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
139
|
if (!data.custom) {
|
|
140
|
-
|
|
140
|
+
_Toast.default.error('Only key of custom env can be changed');
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
const result = await node.api.configBlocklet({
|
|
@@ -5,20 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
-
var _get = _interopRequireDefault(require("lodash/get"));
|
|
9
|
-
var _last = _interopRequireDefault(require("lodash/last"));
|
|
10
|
-
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
11
|
-
var _useAsync = _interopRequireDefault(require("react-use/lib/useAsync"));
|
|
12
8
|
var _RelativeTime = _interopRequireDefault(require("@arcblock/ux/lib/RelativeTime"));
|
|
13
9
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
14
10
|
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
15
11
|
var _Link = _interopRequireDefault(require("@mui/material/Link"));
|
|
16
12
|
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
13
|
+
var _blocklet = require("../../contexts/blocklet");
|
|
17
14
|
var _util = require("../../util");
|
|
18
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
17
|
function Expiration(_ref) {
|
|
21
|
-
var _state$value, _state$value$data, _state$value$data$val;
|
|
22
18
|
let {
|
|
23
19
|
controller
|
|
24
20
|
} = _ref;
|
|
@@ -26,18 +22,15 @@ function Expiration(_ref) {
|
|
|
26
22
|
t,
|
|
27
23
|
locale
|
|
28
24
|
} = (0, _context.useLocaleContext)();
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (state.error) {
|
|
34
|
-
console.error('load nft expiration failed, nfId:', controller === null || controller === void 0 ? void 0 : controller.nftId, 'chainHost:', controller === null || controller === void 0 ? void 0 : controller.chainHost, state.error);
|
|
25
|
+
const {
|
|
26
|
+
nftState
|
|
27
|
+
} = (0, _blocklet.useBlockletContext)();
|
|
28
|
+
if (!nftState) {
|
|
35
29
|
return '-';
|
|
36
30
|
}
|
|
37
|
-
const expirationDate = (0, _last.default)((0, _get.default)(state.value, 'data.value.expirationDate', []));
|
|
38
31
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Typography.default, {
|
|
39
32
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_RelativeTime.default, {
|
|
40
|
-
value: expirationDate,
|
|
33
|
+
value: nftState === null || nftState === void 0 ? void 0 : nftState.expirationDate,
|
|
41
34
|
locale: locale
|
|
42
35
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
43
36
|
style: {
|
|
@@ -45,7 +38,11 @@ function Expiration(_ref) {
|
|
|
45
38
|
},
|
|
46
39
|
variant: "contained",
|
|
47
40
|
component: _Link.default,
|
|
48
|
-
href: (0,
|
|
41
|
+
href: (0, _util.getRenewBlockletURL)({
|
|
42
|
+
nftState,
|
|
43
|
+
nftId: controller.nftId,
|
|
44
|
+
locale
|
|
45
|
+
}),
|
|
49
46
|
children: t('common.renew')
|
|
50
47
|
})]
|
|
51
48
|
});
|