@abtnode/ux 1.16.28-beta-8acda0e6 → 1.16.28-beta-b30865b3

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 CHANGED
@@ -1,12 +1,8 @@
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 IconButton from '@mui/material/IconButton';
5
- import Menu from '@mui/material/Menu';
6
- import MenuItem from '@mui/material/MenuItem';
4
+ import { IconButton, Menu, MenuItem, ListItemIcon, ListItemText, Divider } from '@mui/material';
7
5
  import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
8
- import ListItemIcon from '@mui/material/ListItemIcon';
9
- import ListItemText from '@mui/material/ListItemText';
10
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
7
  export default function Actions({
12
8
  actions,
@@ -57,9 +53,14 @@ export default function Actions({
57
53
  close: onClose
58
54
  });
59
55
  }
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,
63
64
  onClick,
64
65
  disabled = false,
65
66
  ...opts
@@ -69,7 +70,8 @@ export default function Actions({
69
70
  disabled: disabled,
70
71
  dense: true,
71
72
  onClick: async e => {
72
- await onClick(e);
73
+ e.stopPropagation();
74
+ await onClick?.(e);
73
75
  onClose();
74
76
  }
75
77
  // eslint-disable-next-line react/no-array-index-key
@@ -0,0 +1,164 @@
1
+ import normalizePathPrefix from '@abtnode/util/lib/normalize-path-prefix';
2
+ import { Icon } from '@iconify/react';
3
+ import { Box, CircularProgress, IconButton, TextField } from '@mui/material';
4
+ import PropTypes from 'prop-types';
5
+ import { useEffect, useState } from 'react';
6
+ import urlPathFriendly from '@blocklet/meta/lib/url-path-friendly';
7
+ import Toast from '@arcblock/ux/lib/Toast';
8
+ import { useNodeContext } from '../../contexts/node';
9
+ import { formatError } from '../../util';
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ function ComponentCellMountPoint({
12
+ blocklet,
13
+ ancestors,
14
+ mountPoint,
15
+ href
16
+ }) {
17
+ const [hover, setHover] = useState(false);
18
+ const [editing, setEditing] = useState(false);
19
+ const [loading, setLoading] = useState(false);
20
+ const [editValue, setEditValue] = useState(mountPoint);
21
+ const {
22
+ api
23
+ } = useNodeContext();
24
+ const isRoot = !ancestors.length;
25
+ const rootDid = isRoot ? blocklet.meta.did : ancestors.map(x => x.meta.did)[0];
26
+ useEffect(() => {
27
+ setEditing(false);
28
+ setHover(false);
29
+ setLoading(false);
30
+ }, [mountPoint]);
31
+ const handleCancel = () => {
32
+ setHover(false);
33
+ setEditing(false);
34
+ setEditValue(mountPoint);
35
+ };
36
+ const onSubmitMountPoint = async e => {
37
+ e.preventDefault();
38
+ setLoading(true);
39
+ setHover(false);
40
+ try {
41
+ const input = {
42
+ rootDid,
43
+ mountPoint: urlPathFriendly(editValue)
44
+ };
45
+ if (!isRoot) {
46
+ input.did = blocklet.meta.did;
47
+ }
48
+ await api.updateComponentMountPoint({
49
+ input
50
+ });
51
+ } catch (err) {
52
+ setLoading(false);
53
+ err.message = formatError(err);
54
+ Toast.error(err.message);
55
+ throw err;
56
+ }
57
+ };
58
+ const tools = editing ? /*#__PURE__*/_jsxs(Box, {
59
+ sx: {
60
+ ml: 1
61
+ },
62
+ children: [/*#__PURE__*/_jsx(IconButton, {
63
+ size: "medium",
64
+ onMouseEnter: () => setHover(true),
65
+ onMouseLeave: () => setHover(false),
66
+ "data-cy": "edit-mount-point-submit",
67
+ onClick: onSubmitMountPoint,
68
+ children: /*#__PURE__*/_jsx(Box, {
69
+ component: Icon,
70
+ icon: "material-symbols:done",
71
+ sx: {
72
+ color: 'primary.main',
73
+ transition: '0.3s opacity'
74
+ }
75
+ })
76
+ }), /*#__PURE__*/_jsx(IconButton, {
77
+ size: "medium",
78
+ onMouseEnter: () => setHover(true),
79
+ onMouseLeave: () => setHover(false),
80
+ onClick: handleCancel,
81
+ children: /*#__PURE__*/_jsx(Box, {
82
+ component: Icon,
83
+ icon: "iconoir:cancel",
84
+ sx: {
85
+ color: 'primary.main',
86
+ transition: '0.3s opacity'
87
+ }
88
+ })
89
+ })]
90
+ }) : /*#__PURE__*/_jsx(IconButton, {
91
+ size: "medium",
92
+ onMouseEnter: () => setHover(true),
93
+ onMouseLeave: () => setHover(false),
94
+ onClick: () => setEditing(true),
95
+ children: /*#__PURE__*/_jsx(Box, {
96
+ component: Icon,
97
+ "data-cy": "edit-mount-point",
98
+ icon: "lets-icons:edit-light",
99
+ sx: {
100
+ opacity: hover ? 1 : 0,
101
+ color: 'primary.main',
102
+ transition: '0.3s opacity'
103
+ }
104
+ })
105
+ });
106
+ return /*#__PURE__*/_jsxs(Box, {
107
+ sx: {
108
+ display: {
109
+ xs: 'none',
110
+ md: 'flex'
111
+ }
112
+ },
113
+ alignItems: "center",
114
+ flexGrow: "1",
115
+ children: [editing ? /*#__PURE__*/_jsx("form", {
116
+ onSubmit: onSubmitMountPoint,
117
+ children: /*#__PURE__*/_jsx(TextField, {
118
+ style: {
119
+ flex: 1
120
+ },
121
+ fullWidth: true,
122
+ "data-cy": "edit-mount-point-input",
123
+ value: editValue,
124
+ onChange: e => setEditValue(e.target.value),
125
+ autoFocus: true,
126
+ size: "small",
127
+ variant: "outlined",
128
+ placeholder: mountPoint
129
+ })
130
+ }) : /*#__PURE__*/_jsx(Box, {
131
+ component: "a",
132
+ target: "_blank",
133
+ href: href,
134
+ rel: "noopener noreferrer",
135
+ title: href,
136
+ onMouseEnter: () => setHover(true),
137
+ onMouseLeave: () => setHover(false),
138
+ children: /*#__PURE__*/_jsx(Box, {
139
+ maxWidth: 400,
140
+ sx: {
141
+ color: 'secondary.main',
142
+ fontSize: 16,
143
+ px: 2
144
+ },
145
+ overflow: "hidden",
146
+ whiteSpace: "nowrap",
147
+ textOverflow: "ellipsis",
148
+ children: normalizePathPrefix(mountPoint)
149
+ })
150
+ }), loading ? /*#__PURE__*/_jsx(CircularProgress, {
151
+ size: 20,
152
+ sx: {
153
+ ml: 1
154
+ }
155
+ }) : tools]
156
+ }, mountPoint);
157
+ }
158
+ ComponentCellMountPoint.propTypes = {
159
+ mountPoint: PropTypes.string.isRequired,
160
+ href: PropTypes.string.isRequired,
161
+ blocklet: PropTypes.object.isRequired,
162
+ ancestors: PropTypes.array.isRequired
163
+ };
164
+ export default ComponentCellMountPoint;
@@ -11,7 +11,6 @@ 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';
15
14
  import { getComponentMissingConfigs, getDisplayName, isInProgress, hasStartEngine } from '@blocklet/meta/lib/util';
16
15
  import SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined';
17
16
  import { hasMountPoint } from '@blocklet/meta/lib/engine';
@@ -26,6 +25,7 @@ import StartComponent from './start';
26
25
  import Line from './line';
27
26
  import Actions from '../../actions';
28
27
  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,6 +62,7 @@ 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);
65
66
  const {
66
67
  deletingBlocklets: deletingComponents
67
68
  } = useDeletingBlockletContext();
@@ -162,33 +163,11 @@ export default function ComponentCell({
162
163
  })]
163
164
  })]
164
165
  })]
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
- })
166
+ }, blocklet), hasMountPoint(blocklet.meta) && /*#__PURE__*/_jsx(ComponentCellMountPoint, {
167
+ blocklet: blocklet,
168
+ ancestors: ancestors,
169
+ mountPoint: mountPoint,
170
+ href: href
192
171
  }, mountPoint), /*#__PURE__*/_jsx("div", {
193
172
  style: {
194
173
  flex: 1
@@ -198,7 +177,14 @@ export default function ComponentCell({
198
177
  alignItems: "center",
199
178
  children: [hasStartEngine(blocklet.meta) && /*#__PURE__*/_jsx(Tooltip, {
200
179
  title: t('common.visit'),
201
- children: /*#__PURE__*/_jsx("a", {
180
+ children: /*#__PURE__*/_jsx(Box, {
181
+ component: "a",
182
+ sx: {
183
+ display: {
184
+ xs: 'flex',
185
+ md: 'none'
186
+ }
187
+ },
202
188
  target: "_blank",
203
189
  href: href,
204
190
  rel: "noopener noreferrer",
@@ -207,66 +193,73 @@ export default function ComponentCell({
207
193
  children: /*#__PURE__*/_jsx(LaunchIcon, {})
208
194
  })
209
195
  })
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")
229
196
  }), /*#__PURE__*/_jsx(StartComponent, {
230
197
  blocklet: app,
231
198
  component: blocklet,
232
199
  onStart: onStart,
233
200
  onStop: onStop,
234
201
  disabled: !['starting', 'stopping'].includes(app.status) && isInProgress(app.status)
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)
202
+ }), /*#__PURE__*/_jsx(StyledBadge, {
203
+ color: "error",
204
+ badgeContent: "",
205
+ variant: "dot",
206
+ invisible: !getComponentMissingConfigs(blocklet, ancestors[0]).length,
207
+ children: /*#__PURE__*/_jsx(Actions, {
208
+ "data-cy": "component-actions",
209
+ actions: [hasStartEngine(blocklet.meta) || isResource(blocklet) ? {
210
+ icon: /*#__PURE__*/_jsx(InfoOutlinedIcon, {}),
211
+ text: t('common.detail'),
212
+ onClick: () => {
213
+ setComponentInfo(blocklet);
214
+ }
215
+ } : null, {
216
+ icon: /*#__PURE__*/_jsx(RestartIcon, {}),
217
+ text: t('common.restart'),
218
+ onClick: () => {
219
+ setConfirmSetting({
220
+ title: `${t('common.restart')} ${blocklet.meta.title}`,
221
+ description: t('blocklet.action.restartDescription'),
222
+ confirm: t('blocklet.action.confirmRestart'),
223
+ cancel: t('common.cancel'),
224
+ onConfirm: async () => {
225
+ setLoading(true);
226
+ await onRestart(blocklet);
227
+ setLoading(false);
228
+ },
229
+ onCancel: () => setConfirmSetting(null)
230
+ });
231
+ },
232
+ disabled: loading || appInProgress || componentInProgress || blocklet.status !== 'running'
233
+ }, {
234
+ icon: /*#__PURE__*/_jsx(DeleteIcon, {}),
235
+ text: t('common.delete'),
236
+ onClick: () => {
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
+ })
270
263
  })]
271
264
  }, "actions")]
272
265
  }, "group-not-gateway-box"), /*#__PURE__*/_jsx(Line, {}, "line"), /*#__PURE__*/_jsx(ComponentInfoDialog, {
@@ -290,7 +283,13 @@ export default function ComponentCell({
290
283
  params: confirmSetting.params,
291
284
  onConfirm: confirmSetting.onConfirm,
292
285
  onCancel: confirmSetting.onCancel
293
- }, "confirm-setting")]
286
+ }, "confirm-setting"), showComponentConfiguration && /*#__PURE__*/_jsx(ComponentConfiguration, {
287
+ open: true,
288
+ hiddenChildren: true,
289
+ onClose: () => setShowComponentConfiguration(false),
290
+ blocklet: blocklet,
291
+ ancestors: ancestors
292
+ })]
294
293
  });
295
294
  }
296
295
  ComponentCell.propTypes = {
@@ -12,13 +12,16 @@ 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 } from "react/jsx-runtime";
15
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
16
16
  export default function ComponentConfiguration({
17
+ open,
18
+ onClose,
19
+ hiddenChildren,
17
20
  blocklet,
18
21
  ancestors,
19
22
  children
20
23
  }) {
21
- const [showDialog, setShowDialog] = useState('');
24
+ const [showDialog, setShowDialog] = useState(false);
22
25
  const {
23
26
  t
24
27
  } = useLocaleContext();
@@ -31,10 +34,11 @@ export default function ComponentConfiguration({
31
34
  if (blocklet.status === 'unknown' && isInstalling(blocklet.status)) {
32
35
  return null;
33
36
  }
34
- const onClose = () => {
37
+ const handleClose = () => {
38
+ onClose?.();
35
39
  setShowDialog(false);
36
40
  };
37
- const onOpen = e => {
41
+ const handleOpen = e => {
38
42
  e.stopPropagation();
39
43
  // eslint-disable-next-line no-unused-expressions
40
44
  setShowDialog(true);
@@ -69,45 +73,57 @@ export default function ComponentConfiguration({
69
73
  setTab(newTab);
70
74
  };
71
75
  const tabConfig = tabConfigs[tab] || tabConfigsArr[0];
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
- })];
76
+ let child = null;
77
+ if (!hiddenChildren) {
78
+ child = typeof children === 'function' ? children({
79
+ open: handleOpen
80
+ }) : /*#__PURE__*/_jsx(IconButton, {
81
+ onClick: handleOpen,
82
+ "data-cy": "action-config-component",
83
+ children: /*#__PURE__*/_jsx(EditIcon, {})
84
+ });
85
+ }
86
+ return /*#__PURE__*/_jsxs(_Fragment, {
87
+ children: [child, (open || showDialog) && /*#__PURE__*/_jsx(StyledDialog, {
88
+ open: true,
89
+ fullWidth: true,
90
+ maxWidth: "md",
91
+ title: name,
92
+ onClose: handleClose,
93
+ PaperProps: {
94
+ style: {
95
+ minHeight: 'auto'
96
+ }
97
+ },
98
+ children: isComponent ? /*#__PURE__*/_jsxs(Box, {
99
+ mt: 1,
100
+ children: [/*#__PURE__*/_jsx(Tabs, {
101
+ tabs: tabs,
102
+ current: tab,
103
+ onChange: onTabChange,
104
+ scrollButtons: "auto"
105
+ }), tabConfig.component]
106
+ }) : /*#__PURE__*/_jsx(ComponentEnvironment, {
107
+ blocklet: blocklet,
108
+ ancestors: ancestors
109
+ })
110
+ })]
111
+ });
102
112
  }
103
113
  ComponentConfiguration.propTypes = {
104
114
  blocklet: PropTypes.object.isRequired,
105
115
  ancestors: PropTypes.array,
106
- children: PropTypes.any
116
+ children: PropTypes.any,
117
+ open: PropTypes.bool,
118
+ onClose: PropTypes.func,
119
+ hiddenChildren: PropTypes.bool
107
120
  };
108
121
  ComponentConfiguration.defaultProps = {
109
122
  ancestors: [],
110
- children: null
123
+ children: null,
124
+ open: false,
125
+ onClose: null,
126
+ hiddenChildren: false
111
127
  };
112
128
  const StyledDialog = styled(Dialog)`
113
129
  .MuiDialogContent-root {
@@ -7,11 +7,10 @@ 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';
11
10
  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';
15
14
  import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
16
15
  import Checkbox from '@mui/material/Checkbox';
17
16
  import FormControlLabel from '@mui/material/FormControlLabel';
@@ -37,6 +36,7 @@ import useGetInstallComponentByUrl from '../../hooks/use-install-component-by-ur
37
36
  import ComponentCell, { StyledBadge, StyledComponentRow } from './component-cell';
38
37
  import OptionalComponentCell from './optional-component-cell';
39
38
  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,6 +61,8 @@ 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);
64
66
  const [installComponentMeta, setInstallComponentMeta] = useState(null);
65
67
  const needMigration = blocklet && blocklet.structVersion !== APP_STRUCT_VERSION;
66
68
 
@@ -283,24 +285,7 @@ export default function BlockletComponent({
283
285
  children: /*#__PURE__*/_jsxs(Box, {
284
286
  display: "flex",
285
287
  alignItems: "center",
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, {
288
+ children: [!needMigration && /*#__PURE__*/_jsx(AddComponentButton, {
304
289
  blocklet: blocklet,
305
290
  serverVersion: info.version,
306
291
  children: ({
@@ -319,24 +304,20 @@ export default function BlockletComponent({
319
304
  }
320
305
  }), t('blocklet.component.add')]
321
306
  })
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")
307
+ }), /*#__PURE__*/_jsx(Actions, {
308
+ "data-cy": "component-actions",
309
+ actions: [{
310
+ icon: /*#__PURE__*/_jsx(Icon, {
311
+ icon: "fluent:link-20-filled"
312
+ }),
313
+ onClick: () => setShowAddRule(true),
314
+ text: t('router.rule.add.title'),
315
+ disabled: loading || isInProgress(blocklet.status)
316
+ }, !needMigration && {
317
+ icon: /*#__PURE__*/_jsx(SettingsOutlinedIcon, {}),
318
+ text: `${t('blocklet.component.container')}`,
319
+ onClick: () => setShowComponentConfiguration(true)
320
+ }].filter(Boolean)
340
321
  })]
341
322
  })
342
323
  })]
@@ -490,6 +471,16 @@ export default function BlockletComponent({
490
471
  blocklet: blocklet,
491
472
  showDialog: !!parseInstallComponentMeta,
492
473
  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: []
493
484
  })]
494
485
  });
495
486
  }
@@ -17,7 +17,10 @@ import ConfigRoutingRule from './config-routing-rule';
17
17
  import { formatMountPoint } from '../../../util';
18
18
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
19
19
  export default function AddRule({
20
- children
20
+ children,
21
+ hiddenChildren,
22
+ open,
23
+ onClose
21
24
  }) {
22
25
  const {
23
26
  t
@@ -29,12 +32,13 @@ export default function AddRule({
29
32
  blocklet
30
33
  } = useBlockletContext();
31
34
  const [loading, setLoading] = useState(false);
32
- const [confirmSetting, setConfirmSetting] = useState(null);
35
+ const [showConfirm, setShowConfirm] = useState(false);
33
36
  const teamDid = blocklet.meta.did;
34
37
  const siteId = blocklet.site.id;
35
38
  const onCancel = () => {
39
+ onClose?.();
36
40
  setLoading(false);
37
- setConfirmSetting(null);
41
+ setShowConfirm(false);
38
42
  };
39
43
  const onConfirm = async params => {
40
44
  try {
@@ -81,7 +85,7 @@ export default function AddRule({
81
85
  Toast.error(error.message);
82
86
  } finally {
83
87
  setLoading(false);
84
- setConfirmSetting(null);
88
+ setShowConfirm(false);
85
89
  }
86
90
  };
87
91
  const setting = {
@@ -185,11 +189,11 @@ export default function AddRule({
185
189
  const onMenuItemClick = e => {
186
190
  e.stopPropagation();
187
191
  // eslint-disable-next-line no-unused-expressions
188
- setConfirmSetting(setting);
192
+ setShowConfirm(true);
189
193
  };
190
- return /*#__PURE__*/_jsxs(_Fragment, {
191
- children: [typeof children === 'function' ? children({
192
- loading,
194
+ let child = null;
195
+ if (!hiddenChildren) {
196
+ child = typeof children === 'function' ? children({
193
197
  open: onMenuItemClick
194
198
  }) : /*#__PURE__*/_jsxs(MenuItem, {
195
199
  onClick: onMenuItemClick,
@@ -203,21 +207,30 @@ export default function AddRule({
203
207
  marginRight: 5
204
208
  }
205
209
  }), t('router.rule.add.title')]
206
- }), confirmSetting && /*#__PURE__*/_jsx(Confirm, {
207
- title: confirmSetting.title,
208
- description: confirmSetting.description,
209
- confirm: confirmSetting.confirm,
210
- cancel: confirmSetting.cancel,
211
- params: confirmSetting.params,
212
- onConfirm: confirmSetting.onConfirm,
213
- onCancel: confirmSetting.onCancel,
210
+ });
211
+ }
212
+ return /*#__PURE__*/_jsxs(_Fragment, {
213
+ children: [child, (open || showConfirm) && /*#__PURE__*/_jsx(Confirm, {
214
+ title: setting.title,
215
+ description: setting.description,
216
+ confirm: setting.confirm,
217
+ cancel: setting.cancel,
218
+ params: setting.params,
219
+ onConfirm: setting.onConfirm,
220
+ onCancel: setting.onCancel,
214
221
  color: "primary"
215
222
  })]
216
223
  });
217
224
  }
218
225
  AddRule.propTypes = {
219
- children: PropTypes.any
226
+ children: PropTypes.any,
227
+ onClose: PropTypes.func,
228
+ hiddenChildren: PropTypes.bool,
229
+ open: PropTypes.bool
220
230
  };
221
231
  AddRule.defaultProps = {
222
- children: null
232
+ children: null,
233
+ open: false,
234
+ onClose: null,
235
+ hiddenChildren: false
223
236
  };
@@ -23,7 +23,14 @@ export default function RuleActions(rule) {
23
23
  return /*#__PURE__*/_jsxs(Box, {
24
24
  display: "flex",
25
25
  alignItems: "center",
26
- children: [/*#__PURE__*/_jsx("a", {
26
+ children: [/*#__PURE__*/_jsx(Box, {
27
+ component: "a",
28
+ sx: {
29
+ display: {
30
+ xs: 'flex',
31
+ md: 'none'
32
+ }
33
+ },
27
34
  target: "_blank",
28
35
  href: href,
29
36
  rel: "noopener noreferrer",
package/lib/locales/ar.js CHANGED
@@ -891,6 +891,10 @@ export default {
891
891
  monitor: {
892
892
  diskThreshold: 'إرسال تنبيه عند تجاوز استخدام القرص (%)',
893
893
  diskThresholdPlaceholder: 'يرجى تعيين حد التنبيه لاستخدام القرص'
894
+ },
895
+ security: {
896
+ switchLabel: 'عزل نظام الملفات',
897
+ switchTips: 'بعد تعطيل هذا الخيار، فإن نظام ملفات البلوكليت لن يكون عزلًا بعد الآن، مما قد يشكل خطرًا من تلف النظام من قبل البرامج الخبيثة.'
894
898
  }
895
899
  },
896
900
  accessKey: {
@@ -1504,7 +1508,7 @@ export default {
1504
1508
  installedButStopped: 'تم تثبيت التطبيق بنجاح ، ولكن لا يمكن تشغيله. يمكنك بدء تشغيله يدويًا بعد حل مشكلة الحجب.',
1505
1509
  installedButError: 'تم تثبيت التطبيق بنجاح ، ولكن فشل في البدء',
1506
1510
  restoreFailed: 'فشل في استعادة التطبيق، يرجى المحاولة مرة أخرى',
1507
- resourceBlocklet: 'لا يمكن تثبيت الكتلة كتطبيق، يمكنك إضافة هذه الكتلة إلى التطبيقات الحالية.'
1511
+ resourceBlocklet: 'لا يمكن تثبيت بلوكليت الموارد كتطبيق، يمكنك تركيب هذا البلوكليت في التطبيقات الحالية.'
1508
1512
  },
1509
1513
  steps: {
1510
1514
  introduction: 'مقدمة',
package/lib/locales/de.js CHANGED
@@ -891,6 +891,10 @@ export default {
891
891
  monitor: {
892
892
  diskThreshold: 'Sende eine Warnung, wenn die Festplattenauslastung (%) überschritten wird',
893
893
  diskThresholdPlaceholder: 'Bitte legen Sie die Schwelle für die Festplattenauslastungs-Warnung fest'
894
+ },
895
+ security: {
896
+ switchLabel: 'Dateisystemisolierung',
897
+ switchTips: 'Nach Deaktivierung dieser Option befindet sich das Dateisystem des Blocklets nicht mehr in Isolation, was ein Risiko darstellen kann, dass bösartige Software das Dateisystem beschädigt.'
894
898
  }
895
899
  },
896
900
  accessKey: {
package/lib/locales/en.js CHANGED
@@ -1497,7 +1497,7 @@ export default {
1497
1497
  installedButStopped: 'The app is installed successfully, but cannot be started. You can start it manually after resolving blocking issues',
1498
1498
  installedButError: 'The app is successfully installed, but failed to start',
1499
1499
  restoreFailed: 'Failed to restore app, please try again',
1500
- resourceBlocklet: 'Blocklet cannot be installed as an application, you can add this blocklet into existing applications.'
1500
+ resourceBlocklet: ''
1501
1501
  },
1502
1502
  steps: {
1503
1503
  introduction: 'Introduction',
package/lib/locales/es.js CHANGED
@@ -891,6 +891,10 @@ export default {
891
891
  monitor: {
892
892
  diskThreshold: 'Enviar alerta cuando el uso del disco exceda (%)',
893
893
  diskThresholdPlaceholder: 'Por favor, establezca el umbral de alerta para el uso del disco'
894
+ },
895
+ security: {
896
+ switchLabel: 'Aislamiento del sistema de archivos',
897
+ switchTips: 'Después de deshabilitar esta opción, el sistema de archivos del Blocklet ya no estará aislado, lo que podría representar un riesgo de que software malicioso dañe el sistema de archivos.'
894
898
  }
895
899
  },
896
900
  accessKey: {
package/lib/locales/fr.js CHANGED
@@ -891,6 +891,10 @@ export default {
891
891
  monitor: {
892
892
  diskThreshold: "Envoyer une alerte lorsque l'utilisation du disque dépasse (%)",
893
893
  diskThresholdPlaceholder: "Veuillez définir le seuil d'alerte d'utilisation du disque"
894
+ },
895
+ security: {
896
+ switchLabel: 'Isolation du système de fichiers',
897
+ switchTips: 'Après avoir désactivé cette option, le système de fichiers du Blocklet ne sera plus isolé, ce qui pourrait présenter un risque de dommages causés par un logiciel malveillant au système de fichiers.'
894
898
  }
895
899
  },
896
900
  accessKey: {
package/lib/locales/hi.js CHANGED
@@ -891,6 +891,10 @@ export default {
891
891
  monitor: {
892
892
  diskThreshold: 'जब डिस्क उपयोग (%) से अधिक हो जाए, तो चेतावनी भेजें',
893
893
  diskThresholdPlaceholder: 'कृपया डिस्क उपयोग चेतावनी सीमा सेट करें'
894
+ },
895
+ security: {
896
+ switchLabel: 'फ़ाइल सिस्टम विलगनन',
897
+ switchTips: 'इस विकल्प को निषेधित करने के बाद, ब्लॉकलेट का फ़ाइल सिस्टम अलग नहीं होगा, जिससे किसी हानिकारक सॉफ़्टवेयर को फ़ाइल सिस्टम को नुक़सान पहुँचाने का ख़तरा हो सकता है।'
894
898
  }
895
899
  },
896
900
  accessKey: {
Binary file
package/lib/locales/id.js CHANGED
@@ -891,6 +891,10 @@ export default {
891
891
  monitor: {
892
892
  diskThreshold: 'Kirim peringatan ketika penggunaan disk melebihi (%)',
893
893
  diskThresholdPlaceholder: 'Tolong atur ambang batas peringatan penggunaan disk'
894
+ },
895
+ security: {
896
+ switchLabel: 'Pengasingan Sistem File',
897
+ switchTips: 'Setelah menonaktifkan opsi ini, sistem file dari Blocklet tidak akan lagi dalam isolasi, yang dapat menimbulkan risiko perangkat lunak berbahaya merusak sistem file.'
894
898
  }
895
899
  },
896
900
  accessKey: {
package/lib/locales/ja.js CHANGED
@@ -891,6 +891,10 @@ export default {
891
891
  monitor: {
892
892
  diskThreshold: 'ディスク使用率が (%) を超えた場合にアラートを送信する',
893
893
  diskThresholdPlaceholder: 'ディスク使用量のアラート閾値を設定してください'
894
+ },
895
+ security: {
896
+ switchLabel: 'ファイルシステムの分離',
897
+ switchTips: 'このオプションを無効にした後、Blockletのファイルシステムはもはや隔離されず、悪意のあるソフトウェアによってファイルシステムが損傷される可能性があります。'
894
898
  }
895
899
  },
896
900
  accessKey: {
package/lib/locales/ko.js CHANGED
@@ -891,6 +891,10 @@ export default {
891
891
  monitor: {
892
892
  diskThreshold: '디스크 사용량이 (%) 이상인 경우 경고 메시지 보내기',
893
893
  diskThresholdPlaceholder: '디스크 사용량 경고 임계값을 설정해주세요'
894
+ },
895
+ security: {
896
+ switchLabel: '파일 시스템 격리',
897
+ switchTips: '이 옵션을 사용 중지 한 후에는 더 이상 Blocklet의 파일 시스템이 격리되지 않아 악성 소프트웨어가 파일 시스템을 손상시킬 수있는 위험이 있습니다.'
894
898
  }
895
899
  },
896
900
  accessKey: {
package/lib/locales/pt.js CHANGED
@@ -891,6 +891,10 @@ export default {
891
891
  monitor: {
892
892
  diskThreshold: 'Enviar alerta quando o uso do disco exceder (%)',
893
893
  diskThresholdPlaceholder: 'Por favor, defina o limiar de alerta de uso de disco'
894
+ },
895
+ security: {
896
+ switchLabel: 'Isolamento do Sistema de Arquivos',
897
+ switchTips: 'Após desativar esta opção, o sistema de arquivos do Blocklet não estará mais em isolamento, o que pode representar um risco de software malicioso danificar o sistema de arquivos.'
894
898
  }
895
899
  },
896
900
  accessKey: {
package/lib/locales/ru.js CHANGED
@@ -891,6 +891,10 @@ export default {
891
891
  monitor: {
892
892
  diskThreshold: 'Отправить предупреждение, когда использование диска превышает (%)',
893
893
  diskThresholdPlaceholder: 'Пожалуйста, установите порог оповещения об использовании диска'
894
+ },
895
+ security: {
896
+ switchLabel: 'Изоляция файловой системы',
897
+ switchTips: 'После отключения этой опции файловая система блоклета больше не будет находиться в изоляции, что может повлечь за собой риск повреждения файловой системы вредоносным ПО.'
894
898
  }
895
899
  },
896
900
  accessKey: {
package/lib/locales/th.js CHANGED
@@ -891,6 +891,10 @@ export default {
891
891
  monitor: {
892
892
  diskThreshold: 'ส่งการแจ้งเตือนเมื่อการใช้งานดิสก์เกิน (%)',
893
893
  diskThresholdPlaceholder: 'กรุณาระบุเกณฑ์คำเตือนการใช้ดิสก์'
894
+ },
895
+ security: {
896
+ switchLabel: 'การแยกฟิล์ซัสเต็ม',
897
+ switchTips: 'หลังจากที่ปิดตัวเลือกนี้ลง ไฟล์ระบบของ Blocklet จะไม่อยู่ในโหมดกักกันอีกต่อไป ซึ่งอาจเสี่ยงต่อซอฟต์แวร์ที่เป็นอันตรายทำให้ระบบไฟล์เสียหาย'
894
898
  }
895
899
  },
896
900
  accessKey: {
package/lib/locales/vi.js CHANGED
@@ -891,6 +891,10 @@ export default {
891
891
  monitor: {
892
892
  diskThreshold: 'Gửi cảnh báo khi sử dụng đĩa vượt quá (%)',
893
893
  diskThresholdPlaceholder: 'Vui lòng đặt ngưỡng cảnh báo việc sử dụng đĩa'
894
+ },
895
+ security: {
896
+ switchLabel: 'Cách ly Hệ thống Tệp',
897
+ switchTips: 'Sau khi vô hiệu hóa tùy chọn này, hệ thống tệp của Blocklet sẽ không còn được cách ly nữa, điều này có thể tạo ra nguy cơ phần mềm độc hại làm hỏng hệ thống tệp.'
894
898
  }
895
899
  },
896
900
  accessKey: {
@@ -891,6 +891,10 @@ export default {
891
891
  monitor: {
892
892
  diskThreshold: '當磁碟使用量超過 (%) 時發送警示',
893
893
  diskThresholdPlaceholder: '請設置磁碟使用警示閾值'
894
+ },
895
+ security: {
896
+ switchLabel: '檔案系統隔離',
897
+ switchTips: '在停用此選項後,Blocklet的檔案系統將不再處於隔離狀態,這可能會導致惡意軟體損壞檔案系統。'
894
898
  }
895
899
  },
896
900
  accessKey: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/ux",
3
- "version": "1.16.28-beta-8acda0e6",
3
+ "version": "1.16.28-beta-b30865b3",
4
4
  "description": "UX components shared across abtnode packages",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -25,9 +25,9 @@
25
25
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
26
26
  "license": "Apache-2.0",
27
27
  "dependencies": {
28
- "@abtnode/auth": "1.16.28-beta-8acda0e6",
29
- "@abtnode/constant": "1.16.28-beta-8acda0e6",
30
- "@abtnode/util": "1.16.28-beta-8acda0e6",
28
+ "@abtnode/auth": "1.16.28-beta-b30865b3",
29
+ "@abtnode/constant": "1.16.28-beta-b30865b3",
30
+ "@abtnode/util": "1.16.28-beta-b30865b3",
31
31
  "@ahooksjs/use-url-state": "^3.5.1",
32
32
  "@arcblock/did": "^1.18.123",
33
33
  "@arcblock/did-connect": "^2.10.0",
@@ -37,10 +37,10 @@
37
37
  "@arcblock/react-hooks": "^2.10.0",
38
38
  "@arcblock/terminal": "^2.10.0",
39
39
  "@arcblock/ux": "^2.10.0",
40
- "@blocklet/constant": "1.16.28-beta-8acda0e6",
40
+ "@blocklet/constant": "1.16.28-beta-b30865b3",
41
41
  "@blocklet/launcher-layout": "2.3.22",
42
42
  "@blocklet/list": "^0.12.114",
43
- "@blocklet/meta": "1.16.28-beta-8acda0e6",
43
+ "@blocklet/meta": "1.16.28-beta-b30865b3",
44
44
  "@blocklet/ui-react": "^2.10.0",
45
45
  "@blocklet/uploader": "^0.1.10",
46
46
  "@emotion/react": "^11.10.4",
@@ -107,5 +107,5 @@
107
107
  "jest": "^29.7.0",
108
108
  "jest-environment-jsdom": "^29.7.0"
109
109
  },
110
- "gitHead": "a1a896a7d34abc6a1f24b855524c228c0b0a3ade"
110
+ "gitHead": "93a071e3074207fa721a2198b1281f74d666cbbd"
111
111
  }