@abtnode/ux 1.16.29-next-680cf137 → 1.16.29
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/blocklet-owner-info.js +35 -0
- package/lib/blocklet/component/component-info-dialog.js +7 -2
- package/lib/blocklet/component/index.js +30 -27
- package/lib/blocklet/install-from-url.js +9 -3
- package/lib/blocklet/publish/create-release/blocklets.js +5 -5
- package/lib/blocklet/publish/create-release/branding.js +14 -11
- package/lib/blocklet/publish/create-release/connect-store-button.js +11 -10
- package/lib/blocklet/publish/create-release/header.js +136 -123
- package/lib/blocklet/publish/create-release/index.js +16 -16
- package/lib/blocklet/publish/create-release/project-setting.js +182 -0
- package/lib/blocklet/publish/create-release/resource-select.js +16 -12
- package/lib/blocklet/publish/hooks/use-want-to-connect-store.js +6 -2
- package/lib/blocklet/publish/utils/get-studio-store-list.js +3 -0
- package/lib/blocklet/publish/utils/parse-resource-relate-components.js +31 -0
- package/lib/blocklet/storage/auto-check-update.js +2 -2
- package/lib/contexts/blocklet-auto-check-update.js +54 -0
- package/lib/contexts/blocklet-storage.js +0 -19
- package/lib/locales/ar.js +6 -1
- package/lib/locales/de.js +6 -1
- package/lib/locales/en.js +5 -0
- package/lib/locales/es.js +6 -1
- package/lib/locales/fr.js +6 -1
- package/lib/locales/hi.js +6 -1
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +6 -1
- package/lib/locales/ja.js +6 -1
- package/lib/locales/ko.js +6 -1
- package/lib/locales/pt.js +6 -1
- package/lib/locales/ru.js +6 -1
- package/lib/locales/th.js +6 -1
- package/lib/locales/vi.js +6 -1
- package/lib/locales/zh-tw.js +6 -1
- package/lib/locales/zh.js +6 -1
- package/lib/util/index.js +0 -14
- package/package.json +20 -20
|
@@ -54,7 +54,7 @@ const addComponentTabs = ({
|
|
|
54
54
|
});
|
|
55
55
|
};
|
|
56
56
|
const pickParams = (baseParams, app) => {
|
|
57
|
-
const params = pick(baseParams, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'connectedStores', 'blockletComponents', 'lastReleaseId', 'uploadedResource', 'note']);
|
|
57
|
+
const params = pick(baseParams, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'connectedStores', 'blockletComponents', 'lastReleaseId', 'uploadedResource', 'autoUpload', 'possibleSameStore', 'note']);
|
|
58
58
|
if (!params.blockletComponents) {
|
|
59
59
|
params.blockletComponents = (app.children || []).map(x => ({
|
|
60
60
|
did: x.meta.did,
|
|
@@ -122,6 +122,18 @@ export default function CreateRelease({
|
|
|
122
122
|
const [resourceComponentsMap, _setResourceComponentsMap] = useSetState({});
|
|
123
123
|
const dependentComponentsMode = initUrl?.searchParams.get('dependentComponentsMode');
|
|
124
124
|
const disabledSelectComponents = dependentComponentsMode === 'readonly';
|
|
125
|
+
const resourceRelateComponents = useMemo(() => {
|
|
126
|
+
const result = {};
|
|
127
|
+
Object.keys(resourceComponentsMap).forEach(key => {
|
|
128
|
+
const item = resourceComponentsMap[key];
|
|
129
|
+
if (item) {
|
|
130
|
+
item.forEach(k => {
|
|
131
|
+
result[k] = true;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
return result;
|
|
136
|
+
}, [resourceComponentsMap]);
|
|
125
137
|
const setResourceComponentsMap = useCallback(setter => {
|
|
126
138
|
if (disabledSelectComponents) {
|
|
127
139
|
setParams({
|
|
@@ -146,7 +158,7 @@ export default function CreateRelease({
|
|
|
146
158
|
});
|
|
147
159
|
}
|
|
148
160
|
}, [projectId, setParamsErrTip]);
|
|
149
|
-
const projectType = useMemo(() => params?.blockletComponents?.some(x => x.included) || params?.uploadedResource ? 'pack' : 'resource', [params?.blockletComponents, params?.uploadedResource]);
|
|
161
|
+
const projectType = useMemo(() => params?.blockletComponents?.some(x => x.included) || Object.keys(resourceRelateComponents).length || params?.uploadedResource ? 'pack' : 'resource', [params?.blockletComponents, params?.uploadedResource, resourceRelateComponents]);
|
|
150
162
|
const tabs = [];
|
|
151
163
|
const resourceComponents = (blocklet?.children || []).filter(x => x.meta.resource?.exportApi).filter(x => !componentDid || x.meta.did === componentDid);
|
|
152
164
|
resourceComponents.forEach(item => {
|
|
@@ -160,18 +172,6 @@ export default function CreateRelease({
|
|
|
160
172
|
const [tab, setTab] = useState(tabs[0]?.value);
|
|
161
173
|
const isPublished = !releaseUsedLast && release?.status === 'published';
|
|
162
174
|
const readOnly = isPublished;
|
|
163
|
-
const resourceRelateComponents = useMemo(() => {
|
|
164
|
-
const result = {};
|
|
165
|
-
Object.keys(resourceComponentsMap).forEach(key => {
|
|
166
|
-
const item = resourceComponentsMap[key];
|
|
167
|
-
if (item) {
|
|
168
|
-
item.forEach(k => {
|
|
169
|
-
result[k] = true;
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
return result;
|
|
174
|
-
}, [resourceComponentsMap]);
|
|
175
175
|
const updateParamsByUrl = useMemoizedFn(() => {
|
|
176
176
|
if (!initUrl) {
|
|
177
177
|
return;
|
|
@@ -183,7 +183,7 @@ export default function CreateRelease({
|
|
|
183
183
|
blockletTitle: old?.blockletTitle || initUrl.searchParams.get('title'),
|
|
184
184
|
blockletDescription: old?.blockletDescription || initUrl.searchParams.get('description'),
|
|
185
185
|
blockletIntroduction: old?.blockletIntroduction || initUrl.searchParams.get('introduction') || initUrl.searchParams.get('description'),
|
|
186
|
-
blockletComponents: old?.blockletComponents
|
|
186
|
+
blockletComponents: old?.blockletComponents?.length ? old?.blockletComponents : JSON.parse(initUrl.searchParams.get('components') || '[]'),
|
|
187
187
|
note: old?.note || initUrl.searchParams.get('note') || 'No note'
|
|
188
188
|
};
|
|
189
189
|
});
|
|
@@ -308,7 +308,7 @@ export default function CreateRelease({
|
|
|
308
308
|
}
|
|
309
309
|
const resourceItem = resourceComponents.find(x => x.meta.did === tab);
|
|
310
310
|
const allResourceComponentsStop = resourceComponents.every(x => x.status !== 'running');
|
|
311
|
-
if (allResourceComponentsStop) {
|
|
311
|
+
if (allResourceComponentsStop && resourceComponents?.length) {
|
|
312
312
|
return /*#__PURE__*/_jsx(StopBox, {
|
|
313
313
|
children: t('blocklet.publish.allComponentsNotRunning')
|
|
314
314
|
});
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { UNOWNED_DID } from '@abtnode/constant';
|
|
2
|
+
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
3
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
+
import IOSSwitch from '@arcblock/ux/lib/Switch';
|
|
5
|
+
import Toast from '@arcblock/ux/lib/Toast/index';
|
|
6
|
+
import { Icon } from '@iconify/react';
|
|
7
|
+
import { Box, Button, Typography } from '@mui/material';
|
|
8
|
+
import Spinner from '@mui/material/CircularProgress';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import { useEffect, useState } from 'react';
|
|
11
|
+
import { useNodeContext } from '../../../contexts/node';
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
function ProjectSetting({
|
|
14
|
+
did,
|
|
15
|
+
params,
|
|
16
|
+
setParams,
|
|
17
|
+
projectId,
|
|
18
|
+
open,
|
|
19
|
+
onClose
|
|
20
|
+
}) {
|
|
21
|
+
const {
|
|
22
|
+
t
|
|
23
|
+
} = useLocaleContext();
|
|
24
|
+
const [loading, setLoading] = useState(false);
|
|
25
|
+
const {
|
|
26
|
+
api
|
|
27
|
+
} = useNodeContext();
|
|
28
|
+
const [autoUpload, setAutoUpload] = useState(false);
|
|
29
|
+
const [possibleSameStore, setPossibleSameStore] = useState(false);
|
|
30
|
+
const handleClose = () => {
|
|
31
|
+
setAutoUpload(params.autoUpload);
|
|
32
|
+
setPossibleSameStore(params.possibleSameStore);
|
|
33
|
+
setLoading(false);
|
|
34
|
+
onClose(false);
|
|
35
|
+
};
|
|
36
|
+
const handleSubmit = async () => {
|
|
37
|
+
setLoading(true);
|
|
38
|
+
try {
|
|
39
|
+
await api.updateProject({
|
|
40
|
+
input: {
|
|
41
|
+
did,
|
|
42
|
+
projectId,
|
|
43
|
+
blockletTitle: params.blockletTitle,
|
|
44
|
+
blockletDescription: params.blockletDescription,
|
|
45
|
+
blockletIntroduction: params.blockletIntroduction,
|
|
46
|
+
autoUpload: !!autoUpload,
|
|
47
|
+
possibleSameStore: !!possibleSameStore
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
setParams({
|
|
51
|
+
autoUpload,
|
|
52
|
+
possibleSameStore
|
|
53
|
+
});
|
|
54
|
+
onClose(false);
|
|
55
|
+
} catch (err) {
|
|
56
|
+
Toast.error(err.message);
|
|
57
|
+
}
|
|
58
|
+
setLoading(false);
|
|
59
|
+
};
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
setAutoUpload(params.autoUpload);
|
|
62
|
+
setPossibleSameStore(params.possibleSameStore);
|
|
63
|
+
}, [params]);
|
|
64
|
+
const hasProject = !!(projectId && projectId !== UNOWNED_DID);
|
|
65
|
+
return /*#__PURE__*/_jsx(Dialog, {
|
|
66
|
+
title: t('blocklet.publish.projectSettings'),
|
|
67
|
+
disableEscapeKeyDown: true,
|
|
68
|
+
disablePortal: false,
|
|
69
|
+
fullWidth: true,
|
|
70
|
+
open: open,
|
|
71
|
+
onClose: handleClose,
|
|
72
|
+
actions: /*#__PURE__*/_jsxs(_Fragment, {
|
|
73
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
74
|
+
onClick: e => {
|
|
75
|
+
e.stopPropagation();
|
|
76
|
+
onClose();
|
|
77
|
+
},
|
|
78
|
+
color: "inherit",
|
|
79
|
+
children: t('common.cancel')
|
|
80
|
+
}), hasProject && /*#__PURE__*/_jsxs(Button, {
|
|
81
|
+
onClick: e => {
|
|
82
|
+
e.stopPropagation();
|
|
83
|
+
handleSubmit();
|
|
84
|
+
},
|
|
85
|
+
color: "primary",
|
|
86
|
+
"data-cy": "install-blocklet-next-step",
|
|
87
|
+
disabled: loading,
|
|
88
|
+
variant: "contained",
|
|
89
|
+
autoFocus: true,
|
|
90
|
+
children: [loading && /*#__PURE__*/_jsx(Spinner, {
|
|
91
|
+
size: 16
|
|
92
|
+
}), t('common.confirm')]
|
|
93
|
+
})]
|
|
94
|
+
}),
|
|
95
|
+
children: !hasProject ? /*#__PURE__*/_jsxs(Box, {
|
|
96
|
+
sx: {
|
|
97
|
+
display: 'flex',
|
|
98
|
+
flexDirection: 'column',
|
|
99
|
+
alignItems: 'center'
|
|
100
|
+
},
|
|
101
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
102
|
+
component: Icon,
|
|
103
|
+
icon: "ph:empty",
|
|
104
|
+
sx: {
|
|
105
|
+
fontSize: 40,
|
|
106
|
+
mb: 3,
|
|
107
|
+
opacity: 0.6
|
|
108
|
+
}
|
|
109
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
110
|
+
variant: "body1",
|
|
111
|
+
sx: {
|
|
112
|
+
flex: 1
|
|
113
|
+
},
|
|
114
|
+
children: t('blocklet.publish.needProjectId')
|
|
115
|
+
})]
|
|
116
|
+
}) : /*#__PURE__*/_jsxs(Box, {
|
|
117
|
+
component: "label",
|
|
118
|
+
sx: {
|
|
119
|
+
display: 'flex',
|
|
120
|
+
flexDirection: 'column',
|
|
121
|
+
gap: 2
|
|
122
|
+
},
|
|
123
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
124
|
+
sx: {
|
|
125
|
+
display: 'flex',
|
|
126
|
+
flexDirection: 'row',
|
|
127
|
+
alignItems: 'center'
|
|
128
|
+
},
|
|
129
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
130
|
+
component: Icon,
|
|
131
|
+
icon: "ph:upload",
|
|
132
|
+
sx: {
|
|
133
|
+
fontSize: 24,
|
|
134
|
+
mr: 2
|
|
135
|
+
}
|
|
136
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
137
|
+
variant: "body1",
|
|
138
|
+
sx: {
|
|
139
|
+
flex: 1
|
|
140
|
+
},
|
|
141
|
+
children: t('blocklet.publish.autoUploadTip')
|
|
142
|
+
}), /*#__PURE__*/_jsx(IOSSwitch, {
|
|
143
|
+
checked: autoUpload,
|
|
144
|
+
onChange: (_, x) => setAutoUpload(x)
|
|
145
|
+
})]
|
|
146
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
147
|
+
component: "label",
|
|
148
|
+
sx: {
|
|
149
|
+
display: 'flex',
|
|
150
|
+
flexDirection: 'row',
|
|
151
|
+
alignItems: 'center'
|
|
152
|
+
},
|
|
153
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
154
|
+
component: Icon,
|
|
155
|
+
icon: "fluent-mdl2:merge-duplicate",
|
|
156
|
+
sx: {
|
|
157
|
+
fontSize: 24,
|
|
158
|
+
mr: 2
|
|
159
|
+
}
|
|
160
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
161
|
+
variant: "body1",
|
|
162
|
+
sx: {
|
|
163
|
+
flex: 1
|
|
164
|
+
},
|
|
165
|
+
children: t('blocklet.publish.possibleSameStoreTip')
|
|
166
|
+
}), /*#__PURE__*/_jsx(IOSSwitch, {
|
|
167
|
+
checked: possibleSameStore,
|
|
168
|
+
onChange: (_, x) => setPossibleSameStore(x)
|
|
169
|
+
})]
|
|
170
|
+
})]
|
|
171
|
+
})
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
ProjectSetting.propTypes = {
|
|
175
|
+
did: PropTypes.string.isRequired,
|
|
176
|
+
params: PropTypes.object.isRequired,
|
|
177
|
+
open: PropTypes.bool.isRequired,
|
|
178
|
+
onClose: PropTypes.func.isRequired,
|
|
179
|
+
setParams: PropTypes.func.isRequired,
|
|
180
|
+
projectId: PropTypes.string.isRequired
|
|
181
|
+
};
|
|
182
|
+
export default ProjectSetting;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
+
import { hasStartEngine } from '@blocklet/meta/lib/engine';
|
|
1
3
|
import styled from '@emotion/styled';
|
|
4
|
+
import { Box } from '@mui/material';
|
|
2
5
|
import classnames from 'classnames';
|
|
6
|
+
import pAll from 'p-all';
|
|
3
7
|
import PropTypes from 'prop-types';
|
|
4
8
|
import React, { useEffect, useRef } from 'react';
|
|
5
9
|
import useSetState from 'react-use/lib/useSetState';
|
|
6
10
|
import { joinURL } from 'ufo';
|
|
7
|
-
import { Box } from '@mui/material';
|
|
8
|
-
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
9
|
-
import { hasStartEngine } from '@blocklet/meta/lib/engine';
|
|
10
|
-
import pAll from 'p-all';
|
|
11
|
-
import Toast from '@arcblock/ux/lib/Toast/index';
|
|
12
11
|
import { EmptyIcon } from '@arcblock/icons';
|
|
12
|
+
import Toast from '@arcblock/ux/lib/Toast/index';
|
|
13
|
+
import { getDisplayName } from '@blocklet/meta/lib/util';
|
|
13
14
|
import { useNodeContext } from '../../../contexts/node';
|
|
14
15
|
import { axios } from '../../../util/api';
|
|
16
|
+
import keepNowResources from './keep-now-resources';
|
|
15
17
|
import StopBox from './stop-box';
|
|
16
18
|
import Tree from './tree';
|
|
17
|
-
import keepNowResources from './keep-now-resources';
|
|
18
19
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
20
|
const fillParent = (nodes, parentId) => {
|
|
20
21
|
nodes.forEach(node => {
|
|
@@ -32,7 +33,7 @@ const parseUrl = (component, projectId, releaseId, locale, initUrl) => {
|
|
|
32
33
|
const {
|
|
33
34
|
exportApi = '/'
|
|
34
35
|
} = component?.meta.resource || {};
|
|
35
|
-
const urlObj = new URL(joinURL('http://127.0.0.1', component
|
|
36
|
+
const urlObj = new URL(joinURL('http://127.0.0.1', component?.mountPoint, exportApi || '/').replace(/\/+/g, '/'));
|
|
36
37
|
urlObj.searchParams.set('projectId', projectId);
|
|
37
38
|
urlObj.searchParams.set('releaseId', releaseId);
|
|
38
39
|
urlObj.searchParams.set('local', locale);
|
|
@@ -159,7 +160,7 @@ export default function ResourceSelect({
|
|
|
159
160
|
return;
|
|
160
161
|
}
|
|
161
162
|
// If the component does not have a mount point or does not start the engine, the resource is not requested
|
|
162
|
-
if (!child?.mountPoint || !hasStartEngine(child?.meta)) {
|
|
163
|
+
if (!child?.mountPoint || !hasStartEngine(child?.meta) || !child?.meta?.resource?.exportApi) {
|
|
163
164
|
return;
|
|
164
165
|
}
|
|
165
166
|
try {
|
|
@@ -203,12 +204,15 @@ export default function ResourceSelect({
|
|
|
203
204
|
}, [releaseId, projectId, readOnly, locale, initUrl, setResources]);
|
|
204
205
|
useEffect(() => {
|
|
205
206
|
if (initialResources && Object.keys(initialResources).length) {
|
|
206
|
-
app.children.
|
|
207
|
+
pAll(app.children.map(async child => {
|
|
207
208
|
const list = initialResources[child.meta.did];
|
|
208
209
|
if (list?.length) {
|
|
210
|
+
const resTree = await axios.get(parseUrl(child, projectId, releaseId, locale, initUrl));
|
|
211
|
+
const tree = fillParent(resTree?.data?.resources || []);
|
|
209
212
|
setSelectedResourceIds({
|
|
210
213
|
[child.meta.did]: list
|
|
211
214
|
});
|
|
215
|
+
setSelectedComponentsMapByIds(child.meta.did, tree, list);
|
|
212
216
|
if (!readOnly) {
|
|
213
217
|
saveSelectedEventsRef.current[child?.meta.did] = {
|
|
214
218
|
resources: list,
|
|
@@ -216,7 +220,7 @@ export default function ResourceSelect({
|
|
|
216
220
|
};
|
|
217
221
|
}
|
|
218
222
|
}
|
|
219
|
-
});
|
|
223
|
+
}));
|
|
220
224
|
}
|
|
221
225
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
222
226
|
}, [app, initialResources, readOnly]);
|
|
@@ -225,14 +229,14 @@ export default function ResourceSelect({
|
|
|
225
229
|
Empty = /*#__PURE__*/_jsx(StopBox, {
|
|
226
230
|
Icon: EmptyIcon,
|
|
227
231
|
children: t('blocklet.publish.resourceEmptyTip', {
|
|
228
|
-
name: component
|
|
232
|
+
name: getDisplayName(component)
|
|
229
233
|
})
|
|
230
234
|
});
|
|
231
235
|
}
|
|
232
236
|
if (component?.status !== 'running') {
|
|
233
237
|
Empty = /*#__PURE__*/_jsx(StopBox, {
|
|
234
238
|
children: t('blocklet.publish.componentNotRunning', {
|
|
235
|
-
name: component
|
|
239
|
+
name: getDisplayName(component)
|
|
236
240
|
})
|
|
237
241
|
});
|
|
238
242
|
}
|
|
@@ -17,7 +17,7 @@ function useWantToConnectStore(blocklet) {
|
|
|
17
17
|
if (lastStore) {
|
|
18
18
|
return lastStore;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
let firstStore = (blocklet?.settings?.storeList || []).find(x => {
|
|
21
21
|
if (x.id !== BLOCKLET_STORE.id) {
|
|
22
22
|
return false;
|
|
23
23
|
}
|
|
@@ -26,8 +26,12 @@ function useWantToConnectStore(blocklet) {
|
|
|
26
26
|
}
|
|
27
27
|
return true;
|
|
28
28
|
});
|
|
29
|
+
if (!firstStore) {
|
|
30
|
+
firstStore = blocklet?.settings?.storeList?.[0];
|
|
31
|
+
}
|
|
32
|
+
return firstStore;
|
|
29
33
|
}, [blocklet?.settings?.storeList, session?.user?.did]);
|
|
30
|
-
const wantToConnectStore = _wantToConnectStore || baseStore;
|
|
34
|
+
const wantToConnectStore = _wantToConnectStore || baseStore || {};
|
|
31
35
|
return [wantToConnectStore, setWantToConnectStore];
|
|
32
36
|
}
|
|
33
37
|
export default useWantToConnectStore;
|
|
@@ -6,6 +6,9 @@ const getStudioStoreList = ({
|
|
|
6
6
|
}) => {
|
|
7
7
|
const teamDid = fromBlocklet ? blocklet?.meta?.did : nodeInfo?.did;
|
|
8
8
|
let storeList = fromBlocklet ? blocklet?.settings?.storeList || [] : nodeInfo?.blockletRegistryList || [];
|
|
9
|
+
if (!Array.isArray(storeList)) {
|
|
10
|
+
storeList = [];
|
|
11
|
+
}
|
|
9
12
|
storeList = storeList.filter(x => x.protected || !x.scope || x.scope === 'studio' || x.scope === userDid);
|
|
10
13
|
return {
|
|
11
14
|
teamDid,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const parseResourceRelateComponents = (nowBlockletComponents, blocklet, resourceRelateComponents, disabledSelectComponents) => {
|
|
2
|
+
const blockletComponents = nowBlockletComponents ? [...nowBlockletComponents] : [];
|
|
3
|
+
const componentMaps = (blocklet?.children || []).reduce((acc, curr) => {
|
|
4
|
+
acc[curr.meta.did] = true;
|
|
5
|
+
return acc;
|
|
6
|
+
}, {});
|
|
7
|
+
Object.keys(resourceRelateComponents).forEach(blockletDid => {
|
|
8
|
+
if (!componentMaps[blockletDid]) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
let included = false;
|
|
12
|
+
if (!disabledSelectComponents) {
|
|
13
|
+
blockletComponents.forEach(item => {
|
|
14
|
+
if (item.did === blockletDid) {
|
|
15
|
+
item.included = true;
|
|
16
|
+
item.required = true;
|
|
17
|
+
included = true;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (!included) {
|
|
22
|
+
blockletComponents.push({
|
|
23
|
+
did: blockletDid,
|
|
24
|
+
included: true,
|
|
25
|
+
required: true
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return blockletComponents;
|
|
30
|
+
};
|
|
31
|
+
export default parseResourceRelateComponents;
|
|
@@ -5,7 +5,7 @@ import Toast from '@arcblock/ux/lib/Toast';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Tooltip from '@mui/material/Tooltip';
|
|
7
7
|
import SwitchControl from '../component/switch-control';
|
|
8
|
-
import {
|
|
8
|
+
import { useBlockletAutoCheckUpdateContext } from '../../contexts/blocklet-auto-check-update';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @description
|
|
@@ -25,7 +25,7 @@ function AutoCheckUpdate({
|
|
|
25
25
|
const {
|
|
26
26
|
updateAutoCheckUpdate,
|
|
27
27
|
autoCheckUpdate
|
|
28
|
-
} =
|
|
28
|
+
} = useBlockletAutoCheckUpdateContext();
|
|
29
29
|
const configAutoBackup = async () => {
|
|
30
30
|
try {
|
|
31
31
|
const enabled = !autoCheckUpdate?.enabled;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createContext, useContext, useState } from 'react';
|
|
2
|
+
import propTypes from 'prop-types';
|
|
3
|
+
import { useBlockletContext } from './blocklet';
|
|
4
|
+
import { useNodeContext } from './node';
|
|
5
|
+
import { useAutoCheckUpdate } from '../hooks/use-auto-check-update';
|
|
6
|
+
|
|
7
|
+
/** @type {import('react').Context<BlockletAutoCheckUpdateContext>} */
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
const BlockletAutoCheckUpdateContext = /*#__PURE__*/createContext({});
|
|
10
|
+
const {
|
|
11
|
+
Provider,
|
|
12
|
+
Consumer
|
|
13
|
+
} = BlockletAutoCheckUpdateContext;
|
|
14
|
+
function BlockletAutoCheckUpdateProvider({
|
|
15
|
+
children
|
|
16
|
+
}) {
|
|
17
|
+
const {
|
|
18
|
+
api
|
|
19
|
+
} = useNodeContext();
|
|
20
|
+
const {
|
|
21
|
+
blocklet
|
|
22
|
+
} = useBlockletContext();
|
|
23
|
+
const [autoCheckUpdateRefresh, setAutoCheckUpdateRefresh] = useState(false);
|
|
24
|
+
const autoCheckUpdate = useAutoCheckUpdate({
|
|
25
|
+
deps: [autoCheckUpdateRefresh]
|
|
26
|
+
});
|
|
27
|
+
const refreshAutoCheckUpdate = () => {
|
|
28
|
+
setAutoCheckUpdateRefresh(x => !x);
|
|
29
|
+
};
|
|
30
|
+
const updateAutoCheckUpdate = async value => {
|
|
31
|
+
await api.updateAutoCheckUpdate({
|
|
32
|
+
input: {
|
|
33
|
+
did: blocklet.meta.did,
|
|
34
|
+
autoCheckUpdate: value
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
refreshAutoCheckUpdate();
|
|
38
|
+
};
|
|
39
|
+
return /*#__PURE__*/_jsx(Provider, {
|
|
40
|
+
value: {
|
|
41
|
+
updateAutoCheckUpdate,
|
|
42
|
+
autoCheckUpdate
|
|
43
|
+
},
|
|
44
|
+
children: children
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
BlockletAutoCheckUpdateProvider.propTypes = {
|
|
48
|
+
children: propTypes.any.isRequired
|
|
49
|
+
};
|
|
50
|
+
BlockletAutoCheckUpdateProvider.defaultProps = {};
|
|
51
|
+
function useBlockletAutoCheckUpdateContext() {
|
|
52
|
+
return useContext(BlockletAutoCheckUpdateContext);
|
|
53
|
+
}
|
|
54
|
+
export { BlockletAutoCheckUpdateContext, BlockletAutoCheckUpdateProvider, Consumer as BlockletAutoCheckUpdateConsumer, useBlockletAutoCheckUpdateContext };
|
|
@@ -10,7 +10,6 @@ import { useNodeContext } from './node';
|
|
|
10
10
|
import useBackupProgress from '../hooks/use-backup-progress';
|
|
11
11
|
import useBackups from '../hooks/use-backups';
|
|
12
12
|
import { useAutoBackup } from '../hooks/use-auto-backup';
|
|
13
|
-
import { useAutoCheckUpdate } from '../hooks/use-auto-check-update';
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* @typedef {import('../blocklet/storage/connected').SpaceGateway} SpaceGateway
|
|
@@ -87,10 +86,6 @@ function BlockletStorageProvider({
|
|
|
87
86
|
const autoBackup = useAutoBackup({
|
|
88
87
|
deps: [autoBackupRefresh]
|
|
89
88
|
});
|
|
90
|
-
const [autoCheckUpdateRefresh, setAutoCheckUpdateRefresh] = useState(false);
|
|
91
|
-
const autoCheckUpdate = useAutoCheckUpdate({
|
|
92
|
-
deps: [autoCheckUpdateRefresh]
|
|
93
|
-
});
|
|
94
89
|
const refreshSpaceGateways = () => {
|
|
95
90
|
setSpaceGatewaysRefresh(p => !p);
|
|
96
91
|
};
|
|
@@ -100,9 +95,6 @@ function BlockletStorageProvider({
|
|
|
100
95
|
const refreshAutoBackup = () => {
|
|
101
96
|
setAutoBackupRefresh(x => !x);
|
|
102
97
|
};
|
|
103
|
-
const refreshAutoCheckUpdate = () => {
|
|
104
|
-
setAutoCheckUpdateRefresh(x => !x);
|
|
105
|
-
};
|
|
106
98
|
|
|
107
99
|
/**
|
|
108
100
|
* @description
|
|
@@ -220,15 +212,6 @@ function BlockletStorageProvider({
|
|
|
220
212
|
* @param {SpaceGateway} spaceGateway
|
|
221
213
|
*/
|
|
222
214
|
const spaceGatewayIsSelected = spaceGateway => spaceGateway?.endpoint === backupEndpoint;
|
|
223
|
-
const updateAutoCheckUpdate = async value => {
|
|
224
|
-
await api.updateAutoCheckUpdate({
|
|
225
|
-
input: {
|
|
226
|
-
did: blocklet.meta.did,
|
|
227
|
-
autoCheckUpdate: value
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
refreshAutoCheckUpdate();
|
|
231
|
-
};
|
|
232
215
|
return /*#__PURE__*/_jsx(Provider, {
|
|
233
216
|
value: {
|
|
234
217
|
spaceGateways,
|
|
@@ -240,8 +223,6 @@ function BlockletStorageProvider({
|
|
|
240
223
|
spaceGatewaysLoading,
|
|
241
224
|
spaceGatewayIsSelected,
|
|
242
225
|
updateAutoBackup,
|
|
243
|
-
updateAutoCheckUpdate,
|
|
244
|
-
autoCheckUpdate,
|
|
245
226
|
backupEndpoint,
|
|
246
227
|
backupProgress,
|
|
247
228
|
backups,
|
package/lib/locales/ar.js
CHANGED
|
@@ -738,7 +738,12 @@ export default {
|
|
|
738
738
|
deleteStoreTip: 'هل أنت متأكد أنك تريد إزالة {name} من قائمة متجر الاتصال؟',
|
|
739
739
|
disconnectStoreTip: 'سيتم حذف بلوكليت من المخزن بعد الفصل. هل أنت متأكد من أنك تريد الفصل؟',
|
|
740
740
|
connectOrUpload: 'الاتصال أو التحميل',
|
|
741
|
-
developerInfo: 'معلومات المطور'
|
|
741
|
+
developerInfo: 'معلومات المطور',
|
|
742
|
+
autoUploadTip: 'تحميل البلوكليت تلقائيًا إلى المتجر بعد الإصدار',
|
|
743
|
+
possibleSameStoreTip: 'حاول حل بلوكليتات الاعتماد في نفس متجر البلوكليت قبل كل تحميل إذا كان ذلك ممكنًا',
|
|
744
|
+
needProjectId: 'يرجى إنشاء مشروع أولاً',
|
|
745
|
+
projectSettings: 'إعدادات المشروع',
|
|
746
|
+
noStoreSelected: 'يرجى تحديد أحد المتاجر الحالية أو إضافة متجر جديد للمتابعة'
|
|
742
747
|
},
|
|
743
748
|
titleValidationError: 'يجب أن يكون طول العنوان على الأقل 3 أحرف',
|
|
744
749
|
descriptionValidationError: 'يجب أن تكون طول الوصف بين 3 و 160 حرفًا',
|
package/lib/locales/de.js
CHANGED
|
@@ -738,7 +738,12 @@ export default {
|
|
|
738
738
|
deleteStoreTip: 'Möchten Sie {name} wirklich aus der Verbindungsliste des Stores entfernen?',
|
|
739
739
|
disconnectStoreTip: 'Das Blocklet wird nach dem Trennen aus dem Store entfernt. Möchten Sie wirklich trennen?',
|
|
740
740
|
connectOrUpload: 'Verbinden oder Hochladen',
|
|
741
|
-
developerInfo: 'Entwicklerinformation'
|
|
741
|
+
developerInfo: 'Entwicklerinformation',
|
|
742
|
+
autoUploadTip: 'Blocklet nach Erstellung automatisch im Store hochladen',
|
|
743
|
+
possibleSameStoreTip: 'Versuchen Sie, Abhängigkeits-Blocklets vor dem Hochladen, wenn möglich, im selben Blocklet-Store aufzulösen',
|
|
744
|
+
needProjectId: 'Bitte erstellen Sie zuerst ein Projekt',
|
|
745
|
+
projectSettings: 'Projekteinstellungen',
|
|
746
|
+
noStoreSelected: 'Bitte wählen Sie eine der vorhandenen Geschäfte aus oder fügen Sie ein neues Geschäft hinzu, um fortzufahren'
|
|
742
747
|
},
|
|
743
748
|
titleValidationError: 'Die Länge des Titels muss mindestens 3 Zeichen betragen',
|
|
744
749
|
descriptionValidationError: 'Die Beschreibungslänge muss zwischen 3 und 160 Zeichen liegen',
|
package/lib/locales/en.js
CHANGED
|
@@ -660,6 +660,11 @@ export default {
|
|
|
660
660
|
},
|
|
661
661
|
publish: {
|
|
662
662
|
connectOrUpload: 'Connect or Upload',
|
|
663
|
+
projectSettings: 'Project Settings',
|
|
664
|
+
noStoreSelected: 'Please select one of the existing stores or add a new store to continue',
|
|
665
|
+
autoUploadTip: 'Upload release to connected Blocklet Stores automatically after creation',
|
|
666
|
+
possibleSameStoreTip: 'Try resolving dependency blocklets to the same Blocklet Store before each uploading when possible',
|
|
667
|
+
needProjectId: 'Please create a project first',
|
|
663
668
|
developerInfo: 'Developer Information',
|
|
664
669
|
branding: 'Branding',
|
|
665
670
|
brandingHelp: 'More information about the blocklet will be displayed in the Store',
|
package/lib/locales/es.js
CHANGED
|
@@ -738,7 +738,12 @@ export default {
|
|
|
738
738
|
deleteStoreTip: '¿Estás seguro de que quieres eliminar a {name} de la lista de la tienda Connect?',
|
|
739
739
|
disconnectStoreTip: 'Después de la desconexión, se eliminará el blocklet de la tienda. ¿Seguro que desea desconectar?',
|
|
740
740
|
connectOrUpload: 'Conectar o Subir',
|
|
741
|
-
developerInfo: 'Información del desarrollador'
|
|
741
|
+
developerInfo: 'Información del desarrollador',
|
|
742
|
+
autoUploadTip: 'Cargar automáticamente el blocklet en la tienda después de la versión de creación',
|
|
743
|
+
possibleSameStoreTip: 'Intenta resolver las dependencias de los blocklets en la misma tienda de blocklets antes de cada carga cuando sea posible',
|
|
744
|
+
needProjectId: 'Por favor, crea un proyecto primero',
|
|
745
|
+
projectSettings: 'Configuraciones del Proyecto',
|
|
746
|
+
noStoreSelected: 'Por favor, seleccione una de las tiendas existentes o agregue una nueva tienda para continuar'
|
|
742
747
|
},
|
|
743
748
|
titleValidationError: 'La longitud del título debe ser de al menos 3 caracteres',
|
|
744
749
|
descriptionValidationError: 'La longitud de la descripción debe estar entre 3 y 160 caracteres',
|
package/lib/locales/fr.js
CHANGED
|
@@ -738,7 +738,12 @@ export default {
|
|
|
738
738
|
deleteStoreTip: 'Êtes-vous sûr de vouloir supprimer {name} de la liste du magasin Connect?',
|
|
739
739
|
disconnectStoreTip: 'Le bloclet sera supprimé du store après sa déconnexion. Êtes-vous sûr de vouloir le déconnecter ?',
|
|
740
740
|
connectOrUpload: 'Connecter ou Télécharger',
|
|
741
|
-
developerInfo: 'Informations sur le développeur'
|
|
741
|
+
developerInfo: 'Informations sur le développeur',
|
|
742
|
+
autoUploadTip: 'Uploader automatiquement le blocklet dans le Store après sa création',
|
|
743
|
+
possibleSameStoreTip: 'Essayez de résoudre les blocs de dépendance dans le même magasin de blocs avant chaque téléchargement si possible',
|
|
744
|
+
needProjectId: "Veuillez créer un projet d'abord",
|
|
745
|
+
projectSettings: 'Paramètres du projet',
|
|
746
|
+
noStoreSelected: "Veuillez sélectionner l'un des magasins existants ou ajouter un nouveau magasin pour continuer"
|
|
742
747
|
},
|
|
743
748
|
titleValidationError: "La longueur du titre doit être d'au moins 3 caractères",
|
|
744
749
|
descriptionValidationError: 'La longueur de la description doit être comprise entre 3 et 160 caractères',
|
package/lib/locales/hi.js
CHANGED
|
@@ -738,7 +738,12 @@ export default {
|
|
|
738
738
|
deleteStoreTip: 'क्या आप वाकई {name} को कनेक्ट स्टोर से हटाना चाहते हैं?',
|
|
739
739
|
disconnectStoreTip: 'ब्लॉकलेट को डिस्कनेक्ट करने के बाद उसे स्टोर से हटा दिया जाएगा। क्या आप वाकई में उसे डिस्कनेक्ट करना चाहते हैं?',
|
|
740
740
|
connectOrUpload: 'कनेक्ट करें या अपलोड करें',
|
|
741
|
-
developerInfo: 'डेवलपर सूचना'
|
|
741
|
+
developerInfo: 'डेवलपर सूचना',
|
|
742
|
+
autoUploadTip: 'निर्माण रिलीज़ के बाद ब्लॉकलेट को स्टोर पर स्वचालित रूप से अपलोड करें',
|
|
743
|
+
possibleSameStoreTip: 'पोस्ट करने से पहले संभावना होने पर उसी ब्लॉकलेट स्टोर में डिपेंडेंसी ब्लॉकलेट्स को हल करने की कोशिश करें',
|
|
744
|
+
needProjectId: 'कृपया पहले एक परियोजना बनाएं',
|
|
745
|
+
projectSettings: 'परियोजना सेटिंग्स',
|
|
746
|
+
noStoreSelected: 'कृपया जारी स्टोरों में से एक चुनें या जारी रखने के लिए एक नया स्टोर जोड़ें'
|
|
742
747
|
},
|
|
743
748
|
titleValidationError: 'शीर्षक की लंबाई कम से कम 3 अक्षर होनी चाहिए',
|
|
744
749
|
descriptionValidationError: 'विवरण की लंबाई 3 और 160 वर्णों के बीच होनी चाहिए',
|
package/lib/locales/i18n.db
CHANGED
|
Binary file
|
package/lib/locales/id.js
CHANGED
|
@@ -738,7 +738,12 @@ export default {
|
|
|
738
738
|
deleteStoreTip: 'Apakah Anda yakin ingin menghapus {name} dari daftar Toko Koneksi?',
|
|
739
739
|
disconnectStoreTip: 'Setelah terputus, blocklet akan dihapus dari toko. Apa Anda yakin untuk memutuskan?',
|
|
740
740
|
connectOrUpload: 'Hubungkan atau Unggah',
|
|
741
|
-
developerInfo: 'Informasi Pengembang'
|
|
741
|
+
developerInfo: 'Informasi Pengembang',
|
|
742
|
+
autoUploadTip: 'Mengunggah blocklet ke Store secara otomatis setelah rilis penciptaan',
|
|
743
|
+
possibleSameStoreTip: 'Coba selesaikan blocklet dependensi ke Toko Blocklet yang sama sebelum mengunggah setiap kali memungkinkan',
|
|
744
|
+
needProjectId: 'Silakan membuat proyek terlebih dahulu',
|
|
745
|
+
projectSettings: 'Pengaturan Proyek',
|
|
746
|
+
noStoreSelected: 'Silakan pilih salah satu toko yang ada atau tambahkan toko baru untuk melanjutkan'
|
|
742
747
|
},
|
|
743
748
|
titleValidationError: 'Panjang judul harus setidaknya 3 karakter',
|
|
744
749
|
descriptionValidationError: 'Panjang deskripsi harus antara 3 dan 160 karakter.',
|
package/lib/locales/ja.js
CHANGED
|
@@ -738,7 +738,12 @@ export default {
|
|
|
738
738
|
deleteStoreTip: '{name}を接続ストアリストから削除してもよろしいですか?',
|
|
739
739
|
disconnectStoreTip: 'ブロックレットの接続を解除すると、ブロックレットはストアから削除されます。接続を解除してもよろしいですか?',
|
|
740
740
|
connectOrUpload: '接続またはアップロード',
|
|
741
|
-
developerInfo: '開発者情報'
|
|
741
|
+
developerInfo: '開発者情報',
|
|
742
|
+
autoUploadTip: 'リリース後、Blockletを自動的にストアにアップロードします',
|
|
743
|
+
possibleSameStoreTip: '可能な限り、アップロード前に依存ブロックレットを同じ Blocklet ストアに解決してみてください',
|
|
744
|
+
needProjectId: '最初にプロジェクトを作成してください',
|
|
745
|
+
projectSettings: 'プロジェクトの設定',
|
|
746
|
+
noStoreSelected: '続行するために、既存の店舗の1つを選択するか、新しい店舗を追加してください'
|
|
742
747
|
},
|
|
743
748
|
titleValidationError: 'タイトルの長さは最低3文字以上である必要があります',
|
|
744
749
|
descriptionValidationError: '説明の長さは3から160文字の間でなければなりません',
|