@abtnode/ux 1.16.25 → 1.16.26-beta-e0056285

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.
Files changed (67) hide show
  1. package/es/analytics/disk.js +8 -11
  2. package/es/analytics/memory.js +1 -2
  3. package/es/analytics/runtime.js +1 -2
  4. package/es/analytics/traffic.js +1 -2
  5. package/es/blocklet/component/add-component-core.js +3 -0
  6. package/es/blocklet/component/select-store.js +8 -4
  7. package/es/blocklet/disk-info.js +1 -1
  8. package/es/blocklet/publish/connect-store-list.js +62 -0
  9. package/es/blocklet/publish/create-release.js +49 -13
  10. package/es/blocklet/publish/project-list.js +2 -2
  11. package/es/blocklet/publish/release-list.js +1 -1
  12. package/es/blocklet/publish/resource.js +14 -5
  13. package/es/blocklet/publish/select-components.js +3 -3
  14. package/es/locales/ar.js +11 -3
  15. package/es/locales/de.js +10 -2
  16. package/es/locales/en.js +9 -3
  17. package/es/locales/es.js +10 -2
  18. package/es/locales/fr.js +10 -2
  19. package/es/locales/hi.js +10 -2
  20. package/es/locales/i18n.db +0 -0
  21. package/es/locales/id.js +11 -3
  22. package/es/locales/ja.js +11 -3
  23. package/es/locales/ko.js +11 -3
  24. package/es/locales/pt.js +10 -2
  25. package/es/locales/ru.js +10 -2
  26. package/es/locales/th.js +10 -2
  27. package/es/locales/vi.js +11 -3
  28. package/es/locales/zh-tw.js +10 -2
  29. package/es/locales/zh.js +11 -3
  30. package/es/store/add.js +1 -0
  31. package/es/store/delete.js +9 -4
  32. package/es/store/item.js +233 -36
  33. package/es/util/index.js +8 -8
  34. package/lib/analytics/disk.js +7 -10
  35. package/lib/analytics/memory.js +5 -6
  36. package/lib/analytics/runtime.js +1 -2
  37. package/lib/analytics/traffic.js +2 -3
  38. package/lib/blocklet/component/add-component-core.js +3 -0
  39. package/lib/blocklet/component/select-store.js +8 -4
  40. package/lib/blocklet/disk-info.js +2 -2
  41. package/lib/blocklet/publish/connect-store-list.js +72 -0
  42. package/lib/blocklet/publish/create-release.js +47 -11
  43. package/lib/blocklet/publish/project-list.js +1 -1
  44. package/lib/blocklet/publish/release-list.js +1 -1
  45. package/lib/blocklet/publish/resource.js +14 -5
  46. package/lib/blocklet/publish/select-components.js +3 -3
  47. package/lib/locales/ar.js +11 -3
  48. package/lib/locales/de.js +10 -2
  49. package/lib/locales/en.js +9 -3
  50. package/lib/locales/es.js +10 -2
  51. package/lib/locales/fr.js +10 -2
  52. package/lib/locales/hi.js +10 -2
  53. package/lib/locales/i18n.db +0 -0
  54. package/lib/locales/id.js +11 -3
  55. package/lib/locales/ja.js +11 -3
  56. package/lib/locales/ko.js +11 -3
  57. package/lib/locales/pt.js +10 -2
  58. package/lib/locales/ru.js +10 -2
  59. package/lib/locales/th.js +10 -2
  60. package/lib/locales/vi.js +11 -3
  61. package/lib/locales/zh-tw.js +10 -2
  62. package/lib/locales/zh.js +11 -3
  63. package/lib/store/add.js +1 -0
  64. package/lib/store/delete.js +9 -4
  65. package/lib/store/item.js +233 -37
  66. package/lib/util/index.js +14 -13
  67. package/package.json +8 -8
@@ -6,7 +6,7 @@ import LinearProgress from '@mui/material/LinearProgress';
6
6
  import Box from '@mui/material/Box';
7
7
  import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
8
8
  import Card from './card';
9
- import { formatDiskSize } from '../util/index';
9
+ import { filesize } from '../util/index';
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  const BorderLinearProgress = withStyles(theme => ({
12
12
  root: {
@@ -51,8 +51,7 @@ LinearProgressWithLabel.propTypes = {
51
51
  value: PropTypes.number.isRequired
52
52
  };
53
53
  export default function DiskMonitor({
54
- disk,
55
- platform
54
+ disk
56
55
  }) {
57
56
  const {
58
57
  t
@@ -61,21 +60,21 @@ export default function DiskMonitor({
61
60
  id: 1,
62
61
  className: 'used',
63
62
  title: t('system.used'),
64
- metric: formatDiskSize(disk.used, platform)
63
+ metric: filesize(disk.used)
65
64
  }, {
66
65
  id: 2,
67
66
  className: 'free',
68
67
  title: t('system.free'),
69
- metric: formatDiskSize(disk.free, platform)
68
+ metric: filesize(disk.free)
70
69
  }, {
71
70
  id: 3,
72
71
  className: 'total',
73
72
  title: t('system.total'),
74
- metric: formatDiskSize(disk.total, platform)
73
+ metric: filesize(disk.total)
75
74
  }];
76
75
  return /*#__PURE__*/_jsx(Card, {
77
76
  title: `${t('common.disk')} (${disk.device})`,
78
- value: formatDiskSize(disk.used, platform),
77
+ value: filesize(disk.used),
79
78
  graph: /*#__PURE__*/_jsx(Box, {
80
79
  mt: 3,
81
80
  children: /*#__PURE__*/_jsx(LinearProgressWithLabel, {
@@ -96,8 +95,7 @@ DiskMonitor.propTypes = {
96
95
  free: PropTypes.number,
97
96
  total: PropTypes.number,
98
97
  device: PropTypes.string
99
- }),
100
- platform: PropTypes.string
98
+ })
101
99
  };
102
100
  DiskMonitor.defaultProps = {
103
101
  disk: {
@@ -105,6 +103,5 @@ DiskMonitor.defaultProps = {
105
103
  free: 0,
106
104
  total: 1,
107
105
  device: ''
108
- },
109
- platform: ''
106
+ }
110
107
  };
@@ -1,10 +1,9 @@
1
1
  /* eslint-disable react/jsx-one-expression-per-line */
2
2
  import PropTypes from 'prop-types';
3
- import filesize from 'filesize';
4
3
  import Box from '@mui/material/Box';
5
4
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
6
5
  import Chart from './chart';
7
- import { formatTime } from '../util';
6
+ import { formatTime, filesize } from '../util';
8
7
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
9
8
  export default function MemoryMonitor({
10
9
  instanceCount,
@@ -1,6 +1,5 @@
1
1
  import React, { useEffect, useMemo } from 'react';
2
2
  import styled from '@emotion/styled';
3
- import filesize from 'filesize';
4
3
  import prettyMs from 'pretty-ms-i18n';
5
4
  import Box from '@mui/material/Box';
6
5
  import Datatable from '@arcblock/ux/lib/Datatable';
@@ -8,7 +7,7 @@ import Typography from '@mui/material/Typography';
8
7
  import { getDisplayName, forEachBlockletSync } from '@blocklet/meta/lib/util';
9
8
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
10
9
  import { useBlockletContext } from '../contexts/blocklet';
11
- import { formatLocale } from '../util';
10
+ import { formatLocale, filesize } from '../util';
12
11
  import RuntimeInfo from '../blocklet/runtime-info';
13
12
  import BundleAvatar from '../blocklet/bundle-avatar';
14
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -4,7 +4,6 @@ import { useEffect, useState } from 'react';
4
4
  import dayjs from '@abtnode/util/lib/dayjs';
5
5
  import nthArg from 'lodash/nthArg';
6
6
  import joinUrl from 'url-join';
7
- import filesize from 'filesize';
8
7
  import useAsyncRetry from 'react-use/lib/useAsyncRetry';
9
8
  import Iframe from 'react-iframe';
10
9
  import Alert from '@mui/material/Alert';
@@ -22,7 +21,7 @@ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
22
21
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
23
22
  import { WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
24
23
  import { startOfWeek, endOfWeek, addWeeks, startOfMonth, endOfMonth, addMonths, startOfYear, endOfYear, addYears } from 'date-fns';
25
- import { formatError, formatToDate } from '../util';
24
+ import { formatError, formatToDate, filesize } from '../util';
26
25
  import { useNodeContext } from '../contexts/node';
27
26
  import Chart from './chart';
28
27
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -683,6 +683,9 @@ export default function AddComponentCore({
683
683
  key: 'selectComponent',
684
684
  name: t('blocklet.component.selectComponent'),
685
685
  body: /*#__PURE__*/_jsxs(TypographyWrapper, {
686
+ sx: {
687
+ width: 400
688
+ },
686
689
  component: "div",
687
690
  children: [params.showFromUrlDialog && /*#__PURE__*/_jsx(InstallFromUrl
688
691
  // if not set defaultUrl, the dialog will always show step 1 when the dialog is opened
@@ -57,10 +57,10 @@ export default function SelectStore({
57
57
  children: [/*#__PURE__*/_jsxs(SelectStoreTitle, {
58
58
  children: [/*#__PURE__*/_jsx(Button, {
59
59
  ref: storeSelectRef,
60
- color: "secondary",
60
+ color: "primary",
61
61
  "data-cy": "add-component-select-store",
62
62
  endIcon: /*#__PURE__*/_jsx(ArrowDropDownIcon, {
63
- color: "secondary"
63
+ color: "primary"
64
64
  }),
65
65
  onClick: () => {
66
66
  setOpen(true);
@@ -69,11 +69,11 @@ export default function SelectStore({
69
69
  padding: '0 2px'
70
70
  },
71
71
  children: /*#__PURE__*/_jsx(Typography, {
72
- color: "secondary",
72
+ color: "primary",
73
73
  children: currentRegistry.name
74
74
  })
75
75
  }), /*#__PURE__*/_jsx(Typography, {
76
- color: "secondary",
76
+ color: "primary",
77
77
  children: extra
78
78
  })]
79
79
  }), /*#__PURE__*/_jsxs(TextField, {
@@ -110,6 +110,10 @@ export default function SelectStore({
110
110
  margin: "normal",
111
111
  children: [storeList?.map(x => {
112
112
  return /*#__PURE__*/_jsx(MenuItem, {
113
+ sx: {
114
+ width: '400px',
115
+ maxWidth: '90vw'
116
+ },
113
117
  value: x,
114
118
  "data-cy": x.url,
115
119
  children: /*#__PURE__*/_jsx(StoreItem, {
@@ -2,11 +2,11 @@
2
2
  import { useContext } from 'react';
3
3
  import styled from '@emotion/styled';
4
4
  import PropTypes from 'prop-types';
5
- import filesize from 'filesize';
6
5
  import Typography from '@mui/material/Typography';
7
6
  import Link from '@mui/material/Link';
8
7
  import InfoRow from '@arcblock/ux/lib/InfoRow';
9
8
  import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
9
+ import { filesize } from '../util';
10
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  export default function BlockletDiskInfo({
12
12
  blocklet,
@@ -0,0 +1,62 @@
1
+ import { useMemo } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { List, ListItem, ListItemText } from '@mui/material';
4
+ import AddStore from '../../store/add';
5
+ import StoreItem from '../../store/item';
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ function ConnectStoreList({
8
+ blocklet,
9
+ releaseId,
10
+ projectId,
11
+ releaseType,
12
+ publishedStoreIds,
13
+ onPublish
14
+ }) {
15
+ const storeList = blocklet?.settings?.storeList || [];
16
+ const connectedMap = useMemo(() => {
17
+ if (!blocklet?.settings?.connectedStores) {
18
+ return {};
19
+ }
20
+ return blocklet?.settings?.connectedStores?.reduce((acc, x) => {
21
+ acc[x.storeUrl] = x;
22
+ return acc;
23
+ }, {});
24
+ }, [blocklet?.settings?.connectedStores]);
25
+ const did = blocklet?.meta?.did;
26
+ const handleAddStore = () => {};
27
+ return /*#__PURE__*/_jsxs(List, {
28
+ children: [storeList?.map(x => /*#__PURE__*/_jsx(ListItem, {
29
+ "data-cy": "store-switch",
30
+ children: /*#__PURE__*/_jsx(ListItemText, {
31
+ children: /*#__PURE__*/_jsx(StoreItem, {
32
+ releaseId: releaseId,
33
+ projectId: projectId,
34
+ releaseType: releaseType,
35
+ kind: "publish",
36
+ teamDid: did,
37
+ store: x,
38
+ published: publishedStoreIds?.indexOf(x.id) > -1,
39
+ connected: !!connectedMap[x.url],
40
+ onPublish: onPublish
41
+ })
42
+ })
43
+ }, x.url)), /*#__PURE__*/_jsx(AddStore, {
44
+ onAdd: handleAddStore,
45
+ teamDid: did,
46
+ blockletRegistryList: storeList
47
+ })]
48
+ });
49
+ }
50
+ ConnectStoreList.propTypes = {
51
+ blocklet: PropTypes.object.isRequired,
52
+ projectId: PropTypes.string.isRequired,
53
+ releaseId: PropTypes.string.isRequired,
54
+ releaseType: PropTypes.string.isRequired,
55
+ onPublish: PropTypes.func,
56
+ publishedStoreIds: PropTypes.arrayOf(PropTypes.string)
57
+ };
58
+ ConnectStoreList.defaultProps = {
59
+ publishedStoreIds: [],
60
+ onPublish: () => {}
61
+ };
62
+ export default ConnectStoreList;
@@ -14,16 +14,17 @@ import IconButton from '@mui/material/IconButton';
14
14
  import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
15
15
  import InputAdornment from '@mui/material/InputAdornment';
16
16
  import Spinner from '@mui/material/CircularProgress';
17
- import Dialog from '@mui/material/Dialog';
17
+ import MaterialDialog from '@mui/material/Dialog';
18
18
  import DidConnect from '@arcblock/did-connect/lib/Connect';
19
19
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
20
20
  import Button from '@arcblock/ux/lib/Button';
21
21
  import Toast from '@arcblock/ux/lib/Toast';
22
22
  import Empty from '@arcblock/ux/lib/Empty';
23
23
  import Tabs from '@arcblock/ux/lib/Tabs';
24
+ import Dialog from '@arcblock/ux/lib/Dialog';
24
25
  import Alert from '@arcblock/ux/lib/Alert';
25
26
  import { PROJECT } from '@blocklet/constant';
26
- import { WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
27
+ import { WELLKNOWN_SERVICE_PATH_PREFIX, UNOWNED_DID } from '@abtnode/constant';
27
28
  import BlockletBundleAvatar from '../bundle-avatar';
28
29
  import { useSessionContext } from '../../contexts/session';
29
30
  import { useNodeContext } from '../../contexts/node';
@@ -33,6 +34,7 @@ import ClickToCopy from '../../click-to-copy';
33
34
  import { formatError } from '../../util';
34
35
  import Resource from './resource';
35
36
  import SelectComponents from './select-components';
37
+ import ConnectStoreList from './connect-store-list';
36
38
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
37
39
  const allowedFileTypes = ['image/*', '.jpg', '.jpeg', '.png', '.gif', '.svg'];
38
40
  const maxFileSize = 1024 * 1024 * 10; // 10 MB
@@ -105,8 +107,9 @@ const addComponentTabs = ({
105
107
  });
106
108
  };
107
109
  const pickParams = (release, app) => {
108
- const params = pick(release, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'blockletComponents', 'note']);
110
+ const params = pick(release, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'blockletComponents', 'publishedStoreIds', 'note']);
109
111
  params.blockletScreenshots ||= [];
112
+ params.publishedStoreIds ||= [];
110
113
  if (!params.blockletComponents) {
111
114
  params.blockletComponents = (app.children || []).map(x => ({
112
115
  did: x.meta.did,
@@ -152,6 +155,7 @@ export default function CreateRelease({
152
155
  const uploaderScreenshotRef = useRef(null);
153
156
  const [installResourceTip, setInstallResourceTip] = useState();
154
157
  const [openConnect, setOpenConnect] = useState(false);
158
+ const [showStoreDialog, setShowStoreDialog] = useState(false);
155
159
  const releaseId = inputReleaseId === 'create' ? '' : inputReleaseId;
156
160
  const mode = inputReleaseId === 'create' ? 'create' : 'edit';
157
161
  const projectType = useMemo(() => params?.blockletComponents?.some(x => x.included) ? 'pack' : 'resource', [params?.blockletComponents]);
@@ -169,6 +173,13 @@ export default function CreateRelease({
169
173
  const isPublished = release?.status === 'published';
170
174
  const readOnly = isPublished;
171
175
  const getProject = () => {
176
+ if (projectId === UNOWNED_DID) {
177
+ setParams({
178
+ blockletVersion: '1.0.0',
179
+ blockletTitle: ''
180
+ });
181
+ return;
182
+ }
172
183
  if (!projectId) {
173
184
  Toast.error(t('blocklet.publish.errorTip.noDid'));
174
185
  return;
@@ -219,7 +230,6 @@ export default function CreateRelease({
219
230
  return;
220
231
  }
221
232
  getRelease();
222
- // getProject({ typeOnly: true });
223
233
  }
224
234
  if (mode === 'create') {
225
235
  getProject();
@@ -227,7 +237,7 @@ export default function CreateRelease({
227
237
  // eslint-disable-next-line react-hooks/exhaustive-deps
228
238
  }, [mode, releaseId]);
229
239
  const onRelease = status => {
230
- if (!projectId) {
240
+ if (!projectId || projectId === UNOWNED_DID) {
231
241
  Toast.error(t('blocklet.publish.errorTip.noDid'));
232
242
  return;
233
243
  }
@@ -304,7 +314,7 @@ export default function CreateRelease({
304
314
  Toast.error(t('blocklet.publish.errorTip.noTitle'));
305
315
  return;
306
316
  }
307
- if (projectId === '0') {
317
+ if (!projectId || projectId === UNOWNED_DID) {
308
318
  setOpenConnect(true);
309
319
  }
310
320
  };
@@ -336,7 +346,7 @@ export default function CreateRelease({
336
346
  }
337
347
  }).then(() => {
338
348
  setLoading(false);
339
- navigate(`/.well-known/service/admin/publish/${nextProjectDid}/create`, {
349
+ navigate(window.location.pathname.replace(`${UNOWNED_DID}/create`, `${nextProjectDid}/create`), {
340
350
  replace: true
341
351
  });
342
352
  }).catch(err => {
@@ -394,7 +404,7 @@ export default function CreateRelease({
394
404
  error: paramsErrTip.blockletResource,
395
405
  app: blocklet,
396
406
  component: item,
397
- projectId: projectId,
407
+ projectId: projectId === UNOWNED_DID ? '' : projectId,
398
408
  release: {
399
409
  ...release,
400
410
  id: releaseId
@@ -445,7 +455,7 @@ export default function CreateRelease({
445
455
  },
446
456
  onClick: () => setInstallResourceTip(blockletMetaUrl),
447
457
  children: t('blocklet.publish.copyInstallUrl')
448
- }), /*#__PURE__*/_jsx(Dialog, {
458
+ }), /*#__PURE__*/_jsx(MaterialDialog, {
449
459
  fullWidth: true,
450
460
  maxWidth: "sm",
451
461
  open: installResourceTip,
@@ -519,6 +529,9 @@ export default function CreateRelease({
519
529
  }), /*#__PURE__*/_jsxs(Button, {
520
530
  variant: "contained",
521
531
  disabled: loading || createLoading,
532
+ style: {
533
+ marginRight: 12
534
+ },
522
535
  onClick: () => onRelease(PROJECT.RELEASE_STATUS.published),
523
536
  children: [createLoading === PROJECT.RELEASE_STATUS.published && /*#__PURE__*/_jsx(Spinner, {
524
537
  size: 14,
@@ -530,11 +543,18 @@ export default function CreateRelease({
530
543
  })]
531
544
  }), isPublished && /*#__PURE__*/_jsxs(_Fragment, {
532
545
  children: [installButton, /*#__PURE__*/_jsx(Button, {
533
- variant: "contained",
546
+ variant: "outlined",
547
+ style: {
548
+ marginRight: 12
549
+ },
534
550
  children: /*#__PURE__*/_jsx("a", {
535
551
  href: joinUrl(`${WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${blocklet.meta.did}/${projectId}/${releaseId}/download/${(release.files || [])[0]}`),
536
552
  children: t('common.download')
537
553
  })
554
+ }), /*#__PURE__*/_jsx(Button, {
555
+ variant: "contained",
556
+ onClick: () => setShowStoreDialog(true),
557
+ children: t('common.uploadToStore')
538
558
  })]
539
559
  })]
540
560
  })]
@@ -579,13 +599,14 @@ export default function CreateRelease({
579
599
  label: "Blocklet DID",
580
600
  fullWidth: true,
581
601
  readonly: true,
582
- disabled: projectId !== '0',
602
+ disabled: projectId !== UNOWNED_DID,
583
603
  autoComplete: "off",
584
604
  variant: "outlined",
585
605
  onClick: handleDidConnectShow,
606
+ onInput: handleDidConnectShow,
586
607
  InputProps: {
587
608
  'data-cy': 'export-blocklet-did',
588
- endAdornment: projectId === '0' && /*#__PURE__*/_jsx(InputAdornment, {
609
+ endAdornment: projectId === UNOWNED_DID && /*#__PURE__*/_jsx(InputAdornment, {
589
610
  position: "end",
590
611
  children: /*#__PURE__*/_jsx(Button, {
591
612
  onClick: handleDidConnectShow,
@@ -594,7 +615,7 @@ export default function CreateRelease({
594
615
  })
595
616
  },
596
617
  helperText: "",
597
- value: projectId === '0' ? '' : projectId,
618
+ value: projectId === UNOWNED_DID ? '' : projectId,
598
619
  sx: {
599
620
  mt: 3
600
621
  }
@@ -911,6 +932,21 @@ export default function CreateRelease({
911
932
  },
912
933
  children: t('blocklet.publish.packTip')
913
934
  })]
935
+ }), /*#__PURE__*/_jsx(Dialog, {
936
+ title: t('common.connectToStore'),
937
+ disableEscapeKeyDown: true,
938
+ disablePortal: false,
939
+ fullWidth: true,
940
+ open: showStoreDialog,
941
+ onClose: () => setShowStoreDialog(false),
942
+ children: /*#__PURE__*/_jsx(ConnectStoreList, {
943
+ blocklet: blocklet,
944
+ releaseType: params.blockletComponents?.length > 0 ? 'pack' : 'resource',
945
+ projectId: projectId,
946
+ releaseId: releaseId,
947
+ onPublish: getRelease,
948
+ publishedStoreIds: release?.publishedStoreIds
949
+ })
914
950
  })]
915
951
  });
916
952
  }
@@ -11,7 +11,7 @@ import LibraryAddIcon from '@mui/icons-material/LibraryAdd';
11
11
  import DeleteIcon from '@mui/icons-material/Delete';
12
12
  import InstallDesktopIcon from '@mui/icons-material/InstallDesktop';
13
13
  import DownloadIcon from '@mui/icons-material/Download';
14
- import { WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
14
+ import { WELLKNOWN_SERVICE_PATH_PREFIX, UNOWNED_DID } from '@abtnode/constant';
15
15
  import Datatable from '@arcblock/ux/lib/Datatable';
16
16
  import Button from '@arcblock/ux/lib/Button';
17
17
  import Toast from '@arcblock/ux/lib/Toast';
@@ -60,7 +60,7 @@ export default function ProjectList() {
60
60
  });
61
61
  };
62
62
  const handleNewBlocklet = () => {
63
- navigate('/.well-known/service/admin/publish/0/create', {
63
+ navigate(`${UNOWNED_DID}/create`, {
64
64
  replace: true
65
65
  });
66
66
  };
@@ -193,7 +193,7 @@ export default function ReleaseList() {
193
193
  customBodyRender: value => {
194
194
  return /*#__PURE__*/_jsx(Tag, {
195
195
  type: value === 'published' ? 'success' : 'warning',
196
- children: upperFirst(value)
196
+ children: value === 'published' ? 'Released' : upperFirst(value)
197
197
  });
198
198
  }
199
199
  }
@@ -80,6 +80,10 @@ export default function Resource({
80
80
  }
81
81
  };
82
82
  const _onSave = async () => {
83
+ if (!projectId) {
84
+ Toast.error(t('blocklet.publish.errorTip.noDid'));
85
+ return;
86
+ }
83
87
  const params = selectedResourceIds;
84
88
  try {
85
89
  setLoading(true);
@@ -99,6 +103,13 @@ export default function Resource({
99
103
  Toast.error(err.message);
100
104
  }
101
105
  };
106
+ const handleTreeChange = data => {
107
+ if (!projectId) {
108
+ Toast.error(t('blocklet.publish.errorTip.noDid'));
109
+ return;
110
+ }
111
+ setSelectedResourceIds(data);
112
+ };
102
113
  useEffect(() => {
103
114
  axios.get(url).then(res => {
104
115
  const tree = fillParent(res.data?.resources || []);
@@ -109,7 +120,7 @@ export default function Resource({
109
120
  api.getSelectedResources({
110
121
  input: {
111
122
  did: app.meta.did,
112
- projectId,
123
+ projectId: projectId || '0',
113
124
  releaseId,
114
125
  componentDid: component.meta.did
115
126
  }
@@ -121,7 +132,7 @@ export default function Resource({
121
132
  Toast.error(err.message);
122
133
  });
123
134
  // eslint-disable-next-line react-hooks/exhaustive-deps
124
- }, [url]);
135
+ }, [url, projectId]);
125
136
  if (component.status !== 'running') {
126
137
  return /*#__PURE__*/_jsx(Container, {
127
138
  children: /*#__PURE__*/_jsx(Box, {
@@ -140,9 +151,7 @@ export default function Resource({
140
151
  children: [/*#__PURE__*/_jsx(Tree, {
141
152
  data: resources,
142
153
  value: selectedResourceIds,
143
- onChange: data => {
144
- setSelectedResourceIds(data);
145
- },
154
+ onChange: handleTreeChange,
146
155
  disabled: loading || readonly
147
156
  }), !readonly && warning && /*#__PURE__*/_jsx(Box, {
148
157
  className: "footer",
@@ -91,7 +91,7 @@ export default function SelectComponents({
91
91
  // eslint-disable-next-line react/no-unstable-nested-components
92
92
  customBodyRenderLite: rawIndex => {
93
93
  const component = components[rawIndex];
94
- const included = map[component.meta.did]?.included;
94
+ const included = !!map[component.meta.did]?.included;
95
95
  return /*#__PURE__*/_jsx(Checkbox, {
96
96
  size: "small",
97
97
  checked: included,
@@ -107,8 +107,8 @@ export default function SelectComponents({
107
107
  // eslint-disable-next-line react/no-unstable-nested-components
108
108
  customBodyRenderLite: rawIndex => {
109
109
  const component = components[rawIndex];
110
- const included = map[component.meta.did]?.included;
111
- const required = map[component.meta.did]?.required;
110
+ const included = !!map[component.meta.did]?.included;
111
+ const required = !!map[component.meta.did]?.required;
112
112
  return /*#__PURE__*/_jsx(Checkbox, {
113
113
  disabled: disabled || !included,
114
114
  size: "small",
package/es/locales/ar.js CHANGED
@@ -257,7 +257,7 @@ export default {
257
257
  protected: 'محمي',
258
258
  protocol: 'بروتوكول',
259
259
  publish: 'نشر',
260
- published: 'نُشِرَت',
260
+ published: 'نشرت',
261
261
  purchase: 'شراء',
262
262
  readMore: 'أكثر',
263
263
  redirect: 'إعادة توجيه',
@@ -348,7 +348,12 @@ export default {
348
348
  endTime: 'وقت الانتهاء',
349
349
  selected: 'محدد',
350
350
  timeoutError: 'خطأ في المهلة',
351
- tags: 'وسوم'
351
+ tags: 'وسوم',
352
+ publishToStore: 'نشر في المتجر',
353
+ connectToStore: 'الاتصال بالمتجر',
354
+ uploaded: 'تم التحميل',
355
+ uploadToStore: 'تحميل إلى المتجر',
356
+ upload: 'تحميل'
352
357
  },
353
358
  blocklet: {
354
359
  external: 'خارجي',
@@ -691,7 +696,10 @@ export default {
691
696
  download: 'تحميل {name}',
692
697
  delete: 'احذف {name}',
693
698
  copyInstallUrl: 'انسخ عنوان URL للتثبيت',
694
- install: 'تثبيت {name}'
699
+ install: 'تثبيت {name}',
700
+ publishToStoreSuccess: 'تم نشر بلوكليت بنجاح في المتجر',
701
+ connectStoreSuccess: 'تم الاتصال بمتجر البلوكليت بنجاح',
702
+ uploadToStoreSuccess: 'تم تحميل بلوكليت بنجاح في المتجر ، تحتاج إلى نشره في المتجر'
695
703
  },
696
704
  titleValidationError: 'يجب أن يكون طول العنوان على الأقل 3 أحرف',
697
705
  descriptionValidationError: 'يجب أن تكون طول الوصف بين 3 و 160 حرفًا'
package/es/locales/de.js CHANGED
@@ -348,7 +348,12 @@ export default {
348
348
  endTime: 'Endzeit',
349
349
  selected: 'Ausgewählt',
350
350
  timeoutError: 'Zeitüberschreitungsfehler',
351
- tags: 'Tags'
351
+ tags: 'Tags',
352
+ publishToStore: 'Im Store veröffentlichen',
353
+ connectToStore: 'Verbinden Sie mit dem Geschäft',
354
+ uploaded: 'Hochgeladen',
355
+ uploadToStore: 'Upload in den Shop',
356
+ upload: 'Hochladen'
352
357
  },
353
358
  blocklet: {
354
359
  external: 'Extern',
@@ -691,7 +696,10 @@ export default {
691
696
  download: 'Download {name}',
692
697
  delete: 'Lösche {name}',
693
698
  copyInstallUrl: 'Kopiere Installations-URL',
694
- install: 'Installiere {name}'
699
+ install: 'Installiere {name}',
700
+ publishToStoreSuccess: 'Blocklet erfolgreich im Store veröffentlicht',
701
+ connectStoreSuccess: 'Blocklet Store erfolgreich verbunden',
702
+ uploadToStoreSuccess: 'Blocklet erfolgreich im Store hochgeladen, du musst es im Store veröffentlichen'
695
703
  },
696
704
  titleValidationError: 'Die Länge des Titels muss mindestens 3 Zeichen betragen',
697
705
  descriptionValidationError: 'Die Beschreibungslänge muss zwischen 3 und 160 Zeichen liegen'
package/es/locales/en.js CHANGED
@@ -165,6 +165,11 @@ export default {
165
165
  domain: 'Domain',
166
166
  downgradeTo: 'Downgrade to',
167
167
  download: 'Download',
168
+ uploadToStore: 'Upload to Store',
169
+ connectToStore: 'Connect to Store',
170
+ publish: 'Publish',
171
+ upload: 'Upload',
172
+ uploaded: 'Uploaded',
168
173
  downloading: 'Downloading',
169
174
  edit: 'Edit',
170
175
  email: 'Email',
@@ -250,8 +255,6 @@ export default {
250
255
  preview: 'Preview',
251
256
  protected: 'Protected',
252
257
  protocol: 'Protocol',
253
- publish: 'Publish',
254
- published: 'published',
255
258
  purchase: 'Purchase',
256
259
  readMore: 'More',
257
260
  redirect: 'Redirect',
@@ -686,7 +689,10 @@ export default {
686
689
  noVersion: 'Blocklet Version is required',
687
690
  noDescription: 'Blocklet Description is required',
688
691
  noNote: 'Release Note is required'
689
- }
692
+ },
693
+ uploadToStoreSuccess: 'Blocklet upload to Store successfully, you need publish it in the Store',
694
+ publishToStoreSuccess: 'Blocklet published to Store successfully',
695
+ connectStoreSuccess: 'Blocklet Store connected successfully'
690
696
  }
691
697
  },
692
698
  dashboard: {
package/es/locales/es.js CHANGED
@@ -348,7 +348,12 @@ export default {
348
348
  endTime: 'Hora de finalización',
349
349
  selected: 'Seleccionado',
350
350
  timeoutError: 'Error de tiempo de espera',
351
- tags: 'Etiquetas'
351
+ tags: 'Etiquetas',
352
+ publishToStore: 'Publicar en la tienda',
353
+ connectToStore: 'Conectar a la tienda',
354
+ uploaded: 'Subido',
355
+ uploadToStore: 'Subir a la tienda',
356
+ upload: 'Subir'
352
357
  },
353
358
  blocklet: {
354
359
  external: 'Externo',
@@ -691,7 +696,10 @@ export default {
691
696
  download: 'Descargar {name}',
692
697
  delete: 'Eliminar {name}',
693
698
  copyInstallUrl: 'Copiar URL de instalación',
694
- install: 'Instalar {name}'
699
+ install: 'Instalar {name}',
700
+ publishToStoreSuccess: 'Bloque publicado en la tienda exitosamente',
701
+ connectStoreSuccess: 'La tienda de Blocklet se conectó correctamente',
702
+ uploadToStoreSuccess: 'Bloque de carga a la tienda exitosamente, necesitas publicarlo en la tienda'
695
703
  },
696
704
  titleValidationError: 'La longitud del título debe ser de al menos 3 caracteres',
697
705
  descriptionValidationError: 'La longitud de la descripción debe estar entre 3 y 160 caracteres'