@abtnode/ux 1.16.39 → 1.16.40-beta-20250227-092112-1815be0a
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/blocklet/component/add-component/add-component-core.js +31 -21
- package/lib/blocklet/component/component-cell-mount-poin.js +67 -9
- package/lib/blocklet/component/component-cell.js +1 -0
- package/lib/blocklet/configuration.js +123 -51
- package/lib/blocklet/overview.js +23 -3
- package/lib/blocklet/preferences/app-sk.js +45 -10
- package/lib/blocklet/publish/create-release/header.js +3 -0
- package/lib/blocklet/publish/create-release/index.js +2 -0
- package/lib/blocklet/publish/release-list.js +2 -1
- package/lib/blocklet/vault/config.js +306 -0
- package/lib/blocklet/vault/status.js +59 -0
- package/lib/contexts/util.js +9 -4
- package/lib/locales/ar.js +52 -10
- package/lib/locales/de.js +52 -10
- package/lib/locales/en.js +50 -8
- package/lib/locales/es.js +54 -12
- package/lib/locales/fr.js +52 -10
- package/lib/locales/hi.js +54 -12
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +53 -11
- package/lib/locales/ja.js +54 -12
- package/lib/locales/ko.js +52 -10
- package/lib/locales/pt.js +54 -12
- package/lib/locales/ru.js +52 -10
- package/lib/locales/th.js +52 -10
- package/lib/locales/vi.js +53 -11
- package/lib/locales/zh-tw.js +54 -12
- package/lib/locales/zh.js +50 -8
- package/lib/lost-passport.js +20 -25
- package/lib/util/parse-json-text.js +12 -0
- package/package.json +25 -24
|
@@ -195,6 +195,12 @@ export default function AddComponentCore({
|
|
|
195
195
|
}
|
|
196
196
|
return '';
|
|
197
197
|
};
|
|
198
|
+
const onOver = () => {
|
|
199
|
+
setLoading(false);
|
|
200
|
+
setParams({});
|
|
201
|
+
component.current = {};
|
|
202
|
+
onClose();
|
|
203
|
+
};
|
|
198
204
|
const setInstallErrorResult = errorMessage => {
|
|
199
205
|
const update = _loading => {
|
|
200
206
|
updateParams({
|
|
@@ -235,6 +241,21 @@ export default function AddComponentCore({
|
|
|
235
241
|
}
|
|
236
242
|
};
|
|
237
243
|
};
|
|
244
|
+
const handleFinish = () => {
|
|
245
|
+
postInstalledMessage({
|
|
246
|
+
timeout: 0,
|
|
247
|
+
componentDid: routerParams.componentDid,
|
|
248
|
+
manual: true
|
|
249
|
+
});
|
|
250
|
+
onOver();
|
|
251
|
+
// scroll to bottom
|
|
252
|
+
setTimeout(() => {
|
|
253
|
+
const scrollDom = document.getElementsByClassName('dashboard-main')[0];
|
|
254
|
+
if (scrollDom) {
|
|
255
|
+
scrollDom.scrollTop = scrollDom.scrollHeight;
|
|
256
|
+
}
|
|
257
|
+
}, 200);
|
|
258
|
+
};
|
|
238
259
|
useSubscription(BlockletEvents.statusChange, createBlockletEventHandler(e => {
|
|
239
260
|
switch (e.status) {
|
|
240
261
|
case BlockletStatus.upgrading:
|
|
@@ -263,13 +284,16 @@ export default function AddComponentCore({
|
|
|
263
284
|
useSubscription(BlockletEvents.installFailed, createBlockletEventHandler(() => {
|
|
264
285
|
setInstallErrorResult(t('blocklet.component.installComponentError'));
|
|
265
286
|
}), [blocklet?.meta?.did]);
|
|
287
|
+
useSubscription(BlockletEvents.componentInstalled, createBlockletEventHandler(() => {
|
|
288
|
+
updateParams({
|
|
289
|
+
installResultProps: {
|
|
290
|
+
variant: 'success',
|
|
291
|
+
title: getComponentName(),
|
|
292
|
+
subTitle: t('blocklet.component.installSuccessTip')
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}), [blocklet?.meta?.did]);
|
|
266
296
|
const steps = [];
|
|
267
|
-
const onOver = () => {
|
|
268
|
-
setLoading(false);
|
|
269
|
-
setParams({});
|
|
270
|
-
component.current = {};
|
|
271
|
-
onClose();
|
|
272
|
-
};
|
|
273
297
|
const alreadyInstalled = did => (blocklet?.children || []).find(x => x.meta.did === did);
|
|
274
298
|
const onInstall = async payload => {
|
|
275
299
|
const {
|
|
@@ -1027,21 +1051,7 @@ export default function AddComponentCore({
|
|
|
1027
1051
|
})
|
|
1028
1052
|
}),
|
|
1029
1053
|
confirm: t('common.complete'),
|
|
1030
|
-
onConfirm:
|
|
1031
|
-
postInstalledMessage({
|
|
1032
|
-
timeout: 0,
|
|
1033
|
-
componentDid: routerParams.componentDid,
|
|
1034
|
-
manual: true
|
|
1035
|
-
});
|
|
1036
|
-
onOver();
|
|
1037
|
-
// scroll to bottom
|
|
1038
|
-
setTimeout(() => {
|
|
1039
|
-
const scrollDom = document.getElementsByClassName('dashboard-main')[0];
|
|
1040
|
-
if (scrollDom) {
|
|
1041
|
-
scrollDom.scrollTop = scrollDom.scrollHeight;
|
|
1042
|
-
}
|
|
1043
|
-
}, 200);
|
|
1044
|
-
}
|
|
1054
|
+
onConfirm: handleFinish
|
|
1045
1055
|
});
|
|
1046
1056
|
const step = steps[activeStep] || {};
|
|
1047
1057
|
const isDisabled = () => {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import normalizePathPrefix from '@abtnode/util/lib/normalize-path-prefix';
|
|
2
|
+
import { useConfirm } from '@arcblock/ux/lib/Dialog';
|
|
3
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
5
|
+
import urlPathFriendly from '@blocklet/meta/lib/url-path-friendly';
|
|
2
6
|
import { Icon } from '@iconify/react';
|
|
3
|
-
import { Box, CircularProgress, IconButton, TextField } from '@mui/material';
|
|
7
|
+
import { Box, CircularProgress, IconButton, TextField, Typography } from '@mui/material';
|
|
8
|
+
import { useMemoizedFn } from 'ahooks';
|
|
4
9
|
import PropTypes from 'prop-types';
|
|
5
10
|
import { useEffect, useState } from 'react';
|
|
6
|
-
import urlPathFriendly from '@blocklet/meta/lib/url-path-friendly';
|
|
7
|
-
import Toast from '@arcblock/ux/lib/Toast';
|
|
8
11
|
import { useNodeContext } from '../../contexts/node';
|
|
9
12
|
import { formatError } from '../../util';
|
|
10
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -23,6 +26,13 @@ function ComponentCellMountPoint({
|
|
|
23
26
|
} = useNodeContext();
|
|
24
27
|
const isRoot = !ancestors.length;
|
|
25
28
|
const rootDid = isRoot ? blocklet.meta.did : ancestors.map(x => x.meta.did)[0];
|
|
29
|
+
const {
|
|
30
|
+
t
|
|
31
|
+
} = useLocaleContext();
|
|
32
|
+
const {
|
|
33
|
+
confirmApi,
|
|
34
|
+
confirmHolder
|
|
35
|
+
} = useConfirm();
|
|
26
36
|
useEffect(() => {
|
|
27
37
|
setEditing(false);
|
|
28
38
|
setHover(false);
|
|
@@ -33,8 +43,7 @@ function ComponentCellMountPoint({
|
|
|
33
43
|
setEditing(false);
|
|
34
44
|
setEditValue(mountPoint);
|
|
35
45
|
};
|
|
36
|
-
const onSubmitMountPoint = async
|
|
37
|
-
e.preventDefault();
|
|
46
|
+
const onSubmitMountPoint = async () => {
|
|
38
47
|
setLoading(true);
|
|
39
48
|
setHover(false);
|
|
40
49
|
try {
|
|
@@ -49,10 +58,59 @@ function ComponentCellMountPoint({
|
|
|
49
58
|
input
|
|
50
59
|
});
|
|
51
60
|
} catch (err) {
|
|
52
|
-
setLoading(false);
|
|
53
61
|
err.message = formatError(err);
|
|
54
62
|
Toast.error(err.message);
|
|
55
63
|
throw err;
|
|
64
|
+
} finally {
|
|
65
|
+
handleCancel();
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const showConfirmDialog = useMemoizedFn(() => {
|
|
69
|
+
confirmApi.open({
|
|
70
|
+
title: t('common.noticeTitle'),
|
|
71
|
+
content: /*#__PURE__*/_jsxs(Box, {
|
|
72
|
+
sx: {
|
|
73
|
+
color: '#9397A1',
|
|
74
|
+
'& > li': {
|
|
75
|
+
listStyle: 'disc',
|
|
76
|
+
ml: 1.5
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
80
|
+
sx: {
|
|
81
|
+
mb: 1.5
|
|
82
|
+
},
|
|
83
|
+
children: t('blocklet.mountPoint.description1')
|
|
84
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
85
|
+
component: "li",
|
|
86
|
+
children: t('blocklet.mountPoint.case1')
|
|
87
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
88
|
+
component: "li",
|
|
89
|
+
children: t('blocklet.mountPoint.case2')
|
|
90
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
91
|
+
sx: {
|
|
92
|
+
mt: 1.5
|
|
93
|
+
},
|
|
94
|
+
children: t('blocklet.mountPoint.description2')
|
|
95
|
+
})]
|
|
96
|
+
}),
|
|
97
|
+
confirmButtonText: t('common.confirm'),
|
|
98
|
+
cancelButtonText: t('common.cancel'),
|
|
99
|
+
async onConfirm(close) {
|
|
100
|
+
await onSubmitMountPoint();
|
|
101
|
+
close();
|
|
102
|
+
},
|
|
103
|
+
confirmButtonProps: {
|
|
104
|
+
'data-cy': 'edit-mount-point-confirm'
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
const onShowDialog = e => {
|
|
109
|
+
e?.preventDefault();
|
|
110
|
+
if (urlPathFriendly(editValue) !== mountPoint) {
|
|
111
|
+
showConfirmDialog();
|
|
112
|
+
} else {
|
|
113
|
+
setEditing(false);
|
|
56
114
|
}
|
|
57
115
|
};
|
|
58
116
|
const tools = editing ? /*#__PURE__*/_jsxs(Box, {
|
|
@@ -64,7 +122,7 @@ function ComponentCellMountPoint({
|
|
|
64
122
|
onMouseEnter: () => setHover(true),
|
|
65
123
|
onMouseLeave: () => setHover(false),
|
|
66
124
|
"data-cy": "edit-mount-point-submit",
|
|
67
|
-
onClick:
|
|
125
|
+
onClick: onShowDialog,
|
|
68
126
|
children: /*#__PURE__*/_jsx(Box, {
|
|
69
127
|
component: Icon,
|
|
70
128
|
icon: "material-symbols:done",
|
|
@@ -112,8 +170,8 @@ function ComponentCellMountPoint({
|
|
|
112
170
|
},
|
|
113
171
|
alignItems: "center",
|
|
114
172
|
flexGrow: "1",
|
|
115
|
-
children: [editing ? /*#__PURE__*/_jsx("form", {
|
|
116
|
-
onSubmit:
|
|
173
|
+
children: [confirmHolder, editing ? /*#__PURE__*/_jsx("form", {
|
|
174
|
+
onSubmit: onShowDialog,
|
|
117
175
|
children: /*#__PURE__*/_jsx(TextField, {
|
|
118
176
|
style: {
|
|
119
177
|
flex: 1
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import Box from '@mui/material/Box';
|
|
@@ -7,7 +7,9 @@ import Divider from '@mui/material/Divider';
|
|
|
7
7
|
import Grid from '@mui/material/Grid';
|
|
8
8
|
import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
9
9
|
import Button from '@arcblock/ux/lib/Button';
|
|
10
|
-
import
|
|
10
|
+
import TransferIcon from '@mui/icons-material/VolunteerActivismOutlined';
|
|
11
|
+
import VaultIcon from '@mui/icons-material/AccountBalanceWalletOutlined';
|
|
12
|
+
import { useSetState } from 'ahooks';
|
|
11
13
|
import { BLOCKLET_CONFIGURABLE_KEY, BLOCKLET_TENANT_MODES, SUPPORTED_LANGUAGES } from '@blocklet/constant';
|
|
12
14
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
13
15
|
import FormTextInput from '../form/form-text-input';
|
|
@@ -19,10 +21,11 @@ import Permission, { withPermission } from '../permission';
|
|
|
19
21
|
import ClearCache from '../clear-cache';
|
|
20
22
|
import AppSk from './preferences/app-sk';
|
|
21
23
|
import TransferOwner from './transfer-owner';
|
|
24
|
+
import ConfigVault from './vault/config';
|
|
22
25
|
import useAppLogo from '../hooks/use-app-logo';
|
|
23
26
|
import LogoUploader from './logo-uploader';
|
|
24
27
|
import RotateSessionKey from '../rotate-session-key';
|
|
25
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
26
29
|
const languages = Object.keys(SUPPORTED_LANGUAGES).map(x => ({
|
|
27
30
|
code: x,
|
|
28
31
|
name: SUPPORTED_LANGUAGES[x].nativeName,
|
|
@@ -44,10 +47,13 @@ function BlockletEnvironment({
|
|
|
44
47
|
const {
|
|
45
48
|
t
|
|
46
49
|
} = useContext(LocaleContext);
|
|
47
|
-
const [
|
|
48
|
-
|
|
50
|
+
const [state, setState] = useSetState({
|
|
51
|
+
loading: false,
|
|
52
|
+
showTransferOwner: false,
|
|
53
|
+
showConfigVault: false
|
|
54
|
+
});
|
|
49
55
|
const inviteEnabled = !!blocklet?.settings?.invite?.enabled;
|
|
50
|
-
const disabled = loading || !hasPermission;
|
|
56
|
+
const disabled = state.loading || !hasPermission;
|
|
51
57
|
const {
|
|
52
58
|
logoUrl,
|
|
53
59
|
rectLogoUrl,
|
|
@@ -101,7 +107,9 @@ function BlockletEnvironment({
|
|
|
101
107
|
value
|
|
102
108
|
}];
|
|
103
109
|
try {
|
|
104
|
-
|
|
110
|
+
setState({
|
|
111
|
+
loading: true
|
|
112
|
+
});
|
|
105
113
|
const {
|
|
106
114
|
blocklet: data
|
|
107
115
|
} = await api.configBlocklet({
|
|
@@ -114,14 +122,18 @@ function BlockletEnvironment({
|
|
|
114
122
|
} catch (err) {
|
|
115
123
|
Toast.error(err.message);
|
|
116
124
|
} finally {
|
|
117
|
-
|
|
125
|
+
setState({
|
|
126
|
+
loading: false
|
|
127
|
+
});
|
|
118
128
|
}
|
|
119
129
|
};
|
|
120
130
|
const createBooleanConfigHandler = (key, value) => async e => {
|
|
121
|
-
if (loading) {
|
|
131
|
+
if (state.loading) {
|
|
122
132
|
return;
|
|
123
133
|
}
|
|
124
|
-
|
|
134
|
+
setState({
|
|
135
|
+
loading: true
|
|
136
|
+
});
|
|
125
137
|
try {
|
|
126
138
|
const {
|
|
127
139
|
checked
|
|
@@ -141,16 +153,20 @@ function BlockletEnvironment({
|
|
|
141
153
|
} catch (err) {
|
|
142
154
|
Toast.error(err.message);
|
|
143
155
|
} finally {
|
|
144
|
-
|
|
156
|
+
setState({
|
|
157
|
+
loading: false
|
|
158
|
+
});
|
|
145
159
|
}
|
|
146
160
|
};
|
|
147
161
|
const onDeletableChange = createBooleanConfigHandler('BLOCKLET_DELETABLE', checked => checked ? 'no' : 'yes');
|
|
148
162
|
const onTenantModeChange = createBooleanConfigHandler('BLOCKLET_APP_TENANT_MODE', checked => checked ? BLOCKLET_TENANT_MODES.MULTIPLE : BLOCKLET_TENANT_MODES.SINGLE);
|
|
149
163
|
const onChangeInviteSettings = async e => {
|
|
150
|
-
if (loading) {
|
|
164
|
+
if (state.loading) {
|
|
151
165
|
return;
|
|
152
166
|
}
|
|
153
|
-
|
|
167
|
+
setState({
|
|
168
|
+
loading: true
|
|
169
|
+
});
|
|
154
170
|
try {
|
|
155
171
|
await api.updateInviteSettings({
|
|
156
172
|
input: {
|
|
@@ -163,14 +179,18 @@ function BlockletEnvironment({
|
|
|
163
179
|
} catch (err) {
|
|
164
180
|
Toast.error(err.message);
|
|
165
181
|
} finally {
|
|
166
|
-
|
|
182
|
+
setState({
|
|
183
|
+
loading: false
|
|
184
|
+
});
|
|
167
185
|
}
|
|
168
186
|
};
|
|
169
187
|
const onAppSkChange = async value => {
|
|
170
|
-
if (loading) {
|
|
188
|
+
if (state.loading) {
|
|
171
189
|
return;
|
|
172
190
|
}
|
|
173
|
-
|
|
191
|
+
setState({
|
|
192
|
+
loading: true
|
|
193
|
+
});
|
|
174
194
|
try {
|
|
175
195
|
const {
|
|
176
196
|
blocklet: data
|
|
@@ -187,7 +207,9 @@ function BlockletEnvironment({
|
|
|
187
207
|
} catch (err) {
|
|
188
208
|
Toast.error(err.message);
|
|
189
209
|
} finally {
|
|
190
|
-
|
|
210
|
+
setState({
|
|
211
|
+
loading: false
|
|
212
|
+
});
|
|
191
213
|
}
|
|
192
214
|
};
|
|
193
215
|
return /*#__PURE__*/_jsxs(Div, {
|
|
@@ -205,7 +227,7 @@ function BlockletEnvironment({
|
|
|
205
227
|
marginTop: 0
|
|
206
228
|
},
|
|
207
229
|
disabled: disabled,
|
|
208
|
-
loading: loading,
|
|
230
|
+
loading: state.loading,
|
|
209
231
|
initialValue: item.value,
|
|
210
232
|
placeholder: item.description,
|
|
211
233
|
onSubmit: value => onSubmitConfig(item.key, value)
|
|
@@ -382,6 +404,11 @@ function BlockletEnvironment({
|
|
|
382
404
|
}), /*#__PURE__*/_jsxs(Box, {
|
|
383
405
|
className: "config-form",
|
|
384
406
|
mt: 2,
|
|
407
|
+
sx: {
|
|
408
|
+
'.form-item:last-child': {
|
|
409
|
+
marginBottom: 0
|
|
410
|
+
}
|
|
411
|
+
},
|
|
385
412
|
children: [/*#__PURE__*/_jsx(Box, {
|
|
386
413
|
className: "config-label",
|
|
387
414
|
fontSize: 14,
|
|
@@ -392,7 +419,7 @@ function BlockletEnvironment({
|
|
|
392
419
|
marginTop: 0
|
|
393
420
|
},
|
|
394
421
|
disabled: disabled,
|
|
395
|
-
loading: loading,
|
|
422
|
+
loading: state.loading,
|
|
396
423
|
options: languages,
|
|
397
424
|
noEmpty: true,
|
|
398
425
|
initialValue: customLanguages ? customLanguages.value.split(',') : ['en', 'zh'],
|
|
@@ -411,10 +438,6 @@ function BlockletEnvironment({
|
|
|
411
438
|
className: "config-form",
|
|
412
439
|
component: Divider,
|
|
413
440
|
my: 3
|
|
414
|
-
}), /*#__PURE__*/_jsx(Box, {
|
|
415
|
-
className: "config-form",
|
|
416
|
-
component: Divider,
|
|
417
|
-
my: 3
|
|
418
441
|
}), /*#__PURE__*/_jsx(Box, {
|
|
419
442
|
mb: 2,
|
|
420
443
|
className: "config-label",
|
|
@@ -453,8 +476,9 @@ function BlockletEnvironment({
|
|
|
453
476
|
mb: 0,
|
|
454
477
|
children: t('blocklet.config.sk')
|
|
455
478
|
}), /*#__PURE__*/_jsx(AppSk, {
|
|
479
|
+
inService: inService,
|
|
456
480
|
disabled: disabled,
|
|
457
|
-
loading: loading,
|
|
481
|
+
loading: state.loading,
|
|
458
482
|
initialValue: blocklet.environments.find(x => x.key === 'BLOCKLET_APP_SK').value,
|
|
459
483
|
onChange: onAppSkChange
|
|
460
484
|
})]
|
|
@@ -463,38 +487,86 @@ function BlockletEnvironment({
|
|
|
463
487
|
// eslint-disable-next-line jsx-a11y/aria-role
|
|
464
488
|
_jsx(Permission, {
|
|
465
489
|
role: "owner",
|
|
466
|
-
children: isOwner => (isOwner || enableDebug) && /*#__PURE__*/_jsxs(
|
|
467
|
-
className: "config-form",
|
|
468
|
-
mt: 2,
|
|
490
|
+
children: isOwner => (isOwner || enableDebug) && /*#__PURE__*/_jsxs(_Fragment, {
|
|
469
491
|
children: [/*#__PURE__*/_jsxs(Box, {
|
|
470
|
-
className: "config-
|
|
492
|
+
className: "config-form",
|
|
493
|
+
mt: 2,
|
|
471
494
|
children: [/*#__PURE__*/_jsxs(Box, {
|
|
472
|
-
className: "config-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
children: t('
|
|
495
|
+
className: "config-item",
|
|
496
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
497
|
+
className: "config-label",
|
|
498
|
+
mb: 0,
|
|
499
|
+
children: [t('blocklet.config.vault.title'), /*#__PURE__*/_jsx(Box, {
|
|
500
|
+
className: "config-desc",
|
|
501
|
+
children: t('blocklet.config.vault.desc')
|
|
502
|
+
})]
|
|
503
|
+
}), /*#__PURE__*/_jsxs(Button, {
|
|
504
|
+
style: {
|
|
505
|
+
flexShrink: 0
|
|
506
|
+
},
|
|
507
|
+
variant: "contained",
|
|
508
|
+
color: "primary",
|
|
509
|
+
size: "small",
|
|
510
|
+
"data-cy": "config-vault",
|
|
511
|
+
onClick: () => setState({
|
|
512
|
+
showConfigVault: true
|
|
513
|
+
}),
|
|
514
|
+
children: [/*#__PURE__*/_jsx(VaultIcon, {
|
|
515
|
+
style: {
|
|
516
|
+
fontSize: '1.3em',
|
|
517
|
+
marginRight: 4
|
|
518
|
+
}
|
|
519
|
+
}), t('blocklet.config.vault.title')]
|
|
477
520
|
})]
|
|
478
|
-
}), /*#__PURE__*/
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
521
|
+
}), state.showConfigVault && /*#__PURE__*/_jsx(ConfigVault, {
|
|
522
|
+
vaults: blocklet.vaults || [],
|
|
523
|
+
appId: blocklet.appDid,
|
|
524
|
+
onCancel: () => setState({
|
|
525
|
+
showConfigVault: false
|
|
526
|
+
}),
|
|
527
|
+
onSuccess: () => setState({
|
|
528
|
+
showConfigVault: false
|
|
529
|
+
})
|
|
530
|
+
})]
|
|
531
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
532
|
+
className: "config-form",
|
|
533
|
+
mt: 2,
|
|
534
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
535
|
+
className: "config-item",
|
|
536
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
537
|
+
className: "config-label",
|
|
538
|
+
mb: 0,
|
|
539
|
+
children: [t('team.transferApp.name'), /*#__PURE__*/_jsx(Box, {
|
|
540
|
+
className: "config-desc",
|
|
541
|
+
children: t('team.transferApp.description')
|
|
542
|
+
})]
|
|
543
|
+
}), /*#__PURE__*/_jsxs(Button, {
|
|
489
544
|
style: {
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
545
|
+
flexShrink: 0
|
|
546
|
+
},
|
|
547
|
+
variant: "contained",
|
|
548
|
+
edge: "end",
|
|
549
|
+
color: "error",
|
|
550
|
+
size: "small",
|
|
551
|
+
"data-cy": "transfer-app",
|
|
552
|
+
onClick: () => setState({
|
|
553
|
+
showTransferOwner: true
|
|
554
|
+
}),
|
|
555
|
+
children: [/*#__PURE__*/_jsx(TransferIcon, {
|
|
556
|
+
style: {
|
|
557
|
+
fontSize: '1.3em',
|
|
558
|
+
marginRight: 4
|
|
559
|
+
}
|
|
560
|
+
}), t('team.transferApp.name')]
|
|
561
|
+
})]
|
|
562
|
+
}), state.showTransferOwner && /*#__PURE__*/_jsx(TransferOwner, {
|
|
563
|
+
onCancel: () => setState({
|
|
564
|
+
showTransferOwner: false
|
|
565
|
+
}),
|
|
566
|
+
onSuccess: () => setState({
|
|
567
|
+
showTransferOwner: false
|
|
568
|
+
})
|
|
494
569
|
})]
|
|
495
|
-
}), showTransferOwner && /*#__PURE__*/_jsx(TransferOwner, {
|
|
496
|
-
onCancel: () => setShowTransferOwner(false),
|
|
497
|
-
onSuccess: () => setShowTransferOwner(false)
|
|
498
570
|
})]
|
|
499
571
|
})
|
|
500
572
|
}), /*#__PURE__*/_jsx(Box, {
|
package/lib/blocklet/overview.js
CHANGED
|
@@ -12,6 +12,7 @@ import Tag from '@arcblock/ux/lib/Tag';
|
|
|
12
12
|
import { useBlockletContext } from '../contexts/blocklet';
|
|
13
13
|
import { useNodeContext } from '../contexts/node';
|
|
14
14
|
import DidAddress from '../did-address';
|
|
15
|
+
import VaultStatus from './vault/status';
|
|
15
16
|
import { formatToDatetime, getExplorerLink } from '../util';
|
|
16
17
|
import { isServerless } from './util';
|
|
17
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -71,8 +72,11 @@ export default function BlockletOverview() {
|
|
|
71
72
|
did: x.appDid,
|
|
72
73
|
showQrcode: true
|
|
73
74
|
})), migratedFrom.length > 2 && /*#__PURE__*/_jsx(Button, {
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
sx: {
|
|
76
|
+
pl: 0,
|
|
77
|
+
'&:hover': {
|
|
78
|
+
backgroundColor: 'transparent'
|
|
79
|
+
}
|
|
76
80
|
},
|
|
77
81
|
endIcon: showAllDIDs ? /*#__PURE__*/_jsx(Icon, {
|
|
78
82
|
icon: KeyboardArrowUpRoundedIcon
|
|
@@ -97,7 +101,23 @@ export default function BlockletOverview() {
|
|
|
97
101
|
did: blocklet.settings.owner.did,
|
|
98
102
|
showQrcode: true
|
|
99
103
|
}) : '-'
|
|
100
|
-
}, {
|
|
104
|
+
}, blocklet.vaults?.length ? {
|
|
105
|
+
name: t('blocklet.config.vault.name'),
|
|
106
|
+
value: /*#__PURE__*/_jsxs(Box, {
|
|
107
|
+
sx: {
|
|
108
|
+
display: 'flex',
|
|
109
|
+
alignItems: 'center',
|
|
110
|
+
gap: 0.5
|
|
111
|
+
},
|
|
112
|
+
children: [/*#__PURE__*/_jsx(DidAddress, {
|
|
113
|
+
did: blocklet.vaults[blocklet.vaults.length - 1].did,
|
|
114
|
+
showQrcode: true
|
|
115
|
+
}), /*#__PURE__*/_jsx(VaultStatus, {
|
|
116
|
+
vaults: blocklet.vaults,
|
|
117
|
+
appId: blocklet.appDid
|
|
118
|
+
})]
|
|
119
|
+
})
|
|
120
|
+
} : null, {
|
|
101
121
|
name: t('blocklet.installedAt'),
|
|
102
122
|
value: formatToDatetime(blocklet.installedAt, locale)
|
|
103
123
|
}, {
|
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
4
|
import useSetState from 'react-use/lib/useSetState';
|
|
5
5
|
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
6
|
+
import Typography from '@mui/material/Typography';
|
|
6
7
|
import Box from '@mui/material/Box';
|
|
7
8
|
import { APP_STRUCT_VERSION } from '@abtnode/constant';
|
|
8
9
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
@@ -18,20 +19,23 @@ export default function AppSk({
|
|
|
18
19
|
initialValue,
|
|
19
20
|
onChange,
|
|
20
21
|
disabled,
|
|
21
|
-
loading
|
|
22
|
+
loading,
|
|
23
|
+
inService
|
|
22
24
|
}) {
|
|
23
25
|
const {
|
|
24
26
|
t
|
|
25
27
|
} = useLocaleContext();
|
|
26
28
|
const {
|
|
27
|
-
api
|
|
29
|
+
api,
|
|
30
|
+
session
|
|
28
31
|
} = useSessionContext();
|
|
29
32
|
const {
|
|
30
33
|
blocklet
|
|
31
34
|
} = useBlockletContext();
|
|
32
35
|
const [state, setState] = useSetState({
|
|
33
36
|
newAppSk: '',
|
|
34
|
-
isConnectOpen: false
|
|
37
|
+
isConnectOpen: false,
|
|
38
|
+
confirmDialogOpen: false
|
|
35
39
|
});
|
|
36
40
|
const onAppSkChange = value => {
|
|
37
41
|
setState({
|
|
@@ -53,7 +57,7 @@ export default function AppSk({
|
|
|
53
57
|
});
|
|
54
58
|
const triggers = blocklet.structVersion === APP_STRUCT_VERSION ? [{
|
|
55
59
|
key: 'rotate-with-did-wallet',
|
|
56
|
-
title: '
|
|
60
|
+
title: t('blocklet.config.migrate.button'),
|
|
57
61
|
handler: () => {
|
|
58
62
|
if (isRunning(blocklet.status)) {
|
|
59
63
|
Toast.error(t('blocklet.error.isRunning'));
|
|
@@ -64,7 +68,7 @@ export default function AppSk({
|
|
|
64
68
|
return;
|
|
65
69
|
}
|
|
66
70
|
setState({
|
|
67
|
-
|
|
71
|
+
confirmDialogOpen: true
|
|
68
72
|
});
|
|
69
73
|
}
|
|
70
74
|
}] : [];
|
|
@@ -93,8 +97,8 @@ export default function AppSk({
|
|
|
93
97
|
})]
|
|
94
98
|
})]
|
|
95
99
|
}),
|
|
96
|
-
confirm: t('confirm'),
|
|
97
|
-
cancel: t('cancel'),
|
|
100
|
+
confirm: t('common.confirm'),
|
|
101
|
+
cancel: t('common.cancel'),
|
|
98
102
|
onConfirm: () => onConfirm(state.newAppSk),
|
|
99
103
|
onCancel: () => setState({
|
|
100
104
|
newAppSk: ''
|
|
@@ -107,7 +111,12 @@ export default function AppSk({
|
|
|
107
111
|
action: "rotate-key-pair",
|
|
108
112
|
checkFn: api.get,
|
|
109
113
|
checkTimeout: 5 * 60 * 1000,
|
|
110
|
-
onSuccess:
|
|
114
|
+
onSuccess: () => {
|
|
115
|
+
if (inService) {
|
|
116
|
+
session.logout();
|
|
117
|
+
}
|
|
118
|
+
onClose();
|
|
119
|
+
},
|
|
111
120
|
extraParams: {
|
|
112
121
|
appDid: blocklet.appDid
|
|
113
122
|
},
|
|
@@ -118,19 +127,45 @@ export default function AppSk({
|
|
|
118
127
|
success: t('setup.keyPair.success')
|
|
119
128
|
},
|
|
120
129
|
onClose: onClose
|
|
130
|
+
}), state.confirmDialogOpen && /*#__PURE__*/_jsx(Confirm, {
|
|
131
|
+
title: /*#__PURE__*/_jsx(Typography, {
|
|
132
|
+
sx: {
|
|
133
|
+
fontSize: '20px',
|
|
134
|
+
fontWeight: '500'
|
|
135
|
+
},
|
|
136
|
+
children: t('blocklet.config.migrate.title')
|
|
137
|
+
}),
|
|
138
|
+
description: /*#__PURE__*/_jsx(Typography, {
|
|
139
|
+
sx: {
|
|
140
|
+
fontSize: '14px',
|
|
141
|
+
color: '#9397A1'
|
|
142
|
+
},
|
|
143
|
+
children: t('blocklet.config.migrate.description')
|
|
144
|
+
}),
|
|
145
|
+
confirm: t('common.confirm'),
|
|
146
|
+
cancel: t('common.cancel'),
|
|
147
|
+
onConfirm: () => setState({
|
|
148
|
+
confirmDialogOpen: false,
|
|
149
|
+
isConnectOpen: true
|
|
150
|
+
}),
|
|
151
|
+
onCancel: () => setState({
|
|
152
|
+
confirmDialogOpen: false
|
|
153
|
+
})
|
|
121
154
|
})];
|
|
122
155
|
}
|
|
123
156
|
AppSk.propTypes = {
|
|
124
157
|
initialValue: PropTypes.string,
|
|
125
158
|
onChange: PropTypes.func,
|
|
126
159
|
disabled: PropTypes.bool,
|
|
127
|
-
loading: PropTypes.bool
|
|
160
|
+
loading: PropTypes.bool,
|
|
161
|
+
inService: PropTypes.bool
|
|
128
162
|
};
|
|
129
163
|
AppSk.defaultProps = {
|
|
130
164
|
initialValue: 'default',
|
|
131
165
|
onChange: () => {},
|
|
132
166
|
disabled: false,
|
|
133
|
-
loading: false
|
|
167
|
+
loading: false,
|
|
168
|
+
inService: false
|
|
134
169
|
};
|
|
135
170
|
const UL = styled('ul')`
|
|
136
171
|
padding-left: 16px;
|