@abtnode/ux 1.16.23-beta-c9c4e08e → 1.16.23-beta-ed83c878
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/agreement.js +23 -4
- package/es/blocklet/component/related-components-dialog.js +11 -9
- package/es/blocklet/publish/create-release.js +47 -4
- package/es/blocklet/publish/select-components.js +181 -0
- package/es/hooks/blocklet.js +29 -19
- package/es/hooks/use-components-by-blocklet-meta-url.js +1 -1
- package/es/locales/ar.js +24 -2
- package/es/locales/de.js +24 -2
- package/es/locales/en.js +15 -2
- package/es/locales/es.js +24 -2
- package/es/locales/fr.js +24 -2
- package/es/locales/hi.js +24 -2
- package/es/locales/i18n.db +0 -0
- package/es/locales/id.js +24 -2
- package/es/locales/ja.js +24 -2
- package/es/locales/ko.js +24 -2
- package/es/locales/pt.js +24 -2
- package/es/locales/ru.js +24 -2
- package/es/locales/th.js +24 -2
- package/es/locales/vi.js +24 -2
- package/es/locales/zh-tw.js +24 -2
- package/es/locales/zh.js +17 -2
- package/es/util/storage-ttl.js +78 -0
- package/lib/blocklet/agreement.js +23 -4
- package/lib/blocklet/component/related-components-dialog.js +13 -9
- package/lib/blocklet/publish/create-release.js +47 -5
- package/lib/blocklet/publish/select-components.js +175 -0
- package/lib/hooks/blocklet.js +37 -24
- package/lib/hooks/use-components-by-blocklet-meta-url.js +1 -1
- package/lib/locales/ar.js +24 -2
- package/lib/locales/de.js +24 -2
- package/lib/locales/en.js +15 -2
- package/lib/locales/es.js +24 -2
- package/lib/locales/fr.js +24 -2
- package/lib/locales/hi.js +24 -2
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +24 -2
- package/lib/locales/ja.js +24 -2
- package/lib/locales/ko.js +24 -2
- package/lib/locales/pt.js +24 -2
- package/lib/locales/ru.js +24 -2
- package/lib/locales/th.js +24 -2
- package/lib/locales/vi.js +24 -2
- package/lib/locales/zh-tw.js +24 -2
- package/lib/locales/zh.js +17 -2
- package/lib/util/storage-ttl.js +89 -0
- package/package.json +15 -15
package/es/blocklet/agreement.js
CHANGED
|
@@ -9,6 +9,7 @@ import { Box, Checkbox, FormControlLabel, IconButton } from '@mui/material';
|
|
|
9
9
|
import { useState } from 'react';
|
|
10
10
|
import AgreementApp from './agreement-app';
|
|
11
11
|
import RelatedComponentsDialog from './component/related-components-dialog';
|
|
12
|
+
import useComponentsByBlockletMetaUrl from '../hooks/use-components-by-blocklet-meta-url';
|
|
12
13
|
|
|
13
14
|
// TODO: 加载 Blocklet 定义的 Agreement
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -26,6 +27,10 @@ export default function Agreement({
|
|
|
26
27
|
locale
|
|
27
28
|
} = useLocaleContext();
|
|
28
29
|
const [showDependencies, setShowDependencies] = useState(false);
|
|
30
|
+
const {
|
|
31
|
+
components,
|
|
32
|
+
loading
|
|
33
|
+
} = useComponentsByBlockletMetaUrl(meta);
|
|
29
34
|
const clickNext = onClickNext || (() => {
|
|
30
35
|
navigate(`/launch-blocklet/install${window.location.search}`);
|
|
31
36
|
});
|
|
@@ -51,9 +56,21 @@ export default function Agreement({
|
|
|
51
56
|
})
|
|
52
57
|
})
|
|
53
58
|
})
|
|
54
|
-
}), /*#__PURE__*/_jsxs(
|
|
59
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
55
60
|
className: "agreement-bottom",
|
|
56
|
-
|
|
61
|
+
sx: {
|
|
62
|
+
'> .agreement-loading': {
|
|
63
|
+
color: 'primary.main'
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
children: [loading ? /*#__PURE__*/_jsx(Icon, {
|
|
67
|
+
className: "agreement-loading",
|
|
68
|
+
icon: "line-md:loading-loop",
|
|
69
|
+
style: {
|
|
70
|
+
fontSize: 42,
|
|
71
|
+
transform: 'scale(0.6)'
|
|
72
|
+
}
|
|
73
|
+
}) : null, onChangeInstallRelated && components?.length ? /*#__PURE__*/_jsxs(Box, {
|
|
57
74
|
sx: {
|
|
58
75
|
display: 'flex',
|
|
59
76
|
flexDirection: 'row',
|
|
@@ -84,7 +101,7 @@ export default function Agreement({
|
|
|
84
101
|
})
|
|
85
102
|
})
|
|
86
103
|
})]
|
|
87
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
104
|
+
}) : null, /*#__PURE__*/_jsx("div", {
|
|
88
105
|
className: "button-container",
|
|
89
106
|
"data-cy": "agree-all",
|
|
90
107
|
children: /*#__PURE__*/_jsx(ServerEula, {
|
|
@@ -100,7 +117,9 @@ export default function Agreement({
|
|
|
100
117
|
installRelated: installRelated,
|
|
101
118
|
meta: meta,
|
|
102
119
|
show: showDependencies,
|
|
103
|
-
onClose: handleHiddenDependencies
|
|
120
|
+
onClose: handleHiddenDependencies,
|
|
121
|
+
components: components,
|
|
122
|
+
loading: loading
|
|
104
123
|
})]
|
|
105
124
|
});
|
|
106
125
|
}
|
|
@@ -4,23 +4,23 @@ import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
|
4
4
|
import { Box, useMediaQuery } from '@mui/material';
|
|
5
5
|
import { Icon } from '@iconify/react';
|
|
6
6
|
import { useMemo } from 'react';
|
|
7
|
-
import useComponentsByBlockletMetaUrl from '../../hooks/use-components-by-blocklet-meta-url';
|
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
function parseLogoUrl(component) {
|
|
10
|
+
return `${component.bundleSource?.store || component.meta.homepage}/assets/${component.meta?.did}/${component.meta?.logo || 'logo.png'}?v=${component.meta?.version}`;
|
|
11
|
+
}
|
|
10
12
|
export default function RelatedComponentsDialog({
|
|
11
13
|
installRelated,
|
|
12
14
|
meta,
|
|
13
15
|
show,
|
|
14
|
-
onClose
|
|
16
|
+
onClose,
|
|
17
|
+
components,
|
|
18
|
+
loading
|
|
15
19
|
}) {
|
|
16
20
|
const {
|
|
17
21
|
t
|
|
18
22
|
} = useLocaleContext();
|
|
19
23
|
const isMobile = useMediaQuery(theme => theme.breakpoints.down('md'));
|
|
20
|
-
const {
|
|
21
|
-
components,
|
|
22
|
-
loading
|
|
23
|
-
} = useComponentsByBlockletMetaUrl(meta);
|
|
24
24
|
const requiredList = useMemo(() => {
|
|
25
25
|
if (!meta || !meta.components) {
|
|
26
26
|
return {};
|
|
@@ -119,7 +119,7 @@ export default function RelatedComponentsDialog({
|
|
|
119
119
|
minWidth: size,
|
|
120
120
|
minHeight: size
|
|
121
121
|
},
|
|
122
|
-
src:
|
|
122
|
+
src: parseLogoUrl(component),
|
|
123
123
|
alt: component.meta.title
|
|
124
124
|
}), /*#__PURE__*/_jsxs(Box, {
|
|
125
125
|
sx: {
|
|
@@ -142,7 +142,7 @@ export default function RelatedComponentsDialog({
|
|
|
142
142
|
}
|
|
143
143
|
},
|
|
144
144
|
onClick: () => {
|
|
145
|
-
window.open(`${component.meta.homepage}/blocklets/${component.meta.did}`, '_blank');
|
|
145
|
+
window.open(`${component.bundleSource?.store || component.meta.homepage}/blocklets/${component.meta.did}`, '_blank');
|
|
146
146
|
},
|
|
147
147
|
children: [component.meta.title, /*#__PURE__*/_jsxs(Box, {
|
|
148
148
|
sx: {
|
|
@@ -180,7 +180,9 @@ RelatedComponentsDialog.propTypes = {
|
|
|
180
180
|
meta: PropTypes.object,
|
|
181
181
|
show: PropTypes.bool,
|
|
182
182
|
onClose: PropTypes.func.isRequired,
|
|
183
|
-
installRelated: PropTypes.func
|
|
183
|
+
installRelated: PropTypes.func,
|
|
184
|
+
components: PropTypes.array.isRequired,
|
|
185
|
+
loading: PropTypes.bool.isRequired
|
|
184
186
|
};
|
|
185
187
|
RelatedComponentsDialog.defaultProps = {
|
|
186
188
|
meta: null,
|
|
@@ -30,6 +30,7 @@ import EmptySpinner from '../../empty-spinner';
|
|
|
30
30
|
import ClickToCopy from '../../click-to-copy';
|
|
31
31
|
import { formatError } from '../../util';
|
|
32
32
|
import Resource from './resource';
|
|
33
|
+
import SelectComponents from './select-components';
|
|
33
34
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
34
35
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
35
36
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -103,9 +104,21 @@ const addComponentTabs = ({
|
|
|
103
104
|
value: key
|
|
104
105
|
});
|
|
105
106
|
};
|
|
106
|
-
const pickParams = release => {
|
|
107
|
-
const params = pick(release, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'note']);
|
|
107
|
+
const pickParams = (release, app) => {
|
|
108
|
+
const params = pick(release, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'blockletComponents', 'note']);
|
|
108
109
|
params.blockletScreenshots ||= [];
|
|
110
|
+
if (!params.blockletComponents) {
|
|
111
|
+
params.blockletComponents = (app.children || []).map(x => ({
|
|
112
|
+
did: x.meta.did,
|
|
113
|
+
included: true,
|
|
114
|
+
required: true
|
|
115
|
+
}));
|
|
116
|
+
} else {
|
|
117
|
+
params.blockletComponents = params.blockletComponents.map(x => ({
|
|
118
|
+
...x,
|
|
119
|
+
included: true
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
109
122
|
return params;
|
|
110
123
|
};
|
|
111
124
|
export default function CreateRelease({
|
|
@@ -170,7 +183,7 @@ export default function CreateRelease({
|
|
|
170
183
|
} else if (semver.valid(data.blockletVersion)) {
|
|
171
184
|
data.blockletVersion = semver.inc(data.blockletVersion, 'patch');
|
|
172
185
|
}
|
|
173
|
-
setParams(pickParams(data));
|
|
186
|
+
setParams(pickParams(data, blocklet));
|
|
174
187
|
setProjectType(data.type);
|
|
175
188
|
}).catch(err => {
|
|
176
189
|
setLoading(false);
|
|
@@ -186,7 +199,7 @@ export default function CreateRelease({
|
|
|
186
199
|
}
|
|
187
200
|
}).then(res => {
|
|
188
201
|
setLoading(false);
|
|
189
|
-
setParams(pickParams(res?.release));
|
|
202
|
+
setParams(pickParams(res?.release, blocklet));
|
|
190
203
|
setRelease(res?.release);
|
|
191
204
|
}).catch(err => {
|
|
192
205
|
setLoading(false);
|
|
@@ -237,6 +250,11 @@ export default function CreateRelease({
|
|
|
237
250
|
_params.blockletDescription = (_params.blockletDescription || '').trim();
|
|
238
251
|
_params.blockletIntroduction = (_params.blockletIntroduction || '').trim();
|
|
239
252
|
_params.note = (_params.note || '').trim();
|
|
253
|
+
if (projectType === 'pack') {
|
|
254
|
+
_params.blockletComponents = (_params.blockletComponents || []).filter(x => x.included).map(x => pick(x, ['did', 'required'])).map(JSON.stringify);
|
|
255
|
+
} else {
|
|
256
|
+
delete _params.blockletComponents;
|
|
257
|
+
}
|
|
240
258
|
setCreateLoading(status);
|
|
241
259
|
setLoading(true);
|
|
242
260
|
api.createRelease({
|
|
@@ -762,6 +780,31 @@ export default function CreateRelease({
|
|
|
762
780
|
children: resourceContent
|
|
763
781
|
})]
|
|
764
782
|
})]
|
|
783
|
+
}), projectType === 'pack' && /*#__PURE__*/_jsxs(Box, {
|
|
784
|
+
display: "flex",
|
|
785
|
+
mt: 3,
|
|
786
|
+
className: "section full-width",
|
|
787
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
788
|
+
className: "left",
|
|
789
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
790
|
+
variant: "h3",
|
|
791
|
+
children: t('common.components')
|
|
792
|
+
})
|
|
793
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
794
|
+
sx: {
|
|
795
|
+
flex: 1
|
|
796
|
+
},
|
|
797
|
+
children: /*#__PURE__*/_jsx(SelectComponents, {
|
|
798
|
+
disabled: loading || readOnly,
|
|
799
|
+
app: blocklet,
|
|
800
|
+
value: params.blockletComponents,
|
|
801
|
+
onChange: data => {
|
|
802
|
+
setParams({
|
|
803
|
+
blockletComponents: data
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
})
|
|
807
|
+
})]
|
|
765
808
|
})]
|
|
766
809
|
})]
|
|
767
810
|
});
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
import pick from 'lodash/pick';
|
|
6
|
+
import Checkbox from '@mui/material/Checkbox';
|
|
7
|
+
import Box from '@mui/material/Box';
|
|
8
|
+
import Datatable from '@arcblock/ux/lib/Datatable';
|
|
9
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
10
|
+
import BlockletBundleAvatar from '../bundle-avatar';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
export default function SelectComponents({
|
|
14
|
+
value,
|
|
15
|
+
app,
|
|
16
|
+
onChange,
|
|
17
|
+
disabled
|
|
18
|
+
}) {
|
|
19
|
+
const {
|
|
20
|
+
t,
|
|
21
|
+
locale
|
|
22
|
+
} = useLocaleContext();
|
|
23
|
+
const components = app.children || [];
|
|
24
|
+
const list = useMemo(() => app.children.map(component => {
|
|
25
|
+
const exist = value.find(item => item.did === component.meta.did);
|
|
26
|
+
return exist || {
|
|
27
|
+
did: component.meta.did
|
|
28
|
+
};
|
|
29
|
+
}), [app, value]);
|
|
30
|
+
const map = list.reduce((acc, curr) => {
|
|
31
|
+
acc[curr.did] = pick(curr, ['required', 'included']);
|
|
32
|
+
return acc;
|
|
33
|
+
}, {});
|
|
34
|
+
const toggleIncluded = did => {
|
|
35
|
+
const newValue = list.map(item => {
|
|
36
|
+
if (item.did === did) {
|
|
37
|
+
const included = !item.included;
|
|
38
|
+
return {
|
|
39
|
+
...item,
|
|
40
|
+
included,
|
|
41
|
+
required: included
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return item;
|
|
45
|
+
});
|
|
46
|
+
onChange(newValue);
|
|
47
|
+
};
|
|
48
|
+
const toggleRequired = did => {
|
|
49
|
+
const newValue = list.map(item => {
|
|
50
|
+
if (item.did === did) {
|
|
51
|
+
return {
|
|
52
|
+
...item,
|
|
53
|
+
required: !item.required
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return item;
|
|
57
|
+
});
|
|
58
|
+
onChange(newValue);
|
|
59
|
+
};
|
|
60
|
+
const columns = [{
|
|
61
|
+
label: t('common.name'),
|
|
62
|
+
name: 'meta.title',
|
|
63
|
+
width: 200,
|
|
64
|
+
options: {
|
|
65
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
66
|
+
customBodyRenderLite: rawIndex => {
|
|
67
|
+
const component = components[rawIndex];
|
|
68
|
+
const included = map[component.meta.did]?.included;
|
|
69
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
70
|
+
display: "flex",
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
children: [/*#__PURE__*/_jsx(BlockletBundleAvatar, {
|
|
73
|
+
size: 24,
|
|
74
|
+
blocklet: component,
|
|
75
|
+
ancestors: [app]
|
|
76
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
77
|
+
ml: "4px",
|
|
78
|
+
className: classnames('text', {
|
|
79
|
+
excluded: !included
|
|
80
|
+
}),
|
|
81
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
82
|
+
children: component.meta.title
|
|
83
|
+
})
|
|
84
|
+
})]
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, {
|
|
89
|
+
label: t('blocklet.publish.componentIncluded'),
|
|
90
|
+
width: 100,
|
|
91
|
+
options: {
|
|
92
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
93
|
+
customBodyRenderLite: rawIndex => {
|
|
94
|
+
const component = components[rawIndex];
|
|
95
|
+
const included = map[component.meta.did]?.included;
|
|
96
|
+
return /*#__PURE__*/_jsx(Checkbox, {
|
|
97
|
+
size: "small",
|
|
98
|
+
checked: included,
|
|
99
|
+
onClick: () => toggleIncluded(component.meta.did),
|
|
100
|
+
disabled: disabled
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
label: t('blocklet.publish.componentForceRequired'),
|
|
106
|
+
width: 100,
|
|
107
|
+
options: {
|
|
108
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
109
|
+
customBodyRenderLite: rawIndex => {
|
|
110
|
+
const component = components[rawIndex];
|
|
111
|
+
const included = map[component.meta.did]?.included;
|
|
112
|
+
const required = map[component.meta.did]?.required;
|
|
113
|
+
return /*#__PURE__*/_jsx(Checkbox, {
|
|
114
|
+
disabled: disabled || !included,
|
|
115
|
+
size: "small",
|
|
116
|
+
checked: required && included,
|
|
117
|
+
onClick: () => toggleRequired(component.meta.did)
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}];
|
|
122
|
+
return /*#__PURE__*/_jsx(Root, {
|
|
123
|
+
children: /*#__PURE__*/_jsx(Datatable, {
|
|
124
|
+
className: "main-table",
|
|
125
|
+
verticalKeyWidth: 100,
|
|
126
|
+
locale: locale,
|
|
127
|
+
data: components,
|
|
128
|
+
columns: columns,
|
|
129
|
+
options: {
|
|
130
|
+
sort: false,
|
|
131
|
+
download: false,
|
|
132
|
+
filter: false,
|
|
133
|
+
print: false,
|
|
134
|
+
search: false,
|
|
135
|
+
rowsPerPage: 100
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
SelectComponents.propTypes = {
|
|
141
|
+
app: PropTypes.object.isRequired,
|
|
142
|
+
value: PropTypes.arrayOf(PropTypes.shape({
|
|
143
|
+
did: PropTypes.string.isRequired,
|
|
144
|
+
required: PropTypes.bool,
|
|
145
|
+
included: PropTypes.bool
|
|
146
|
+
})),
|
|
147
|
+
onChange: PropTypes.func,
|
|
148
|
+
disabled: PropTypes.bool
|
|
149
|
+
};
|
|
150
|
+
SelectComponents.defaultProps = {
|
|
151
|
+
value: [],
|
|
152
|
+
onChange: () => {},
|
|
153
|
+
disabled: false
|
|
154
|
+
};
|
|
155
|
+
const Root = styled(Box)`
|
|
156
|
+
.main-table {
|
|
157
|
+
.text.excluded {
|
|
158
|
+
color: #999;
|
|
159
|
+
}
|
|
160
|
+
width: 400px;
|
|
161
|
+
${({
|
|
162
|
+
theme
|
|
163
|
+
}) => theme.breakpoints.down('md')} {
|
|
164
|
+
width: 100%;
|
|
165
|
+
}
|
|
166
|
+
> div:first-child {
|
|
167
|
+
display: none;
|
|
168
|
+
}
|
|
169
|
+
.MuiTableCell-head {
|
|
170
|
+
padding-top: 0;
|
|
171
|
+
padding-bottom: 0;
|
|
172
|
+
}
|
|
173
|
+
.MuiTableCell-body {
|
|
174
|
+
padding-top: 6px;
|
|
175
|
+
padding-bottom: 6px;
|
|
176
|
+
}
|
|
177
|
+
.datatable-footer {
|
|
178
|
+
display: none;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
`;
|
package/es/hooks/blocklet.js
CHANGED
|
@@ -7,9 +7,9 @@ import { toSlotDomain, getBlockletUrlParams, getBlockletUrl } from '../util';
|
|
|
7
7
|
import { fixBlocklet } from '../blocklet/util';
|
|
8
8
|
import { useDomainsAccessibility } from './url-evaluation';
|
|
9
9
|
import parseProgress from '../util/parse-progress';
|
|
10
|
+
import { getStorageWithTTL, removeStorageTTL, setStorageWithTTL } from '../util/storage-ttl';
|
|
11
|
+
const parseStatusKey = id => `blocklet-status-${id}`;
|
|
10
12
|
const excludeDownloadingStatus = {
|
|
11
|
-
waiting: 1,
|
|
12
|
-
installing: 1,
|
|
13
13
|
installed: 1,
|
|
14
14
|
starting: 1,
|
|
15
15
|
running: 1,
|
|
@@ -18,6 +18,26 @@ const excludeDownloadingStatus = {
|
|
|
18
18
|
restarting: 1,
|
|
19
19
|
deleting: 1
|
|
20
20
|
};
|
|
21
|
+
function rollbackSessionBlockletStatus(blocklet) {
|
|
22
|
+
if (blocklet) {
|
|
23
|
+
const children = blocklet.children || [];
|
|
24
|
+
let isExtracting = false;
|
|
25
|
+
children.forEach(item => {
|
|
26
|
+
if (item.status === 'downloading') {
|
|
27
|
+
const status = getStorageWithTTL(parseStatusKey(item.meta?.bundleDid));
|
|
28
|
+
item.status = status || item.status;
|
|
29
|
+
if (status === 'extracting') {
|
|
30
|
+
isExtracting = true;
|
|
31
|
+
}
|
|
32
|
+
} else if (excludeDownloadingStatus[blocklet.status]) {
|
|
33
|
+
removeStorageTTL(parseStatusKey(item.meta?.bundleDid));
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
if (isExtracting) {
|
|
37
|
+
blocklet.status = 'extracting';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
21
41
|
|
|
22
42
|
// eslint-disable-next-line import/prefer-default-export
|
|
23
43
|
export function useBlocklet({
|
|
@@ -62,6 +82,7 @@ export function useBlocklet({
|
|
|
62
82
|
await fixBlocklet(data, {
|
|
63
83
|
getIP
|
|
64
84
|
});
|
|
85
|
+
rollbackSessionBlockletStatus(data);
|
|
65
86
|
setBlocklet(data);
|
|
66
87
|
} catch (err) {
|
|
67
88
|
Toast.error(err.message);
|
|
@@ -116,12 +137,7 @@ export function useBlocklet({
|
|
|
116
137
|
fixRuntime: 'merge-old',
|
|
117
138
|
oldBlocklet
|
|
118
139
|
});
|
|
119
|
-
|
|
120
|
-
oldBlocklet?.children?.forEach(item => {
|
|
121
|
-
delete item.progress;
|
|
122
|
-
});
|
|
123
|
-
delete oldBlocklet.progress;
|
|
124
|
-
}
|
|
140
|
+
rollbackSessionBlockletStatus(data);
|
|
125
141
|
return data;
|
|
126
142
|
});
|
|
127
143
|
setLoading(false);
|
|
@@ -167,21 +183,14 @@ export function useBlocklet({
|
|
|
167
183
|
const children = oldBlocklet.children || [];
|
|
168
184
|
children.forEach(x => {
|
|
169
185
|
if (x.meta?.bundleDid === data.component?.did) {
|
|
186
|
+
setStorageWithTTL(parseStatusKey(x.meta?.bundleDid), data.status, 1000 * 60 * 5);
|
|
170
187
|
x.status = data.status;
|
|
171
188
|
}
|
|
172
189
|
});
|
|
173
|
-
|
|
174
|
-
// 判断当前下载的 children 是否都处于 extracting
|
|
175
|
-
const extracting = children.every(x => {
|
|
176
|
-
if (excludeDownloadingStatus[x.status]) {
|
|
177
|
-
return true;
|
|
178
|
-
}
|
|
179
|
-
return x.status === 'extracting';
|
|
180
|
-
});
|
|
181
190
|
return {
|
|
182
191
|
...oldBlocklet,
|
|
183
192
|
children,
|
|
184
|
-
status:
|
|
193
|
+
status: data.status
|
|
185
194
|
};
|
|
186
195
|
});
|
|
187
196
|
}
|
|
@@ -193,14 +202,15 @@ export function useBlocklet({
|
|
|
193
202
|
|
|
194
203
|
// keep largest files as progress
|
|
195
204
|
const children = oldBlocklet.children || [];
|
|
196
|
-
let progress =
|
|
205
|
+
let progress = oldBlocklet.progress || 0;
|
|
197
206
|
children.forEach(item => {
|
|
198
207
|
if (item.meta?.bundleDid === data.component?.did) {
|
|
199
208
|
item.progress = parseProgress(data.current, data.total);
|
|
200
209
|
item.status = data.status;
|
|
201
|
-
if (item.progress
|
|
210
|
+
if (item.progress > progress) {
|
|
202
211
|
progress = item.progress;
|
|
203
212
|
}
|
|
213
|
+
removeStorageTTL(parseStatusKey(item.meta?.bundleDid));
|
|
204
214
|
}
|
|
205
215
|
});
|
|
206
216
|
return {
|
|
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
|
|
|
2
2
|
import { useSearchParams } from 'react-router-dom';
|
|
3
3
|
import { useNodeContext } from '../contexts/node';
|
|
4
4
|
function parseBlockletMetaUrl(meta) {
|
|
5
|
-
return meta && meta.homepage && meta.did ? `${meta
|
|
5
|
+
return meta && (meta.registryUrl || meta.homepage) && meta.did ? `${meta.registryUrl || meta.homepage}/api/blocklets/${meta?.did}/blocklet.json` : '';
|
|
6
6
|
}
|
|
7
7
|
function useComponentsByBlockletMetaUrl(meta) {
|
|
8
8
|
const {
|
package/es/locales/ar.js
CHANGED
|
@@ -46,6 +46,24 @@ export default {
|
|
|
46
46
|
scan: 'قم بتوصيل محفظة DID الخاصة بك لتوفير جواز السفر',
|
|
47
47
|
confirm: 'أكد على محفظة الهوية الرقمية الخاصة بك',
|
|
48
48
|
success: 'تم اتصالك بنجاح'
|
|
49
|
+
},
|
|
50
|
+
switchDid: {
|
|
51
|
+
title: 'تبديل محفظة DID',
|
|
52
|
+
scan: 'مسح رمز الاستجابة السريعة التالي لتبديل الحساب',
|
|
53
|
+
confirm: 'قم بتأكيد التبديل في محفظة ديد الخاصة بك',
|
|
54
|
+
success: 'تم التحويل بنجاح'
|
|
55
|
+
},
|
|
56
|
+
switchSpecifiedDid: {
|
|
57
|
+
title: 'تبديل محفظة DID',
|
|
58
|
+
scan: 'تحتاج إلى تبديل DID إلى {did} لإكمال الإجراءات التالية',
|
|
59
|
+
confirm: 'قم بتأكيد التبديل في محفظة ديد الخاصة بك',
|
|
60
|
+
success: 'تم التبديل بنجاح'
|
|
61
|
+
},
|
|
62
|
+
connect: {
|
|
63
|
+
title: 'قم بتوصيل محفظة DID',
|
|
64
|
+
scan: 'قم بتوصيل محفظة DID الخاصة بك لتوفير جواز السفر',
|
|
65
|
+
confirm: 'قم بتأكيد على محفظتك الرقمية',
|
|
66
|
+
success: 'لقد تم توصيلك بنجاح'
|
|
49
67
|
}
|
|
50
68
|
},
|
|
51
69
|
acceptServer: {
|
|
@@ -579,7 +597,8 @@ export default {
|
|
|
579
597
|
setting: 'الإعدادات',
|
|
580
598
|
components: 'تبعيات المكوّن {name}',
|
|
581
599
|
noDependencies: 'لا يوجد لدى {name} أي تبعيات',
|
|
582
|
-
relatedComponents: 'المكونات ذات الصلة'
|
|
600
|
+
relatedComponents: 'المكونات ذات الصلة',
|
|
601
|
+
required: 'مطلوب'
|
|
583
602
|
},
|
|
584
603
|
router: {
|
|
585
604
|
urlPath: 'مسار عنوان URL',
|
|
@@ -662,7 +681,10 @@ export default {
|
|
|
662
681
|
noNote: 'ملاحظة الإصدار مطلوبة'
|
|
663
682
|
},
|
|
664
683
|
packTip: 'سيتم تضمين مكونات وتكوين التطبيق تلقائيًا في البلوكليت.',
|
|
665
|
-
resourceChangedWarning: 'لقد قمت بتعديل المورد، يرجى حفظه في الوقت المناسب'
|
|
684
|
+
resourceChangedWarning: 'لقد قمت بتعديل المورد، يرجى حفظه في الوقت المناسب',
|
|
685
|
+
installResourceTip: 'يرجى إضافة المكون في التطبيق، عنوان URL للمكون:',
|
|
686
|
+
installResourceTip2: 'إذا كنت ترغب في رؤية المزيد من النصائح، يرجى زيارة',
|
|
687
|
+
installResourceHelp: 'وثيقة المساعدة'
|
|
666
688
|
}
|
|
667
689
|
},
|
|
668
690
|
dashboard: {
|
package/es/locales/de.js
CHANGED
|
@@ -46,6 +46,24 @@ export default {
|
|
|
46
46
|
scan: 'Verbinden Sie Ihre DID-Brieftasche, um Ihren Reisepass bereitzustellen',
|
|
47
47
|
confirm: 'Bestätigen Sie in Ihrer DID-Brieftasche',
|
|
48
48
|
success: 'Du bist erfolgreich verbunden'
|
|
49
|
+
},
|
|
50
|
+
switchDid: {
|
|
51
|
+
title: 'Schalte DID Wallet um',
|
|
52
|
+
scan: 'Scannen Sie den folgenden QR-Code, um das Konto zu wechseln',
|
|
53
|
+
confirm: 'Bestätigen Sie den Wechsel in Ihrem DID-Wallet',
|
|
54
|
+
success: 'Erfolgreich umgeschaltet'
|
|
55
|
+
},
|
|
56
|
+
switchSpecifiedDid: {
|
|
57
|
+
title: 'Wechsle auf DID Wallet',
|
|
58
|
+
scan: 'Du musst DID auf {did} umschalten, um die folgenden Aktionen abzuschließen',
|
|
59
|
+
confirm: 'Bestätige den Wechsel in deiner DID-Brieftasche',
|
|
60
|
+
success: 'Erfolgreich gewechselt'
|
|
61
|
+
},
|
|
62
|
+
connect: {
|
|
63
|
+
title: 'Verbinden Sie das DID-Wallet',
|
|
64
|
+
scan: 'Verbinden Sie Ihre DID Wallet, um einen Pass zu hinterlegen',
|
|
65
|
+
confirm: 'Bestätige in deinem DID Wallet',
|
|
66
|
+
success: 'Du bist erfolgreich verbunden'
|
|
49
67
|
}
|
|
50
68
|
},
|
|
51
69
|
acceptServer: {
|
|
@@ -579,7 +597,8 @@ export default {
|
|
|
579
597
|
setting: 'Einstellungen',
|
|
580
598
|
components: 'Abhängigkeiten von Komponente {name}',
|
|
581
599
|
noDependencies: '{name} hat keine Abhängigkeiten',
|
|
582
|
-
relatedComponents: 'Verbundene Komponenten'
|
|
600
|
+
relatedComponents: 'Verbundene Komponenten',
|
|
601
|
+
required: 'Erforderlich'
|
|
583
602
|
},
|
|
584
603
|
router: {
|
|
585
604
|
urlPath: 'URL Pfad',
|
|
@@ -662,7 +681,10 @@ export default {
|
|
|
662
681
|
noNote: 'Versionshinweis wird benötigt'
|
|
663
682
|
},
|
|
664
683
|
packTip: 'Komponenten und Anwendungskonfiguration werden automatisch in das Blocklet einbezogen.',
|
|
665
|
-
resourceChangedWarning: 'Sie haben die Ressource geändert, bitte rechtzeitig speichern'
|
|
684
|
+
resourceChangedWarning: 'Sie haben die Ressource geändert, bitte rechtzeitig speichern',
|
|
685
|
+
installResourceTip: 'Bitte fügen Sie das Bauteil in einer Anwendung hinzu, Bauteil-URL:',
|
|
686
|
+
installResourceTip2: 'Wenn du mehr Tipps sehen möchtest, besuche bitte',
|
|
687
|
+
installResourceHelp: 'Hilfe-Dokument'
|
|
666
688
|
}
|
|
667
689
|
},
|
|
668
690
|
dashboard: {
|
package/es/locales/en.js
CHANGED
|
@@ -41,7 +41,19 @@ export default {
|
|
|
41
41
|
login: {
|
|
42
42
|
loginTo: 'Connect to',
|
|
43
43
|
description: 'Only server owner and approved members can access the dashboard',
|
|
44
|
-
|
|
44
|
+
switchDid: {
|
|
45
|
+
title: 'Switch DID Wallet',
|
|
46
|
+
scan: 'Scan following qrcode to switch account',
|
|
47
|
+
confirm: 'Confirm switch in your DID Wallet',
|
|
48
|
+
success: 'Successfully switched'
|
|
49
|
+
},
|
|
50
|
+
switchSpecifiedDid: {
|
|
51
|
+
title: 'Switch DID Wallet',
|
|
52
|
+
scan: 'You need switch DID to {did} to complete the following actions',
|
|
53
|
+
confirm: 'Confirm switch in your DID Wallet',
|
|
54
|
+
success: 'Successfully switched'
|
|
55
|
+
},
|
|
56
|
+
connect: {
|
|
45
57
|
title: 'Connect DID Wallet',
|
|
46
58
|
scan: 'Connect your DID Wallet to provide passport',
|
|
47
59
|
confirm: 'Confirm on your DID Wallet',
|
|
@@ -650,8 +662,9 @@ export default {
|
|
|
650
662
|
resourceChangedWarning: 'You have modified the resource, please save it in time',
|
|
651
663
|
installResourceTip: 'Please add the component in an application, component URL:',
|
|
652
664
|
installResourceTip2: 'If you want to see more tips, please visit',
|
|
653
|
-
// translate to en
|
|
654
665
|
installResourceHelp: 'Help Document',
|
|
666
|
+
componentIncluded: 'Included',
|
|
667
|
+
componentForceRequired: 'Forced Required',
|
|
655
668
|
connect: {
|
|
656
669
|
title: 'Create Blocklet DID',
|
|
657
670
|
scan: 'Scan the QR code below to generate Blocklet DID',
|
package/es/locales/es.js
CHANGED
|
@@ -46,6 +46,24 @@ export default {
|
|
|
46
46
|
scan: 'Conecta tu billetera DID para proporcionar el pasaporte',
|
|
47
47
|
confirm: 'Confirma en tu billetera DID',
|
|
48
48
|
success: 'Estás conectado con éxito'
|
|
49
|
+
},
|
|
50
|
+
switchDid: {
|
|
51
|
+
title: 'Cambiar billetera DID',
|
|
52
|
+
scan: 'Escanea el siguiente código QR para cambiar de cuenta',
|
|
53
|
+
confirm: 'Confirma el cambio en tu billetera DID',
|
|
54
|
+
success: 'Cambiado exitosamente'
|
|
55
|
+
},
|
|
56
|
+
switchSpecifiedDid: {
|
|
57
|
+
title: 'Cambiar billetera DID',
|
|
58
|
+
scan: 'Necesitas cambiar el DID a {did} para completar las siguientes acciones',
|
|
59
|
+
confirm: 'Confirma el cambio en tu billetera de DID',
|
|
60
|
+
success: 'Cambiado con éxito'
|
|
61
|
+
},
|
|
62
|
+
connect: {
|
|
63
|
+
title: 'Conectar billetera DID',
|
|
64
|
+
scan: 'Conecta tu billetera DID para proporcionar pasaporte',
|
|
65
|
+
confirm: 'Confirma en tu billetera DID',
|
|
66
|
+
success: 'Estás conectado exitosamente'
|
|
49
67
|
}
|
|
50
68
|
},
|
|
51
69
|
acceptServer: {
|
|
@@ -579,7 +597,8 @@ export default {
|
|
|
579
597
|
setting: 'Ajustes',
|
|
580
598
|
components: 'Dependencias del componente {name}',
|
|
581
599
|
noDependencies: '{name} no tiene dependencias',
|
|
582
|
-
relatedComponents: 'Componentes relacionados'
|
|
600
|
+
relatedComponents: 'Componentes relacionados',
|
|
601
|
+
required: 'Requerido'
|
|
583
602
|
},
|
|
584
603
|
router: {
|
|
585
604
|
urlPath: 'URL Path',
|
|
@@ -662,7 +681,10 @@ export default {
|
|
|
662
681
|
noNote: 'Se requiere la Nota de Lanzamiento'
|
|
663
682
|
},
|
|
664
683
|
packTip: 'Los componentes y la configuración de la aplicación se incluirán automáticamente en el blocklet',
|
|
665
|
-
resourceChangedWarning: 'Ha modificado el recurso, por favor guárdelo a tiempo'
|
|
684
|
+
resourceChangedWarning: 'Ha modificado el recurso, por favor guárdelo a tiempo',
|
|
685
|
+
installResourceTip: 'Por favor agrega el componente en una aplicación, URL del componente:',
|
|
686
|
+
installResourceTip2: 'Si desea ver más consejos, visite {name}',
|
|
687
|
+
installResourceHelp: 'Ayuda Documento'
|
|
666
688
|
}
|
|
667
689
|
},
|
|
668
690
|
dashboard: {
|