@abtnode/ux 1.16.28-beta-b30865b3 → 1.16.28-next-5a717317
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/actions.js +6 -8
- package/lib/analytics/traffic.js +10 -4
- package/lib/blocklet/authentication/federated/federated-detail-dialog.js +2 -2
- package/lib/blocklet/blocklet-source.js +2 -2
- package/lib/blocklet/component/component-cell.js +84 -83
- package/lib/blocklet/component/configuration.js +36 -52
- package/lib/blocklet/component/did-space/connect-to.js +4 -4
- package/lib/blocklet/component/index.js +38 -29
- package/lib/blocklet/component/navigation/navigation-dialog.js +3 -2
- package/lib/blocklet/component/space-connector.js +3 -3
- package/lib/blocklet/component/space-selector.js +2 -2
- package/lib/blocklet/component/store-blocklet-list.js +3 -3
- package/lib/blocklet/logo-uploader.js +2 -2
- package/lib/blocklet/notification/push-kit.js +1 -1
- package/lib/blocklet/preferences/index.js +3 -3
- package/lib/blocklet/publish/create-release/resources.js +3 -4
- package/lib/blocklet/publish/release-list.js +4 -4
- package/lib/blocklet/purchase/component-purchase.js +2 -2
- package/lib/blocklet/router/action/add-rule.js +18 -31
- package/lib/blocklet/router/rule-actions.js +1 -8
- package/lib/blocklet/storage/connect-to.js +4 -4
- package/lib/blocklet/storage/item.js +3 -3
- package/lib/blocklet/util.js +4 -4
- package/lib/hooks/url-evaluation.js +2 -2
- package/lib/hooks/use-app-logo.js +4 -4
- package/lib/hooks/use-bundle-logo.js +4 -4
- package/lib/invitation/invitation-receive.js +1 -1
- package/lib/locales/ar.js +1 -5
- package/lib/locales/de.js +0 -4
- package/lib/locales/en.js +1 -5
- package/lib/locales/es.js +0 -4
- package/lib/locales/fr.js +0 -4
- package/lib/locales/hi.js +0 -4
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +0 -4
- package/lib/locales/ja.js +0 -4
- package/lib/locales/ko.js +0 -4
- package/lib/locales/pt.js +0 -4
- package/lib/locales/ru.js +0 -4
- package/lib/locales/th.js +0 -4
- package/lib/locales/vi.js +0 -4
- package/lib/locales/zh-tw.js +1 -5
- package/lib/locales/zh.js +1 -5
- package/lib/store/connect-actions.js +2 -2
- package/lib/store/item.js +2 -2
- package/lib/team/members/util.js +3 -3
- package/lib/util/index.js +18 -18
- package/lib/util/join-url-keep-search.js +2 -2
- package/lib/util/spaces.js +2 -4
- package/package.json +20 -19
- package/lib/blocklet/component/component-cell-mount-poin.js +0 -164
- package/lib/blocklet/publish/create-release/keep-now-resources.js +0 -15
package/lib/actions.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { useState, createElement as _createElement } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
|
-
import
|
|
4
|
+
import IconButton from '@mui/material/IconButton';
|
|
5
|
+
import Menu from '@mui/material/Menu';
|
|
6
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
5
7
|
import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
|
|
8
|
+
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
9
|
+
import ListItemText from '@mui/material/ListItemText';
|
|
6
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
11
|
export default function Actions({
|
|
8
12
|
actions,
|
|
@@ -53,14 +57,9 @@ export default function Actions({
|
|
|
53
57
|
close: onClose
|
|
54
58
|
});
|
|
55
59
|
}
|
|
56
|
-
if (action.separator) {
|
|
57
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
58
|
-
return /*#__PURE__*/_jsx(Divider, {}, `separator-${index}`);
|
|
59
|
-
}
|
|
60
60
|
const {
|
|
61
61
|
icon,
|
|
62
62
|
text,
|
|
63
|
-
render,
|
|
64
63
|
onClick,
|
|
65
64
|
disabled = false,
|
|
66
65
|
...opts
|
|
@@ -70,8 +69,7 @@ export default function Actions({
|
|
|
70
69
|
disabled: disabled,
|
|
71
70
|
dense: true,
|
|
72
71
|
onClick: async e => {
|
|
73
|
-
e
|
|
74
|
-
await onClick?.(e);
|
|
72
|
+
await onClick(e);
|
|
75
73
|
onClose();
|
|
76
74
|
}
|
|
77
75
|
// eslint-disable-next-line react/no-array-index-key
|
package/lib/analytics/traffic.js
CHANGED
|
@@ -3,10 +3,16 @@
|
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
4
|
import dayjs from '@abtnode/util/lib/dayjs';
|
|
5
5
|
import nthArg from 'lodash/nthArg';
|
|
6
|
-
import
|
|
6
|
+
import joinUrl from 'url-join';
|
|
7
7
|
import useAsyncRetry from 'react-use/lib/useAsyncRetry';
|
|
8
8
|
import Iframe from 'react-iframe';
|
|
9
|
-
import
|
|
9
|
+
import Alert from '@mui/material/Alert';
|
|
10
|
+
import Spinner from '@mui/material/CircularProgress';
|
|
11
|
+
import Grid from '@mui/material/Grid';
|
|
12
|
+
import Typography from '@mui/material/Typography';
|
|
13
|
+
import Button from '@mui/material/Button';
|
|
14
|
+
import IconButton from '@mui/material/IconButton';
|
|
15
|
+
import Popover from '@mui/material/Popover';
|
|
10
16
|
import ViewIcon from '@mui/icons-material/LaunchOutlined';
|
|
11
17
|
import { DateRangePicker } from 'mui-daterange-picker';
|
|
12
18
|
import { DatePicker } from '@mui/x-date-pickers';
|
|
@@ -108,7 +114,7 @@ export default function TrafficInsights({
|
|
|
108
114
|
error
|
|
109
115
|
} = data;
|
|
110
116
|
if (!list.length && loading) {
|
|
111
|
-
return /*#__PURE__*/_jsx(
|
|
117
|
+
return /*#__PURE__*/_jsx(Spinner, {});
|
|
112
118
|
}
|
|
113
119
|
if (error) {
|
|
114
120
|
return /*#__PURE__*/_jsx(Alert, {
|
|
@@ -144,7 +150,7 @@ export default function TrafficInsights({
|
|
|
144
150
|
|
|
145
151
|
// eslint-disable-next-line no-nested-ternary
|
|
146
152
|
const pathPrefix = inService ? WELLKNOWN_SERVICE_PATH_PREFIX : process.env.NODE_ENV === 'production' ? info.routing.adminPath : '';
|
|
147
|
-
const breakdownUrl =
|
|
153
|
+
const breakdownUrl = joinUrl(window.location.origin, pathPrefix, `/api/analytics/traffic?date=${dayjs(date).format('YYYY-MM-DD')}&did=${did}`);
|
|
148
154
|
const onRangeChange = range => {
|
|
149
155
|
setDateRange(range);
|
|
150
156
|
setAnchorEl(null);
|
|
@@ -11,7 +11,7 @@ import { Address } from '@arcblock/did-connect';
|
|
|
11
11
|
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
12
12
|
import StarsIcon from '@mui/icons-material/Stars';
|
|
13
13
|
import isUrl from 'is-url';
|
|
14
|
-
import
|
|
14
|
+
import joinUrl from 'url-join';
|
|
15
15
|
import { useBlockletContext } from '../../../contexts/blocklet';
|
|
16
16
|
import { useNodeContext } from '../../../contexts/node';
|
|
17
17
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -95,7 +95,7 @@ const FederatedDetailDialog = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
97
|
if (['appLogo'].includes(key)) {
|
|
98
|
-
const logoUrl = isUrl(value) ? value :
|
|
98
|
+
const logoUrl = isUrl(value) ? value : joinUrl(state.data.appUrl || '', value || '');
|
|
99
99
|
try {
|
|
100
100
|
const logoUrlInstance = new URL(logoUrl);
|
|
101
101
|
logoUrlInstance.searchParams.set('imageFilter', 'resize');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
3
|
+
import joinUrl from 'url-join';
|
|
4
4
|
import toUpper from 'lodash/toUpper';
|
|
5
5
|
import Tag from '@arcblock/ux/lib/Tag';
|
|
6
6
|
import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
@@ -21,7 +21,7 @@ export default function BlockletSource({
|
|
|
21
21
|
type: "success",
|
|
22
22
|
children: toUpper(sourceInfo.source)
|
|
23
23
|
}, "source"), sourceInfo.source === 'registry' && /*#__PURE__*/_jsx(ExternalLink, {
|
|
24
|
-
href:
|
|
24
|
+
href: joinUrl(sourceInfo.deployedFrom, 'blocklets', blocklet?.meta?.bundleDid || ''),
|
|
25
25
|
target: "_blank",
|
|
26
26
|
className: "page-link",
|
|
27
27
|
underline: "hover",
|
|
@@ -11,6 +11,7 @@ import DeleteIcon from '@mui/icons-material/Delete';
|
|
|
11
11
|
import { Icon } from '@iconify/react';
|
|
12
12
|
import Tooltip from '@mui/material/Tooltip';
|
|
13
13
|
import Box from '@mui/material/Box';
|
|
14
|
+
import normalizePathPrefix from '@abtnode/util/lib/normalize-path-prefix';
|
|
14
15
|
import { getComponentMissingConfigs, getDisplayName, isInProgress, hasStartEngine } from '@blocklet/meta/lib/util';
|
|
15
16
|
import SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined';
|
|
16
17
|
import { hasMountPoint } from '@blocklet/meta/lib/engine';
|
|
@@ -25,7 +26,6 @@ import StartComponent from './start';
|
|
|
25
26
|
import Line from './line';
|
|
26
27
|
import Actions from '../../actions';
|
|
27
28
|
import ComponentInfoDialog from './component-info-dialog';
|
|
28
|
-
import ComponentCellMountPoint from './component-cell-mount-poin';
|
|
29
29
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
30
30
|
const isResource = component => !component?.meta?.group;
|
|
31
31
|
const getComponentName = (componentId, app) => {
|
|
@@ -62,7 +62,6 @@ export default function ComponentCell({
|
|
|
62
62
|
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
|
63
63
|
const [loading, setLoading] = useState(false);
|
|
64
64
|
const [confirmSetting, setConfirmSetting] = useState(null);
|
|
65
|
-
const [showComponentConfiguration, setShowComponentConfiguration] = useState(false);
|
|
66
65
|
const {
|
|
67
66
|
deletingBlocklets: deletingComponents
|
|
68
67
|
} = useDeletingBlockletContext();
|
|
@@ -163,11 +162,33 @@ export default function ComponentCell({
|
|
|
163
162
|
})]
|
|
164
163
|
})]
|
|
165
164
|
})]
|
|
166
|
-
}, blocklet), hasMountPoint(blocklet.meta) && /*#__PURE__*/_jsx(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
165
|
+
}, blocklet), hasMountPoint(blocklet.meta) && /*#__PURE__*/_jsx(Box, {
|
|
166
|
+
sx: {
|
|
167
|
+
display: {
|
|
168
|
+
xs: 'none',
|
|
169
|
+
md: 'flex'
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
alignItems: "center",
|
|
173
|
+
flexGrow: "1",
|
|
174
|
+
children: /*#__PURE__*/_jsx("a", {
|
|
175
|
+
target: "_blank",
|
|
176
|
+
href: href,
|
|
177
|
+
rel: "noopener noreferrer",
|
|
178
|
+
title: href,
|
|
179
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
180
|
+
maxWidth: 400,
|
|
181
|
+
sx: {
|
|
182
|
+
color: 'secondary.main',
|
|
183
|
+
fontSize: 16,
|
|
184
|
+
px: 2
|
|
185
|
+
},
|
|
186
|
+
overflow: "hidden",
|
|
187
|
+
whiteSpace: "nowrap",
|
|
188
|
+
textOverflow: "ellipsis",
|
|
189
|
+
children: normalizePathPrefix(mountPoint)
|
|
190
|
+
})
|
|
191
|
+
})
|
|
171
192
|
}, mountPoint), /*#__PURE__*/_jsx("div", {
|
|
172
193
|
style: {
|
|
173
194
|
flex: 1
|
|
@@ -177,14 +198,7 @@ export default function ComponentCell({
|
|
|
177
198
|
alignItems: "center",
|
|
178
199
|
children: [hasStartEngine(blocklet.meta) && /*#__PURE__*/_jsx(Tooltip, {
|
|
179
200
|
title: t('common.visit'),
|
|
180
|
-
children: /*#__PURE__*/_jsx(
|
|
181
|
-
component: "a",
|
|
182
|
-
sx: {
|
|
183
|
-
display: {
|
|
184
|
-
xs: 'flex',
|
|
185
|
-
md: 'none'
|
|
186
|
-
}
|
|
187
|
-
},
|
|
201
|
+
children: /*#__PURE__*/_jsx("a", {
|
|
188
202
|
target: "_blank",
|
|
189
203
|
href: href,
|
|
190
204
|
rel: "noopener noreferrer",
|
|
@@ -193,73 +207,66 @@ export default function ComponentCell({
|
|
|
193
207
|
children: /*#__PURE__*/_jsx(LaunchIcon, {})
|
|
194
208
|
})
|
|
195
209
|
})
|
|
210
|
+
}), /*#__PURE__*/_jsx(ComponentConfiguration, {
|
|
211
|
+
blocklet: blocklet,
|
|
212
|
+
ancestors: ancestors,
|
|
213
|
+
children: ({
|
|
214
|
+
open
|
|
215
|
+
}) => /*#__PURE__*/_jsx(Tooltip, {
|
|
216
|
+
title: t('common.config'),
|
|
217
|
+
children: /*#__PURE__*/_jsx(StyledBadge, {
|
|
218
|
+
color: "error",
|
|
219
|
+
badgeContent: "",
|
|
220
|
+
variant: "dot",
|
|
221
|
+
invisible: !getComponentMissingConfigs(blocklet, ancestors[0]).length,
|
|
222
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
223
|
+
onClick: open,
|
|
224
|
+
size: "small",
|
|
225
|
+
children: /*#__PURE__*/_jsx(SettingsOutlinedIcon, {})
|
|
226
|
+
})
|
|
227
|
+
})
|
|
228
|
+
}, "config")
|
|
196
229
|
}), /*#__PURE__*/_jsx(StartComponent, {
|
|
197
230
|
blocklet: app,
|
|
198
231
|
component: blocklet,
|
|
199
232
|
onStart: onStart,
|
|
200
233
|
onStop: onStop,
|
|
201
234
|
disabled: !['starting', 'stopping'].includes(app.status) && isInProgress(app.status)
|
|
202
|
-
}), /*#__PURE__*/_jsx(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
},
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
setShowDeleteConfirm(true);
|
|
238
|
-
},
|
|
239
|
-
disabled: appInProgress || componentInProgress || !!deleteDisabledTip,
|
|
240
|
-
tip: deleteDisabledTip
|
|
241
|
-
}, {
|
|
242
|
-
separator: true
|
|
243
|
-
}, {
|
|
244
|
-
icon: /*#__PURE__*/_jsx(SettingsOutlinedIcon, {}),
|
|
245
|
-
onClick: () => {
|
|
246
|
-
setShowComponentConfiguration(true);
|
|
247
|
-
},
|
|
248
|
-
text: /*#__PURE__*/_jsx(StyledBadge, {
|
|
249
|
-
color: "error",
|
|
250
|
-
badgeContent: "",
|
|
251
|
-
variant: "dot",
|
|
252
|
-
invisible: !getComponentMissingConfigs(blocklet, ancestors[0]).length,
|
|
253
|
-
children: /*#__PURE__*/_jsx(Box, {
|
|
254
|
-
sx: {
|
|
255
|
-
width: '100%'
|
|
256
|
-
},
|
|
257
|
-
children: t('common.config')
|
|
258
|
-
})
|
|
259
|
-
}),
|
|
260
|
-
disabled: appInProgress || componentInProgress
|
|
261
|
-
}].filter(Boolean)
|
|
262
|
-
})
|
|
235
|
+
}), /*#__PURE__*/_jsx(Actions, {
|
|
236
|
+
"data-cy": "component-actions",
|
|
237
|
+
actions: [hasStartEngine(blocklet.meta) || isResource(blocklet) ? {
|
|
238
|
+
icon: /*#__PURE__*/_jsx(InfoOutlinedIcon, {}),
|
|
239
|
+
text: t('common.detail'),
|
|
240
|
+
onClick: () => {
|
|
241
|
+
setComponentInfo(blocklet);
|
|
242
|
+
}
|
|
243
|
+
} : null, {
|
|
244
|
+
icon: /*#__PURE__*/_jsx(RestartIcon, {}),
|
|
245
|
+
text: t('common.restart'),
|
|
246
|
+
onClick: () => {
|
|
247
|
+
setConfirmSetting({
|
|
248
|
+
title: `${t('common.restart')} ${blocklet.meta.title}`,
|
|
249
|
+
description: t('blocklet.action.restartDescription'),
|
|
250
|
+
confirm: t('blocklet.action.confirmRestart'),
|
|
251
|
+
cancel: t('common.cancel'),
|
|
252
|
+
onConfirm: async () => {
|
|
253
|
+
setLoading(true);
|
|
254
|
+
await onRestart(blocklet);
|
|
255
|
+
setLoading(false);
|
|
256
|
+
},
|
|
257
|
+
onCancel: () => setConfirmSetting(null)
|
|
258
|
+
});
|
|
259
|
+
},
|
|
260
|
+
disabled: loading || appInProgress || componentInProgress || blocklet.status !== 'running'
|
|
261
|
+
}, {
|
|
262
|
+
icon: /*#__PURE__*/_jsx(DeleteIcon, {}),
|
|
263
|
+
text: t('common.delete'),
|
|
264
|
+
onClick: () => {
|
|
265
|
+
setShowDeleteConfirm(true);
|
|
266
|
+
},
|
|
267
|
+
disabled: appInProgress || componentInProgress || !!deleteDisabledTip,
|
|
268
|
+
tip: deleteDisabledTip
|
|
269
|
+
}].filter(Boolean)
|
|
263
270
|
})]
|
|
264
271
|
}, "actions")]
|
|
265
272
|
}, "group-not-gateway-box"), /*#__PURE__*/_jsx(Line, {}, "line"), /*#__PURE__*/_jsx(ComponentInfoDialog, {
|
|
@@ -283,13 +290,7 @@ export default function ComponentCell({
|
|
|
283
290
|
params: confirmSetting.params,
|
|
284
291
|
onConfirm: confirmSetting.onConfirm,
|
|
285
292
|
onCancel: confirmSetting.onCancel
|
|
286
|
-
}, "confirm-setting")
|
|
287
|
-
open: true,
|
|
288
|
-
hiddenChildren: true,
|
|
289
|
-
onClose: () => setShowComponentConfiguration(false),
|
|
290
|
-
blocklet: blocklet,
|
|
291
|
-
ancestors: ancestors
|
|
292
|
-
})]
|
|
293
|
+
}, "confirm-setting")]
|
|
293
294
|
});
|
|
294
295
|
}
|
|
295
296
|
ComponentCell.propTypes = {
|
|
@@ -12,16 +12,13 @@ import Tabs from '@arcblock/ux/lib/Tabs';
|
|
|
12
12
|
import { isInstalling } from '../../util';
|
|
13
13
|
import ComponentEnvironment from './environment';
|
|
14
14
|
import ComponentSetting from './setting';
|
|
15
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
export default function ComponentConfiguration({
|
|
17
|
-
open,
|
|
18
|
-
onClose,
|
|
19
|
-
hiddenChildren,
|
|
20
17
|
blocklet,
|
|
21
18
|
ancestors,
|
|
22
19
|
children
|
|
23
20
|
}) {
|
|
24
|
-
const [showDialog, setShowDialog] = useState(
|
|
21
|
+
const [showDialog, setShowDialog] = useState('');
|
|
25
22
|
const {
|
|
26
23
|
t
|
|
27
24
|
} = useLocaleContext();
|
|
@@ -34,11 +31,10 @@ export default function ComponentConfiguration({
|
|
|
34
31
|
if (blocklet.status === 'unknown' && isInstalling(blocklet.status)) {
|
|
35
32
|
return null;
|
|
36
33
|
}
|
|
37
|
-
const
|
|
38
|
-
onClose?.();
|
|
34
|
+
const onClose = () => {
|
|
39
35
|
setShowDialog(false);
|
|
40
36
|
};
|
|
41
|
-
const
|
|
37
|
+
const onOpen = e => {
|
|
42
38
|
e.stopPropagation();
|
|
43
39
|
// eslint-disable-next-line no-unused-expressions
|
|
44
40
|
setShowDialog(true);
|
|
@@ -73,57 +69,45 @@ export default function ComponentConfiguration({
|
|
|
73
69
|
setTab(newTab);
|
|
74
70
|
};
|
|
75
71
|
const tabConfig = tabConfigs[tab] || tabConfigsArr[0];
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}) : /*#__PURE__*/_jsx(ComponentEnvironment, {
|
|
107
|
-
blocklet: blocklet,
|
|
108
|
-
ancestors: ancestors
|
|
109
|
-
})
|
|
110
|
-
})]
|
|
111
|
-
});
|
|
72
|
+
return [typeof children === 'function' ? children({
|
|
73
|
+
open: onOpen
|
|
74
|
+
}) : /*#__PURE__*/_jsx(IconButton, {
|
|
75
|
+
onClick: onOpen,
|
|
76
|
+
"data-cy": "action-config-component",
|
|
77
|
+
children: /*#__PURE__*/_jsx(EditIcon, {})
|
|
78
|
+
}), showDialog && /*#__PURE__*/_jsx(StyledDialog, {
|
|
79
|
+
open: true,
|
|
80
|
+
fullWidth: true,
|
|
81
|
+
maxWidth: "md",
|
|
82
|
+
title: name,
|
|
83
|
+
onClose: onClose,
|
|
84
|
+
PaperProps: {
|
|
85
|
+
style: {
|
|
86
|
+
minHeight: 'auto'
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
children: isComponent ? /*#__PURE__*/_jsxs(Box, {
|
|
90
|
+
mt: 1,
|
|
91
|
+
children: [/*#__PURE__*/_jsx(Tabs, {
|
|
92
|
+
tabs: tabs,
|
|
93
|
+
current: tab,
|
|
94
|
+
onChange: onTabChange,
|
|
95
|
+
scrollButtons: "auto"
|
|
96
|
+
}), tabConfig.component]
|
|
97
|
+
}) : /*#__PURE__*/_jsx(ComponentEnvironment, {
|
|
98
|
+
blocklet: blocklet,
|
|
99
|
+
ancestors: ancestors
|
|
100
|
+
})
|
|
101
|
+
})];
|
|
112
102
|
}
|
|
113
103
|
ComponentConfiguration.propTypes = {
|
|
114
104
|
blocklet: PropTypes.object.isRequired,
|
|
115
105
|
ancestors: PropTypes.array,
|
|
116
|
-
children: PropTypes.any
|
|
117
|
-
open: PropTypes.bool,
|
|
118
|
-
onClose: PropTypes.func,
|
|
119
|
-
hiddenChildren: PropTypes.bool
|
|
106
|
+
children: PropTypes.any
|
|
120
107
|
};
|
|
121
108
|
ComponentConfiguration.defaultProps = {
|
|
122
109
|
ancestors: [],
|
|
123
|
-
children: null
|
|
124
|
-
open: false,
|
|
125
|
-
onClose: null,
|
|
126
|
-
hiddenChildren: false
|
|
110
|
+
children: null
|
|
127
111
|
};
|
|
128
112
|
const StyledDialog = styled(Dialog)`
|
|
129
113
|
.MuiDialogContent-root {
|
|
@@ -3,7 +3,7 @@ import React, { useState } from 'react';
|
|
|
3
3
|
import Button from '@arcblock/ux/lib/Button';
|
|
4
4
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
5
5
|
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
6
|
-
import
|
|
6
|
+
import joinUrl from 'url-join';
|
|
7
7
|
import toast from '@arcblock/ux/lib/Toast';
|
|
8
8
|
import SplitButton from '@arcblock/ux/lib/SplitButton';
|
|
9
9
|
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
@@ -62,7 +62,7 @@ function ConnectTo({
|
|
|
62
62
|
checkTimeout: 1000 * 300,
|
|
63
63
|
prefix: '/api/did',
|
|
64
64
|
checkFn: axios.create({
|
|
65
|
-
baseURL:
|
|
65
|
+
baseURL: joinUrl(window.location.origin, getPathPrefix())
|
|
66
66
|
}).get,
|
|
67
67
|
messages: {
|
|
68
68
|
title: t('storage.spaces.provideNFT.title', {
|
|
@@ -191,10 +191,10 @@ function ConnectTo({
|
|
|
191
191
|
setAuthorizeConnect(preValue => ({
|
|
192
192
|
...preValue,
|
|
193
193
|
open: true,
|
|
194
|
-
prefix:
|
|
194
|
+
prefix: joinUrl(didSpacesCoreUrl, 'space/api/did'),
|
|
195
195
|
baseUrl: new URL(didSpacesCoreUrl).origin,
|
|
196
196
|
checkFn: axios.create({
|
|
197
|
-
baseURL:
|
|
197
|
+
baseURL: joinUrl(didSpacesCoreUrl, 'space')
|
|
198
198
|
}).get,
|
|
199
199
|
extraParams: {
|
|
200
200
|
appDid: blockletInfo.appDid,
|
|
@@ -7,10 +7,11 @@ import DialogContent from '@mui/material/DialogContent';
|
|
|
7
7
|
import DialogTitle from '@mui/material/DialogTitle';
|
|
8
8
|
import DialogActions from '@mui/material/DialogActions';
|
|
9
9
|
import UpdateIcon from '@mui/icons-material/Update';
|
|
10
|
+
import IconButton from '@mui/material/IconButton';
|
|
10
11
|
import AddIcon from '@mui/icons-material/Add';
|
|
11
|
-
import { Icon } from '@iconify/react';
|
|
12
12
|
import SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined';
|
|
13
13
|
import Grid from '@mui/material/Grid';
|
|
14
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
14
15
|
import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
|
|
15
16
|
import Checkbox from '@mui/material/Checkbox';
|
|
16
17
|
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
@@ -36,7 +37,6 @@ import useGetInstallComponentByUrl from '../../hooks/use-install-component-by-ur
|
|
|
36
37
|
import ComponentCell, { StyledBadge, StyledComponentRow } from './component-cell';
|
|
37
38
|
import OptionalComponentCell from './optional-component-cell';
|
|
38
39
|
import AddComponentDialog from './add-component/add-component-dialog';
|
|
39
|
-
import Actions from '../../actions';
|
|
40
40
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
41
41
|
export default function BlockletComponent({
|
|
42
42
|
blocklet,
|
|
@@ -61,8 +61,6 @@ export default function BlockletComponent({
|
|
|
61
61
|
const [updateConfirm, setUpdateConfirm] = useState(null);
|
|
62
62
|
const [showSettings, setShowSettings] = useState(null);
|
|
63
63
|
const [showContainer, setShowContainer] = useState(false);
|
|
64
|
-
const [showAddRule, setShowAddRule] = useState(false);
|
|
65
|
-
const [showComponentConfiguration, setShowComponentConfiguration] = useState(false);
|
|
66
64
|
const [installComponentMeta, setInstallComponentMeta] = useState(null);
|
|
67
65
|
const needMigration = blocklet && blocklet.structVersion !== APP_STRUCT_VERSION;
|
|
68
66
|
|
|
@@ -285,7 +283,24 @@ export default function BlockletComponent({
|
|
|
285
283
|
children: /*#__PURE__*/_jsxs(Box, {
|
|
286
284
|
display: "flex",
|
|
287
285
|
alignItems: "center",
|
|
288
|
-
children: [
|
|
286
|
+
children: [/*#__PURE__*/_jsx(AddRule, {
|
|
287
|
+
children: ({
|
|
288
|
+
open
|
|
289
|
+
}) => /*#__PURE__*/_jsxs(Button, {
|
|
290
|
+
disabled: loading || isInProgress(blocklet.status),
|
|
291
|
+
variant: "text",
|
|
292
|
+
color: "primary",
|
|
293
|
+
"data-cy": "add-rule",
|
|
294
|
+
className: "sm-hide-icon",
|
|
295
|
+
onClick: open,
|
|
296
|
+
children: [/*#__PURE__*/_jsx(AddIcon, {
|
|
297
|
+
style: {
|
|
298
|
+
fontSize: '1.3em',
|
|
299
|
+
marginRight: 4
|
|
300
|
+
}
|
|
301
|
+
}), t('router.rule.add.title')]
|
|
302
|
+
})
|
|
303
|
+
}), !needMigration && /*#__PURE__*/_jsx(AddComponentButton, {
|
|
289
304
|
blocklet: blocklet,
|
|
290
305
|
serverVersion: info.version,
|
|
291
306
|
children: ({
|
|
@@ -304,20 +319,24 @@ export default function BlockletComponent({
|
|
|
304
319
|
}
|
|
305
320
|
}), t('blocklet.component.add')]
|
|
306
321
|
})
|
|
307
|
-
}), /*#__PURE__*/_jsx(
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
322
|
+
}), !needMigration && /*#__PURE__*/_jsx(ComponentConfiguration, {
|
|
323
|
+
blocklet: blocklet,
|
|
324
|
+
ancestors: [],
|
|
325
|
+
children: ({
|
|
326
|
+
open
|
|
327
|
+
}) => /*#__PURE__*/_jsx(Tooltip, {
|
|
328
|
+
title: `${t('blocklet.component.container')}${t('common.config')}`,
|
|
329
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
330
|
+
onClick: open,
|
|
331
|
+
size: "small",
|
|
332
|
+
color: "primary",
|
|
333
|
+
children: /*#__PURE__*/_jsx(SettingsOutlinedIcon, {
|
|
334
|
+
style: {
|
|
335
|
+
fontSize: 18
|
|
336
|
+
}
|
|
337
|
+
})
|
|
338
|
+
})
|
|
339
|
+
}, "config")
|
|
321
340
|
})]
|
|
322
341
|
})
|
|
323
342
|
})]
|
|
@@ -471,16 +490,6 @@ export default function BlockletComponent({
|
|
|
471
490
|
blocklet: blocklet,
|
|
472
491
|
showDialog: !!parseInstallComponentMeta,
|
|
473
492
|
setShowDialog: () => setInstallComponentMeta(null)
|
|
474
|
-
}), showAddRule && /*#__PURE__*/_jsx(AddRule, {
|
|
475
|
-
hiddenChildren: true,
|
|
476
|
-
open: true,
|
|
477
|
-
onClose: () => setShowAddRule(false)
|
|
478
|
-
}), showComponentConfiguration && /*#__PURE__*/_jsx(ComponentConfiguration, {
|
|
479
|
-
open: true,
|
|
480
|
-
onClose: () => setShowComponentConfiguration(false),
|
|
481
|
-
hiddenChildren: true,
|
|
482
|
-
blocklet: blocklet,
|
|
483
|
-
ancestors: []
|
|
484
493
|
})]
|
|
485
494
|
});
|
|
486
495
|
}
|
|
@@ -23,7 +23,8 @@ import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRe
|
|
|
23
23
|
import { Controller, useForm } from 'react-hook-form';
|
|
24
24
|
import { Icon, loadIcon } from '@iconify/react';
|
|
25
25
|
import { isMatchSection, checkLink, flattenNavigation } from '@blocklet/meta/lib/parse-navigation-from-blocklet';
|
|
26
|
-
import
|
|
26
|
+
import urljoin from 'url-join';
|
|
27
|
+
import { withoutTrailingSlash } from 'ufo/dist/index.mjs';
|
|
27
28
|
import isAbsoluteUrl from 'is-absolute-url';
|
|
28
29
|
import { SUPPORTED_LANGUAGES } from '@blocklet/constant';
|
|
29
30
|
import LocaleTabs from './locale-tabs';
|
|
@@ -168,7 +169,7 @@ const NavigationDialog = /*#__PURE__*/forwardRef(function NavigationDialog({
|
|
|
168
169
|
return withoutTrailingSlash(stringLink);
|
|
169
170
|
}
|
|
170
171
|
const selectedLink = isObject(selectedOption.link) ? selectedOption.link[state.locale] : selectedOption.link;
|
|
171
|
-
return withoutTrailingSlash(
|
|
172
|
+
return withoutTrailingSlash(urljoin(stringLink, selectedLink || '/'));
|
|
172
173
|
}
|
|
173
174
|
return null;
|
|
174
175
|
}, [components, state.locale, selectedOption, watchComponent]);
|
|
@@ -4,7 +4,7 @@ import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
|
4
4
|
import { BLOCKLET_CONFIGURABLE_KEY, DID_SPACES } from '@blocklet/constant';
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import
|
|
7
|
+
import joinUrl from 'url-join';
|
|
8
8
|
import { isEmpty } from 'lodash';
|
|
9
9
|
import Typography from '@mui/material/Typography';
|
|
10
10
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
@@ -118,10 +118,10 @@ const SpaceConnector = /*#__PURE__*/forwardRef(({
|
|
|
118
118
|
...preValue,
|
|
119
119
|
action: 'one-click-authorization',
|
|
120
120
|
checkTimeout: 1000 * 300,
|
|
121
|
-
prefix:
|
|
121
|
+
prefix: joinUrl(gatewayUrl, 'space/api/did'),
|
|
122
122
|
baseUrl: new URL(gatewayUrl).origin,
|
|
123
123
|
checkFn: axios.create({
|
|
124
|
-
baseURL:
|
|
124
|
+
baseURL: joinUrl(gatewayUrl, 'space')
|
|
125
125
|
}).get,
|
|
126
126
|
extraParams: {
|
|
127
127
|
appDid: blocklet.appDid,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
|
-
import
|
|
4
|
+
import joinUrl from 'url-join';
|
|
5
5
|
import isUrl from 'is-url';
|
|
6
6
|
import useLocalStorage from 'react-use/lib/useLocalStorage';
|
|
7
7
|
import Button from '@arcblock/ux/lib/Button';
|
|
@@ -40,7 +40,7 @@ function SpaceSelector({
|
|
|
40
40
|
} = useSessionContext();
|
|
41
41
|
useEffect(() => {
|
|
42
42
|
if (gatewayUrl && !gatewayList.find(x => x.value === gatewayUrl)) {
|
|
43
|
-
api.get(
|
|
43
|
+
api.get(joinUrl(gatewayUrl, '/__blocklet__.js?type=json')).then(res => {
|
|
44
44
|
// FIXME: @wangshijun handle mountPoint
|
|
45
45
|
setGatewayList([...gatewayList, {
|
|
46
46
|
value: gatewayUrl,
|