@abtnode/ux 1.16.29-beta-e04c6f40 → 1.16.29-beta-db5c4ed6
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 +4 -15
- package/lib/blocklet/logo-uploader.js +1 -1
- package/lib/blocklet/publish/create-release/branding.js +53 -56
- package/lib/blocklet/publish/create-release/connect-store-button.js +59 -19
- package/lib/blocklet/publish/create-release/connect-store-list.js +23 -4
- package/lib/blocklet/publish/create-release/header.js +12 -2
- package/lib/blocklet/publish/create-release/index.js +8 -5
- package/lib/blocklet/publish/create-release/release-stepper.js +2 -2
- package/lib/blocklet/publish/create-release/resource-upload.js +16 -4
- package/lib/blocklet/publish/create-release/tree.js +4 -1
- package/lib/blocklet/publish/hooks/use-want-to-connect-store.js +14 -2
- package/lib/blocklet/publish/utils/can-delete-store.js +18 -0
- package/lib/blocklet/publish/utils/get-studio-store-list.js +15 -0
- package/lib/blocklet/publish/utils/validate-params.js +1 -1
- package/lib/delete-confirm.js +9 -2
- package/lib/locales/ar.js +1 -14
- package/lib/locales/de.js +1 -14
- package/lib/locales/en.js +1 -2
- package/lib/locales/es.js +1 -14
- package/lib/locales/fr.js +1 -14
- package/lib/locales/hi.js +1 -14
- package/lib/locales/id.js +1 -14
- package/lib/locales/ja.js +1 -14
- package/lib/locales/ko.js +1 -14
- package/lib/locales/pt.js +1 -14
- package/lib/locales/ru.js +1 -14
- package/lib/locales/th.js +1 -14
- package/lib/locales/vi.js +1 -14
- package/lib/locales/zh-tw.js +1 -14
- package/lib/locales/zh.js +3 -22
- package/lib/store/add.js +0 -4
- package/lib/store/connect-actions.js +10 -1
- package/lib/store/delete.js +10 -3
- package/lib/store/item.js +19 -10
- package/lib/team/members/index.js +19 -19
- package/lib/util/index.js +4 -9
- package/package.json +20 -20
|
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { useParams } from 'react-router-dom';
|
|
5
5
|
import { isInServerlessMode } from '@abtnode/util/lib/serverless';
|
|
6
|
-
import Alert from '@mui/material/Alert';
|
|
7
6
|
import AnimationWaiter from '@arcblock/ux/lib/AnimationWaiter';
|
|
8
7
|
import Button from '@arcblock/ux/lib/Button';
|
|
9
8
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
@@ -14,6 +13,7 @@ import PageHeader from '@blocklet/launcher-layout/lib/page-header';
|
|
|
14
13
|
import styled from '@emotion/styled';
|
|
15
14
|
import CheckIcon from '@mui/icons-material/Check';
|
|
16
15
|
import AddIcon from '@mui/icons-material/Link';
|
|
16
|
+
import Alert from '@mui/material/Alert';
|
|
17
17
|
import Box from '@mui/material/Box';
|
|
18
18
|
import Spinner from '@mui/material/CircularProgress';
|
|
19
19
|
import TextField from '@mui/material/TextField';
|
|
@@ -23,9 +23,9 @@ import flatten from 'lodash/flatten';
|
|
|
23
23
|
import isEmpty from 'lodash/isEmpty';
|
|
24
24
|
import isNil from 'lodash/isNil';
|
|
25
25
|
import uniqBy from 'lodash/uniqBy';
|
|
26
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
26
27
|
import urlPathFriendly from '@blocklet/meta/lib/url-path-friendly';
|
|
27
28
|
import { getDisplayName, getSharedConfigObj, hasStartEngine, isFreeBlocklet } from '@blocklet/meta/lib/util';
|
|
28
|
-
import Toast from '@arcblock/ux/lib/Toast';
|
|
29
29
|
import { useBlockletContext } from '../../../contexts/blocklet';
|
|
30
30
|
import { ConfigSpaceProvider } from '../../../contexts/config-space';
|
|
31
31
|
import { useNodeContext } from '../../../contexts/node';
|
|
@@ -783,19 +783,8 @@ export default function AddComponentCore({
|
|
|
783
783
|
onClickNext: onNext,
|
|
784
784
|
installRelated: installRelated,
|
|
785
785
|
onChangeInstallRelated: setInstallRelated,
|
|
786
|
-
handleDescEle: /*#__PURE__*/
|
|
787
|
-
children:
|
|
788
|
-
children: /*#__PURE__*/_jsx("div", {
|
|
789
|
-
// eslint-disable-next-line
|
|
790
|
-
dangerouslySetInnerHTML: {
|
|
791
|
-
__html: t(`blocklet.component.addComponentTip.${params.requirePurchase ? 'isPurchase' : 'isFree'}`, {
|
|
792
|
-
name: getComponentName()
|
|
793
|
-
})
|
|
794
|
-
}
|
|
795
|
-
})
|
|
796
|
-
}), /*#__PURE__*/_jsx("p", {
|
|
797
|
-
children: t('blocklet.component.addComponentTip.belowInformation')
|
|
798
|
-
})]
|
|
786
|
+
handleDescEle: /*#__PURE__*/_jsx("p", {
|
|
787
|
+
children: t('blocklet.component.addComponentTip.belowInformation')
|
|
799
788
|
})
|
|
800
789
|
})]
|
|
801
790
|
}),
|
|
@@ -57,7 +57,7 @@ export default function LogoUploader({
|
|
|
57
57
|
},
|
|
58
58
|
coreProps: {
|
|
59
59
|
restrictions: {
|
|
60
|
-
|
|
60
|
+
allowedFileExts: ['.webp', '.jpg', '.jpeg', '.png', '.gif', '.svg'],
|
|
61
61
|
maxFileSize: 1024 * 1024 * 10,
|
|
62
62
|
maxNumberOfFiles: 1
|
|
63
63
|
}
|
|
@@ -15,7 +15,7 @@ import { useNodeContext } from '../../../contexts/node';
|
|
|
15
15
|
import useWantToConnectStore from '../hooks/use-want-to-connect-store';
|
|
16
16
|
import EmptySpinner from '../../../empty-spinner';
|
|
17
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
-
const
|
|
18
|
+
const allowedFileExts = ['.webp', '.jpg', '.jpeg', '.png', '.gif', '.svg'];
|
|
19
19
|
const maxFileSize = 1024 * 1024 * 10; // 10 MB
|
|
20
20
|
|
|
21
21
|
// eslint-disable-next-line import/no-unresolved
|
|
@@ -211,11 +211,11 @@ function Branding({
|
|
|
211
211
|
}
|
|
212
212
|
})]
|
|
213
213
|
})
|
|
214
|
-
}), /*#__PURE__*/
|
|
214
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
215
215
|
display: "flex",
|
|
216
216
|
mt: 3,
|
|
217
217
|
className: "section full-width",
|
|
218
|
-
children:
|
|
218
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
219
219
|
sx: {
|
|
220
220
|
flex: 1
|
|
221
221
|
},
|
|
@@ -303,61 +303,58 @@ function Branding({
|
|
|
303
303
|
})]
|
|
304
304
|
})]
|
|
305
305
|
})]
|
|
306
|
-
})
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
306
|
+
})
|
|
307
|
+
}), /*#__PURE__*/_jsxs(Suspense, {
|
|
308
|
+
fallback: /*#__PURE__*/_jsx(EmptySpinner, {}),
|
|
309
|
+
children: [/*#__PURE__*/_jsx(UploaderComponent, {
|
|
310
|
+
ref: uploaderLogoRef,
|
|
311
|
+
popup: true,
|
|
312
|
+
onUploadFinish: result => {
|
|
313
|
+
setParams({
|
|
314
|
+
blockletLogo: result.data.filename
|
|
315
|
+
});
|
|
316
|
+
setInitLogoUrl('');
|
|
317
|
+
uploaderLogoRef.current.close();
|
|
318
|
+
},
|
|
319
|
+
plugins: ['ImageEditor'],
|
|
320
|
+
installerProps: {
|
|
321
|
+
disabled: true
|
|
322
|
+
},
|
|
323
|
+
apiPathProps: {
|
|
324
|
+
uploader: uploadLogoPrefix,
|
|
325
|
+
disableMediaKitPrefix: true
|
|
326
|
+
},
|
|
327
|
+
coreProps: {
|
|
328
|
+
restrictions: {
|
|
329
|
+
allowedFileExts,
|
|
330
|
+
maxFileSize,
|
|
331
|
+
maxNumberOfFiles: 1
|
|
332
332
|
}
|
|
333
|
-
}
|
|
334
|
-
}), /*#__PURE__*/_jsx(
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
blockletScreenshots
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
maxFileSize,
|
|
356
|
-
maxNumberOfFiles: 5 - screenshotUrls.length
|
|
357
|
-
}
|
|
333
|
+
}
|
|
334
|
+
}, "uploader-logo"), /*#__PURE__*/_jsx(UploaderComponent, {
|
|
335
|
+
ref: uploaderScreenshotRef,
|
|
336
|
+
popup: true,
|
|
337
|
+
onUploadFinish: result => {
|
|
338
|
+
const blockletScreenshots = params.blockletScreenshots || [];
|
|
339
|
+
blockletScreenshots.push(result.data?.filename);
|
|
340
|
+
setParams({
|
|
341
|
+
blockletScreenshots
|
|
342
|
+
});
|
|
343
|
+
uploaderScreenshotRef.current.close();
|
|
344
|
+
},
|
|
345
|
+
plugins: ['ImageEditor'],
|
|
346
|
+
apiPathProps: {
|
|
347
|
+
uploader: uploadScreenshotPrefix,
|
|
348
|
+
disableMediaKitPrefix: true
|
|
349
|
+
},
|
|
350
|
+
coreProps: {
|
|
351
|
+
restrictions: {
|
|
352
|
+
allowedFileExts,
|
|
353
|
+
maxFileSize,
|
|
354
|
+
maxNumberOfFiles: 5 - screenshotUrls.length
|
|
358
355
|
}
|
|
359
|
-
}
|
|
360
|
-
})]
|
|
356
|
+
}
|
|
357
|
+
}, "uploader-screenshot")]
|
|
361
358
|
})]
|
|
362
359
|
});
|
|
363
360
|
}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
-
import { BLOCKLET_TENANT_MODES } from '@blocklet/constant';
|
|
3
2
|
import AddIcon from '@mui/icons-material/Add';
|
|
4
3
|
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
|
5
|
-
import { Button, ButtonGroup, CircularProgress, ClickAwayListener, Divider, Grow, IconButton, MenuItem, MenuList, Paper, Popper, Typography } from '@mui/material';
|
|
4
|
+
import { Box, Button, ButtonGroup, CircularProgress, ClickAwayListener, Divider, Grow, IconButton, MenuItem, MenuList, Paper, Popper, Typography } from '@mui/material';
|
|
6
5
|
import PropTypes from 'prop-types';
|
|
7
6
|
import { Icon } from '@iconify/react';
|
|
8
7
|
import { useRef, useState } from 'react';
|
|
9
8
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
10
9
|
import formatError from '@abtnode/util/lib/format-error';
|
|
10
|
+
import { useSessionContext } from '../../../contexts/session';
|
|
11
11
|
import AddStore from '../../../store/add';
|
|
12
12
|
import { useNodeContext } from '../../../contexts/node';
|
|
13
13
|
import ConfirmDialog from '../../../confirm';
|
|
14
|
+
import { useBlockletContext } from '../../../contexts/blocklet';
|
|
15
|
+
import ShortenLabel from '../../component/shorten-label';
|
|
16
|
+
import canDeleteStore from '../utils/can-delete-store';
|
|
17
|
+
import getStudioStoreList from '../utils/get-studio-store-list';
|
|
14
18
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
19
|
export default function ConnectStoreButton({
|
|
16
20
|
blocklet,
|
|
@@ -24,12 +28,18 @@ export default function ConnectStoreButton({
|
|
|
24
28
|
const {
|
|
25
29
|
t
|
|
26
30
|
} = useLocaleContext();
|
|
31
|
+
const {
|
|
32
|
+
session
|
|
33
|
+
} = useSessionContext();
|
|
34
|
+
const {
|
|
35
|
+
api,
|
|
36
|
+
info: nodeInfo,
|
|
37
|
+
inService
|
|
38
|
+
} = useNodeContext();
|
|
39
|
+
const blockletContext = useBlockletContext();
|
|
27
40
|
const [open, setOpen] = useState(false);
|
|
28
41
|
const anchorRef = useRef(null);
|
|
29
42
|
const [openAddStore, setOpenAddStore] = useState(false);
|
|
30
|
-
const {
|
|
31
|
-
api
|
|
32
|
-
} = useNodeContext();
|
|
33
43
|
const [deleteStore, setDeleteStore] = useState(null);
|
|
34
44
|
const handleSelectStore = nextStore => {
|
|
35
45
|
onChangeStore(nextStore);
|
|
@@ -59,17 +69,27 @@ export default function ConnectStoreButton({
|
|
|
59
69
|
input: {
|
|
60
70
|
teamDid: blocklet.meta.did,
|
|
61
71
|
url: deleteStore.url,
|
|
62
|
-
projectId: ''
|
|
72
|
+
projectId: '',
|
|
73
|
+
scope: deleteStore.scope || 'studio'
|
|
63
74
|
}
|
|
64
75
|
});
|
|
65
|
-
|
|
76
|
+
await blockletContext?.actions?.refreshBlocklet();
|
|
66
77
|
} catch (err) {
|
|
67
78
|
Toast.error(`Remove Blocklet Store Error: ${formatError(err)}`);
|
|
79
|
+
} finally {
|
|
80
|
+
setDeleteStore(null);
|
|
68
81
|
}
|
|
69
82
|
};
|
|
70
|
-
const
|
|
83
|
+
const {
|
|
84
|
+
storeList
|
|
85
|
+
} = getStudioStoreList({
|
|
86
|
+
fromBlocklet: inService,
|
|
87
|
+
blocklet,
|
|
88
|
+
nodeInfo,
|
|
89
|
+
componentDid,
|
|
90
|
+
userDid: session?.user?.did
|
|
91
|
+
});
|
|
71
92
|
const did = blocklet?.meta?.did;
|
|
72
|
-
const manageable = !(componentDid && window.blocklet?.tenantMode === BLOCKLET_TENANT_MODES.MULTIPLE);
|
|
73
93
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
74
94
|
children: [/*#__PURE__*/_jsxs(ButtonGroup, {
|
|
75
95
|
disabled: disabled,
|
|
@@ -100,16 +120,16 @@ export default function ConnectStoreButton({
|
|
|
100
120
|
},
|
|
101
121
|
open: open,
|
|
102
122
|
anchorEl: anchorRef.current,
|
|
123
|
+
placement: "bottom-end",
|
|
103
124
|
role: undefined,
|
|
104
125
|
transition: true,
|
|
105
126
|
disablePortal: true,
|
|
106
127
|
children: ({
|
|
107
|
-
TransitionProps
|
|
108
|
-
placement
|
|
128
|
+
TransitionProps
|
|
109
129
|
}) => /*#__PURE__*/_jsx(Grow, {
|
|
110
130
|
...TransitionProps,
|
|
111
131
|
style: {
|
|
112
|
-
transformOrigin:
|
|
132
|
+
transformOrigin: 'center top'
|
|
113
133
|
},
|
|
114
134
|
children: /*#__PURE__*/_jsx(Paper, {
|
|
115
135
|
children: /*#__PURE__*/_jsx(ClickAwayListener, {
|
|
@@ -117,16 +137,35 @@ export default function ConnectStoreButton({
|
|
|
117
137
|
children: /*#__PURE__*/_jsxs(MenuList, {
|
|
118
138
|
id: "split-button-menu",
|
|
119
139
|
autoFocusItem: true,
|
|
140
|
+
sx: {
|
|
141
|
+
maxHeight: 300,
|
|
142
|
+
overflowY: 'auto'
|
|
143
|
+
},
|
|
120
144
|
children: [storeList.map(option => /*#__PURE__*/_jsxs(MenuItem, {
|
|
121
145
|
selected: option.id === store.id,
|
|
122
146
|
sx: {
|
|
123
|
-
height:
|
|
147
|
+
height: 56
|
|
124
148
|
},
|
|
125
149
|
onClick: () => handleSelectStore(option),
|
|
126
|
-
children: [/*#__PURE__*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
150
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
151
|
+
children: [/*#__PURE__*/_jsx(ShortenLabel, {
|
|
152
|
+
sx: {
|
|
153
|
+
fontSize: '16px'
|
|
154
|
+
},
|
|
155
|
+
maxLength: 24,
|
|
156
|
+
children: option.name
|
|
157
|
+
}), /*#__PURE__*/_jsx(ShortenLabel, {
|
|
158
|
+
sx: {
|
|
159
|
+
fontSize: '13px',
|
|
160
|
+
opacity: 0.6
|
|
161
|
+
},
|
|
162
|
+
maxLength: 30,
|
|
163
|
+
children: option.url
|
|
164
|
+
})]
|
|
165
|
+
}), canDeleteStore({
|
|
166
|
+
store: option,
|
|
167
|
+
userDid: session?.user?.did
|
|
168
|
+
}) && /*#__PURE__*/_jsx(IconButton, {
|
|
130
169
|
sx: {
|
|
131
170
|
ml: 1
|
|
132
171
|
},
|
|
@@ -139,7 +178,7 @@ export default function ConnectStoreButton({
|
|
|
139
178
|
icon: "ic:outline-delete"
|
|
140
179
|
})
|
|
141
180
|
})]
|
|
142
|
-
}, option.url)),
|
|
181
|
+
}, option.url)), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsxs(MenuItem, {
|
|
143
182
|
onClick: handleOpenAddStore,
|
|
144
183
|
children: [/*#__PURE__*/_jsx(AddIcon, {
|
|
145
184
|
font: true
|
|
@@ -158,7 +197,8 @@ export default function ConnectStoreButton({
|
|
|
158
197
|
onClose: handleCloseAddStore,
|
|
159
198
|
teamDid: did,
|
|
160
199
|
storeList: storeList,
|
|
161
|
-
scope: "studio"
|
|
200
|
+
scope: "studio",
|
|
201
|
+
onAdd: blockletContext?.actions?.refreshBlocklet
|
|
162
202
|
}), deleteStore && /*#__PURE__*/_jsx(ConfirmDialog, {
|
|
163
203
|
displayError: true,
|
|
164
204
|
title: `${t('common.delete')} ${deleteStore.name}`,
|
|
@@ -4,9 +4,11 @@ import { Box, List, Alert, ListItem, ListItemText } from '@mui/material';
|
|
|
4
4
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
5
5
|
import LaunchIcon from '@mui/icons-material/Launch';
|
|
6
6
|
import { blueGrey } from '@mui/material/colors';
|
|
7
|
-
import { BLOCKLET_TENANT_MODES } from '@blocklet/constant';
|
|
8
7
|
import AddStore from '../../../store/add';
|
|
9
8
|
import StoreItem from '../../../store/item';
|
|
9
|
+
import { useSessionContext } from '../../../contexts/session';
|
|
10
|
+
import { useBlockletContext } from '../../../contexts/blocklet';
|
|
11
|
+
import getStudioStoreList from '../utils/get-studio-store-list';
|
|
10
12
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
13
|
function ConnectStoreList({
|
|
12
14
|
blocklet,
|
|
@@ -26,7 +28,22 @@ function ConnectStoreList({
|
|
|
26
28
|
const {
|
|
27
29
|
t
|
|
28
30
|
} = useLocaleContext();
|
|
29
|
-
const
|
|
31
|
+
const {
|
|
32
|
+
actions: {
|
|
33
|
+
refreshBlocklet
|
|
34
|
+
}
|
|
35
|
+
} = useBlockletContext();
|
|
36
|
+
const {
|
|
37
|
+
session
|
|
38
|
+
} = useSessionContext();
|
|
39
|
+
const {
|
|
40
|
+
storeList
|
|
41
|
+
} = getStudioStoreList({
|
|
42
|
+
fromBlocklet: true,
|
|
43
|
+
blocklet,
|
|
44
|
+
componentDid,
|
|
45
|
+
userDid: session?.user?.did
|
|
46
|
+
});
|
|
30
47
|
const connectedMap = useMemo(() => {
|
|
31
48
|
if (!connectedStores?.length) {
|
|
32
49
|
return {};
|
|
@@ -74,14 +91,16 @@ function ConnectStoreList({
|
|
|
74
91
|
connectedStore: connectedMap[x.id],
|
|
75
92
|
onPublish: onPublish,
|
|
76
93
|
onDelete: onDelete,
|
|
94
|
+
scope: x.scope || 'studio',
|
|
77
95
|
onOpenConnectStore: onOpenConnectStore
|
|
78
96
|
})
|
|
79
97
|
})
|
|
80
98
|
}, x.url))
|
|
81
|
-
}),
|
|
99
|
+
}), /*#__PURE__*/_jsx(AddStore, {
|
|
82
100
|
teamDid: did,
|
|
83
101
|
storeList: storeList,
|
|
84
|
-
scope: "studio"
|
|
102
|
+
scope: "studio",
|
|
103
|
+
onAdd: refreshBlocklet
|
|
85
104
|
})]
|
|
86
105
|
});
|
|
87
106
|
}
|
|
@@ -165,7 +165,7 @@ function Header({
|
|
|
165
165
|
Toast.error(err?.response?.data?.error?.message || err.message);
|
|
166
166
|
setLoading(false);
|
|
167
167
|
setParamsErrTip({
|
|
168
|
-
|
|
168
|
+
blockletResource: 'Invalid save the resource'
|
|
169
169
|
});
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
@@ -197,6 +197,16 @@ function Header({
|
|
|
197
197
|
componentDid
|
|
198
198
|
}, '*');
|
|
199
199
|
}
|
|
200
|
+
setParamsErrTip({
|
|
201
|
+
blockletResource: '',
|
|
202
|
+
blockletTitle: '',
|
|
203
|
+
blockletDescription: '',
|
|
204
|
+
blockletVersion: '',
|
|
205
|
+
blockletLogo: '',
|
|
206
|
+
projectId: '',
|
|
207
|
+
blockletIntroduction: '',
|
|
208
|
+
note: ''
|
|
209
|
+
});
|
|
200
210
|
if (mode === 'create' || mode === 'new-release') {
|
|
201
211
|
const id = res?.release?.id;
|
|
202
212
|
navigate(`../${projectId}/view/${id}`, {
|
|
@@ -208,7 +218,7 @@ function Header({
|
|
|
208
218
|
}).catch(err => {
|
|
209
219
|
const msg = formatError(err);
|
|
210
220
|
Toast.error(msg);
|
|
211
|
-
if (/resource
|
|
221
|
+
if (/resource/.test(msg) || /zip/.test(msg)) {
|
|
212
222
|
setParamsErrTip({
|
|
213
223
|
blockletResource: msg
|
|
214
224
|
});
|
|
@@ -53,9 +53,7 @@ const addComponentTabs = ({
|
|
|
53
53
|
});
|
|
54
54
|
};
|
|
55
55
|
const pickParams = (baseParams, app) => {
|
|
56
|
-
const params = pick(baseParams, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'connectedStores', 'blockletComponents', 'lastReleaseId', 'uploadedResource'
|
|
57
|
-
// 'note',
|
|
58
|
-
]);
|
|
56
|
+
const params = pick(baseParams, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'connectedStores', 'blockletComponents', 'lastReleaseId', 'uploadedResource', 'note']);
|
|
59
57
|
if (!params.blockletComponents) {
|
|
60
58
|
params.blockletComponents = (app.children || []).map(x => ({
|
|
61
59
|
did: x.meta.did,
|
|
@@ -134,7 +132,7 @@ export default function CreateRelease({
|
|
|
134
132
|
const setSelectedResourceIds = useCallback((...args) => {
|
|
135
133
|
_setSelectedResourceIds(...args);
|
|
136
134
|
setParamsErrTip({
|
|
137
|
-
|
|
135
|
+
blockletResource: ''
|
|
138
136
|
});
|
|
139
137
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
140
138
|
}, []);
|
|
@@ -190,6 +188,9 @@ export default function CreateRelease({
|
|
|
190
188
|
Toast.error('Release not found');
|
|
191
189
|
return;
|
|
192
190
|
}
|
|
191
|
+
if (mode !== 'view') {
|
|
192
|
+
res.release.note = '';
|
|
193
|
+
}
|
|
193
194
|
setParams(lastParams => pickParams({
|
|
194
195
|
...lastParams,
|
|
195
196
|
...res.release,
|
|
@@ -520,7 +521,9 @@ export default function CreateRelease({
|
|
|
520
521
|
readOnly: readOnly,
|
|
521
522
|
projectId: projectId === UNOWNED_DID ? '' : projectId,
|
|
522
523
|
params: params,
|
|
523
|
-
|
|
524
|
+
error: paramsErrTip.blockletResource,
|
|
525
|
+
setParams: setParams,
|
|
526
|
+
setParamsErrTip: setParamsErrTip
|
|
524
527
|
})]
|
|
525
528
|
})
|
|
526
529
|
})
|
|
@@ -29,7 +29,7 @@ export default function ReleaseStepper({
|
|
|
29
29
|
return paramsErrTip?.blockletTitle || paramsErrTip?.projectId || paramsErrTip?.blockletDescription;
|
|
30
30
|
}
|
|
31
31
|
if (step === 2) {
|
|
32
|
-
return paramsErrTip?.
|
|
32
|
+
return paramsErrTip?.blockletResource;
|
|
33
33
|
}
|
|
34
34
|
if (step >= 4) {
|
|
35
35
|
return paramsErrTip?.blockletVersion || paramsErrTip?.note;
|
|
@@ -156,6 +156,6 @@ ReleaseStepper.propTypes = {
|
|
|
156
156
|
blockletTitle: PropTypes.string,
|
|
157
157
|
blockletDescription: PropTypes.string,
|
|
158
158
|
note: PropTypes.string,
|
|
159
|
-
|
|
159
|
+
blockletResource: PropTypes.string
|
|
160
160
|
}).isRequired
|
|
161
161
|
};
|
|
@@ -6,7 +6,7 @@ import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
|
6
6
|
import Toast from '@arcblock/ux/lib/Toast/index';
|
|
7
7
|
import EmptySpinner from '../../../empty-spinner';
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
const
|
|
9
|
+
const allowedFileExts = ['.zip', '.gz'];
|
|
10
10
|
const maxFileSize = 1024 * 1024 * 100; // 100 MB
|
|
11
11
|
|
|
12
12
|
// eslint-disable-next-line import/no-unresolved
|
|
@@ -18,7 +18,9 @@ export default function ResourceUpload({
|
|
|
18
18
|
projectId,
|
|
19
19
|
readOnly,
|
|
20
20
|
params,
|
|
21
|
-
setParams
|
|
21
|
+
setParams,
|
|
22
|
+
setParamsErrTip,
|
|
23
|
+
error
|
|
22
24
|
}) {
|
|
23
25
|
const {
|
|
24
26
|
t
|
|
@@ -74,6 +76,9 @@ export default function ResourceUpload({
|
|
|
74
76
|
setParams({
|
|
75
77
|
uploadedResource: result.data.filename
|
|
76
78
|
});
|
|
79
|
+
setParamsErrTip({
|
|
80
|
+
blockletResource: ''
|
|
81
|
+
});
|
|
77
82
|
uploaderRef.current?.close();
|
|
78
83
|
},
|
|
79
84
|
plugins: ['ImageEditor'],
|
|
@@ -86,12 +91,17 @@ export default function ResourceUpload({
|
|
|
86
91
|
},
|
|
87
92
|
coreProps: {
|
|
88
93
|
restrictions: {
|
|
89
|
-
|
|
94
|
+
allowedFileExts,
|
|
90
95
|
maxFileSize,
|
|
91
96
|
maxNumberOfFiles: 1
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
99
|
}, "uploader-resource")
|
|
100
|
+
}), !!error && /*#__PURE__*/_jsx(Box, {
|
|
101
|
+
color: "error.main",
|
|
102
|
+
mt: 1,
|
|
103
|
+
fontSize: 14,
|
|
104
|
+
children: error
|
|
95
105
|
})]
|
|
96
106
|
});
|
|
97
107
|
}
|
|
@@ -100,6 +110,8 @@ ResourceUpload.propTypes = {
|
|
|
100
110
|
projectId: PropTypes.string.isRequired,
|
|
101
111
|
readOnly: PropTypes.bool.isRequired,
|
|
102
112
|
params: PropTypes.object.isRequired,
|
|
103
|
-
setParams: PropTypes.func.isRequired
|
|
113
|
+
setParams: PropTypes.func.isRequired,
|
|
114
|
+
error: PropTypes.string.isRequired,
|
|
115
|
+
setParamsErrTip: PropTypes.func.isRequired
|
|
104
116
|
};
|
|
105
117
|
ResourceUpload.defaultProps = {};
|
|
@@ -140,7 +140,10 @@ export default function Tree({
|
|
|
140
140
|
}), /*#__PURE__*/_jsx(Box, {
|
|
141
141
|
className: "name",
|
|
142
142
|
children: node.name
|
|
143
|
-
}), node.url &&
|
|
143
|
+
}), node.url &&
|
|
144
|
+
/*#__PURE__*/
|
|
145
|
+
// eslint-disable-next-line jsx-a11y/control-has-associated-label
|
|
146
|
+
_jsx("a", {
|
|
144
147
|
href: node.url,
|
|
145
148
|
target: "_blank",
|
|
146
149
|
rel: "noreferrer",
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { BLOCKLET_STORE } from '@abtnode/constant';
|
|
2
2
|
import { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import { useSessionContext } from '../../../contexts/session';
|
|
3
4
|
const LOCAL_STORAGE_KEY = 'lastWantToConnectStoreId';
|
|
4
5
|
function useWantToConnectStore(blocklet) {
|
|
5
6
|
const [_wantToConnectStore, _setWantToConnectStore] = useState(null);
|
|
7
|
+
const {
|
|
8
|
+
session
|
|
9
|
+
} = useSessionContext();
|
|
6
10
|
const setWantToConnectStore = useCallback(x => {
|
|
7
11
|
_setWantToConnectStore(x);
|
|
8
12
|
localStorage.setItem(LOCAL_STORAGE_KEY, x?.id);
|
|
@@ -13,8 +17,16 @@ function useWantToConnectStore(blocklet) {
|
|
|
13
17
|
if (lastStore) {
|
|
14
18
|
return lastStore;
|
|
15
19
|
}
|
|
16
|
-
return (blocklet?.settings?.storeList || []).find(x =>
|
|
17
|
-
|
|
20
|
+
return (blocklet?.settings?.storeList || []).find(x => {
|
|
21
|
+
if (x.id !== BLOCKLET_STORE.id) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
if (x.scope && x.scope !== 'studio' && x.scope !== session?.user?.did) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
});
|
|
29
|
+
}, [blocklet?.settings?.storeList, session?.user?.did]);
|
|
18
30
|
const wantToConnectStore = _wantToConnectStore || baseStore;
|
|
19
31
|
return [wantToConnectStore, setWantToConnectStore];
|
|
20
32
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BLOCKLET_TENANT_MODES } from '@blocklet/constant';
|
|
2
|
+
const canDeleteStore = ({
|
|
3
|
+
store,
|
|
4
|
+
userDid
|
|
5
|
+
}) => {
|
|
6
|
+
const singleTenant = !(window.blocklet?.tenantMode === BLOCKLET_TENANT_MODES.MULTIPLE);
|
|
7
|
+
if (store.protected) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
if (store.scope && store.scope === userDid) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
if (singleTenant) {
|
|
14
|
+
return store.scope === 'studio';
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
};
|
|
18
|
+
export default canDeleteStore;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const getStudioStoreList = ({
|
|
2
|
+
fromBlocklet,
|
|
3
|
+
nodeInfo,
|
|
4
|
+
blocklet,
|
|
5
|
+
userDid
|
|
6
|
+
}) => {
|
|
7
|
+
const teamDid = fromBlocklet ? blocklet?.meta?.did : nodeInfo?.did;
|
|
8
|
+
let storeList = fromBlocklet ? blocklet?.settings?.storeList || [] : nodeInfo?.blockletRegistryList || [];
|
|
9
|
+
storeList = storeList.filter(x => x.protected || !x.scope || x.scope === 'studio' || x.scope === userDid);
|
|
10
|
+
return {
|
|
11
|
+
teamDid,
|
|
12
|
+
storeList
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default getStudioStoreList;
|