@abtnode/ux 1.16.26-beta-4831bf3f → 1.16.26-beta-5251ab18
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/actions.js +74 -33
- package/es/blocklet/component/add-component-core.js +28 -29
- package/es/blocklet/component/select-store.js +9 -10
- package/es/blocklet/icons.js +3 -1
- package/es/blocklet/publish/connect-store-list.js +8 -4
- package/es/blocklet/publish/project-list.js +56 -18
- package/es/blocklet/publish/release-list.js +0 -1
- package/es/locales/ar.js +11 -2
- package/es/locales/de.js +12 -3
- package/es/locales/en.js +11 -2
- package/es/locales/es.js +12 -3
- package/es/locales/fr.js +12 -3
- package/es/locales/hi.js +12 -3
- package/es/locales/i18n.db +0 -0
- package/es/locales/id.js +11 -2
- package/es/locales/ja.js +12 -3
- package/es/locales/ko.js +12 -3
- package/es/locales/pt.js +12 -3
- package/es/locales/ru.js +11 -2
- package/es/locales/th.js +11 -2
- package/es/locales/vi.js +11 -2
- package/es/locales/zh-tw.js +12 -3
- package/es/locales/zh.js +12 -3
- package/es/store/connect-actions.js +130 -0
- package/es/store/delete.js +8 -2
- package/es/store/item.js +5 -9
- package/es/util/join-url-keep-search.js +15 -0
- package/lib/blocklet/actions.js +82 -38
- package/lib/blocklet/component/add-component-core.js +27 -28
- package/lib/blocklet/component/select-store.js +9 -10
- package/lib/blocklet/icons.js +3 -1
- package/lib/blocklet/publish/connect-store-list.js +8 -4
- package/lib/blocklet/publish/project-list.js +56 -18
- package/lib/blocklet/publish/release-list.js +0 -1
- package/lib/locales/ar.js +11 -2
- package/lib/locales/de.js +12 -3
- package/lib/locales/en.js +11 -2
- package/lib/locales/es.js +12 -3
- package/lib/locales/fr.js +12 -3
- package/lib/locales/hi.js +12 -3
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +11 -2
- package/lib/locales/ja.js +12 -3
- package/lib/locales/ko.js +12 -3
- package/lib/locales/pt.js +12 -3
- package/lib/locales/ru.js +11 -2
- package/lib/locales/th.js +11 -2
- package/lib/locales/vi.js +11 -2
- package/lib/locales/zh-tw.js +12 -3
- package/lib/locales/zh.js +12 -3
- package/lib/store/connect-actions.js +138 -0
- package/lib/store/delete.js +8 -2
- package/lib/store/item.js +5 -9
- package/lib/util/join-url-keep-search.js +22 -0
- package/package.json +7 -7
package/es/blocklet/actions.js
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
/* eslint-disable operator-linebreak */
|
|
3
|
-
import { useState, useContext } from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
3
|
import styled from '@emotion/styled';
|
|
6
|
-
import
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { useContext, useEffect, useState } from 'react';
|
|
6
|
+
import { Link, useNavigate } from 'react-router-dom';
|
|
7
7
|
import useLocalStorage from 'react-use/lib/useLocalStorage';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
8
|
+
import { LAUNCH_SESSION_STATUS } from '@abtnode/constant';
|
|
9
|
+
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
10
|
+
import Alert from '@mui/material/Alert';
|
|
11
11
|
import ButtonGroup from '@mui/material/ButtonGroup';
|
|
12
12
|
import Spinner from '@mui/material/CircularProgress';
|
|
13
|
-
import
|
|
14
|
-
import
|
|
13
|
+
import Divider from '@mui/material/Divider';
|
|
14
|
+
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
15
|
+
import IconButton from '@mui/material/IconButton';
|
|
15
16
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
16
17
|
import ListItemText from '@mui/material/ListItemText';
|
|
17
|
-
import
|
|
18
|
+
import Menu from '@mui/material/Menu';
|
|
19
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
18
20
|
import Radio from '@mui/material/Radio';
|
|
19
21
|
import RadioGroup from '@mui/material/RadioGroup';
|
|
20
|
-
import
|
|
21
|
-
import Alert from '@mui/material/Alert';
|
|
22
|
+
import Typography from '@mui/material/Typography';
|
|
22
23
|
import Button from '@arcblock/ux/lib/Button';
|
|
23
|
-
import { getAppMissingConfigs, isDeletableBlocklet, hasRunnableComponent, getDisplayName, isInProgress } from '@blocklet/meta/lib/util';
|
|
24
24
|
import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
25
|
+
import { getAppMissingConfigs, getDisplayName, hasRunnableComponent, isDeletableBlocklet, isInProgress } from '@blocklet/meta/lib/util';
|
|
25
26
|
import { BLOCKLET_CONTROLLER_STATUS, BLOCKLET_MODES } from '@blocklet/constant';
|
|
26
27
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
27
|
-
import { sleep, formatError, isDownloading } from '../util';
|
|
28
|
-
import { getServerUrl } from './util';
|
|
29
|
-
import { useNodeContext } from '../contexts/node';
|
|
30
28
|
import Confirm from '../confirm';
|
|
29
|
+
import { useNodeContext } from '../contexts/node';
|
|
30
|
+
import { formatError, isDownloading, sleep } from '../util';
|
|
31
|
+
import joinUrlKeepSearch from '../util/join-url-keep-search';
|
|
31
32
|
import Icons from './icons';
|
|
33
|
+
import { getServerUrl } from './util';
|
|
32
34
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
33
35
|
export default function BlockletActions({
|
|
34
36
|
blocklet,
|
|
@@ -36,6 +38,7 @@ export default function BlockletActions({
|
|
|
36
38
|
onComplete,
|
|
37
39
|
variant,
|
|
38
40
|
hasPermission,
|
|
41
|
+
getComponentUrl,
|
|
39
42
|
useBlockletUrlEvaluation,
|
|
40
43
|
...rest
|
|
41
44
|
}) {
|
|
@@ -54,16 +57,43 @@ export default function BlockletActions({
|
|
|
54
57
|
recommendedUrl
|
|
55
58
|
} = useBlockletUrlEvaluation(blocklet);
|
|
56
59
|
const inProgress = isInProgress(blocklet.status);
|
|
57
|
-
const disableStart =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
const [disableStart, setDisableStart] = useState(false);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (!blocklet?.controller) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
setDisableStart(blocklet?.controller?.status?.value === BLOCKLET_CONTROLLER_STATUS.suspended);
|
|
66
|
+
const func = async () => {
|
|
67
|
+
try {
|
|
68
|
+
const data = await node.api.getLauncherSession({
|
|
69
|
+
input: {
|
|
70
|
+
launcherSessionId: blocklet?.controller?.launcherSessionId,
|
|
71
|
+
launcherUrl: blocklet?.controller?.launcherUrl
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
if (data?.error) {
|
|
75
|
+
console.error('get launcher session failed', data.error);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
setDisableStart([LAUNCH_SESSION_STATUS.expired, LAUNCH_SESSION_STATUS.terminated].includes(data?.launcherSession?.status));
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.error('call getLauncherSession error', error);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
func();
|
|
84
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
85
|
+
}, []);
|
|
64
86
|
const {
|
|
65
87
|
inService
|
|
66
88
|
} = node;
|
|
89
|
+
const handleOpenDashboard = () => {
|
|
90
|
+
const mountPoint = `/${blocklet.mountPoint || '/'}`.replace(/\/+/g, '/');
|
|
91
|
+
const href = getComponentUrl?.({
|
|
92
|
+
mountPoint,
|
|
93
|
+
blocklet
|
|
94
|
+
});
|
|
95
|
+
window.open(joinUrlKeepSearch(href, '.well-known/service/admin'));
|
|
96
|
+
};
|
|
67
97
|
const createHandler = (action, fn, requireUserConfirm = false) => async () => {
|
|
68
98
|
const onConfirm = async params => {
|
|
69
99
|
onStart({
|
|
@@ -329,17 +359,26 @@ export default function BlockletActions({
|
|
|
329
359
|
name: t('common.restart'),
|
|
330
360
|
handler: createHandler('restart', node.api.restartBlocklet, true),
|
|
331
361
|
disabled: disableStart || blocklet.status !== 'running'
|
|
332
|
-
},
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
362
|
+
}, isDownloading(blocklet.status) ? cancelDownloadAction : removeAction, {
|
|
363
|
+
separator: true
|
|
364
|
+
}, !inService ? {
|
|
365
|
+
action: 'dashboard',
|
|
366
|
+
icon: ({
|
|
367
|
+
style,
|
|
368
|
+
...restProps
|
|
369
|
+
}) => /*#__PURE__*/_jsx(Icons.Dashboard, {
|
|
370
|
+
...restProps,
|
|
371
|
+
style: {
|
|
372
|
+
...style,
|
|
373
|
+
width: '26px',
|
|
374
|
+
height: '26px',
|
|
375
|
+
paddingRight: '3px'
|
|
376
|
+
}
|
|
377
|
+
}),
|
|
378
|
+
name: t('sidebar.dashboard'),
|
|
379
|
+
handler: handleOpenDashboard,
|
|
380
|
+
disabled: disableStart || blocklet.status !== 'running'
|
|
381
|
+
} : null, {
|
|
343
382
|
separator: true
|
|
344
383
|
}, {
|
|
345
384
|
onlyInMenu: true,
|
|
@@ -467,6 +506,7 @@ export default function BlockletActions({
|
|
|
467
506
|
});
|
|
468
507
|
}
|
|
469
508
|
BlockletActions.propTypes = {
|
|
509
|
+
getComponentUrl: PropTypes.func,
|
|
470
510
|
blocklet: PropTypes.object.isRequired,
|
|
471
511
|
onStart: PropTypes.func.isRequired,
|
|
472
512
|
onComplete: PropTypes.func.isRequired,
|
|
@@ -475,6 +515,7 @@ BlockletActions.propTypes = {
|
|
|
475
515
|
useBlockletUrlEvaluation: PropTypes.func
|
|
476
516
|
};
|
|
477
517
|
BlockletActions.defaultProps = {
|
|
518
|
+
getComponentUrl: null,
|
|
478
519
|
variant: 'menu',
|
|
479
520
|
hasPermission: false,
|
|
480
521
|
useBlockletUrlEvaluation: () => ({
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
|
-
import { useState, useRef, useImperativeHandle, forwardRef, useEffect } from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
4
4
|
import { useParams } from 'react-router-dom';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import PageHeader from '@blocklet/launcher-layout/lib/page-header';
|
|
10
|
-
import Spinner from '@mui/material/CircularProgress';
|
|
11
|
-
import Typography from '@mui/material/Typography';
|
|
12
|
-
import TextField from '@mui/material/TextField';
|
|
13
|
-
import AddIcon from '@mui/icons-material/Link';
|
|
14
|
-
import CheckIcon from '@mui/icons-material/Check';
|
|
15
|
-
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
16
|
-
import styled from '@emotion/styled';
|
|
5
|
+
import { isInServerlessMode } from '@abtnode/util/lib/serverless';
|
|
6
|
+
import Alert from '@arcblock/ux/lib/Alert';
|
|
7
|
+
import AnimationWaiter from '@arcblock/ux/lib/AnimationWaiter';
|
|
8
|
+
import Button from '@arcblock/ux/lib/Button';
|
|
17
9
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
18
|
-
import {
|
|
10
|
+
import { BLOCKLET_APP_SPACE_REQUIREMENT, BLOCKLET_CONFIGURABLE_KEY, BlockletEvents, BlockletStatus } from '@blocklet/constant';
|
|
19
11
|
import Layout from '@blocklet/launcher-layout';
|
|
20
12
|
import { StepProvider, useStepContext } from '@blocklet/launcher-layout/lib/context/step';
|
|
21
|
-
import Box from '@mui/material/Box';
|
|
22
|
-
import { NODE_MODES } from '@abtnode/constant';
|
|
23
|
-
import Button from '@arcblock/ux/lib/Button';
|
|
24
|
-
import Alert from '@arcblock/ux/lib/Alert';
|
|
25
|
-
import AnimationWaiter from '@arcblock/ux/lib/AnimationWaiter';
|
|
26
13
|
import ResultMessage from '@blocklet/launcher-layout/lib/launch-result-message';
|
|
27
|
-
import
|
|
14
|
+
import PageHeader from '@blocklet/launcher-layout/lib/page-header';
|
|
15
|
+
import styled from '@emotion/styled';
|
|
16
|
+
import CheckIcon from '@mui/icons-material/Check';
|
|
17
|
+
import AddIcon from '@mui/icons-material/Link';
|
|
18
|
+
import Box from '@mui/material/Box';
|
|
19
|
+
import Spinner from '@mui/material/CircularProgress';
|
|
20
|
+
import TextField from '@mui/material/TextField';
|
|
21
|
+
import Typography from '@mui/material/Typography';
|
|
22
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
23
|
+
import flatten from 'lodash/flatten';
|
|
24
|
+
import isEmpty from 'lodash/isEmpty';
|
|
25
|
+
import isNil from 'lodash/isNil';
|
|
26
|
+
import uniqBy from 'lodash/uniqBy';
|
|
28
27
|
import urlPathFriendly from '@blocklet/meta/lib/url-path-friendly';
|
|
28
|
+
import { getDisplayName, getSharedConfigObj, hasStartEngine, isFreeBlocklet } from '@blocklet/meta/lib/util';
|
|
29
29
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
30
|
-
import { useNodeContext } from '../../contexts/node';
|
|
31
30
|
import { useBlockletContext } from '../../contexts/blocklet';
|
|
32
|
-
import {
|
|
33
|
-
import
|
|
31
|
+
import { ConfigSpaceProvider } from '../../contexts/config-space';
|
|
32
|
+
import { useNodeContext } from '../../contexts/node';
|
|
34
33
|
import Required from '../../form/required';
|
|
35
|
-
import
|
|
36
|
-
import {
|
|
34
|
+
import SchemaForm from '../../schema-form';
|
|
35
|
+
import { formatError, formatMountPoint, getBlockletLogoUrl, getBlockletMetaUrl, getStoreList, isNewStoreUrl } from '../../util';
|
|
37
36
|
import Agreement from '../agreement';
|
|
38
37
|
import InstallFromUrl from '../install-from-url';
|
|
38
|
+
import { ComponentPurchaseSelect } from '../purchase';
|
|
39
|
+
import { validatePathPrefix } from '../router/util';
|
|
40
|
+
import DidSpace from './did-space';
|
|
39
41
|
import SelectStore from './select-store';
|
|
40
42
|
import BlockletList from './store-blocklet-list';
|
|
41
|
-
import DidSpace from './did-space';
|
|
42
|
-
import { ConfigSpaceProvider } from '../../contexts/config-space';
|
|
43
43
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
44
44
|
const requirePurchase = meta => meta.inStore && isFreeBlocklet(meta) === false;
|
|
45
45
|
const isRequiredOnSetup = meta => {
|
|
@@ -209,7 +209,6 @@ export default function AddComponentCore({
|
|
|
209
209
|
const {
|
|
210
210
|
meta
|
|
211
211
|
} = component.current;
|
|
212
|
-
const isServerlessMode = nodeInfo.mode === NODE_MODES.SERVERLESS;
|
|
213
212
|
const updateParams = obj => setParams(x => ({
|
|
214
213
|
...x,
|
|
215
214
|
...obj
|
|
@@ -725,7 +724,7 @@ export default function AddComponentCore({
|
|
|
725
724
|
}
|
|
726
725
|
}), /*#__PURE__*/_jsx(SelectStore, {
|
|
727
726
|
stores: stores,
|
|
728
|
-
extra: !
|
|
727
|
+
extra: !isInServerlessMode(nodeInfo) ? /*#__PURE__*/_jsxs(Button, {
|
|
729
728
|
variant: "text",
|
|
730
729
|
color: "primary",
|
|
731
730
|
"data-cy": "add-component-from-url",
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { useState, useRef } from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import TextField from '@mui/material/TextField';
|
|
6
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
7
|
-
import { NODE_MODES } from '@abtnode/constant';
|
|
2
|
+
import { useRef, useState } from 'react';
|
|
3
|
+
import { isInServerlessMode } from '@abtnode/util/lib/serverless';
|
|
8
4
|
import Button from '@arcblock/ux/lib/Button';
|
|
5
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
6
|
+
import styled from '@emotion/styled';
|
|
9
7
|
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
|
8
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
9
|
+
import TextField from '@mui/material/TextField';
|
|
10
10
|
import Typography from '@mui/material/Typography';
|
|
11
|
-
import useLocalStorage from 'react-use/lib/useLocalStorage';
|
|
12
11
|
import uniqBy from 'lodash/uniqBy';
|
|
13
|
-
import
|
|
12
|
+
import useLocalStorage from 'react-use/lib/useLocalStorage';
|
|
14
13
|
import { useBlockletContext } from '../../contexts/blocklet';
|
|
14
|
+
import { useNodeContext } from '../../contexts/node';
|
|
15
15
|
import AddStore from '../../store/add';
|
|
16
16
|
import StoreItem from '../../store/item';
|
|
17
17
|
import { getStoreList } from '../../util';
|
|
@@ -52,7 +52,6 @@ export default function SelectStore({
|
|
|
52
52
|
protected: true
|
|
53
53
|
})), ...appStoreList], 'url');
|
|
54
54
|
const currentRegistry = storeUrl && storeList.find(x => storeUrl === x.url) || storeList[0];
|
|
55
|
-
const isServerlessMode = nodeInfo.mode === NODE_MODES.SERVERLESS;
|
|
56
55
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
57
56
|
children: [/*#__PURE__*/_jsxs(SelectStoreTitle, {
|
|
58
57
|
children: [/*#__PURE__*/_jsx(Button, {
|
|
@@ -126,7 +125,7 @@ export default function SelectStore({
|
|
|
126
125
|
}
|
|
127
126
|
})
|
|
128
127
|
}, x.url);
|
|
129
|
-
}), !
|
|
128
|
+
}), !isInServerlessMode(nodeInfo) && /*#__PURE__*/_jsx(AddStore, {
|
|
130
129
|
disabled: loading,
|
|
131
130
|
storeList: storeList,
|
|
132
131
|
teamDid: teamDid,
|
package/es/blocklet/icons.js
CHANGED
|
@@ -7,6 +7,7 @@ import Config from '@mui/icons-material/Settings';
|
|
|
7
7
|
import Log from '@mui/icons-material/Receipt';
|
|
8
8
|
import Group from '@mui/icons-material/Group';
|
|
9
9
|
import Cancel from '@mui/icons-material/NotInterested';
|
|
10
|
+
import Dashboard from '@arcblock/icons/lib/Dashboard';
|
|
10
11
|
export default {
|
|
11
12
|
Start,
|
|
12
13
|
Stop,
|
|
@@ -16,5 +17,6 @@ export default {
|
|
|
16
17
|
Config,
|
|
17
18
|
Log,
|
|
18
19
|
Group,
|
|
19
|
-
Cancel
|
|
20
|
+
Cancel,
|
|
21
|
+
Dashboard
|
|
20
22
|
};
|
|
@@ -10,7 +10,8 @@ function ConnectStoreList({
|
|
|
10
10
|
projectId,
|
|
11
11
|
releaseType,
|
|
12
12
|
publishedStoreIds,
|
|
13
|
-
onPublish
|
|
13
|
+
onPublish,
|
|
14
|
+
onDelete
|
|
14
15
|
}) {
|
|
15
16
|
const storeList = blocklet?.settings?.storeList || [];
|
|
16
17
|
const connectedMap = useMemo(() => {
|
|
@@ -37,13 +38,14 @@ function ConnectStoreList({
|
|
|
37
38
|
store: x,
|
|
38
39
|
published: publishedStoreIds?.indexOf(x.id) > -1,
|
|
39
40
|
connected: !!connectedMap[x.url],
|
|
40
|
-
onPublish: onPublish
|
|
41
|
+
onPublish: onPublish,
|
|
42
|
+
onDelete: onDelete
|
|
41
43
|
})
|
|
42
44
|
})
|
|
43
45
|
}, x.url)), /*#__PURE__*/_jsx(AddStore, {
|
|
44
46
|
onAdd: handleAddStore,
|
|
45
47
|
teamDid: did,
|
|
46
|
-
|
|
48
|
+
storeList: storeList
|
|
47
49
|
})]
|
|
48
50
|
});
|
|
49
51
|
}
|
|
@@ -53,10 +55,12 @@ ConnectStoreList.propTypes = {
|
|
|
53
55
|
releaseId: PropTypes.string.isRequired,
|
|
54
56
|
releaseType: PropTypes.string.isRequired,
|
|
55
57
|
onPublish: PropTypes.func,
|
|
58
|
+
onDelete: PropTypes.func,
|
|
56
59
|
publishedStoreIds: PropTypes.arrayOf(PropTypes.string)
|
|
57
60
|
};
|
|
58
61
|
ConnectStoreList.defaultProps = {
|
|
59
62
|
publishedStoreIds: [],
|
|
60
|
-
onPublish: () => {}
|
|
63
|
+
onPublish: () => {},
|
|
64
|
+
onDelete: () => {}
|
|
61
65
|
};
|
|
62
66
|
export default ConnectStoreList;
|
|
@@ -16,7 +16,9 @@ import Button from '@arcblock/ux/lib/Button';
|
|
|
16
16
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
17
17
|
import Tag from '@arcblock/ux/lib/Tag';
|
|
18
18
|
import RelativeTime from '@arcblock/ux/lib/RelativeTime';
|
|
19
|
+
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
19
20
|
import { Tooltip } from '@mui/material';
|
|
21
|
+
import { useSessionContext } from '../../contexts/session';
|
|
20
22
|
import { useBlockletContext } from '../../contexts/blocklet';
|
|
21
23
|
import { useNodeContext } from '../../contexts/node';
|
|
22
24
|
import EmptySpinner from '../../empty-spinner';
|
|
@@ -33,11 +35,15 @@ export default function ProjectList() {
|
|
|
33
35
|
const {
|
|
34
36
|
api
|
|
35
37
|
} = useNodeContext();
|
|
38
|
+
const {
|
|
39
|
+
api: sessionApi
|
|
40
|
+
} = useSessionContext();
|
|
36
41
|
const [loading, setLoading] = useState(true);
|
|
37
42
|
const {
|
|
38
43
|
blocklet
|
|
39
44
|
} = useBlockletContext();
|
|
40
45
|
const [deleteConfirm, setDeleteConfirm] = useState(null);
|
|
46
|
+
const [openDidConnect, setOpenDidConnect] = useState(false);
|
|
41
47
|
const {
|
|
42
48
|
componentDid = ''
|
|
43
49
|
} = useParams();
|
|
@@ -65,23 +71,27 @@ export default function ProjectList() {
|
|
|
65
71
|
const onDeleteProject = project => {
|
|
66
72
|
setDeleteConfirm(project);
|
|
67
73
|
};
|
|
68
|
-
const
|
|
74
|
+
const confirmDeleteProject = () => {
|
|
69
75
|
setLoading(false);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
Toast.error(
|
|
84
|
-
|
|
76
|
+
setOpenDidConnect(true);
|
|
77
|
+
};
|
|
78
|
+
const handleDidConnectClose = () => {
|
|
79
|
+
setOpenDidConnect(false);
|
|
80
|
+
setDeleteConfirm(null);
|
|
81
|
+
};
|
|
82
|
+
const handleDidConnectDidError = err => {
|
|
83
|
+
Toast.error(err.message);
|
|
84
|
+
setOpenDidConnect(false);
|
|
85
|
+
setDeleteConfirm(null);
|
|
86
|
+
};
|
|
87
|
+
const handleDidConnectDidSuccess = result => {
|
|
88
|
+
if (!result?.deleted) {
|
|
89
|
+
Toast.error('Delete project failed');
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
getProjects();
|
|
93
|
+
setOpenDidConnect(false);
|
|
94
|
+
setDeleteConfirm(null);
|
|
85
95
|
};
|
|
86
96
|
useEffect(() => {
|
|
87
97
|
getProjects();
|
|
@@ -266,6 +276,34 @@ export default function ProjectList() {
|
|
|
266
276
|
}
|
|
267
277
|
}
|
|
268
278
|
}].filter(Boolean);
|
|
279
|
+
const didConnect = openDidConnect ? /*#__PURE__*/_jsx(DidConnect, {
|
|
280
|
+
open: true,
|
|
281
|
+
popup: true,
|
|
282
|
+
onClose: handleDidConnectClose,
|
|
283
|
+
action: "check-has-project-id",
|
|
284
|
+
locale: locale,
|
|
285
|
+
checkFn: sessionApi.get,
|
|
286
|
+
saveConnect: false,
|
|
287
|
+
forceConnected: false,
|
|
288
|
+
checkTimeout: 5 * 60 * 1000,
|
|
289
|
+
onSuccess: handleDidConnectDidSuccess,
|
|
290
|
+
onError: handleDidConnectDidError,
|
|
291
|
+
extraParams: {
|
|
292
|
+
projectId: deleteConfirm.id,
|
|
293
|
+
did: blocklet.meta.did,
|
|
294
|
+
name: deleteConfirm.blockletTitle
|
|
295
|
+
},
|
|
296
|
+
messages: {
|
|
297
|
+
title: t('blocklet.publish.deleteProject.title', {
|
|
298
|
+
name: deleteConfirm.blockletTitle
|
|
299
|
+
}),
|
|
300
|
+
scan: t('blocklet.publish.deleteProject.scan', {
|
|
301
|
+
name: deleteConfirm.blockletTitle
|
|
302
|
+
}),
|
|
303
|
+
confirm: t('blocklet.publish.deleteProject.confirm'),
|
|
304
|
+
success: t('blocklet.publish.deleteProject.success')
|
|
305
|
+
}
|
|
306
|
+
}) : null;
|
|
269
307
|
return /*#__PURE__*/_jsxs(Main, {
|
|
270
308
|
children: [/*#__PURE__*/_jsxs(Box, {
|
|
271
309
|
display: "flex",
|
|
@@ -321,9 +359,9 @@ export default function ProjectList() {
|
|
|
321
359
|
title: `${t('common.delete')} ${deleteConfirm.blockletTitle}`,
|
|
322
360
|
description: t('blocklet.publish.deleteBlockletTip'),
|
|
323
361
|
confirm: t('common.confirm'),
|
|
324
|
-
onConfirm:
|
|
362
|
+
onConfirm: confirmDeleteProject,
|
|
325
363
|
onCancel: () => setDeleteConfirm(null)
|
|
326
|
-
})]
|
|
364
|
+
}), didConnect]
|
|
327
365
|
});
|
|
328
366
|
}
|
|
329
367
|
ProjectList.propTypes = {};
|
|
@@ -232,7 +232,6 @@ export default function ReleaseList() {
|
|
|
232
232
|
installUrl = url.href;
|
|
233
233
|
downloadUrl = joinUrl(`${WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${blocklet.meta.did}/${project.id}/${project.lastReleaseId}/download/${(project.lastReleaseFiles || [])[0]}`);
|
|
234
234
|
}
|
|
235
|
-
console.error('--debug--', release);
|
|
236
235
|
return /*#__PURE__*/_jsxs(Box, {
|
|
237
236
|
display: "flex",
|
|
238
237
|
alignItems: "center",
|
package/es/locales/ar.js
CHANGED
|
@@ -353,7 +353,9 @@ export default {
|
|
|
353
353
|
uploaded: 'تم التحميل',
|
|
354
354
|
uploadToStore: 'تحميل إلى المتجر',
|
|
355
355
|
upload: 'تحميل',
|
|
356
|
-
blockletStudio: 'استوديو بلوكليت'
|
|
356
|
+
blockletStudio: 'استوديو بلوكليت',
|
|
357
|
+
visitStore: 'زيارة المتجر',
|
|
358
|
+
reconnect: 'إعادة الاتصال'
|
|
357
359
|
},
|
|
358
360
|
blocklet: {
|
|
359
361
|
external: 'خارجي',
|
|
@@ -700,7 +702,14 @@ export default {
|
|
|
700
702
|
publishToStoreSuccess: 'تم نشر بلوكليت بنجاح في المتجر',
|
|
701
703
|
connectStoreSuccess: 'تم الاتصال بمتجر البلوكليت بنجاح',
|
|
702
704
|
uploadToStoreSuccess: 'تم تحميل بلوكليت بنجاح في المتجر ، تحتاج إلى نشره في المتجر',
|
|
703
|
-
viewLastRelease: 'عرض آخر إصدار'
|
|
705
|
+
viewLastRelease: 'عرض آخر إصدار',
|
|
706
|
+
reconnectStoreTip: 'بعد إعادة الاتصال، سيتم ربط مطور جديد. هل أنت متأكد أنك تريد إعادة الاتصال؟',
|
|
707
|
+
deleteProject: {
|
|
708
|
+
title: 'احذف {name}',
|
|
709
|
+
scan: 'امسح رمز الاستجابة السريعة أدناه لحذف {name}',
|
|
710
|
+
confirm: 'يرجى تأكيد استخدام محفظة الهوية اللامركزية',
|
|
711
|
+
success: 'تم حذف مشروع Blocklet ، يرجى متابعة العملية الخاصة بك.'
|
|
712
|
+
}
|
|
704
713
|
},
|
|
705
714
|
titleValidationError: 'يجب أن يكون طول العنوان على الأقل 3 أحرف',
|
|
706
715
|
descriptionValidationError: 'يجب أن تكون طول الوصف بين 3 و 160 حرفًا'
|
package/es/locales/de.js
CHANGED
|
@@ -353,7 +353,9 @@ export default {
|
|
|
353
353
|
uploaded: 'Hochgeladen',
|
|
354
354
|
uploadToStore: 'Upload in den Shop',
|
|
355
355
|
upload: 'Hochladen',
|
|
356
|
-
blockletStudio: 'Blocklet Studio'
|
|
356
|
+
blockletStudio: 'Blocklet Studio',
|
|
357
|
+
visitStore: 'Besuche den Laden',
|
|
358
|
+
reconnect: 'Verbinden wiederherstellen'
|
|
357
359
|
},
|
|
358
360
|
blocklet: {
|
|
359
361
|
external: 'Extern',
|
|
@@ -663,7 +665,7 @@ export default {
|
|
|
663
665
|
createBlocklet: 'Neuer Blocklet',
|
|
664
666
|
deleteBlockletTip: 'Der Blocklet kann nach dem Löschen nicht wiederhergestellt werden, bitte bestätigen',
|
|
665
667
|
componentNotRunning: 'Komponente {name} läuft nicht, starten Sie sie bitte zuerst',
|
|
666
|
-
releaseEmptyTip: '
|
|
668
|
+
releaseEmptyTip: 'Es gibt hier keine Veröffentlichungen',
|
|
667
669
|
createReleaseTip: 'Du kannst eine Veröffentlichung des Blocklets erstellen, zusammen mit Versionshinweisen und Ressourcen, die andere Personen nutzen können.',
|
|
668
670
|
createRelease: 'Neue Veröffentlichung',
|
|
669
671
|
deleteReleaseTip: 'Die Veröffentlichung kann nach Löschung nicht wiederhergestellt werden',
|
|
@@ -700,7 +702,14 @@ export default {
|
|
|
700
702
|
publishToStoreSuccess: 'Blocklet erfolgreich im Store veröffentlicht',
|
|
701
703
|
connectStoreSuccess: 'Blocklet Store erfolgreich verbunden',
|
|
702
704
|
uploadToStoreSuccess: 'Blocklet erfolgreich im Store hochgeladen, du musst es im Store veröffentlichen',
|
|
703
|
-
viewLastRelease: 'Letzte Version anzeigen'
|
|
705
|
+
viewLastRelease: 'Letzte Version anzeigen',
|
|
706
|
+
reconnectStoreTip: 'Nach dem erneuten Verbinden wird ein neuer Entwickler zugewiesen. Bist du sicher, dass du dich erneut verbinden möchtest?',
|
|
707
|
+
deleteProject: {
|
|
708
|
+
title: 'Lösche {name}',
|
|
709
|
+
scan: 'Scanne den QR-Code unten, um {name} zu löschen',
|
|
710
|
+
confirm: 'Bitte bestätigen Sie die Verwendung der DID-Brieftasche',
|
|
711
|
+
success: 'Das Blocklet-Projekt wurde gelöscht, bitte fahren Sie mit Ihrer Operation fort.'
|
|
712
|
+
}
|
|
704
713
|
},
|
|
705
714
|
titleValidationError: 'Die Länge des Titels muss mindestens 3 Zeichen betragen',
|
|
706
715
|
descriptionValidationError: 'Die Beschreibungslänge muss zwischen 3 und 160 Zeichen liegen'
|
package/es/locales/en.js
CHANGED
|
@@ -242,6 +242,7 @@ export default {
|
|
|
242
242
|
noticeTitle: 'Notice',
|
|
243
243
|
notification: 'Notification',
|
|
244
244
|
open: 'Open',
|
|
245
|
+
visitStore: 'Visit Store',
|
|
245
246
|
management: 'Management',
|
|
246
247
|
os: 'Operating System',
|
|
247
248
|
overview: 'Overview',
|
|
@@ -256,6 +257,7 @@ export default {
|
|
|
256
257
|
protected: 'Protected',
|
|
257
258
|
protocol: 'Protocol',
|
|
258
259
|
purchase: 'Purchase',
|
|
260
|
+
reconnect: 'Reconnect',
|
|
259
261
|
readMore: 'More',
|
|
260
262
|
redirect: 'Redirect',
|
|
261
263
|
redirectCode: 'Redirect Code',
|
|
@@ -658,9 +660,10 @@ export default {
|
|
|
658
660
|
blockletEmptyTip: 'There aren’t any blocklets here',
|
|
659
661
|
createBlockletTip: 'You can create new blocklet through existing resources, components, and configuration in this application',
|
|
660
662
|
createBlocklet: 'New blocklet',
|
|
661
|
-
deleteBlockletTip:
|
|
663
|
+
deleteBlockletTip: "The blocklet cannot be recovered after deletion, You also can't republish a new version of the app in question, please confirm",
|
|
664
|
+
reconnectStoreTip: 'After reconnecting, a new developer will be bound. Are you sure you want to reconnect?',
|
|
662
665
|
componentNotRunning: 'Component {name} is not running, please start it first',
|
|
663
|
-
releaseEmptyTip:
|
|
666
|
+
releaseEmptyTip: "There aren't any releases here",
|
|
664
667
|
viewLastRelease: 'View last release',
|
|
665
668
|
createReleaseTip: 'You can create a release of the blocklet, along with release notes and resources, for other people to use',
|
|
666
669
|
createRelease: 'New release',
|
|
@@ -682,6 +685,12 @@ export default {
|
|
|
682
685
|
confirm: 'Confirm using DID Wallet',
|
|
683
686
|
success: 'Blocklet DID has been generated, please continue your operation'
|
|
684
687
|
},
|
|
688
|
+
deleteProject: {
|
|
689
|
+
title: 'Delete {name}',
|
|
690
|
+
scan: 'Scan the QR code below to delete {name}',
|
|
691
|
+
confirm: 'Confirm using DID Wallet',
|
|
692
|
+
success: 'Blocklet project has been deleted, please continue your operation'
|
|
693
|
+
},
|
|
685
694
|
saveDraft: 'Save Draft',
|
|
686
695
|
releaseNote: 'Release Note',
|
|
687
696
|
errorTip: {
|
package/es/locales/es.js
CHANGED
|
@@ -353,7 +353,9 @@ export default {
|
|
|
353
353
|
uploaded: 'Subido',
|
|
354
354
|
uploadToStore: 'Subir a la tienda',
|
|
355
355
|
upload: 'Subir',
|
|
356
|
-
blockletStudio: 'Blocklet Studio'
|
|
356
|
+
blockletStudio: 'Blocklet Studio',
|
|
357
|
+
visitStore: 'Visitar tienda',
|
|
358
|
+
reconnect: 'Reconecta'
|
|
357
359
|
},
|
|
358
360
|
blocklet: {
|
|
359
361
|
external: 'Externo',
|
|
@@ -663,7 +665,7 @@ export default {
|
|
|
663
665
|
createBlocklet: 'Nuevo bloque',
|
|
664
666
|
deleteBlockletTip: 'El blocklet no puede ser recuperado después de ser eliminado, por favor confirma',
|
|
665
667
|
componentNotRunning: 'El componente {name} no está en ejecución, por favor iniciar primero',
|
|
666
|
-
releaseEmptyTip: 'No hay
|
|
668
|
+
releaseEmptyTip: 'No hay ninguna versión aquí',
|
|
667
669
|
createReleaseTip: 'Puedes crear una versión de la blocklet, junto con notas de lanzamiento y recursos, para que otras personas la puedan utilizar',
|
|
668
670
|
createRelease: 'Nuevo lanzamiento',
|
|
669
671
|
deleteReleaseTip: 'La versión no se puede recuperar después de la eliminación',
|
|
@@ -700,7 +702,14 @@ export default {
|
|
|
700
702
|
publishToStoreSuccess: 'Bloque publicado en la tienda exitosamente',
|
|
701
703
|
connectStoreSuccess: 'La tienda de Blocklet se conectó correctamente',
|
|
702
704
|
uploadToStoreSuccess: 'Bloque de carga a la tienda exitosamente, necesitas publicarlo en la tienda',
|
|
703
|
-
viewLastRelease: 'Ver última versión'
|
|
705
|
+
viewLastRelease: 'Ver última versión',
|
|
706
|
+
reconnectStoreTip: 'Después de reconectar, se vinculará un nuevo desarrollador. ¿Estás seguro de que deseas reconectar?',
|
|
707
|
+
deleteProject: {
|
|
708
|
+
title: 'Borrar {name}',
|
|
709
|
+
scan: 'Escanee el código QR a continuación para eliminar a {name}',
|
|
710
|
+
confirm: 'Confirmar usando el monedero DID',
|
|
711
|
+
success: 'El proyecto Blocklet ha sido eliminado, por favor continúa tu operación'
|
|
712
|
+
}
|
|
704
713
|
},
|
|
705
714
|
titleValidationError: 'La longitud del título debe ser de al menos 3 caracteres',
|
|
706
715
|
descriptionValidationError: 'La longitud de la descripción debe estar entre 3 y 160 caracteres'
|