@abtnode/ux 1.16.23-beta-f3f10110 → 1.16.23-beta-aeb9f5bd
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/agreement.js +85 -16
- package/es/blocklet/component/add-component-button.js +50 -0
- package/es/blocklet/component/add-component-core.js +35 -12
- package/es/blocklet/component/add-component-dialog.js +78 -0
- package/es/blocklet/component/component-cell.js +509 -0
- package/es/blocklet/component/index.js +78 -532
- package/es/blocklet/component/line.js +7 -3
- package/es/blocklet/component/optional-component-cell.js +145 -0
- package/es/blocklet/component/related-components-dialog.js +189 -0
- package/es/blocklet/component/store-blocklet-list.js +8 -1
- package/es/blocklet/config-navigation.js +2 -1
- package/es/hooks/use-check-update-by-url.js +1 -1
- package/es/hooks/use-components-by-blocklet-meta-url.js +36 -0
- package/es/hooks/use-install-component-by-url.js +64 -0
- package/es/hooks/use-navigation.js +0 -16
- package/es/locales/ar.js +13 -4
- package/es/locales/de.js +13 -4
- package/es/locales/en.js +6 -0
- package/es/locales/es.js +13 -4
- package/es/locales/fr.js +13 -4
- package/es/locales/hi.js +13 -4
- package/es/locales/i18n.db +0 -0
- package/es/locales/id.js +13 -4
- package/es/locales/ja.js +13 -4
- package/es/locales/ko.js +13 -4
- package/es/locales/pt.js +13 -4
- package/es/locales/ru.js +13 -4
- package/es/locales/th.js +13 -4
- package/es/locales/vi.js +13 -4
- package/es/locales/zh-tw.js +13 -4
- package/es/locales/zh.js +10 -3
- package/es/team/members/index.js +4 -3
- package/es/team/members/member.js +3 -3
- package/lib/actions.js +2 -2
- package/lib/analytics/card.js +2 -2
- package/lib/analytics/chart.js +2 -2
- package/lib/analytics/disk.js +2 -2
- package/lib/analytics/traffic.js +2 -2
- package/lib/blocklet/actions.js +2 -2
- package/lib/blocklet/add-cert.js +2 -2
- package/lib/blocklet/agreement-app.js +2 -2
- package/lib/blocklet/agreement.js +70 -14
- package/lib/blocklet/app-avatar.js +2 -2
- package/lib/blocklet/bundle-avatar.js +2 -2
- package/lib/blocklet/component/add-component-button.js +57 -0
- package/lib/blocklet/component/add-component-core.js +40 -15
- package/lib/blocklet/component/add-component-dialog.js +85 -0
- package/lib/blocklet/component/button.js +2 -2
- package/lib/blocklet/component/component-cell.js +507 -0
- package/lib/blocklet/component/delete.js +2 -2
- package/lib/blocklet/component/did-space/connect-to.js +2 -2
- package/lib/blocklet/component/did-space/disconnect.js +2 -2
- package/lib/blocklet/component/did-space/item.js +2 -2
- package/lib/blocklet/component/domain-list.js +2 -2
- package/lib/blocklet/component/environment.js +2 -2
- package/lib/blocklet/component/index.js +76 -539
- package/lib/blocklet/component/line.js +7 -3
- package/lib/blocklet/component/navigation/navigation-dialog.js +2 -2
- package/lib/blocklet/component/navigation/simple-select.js +2 -2
- package/lib/blocklet/component/optional-component-cell.js +112 -0
- package/lib/blocklet/component/related-components-dialog.js +196 -0
- package/lib/blocklet/component/select-store.js +2 -2
- package/lib/blocklet/component/setting.js +2 -2
- package/lib/blocklet/component/sortable-tree.js +2 -2
- package/lib/blocklet/component/space-connector.js +2 -2
- package/lib/blocklet/component/space-selector.js +2 -2
- package/lib/blocklet/component/store-blocklet-list.js +10 -3
- package/lib/blocklet/component/switch-control.js +2 -2
- package/lib/blocklet/config-navigation.js +4 -3
- package/lib/blocklet/configuration.js +2 -2
- package/lib/blocklet/disk-info.js +2 -2
- package/lib/blocklet/install-from-url.js +2 -2
- package/lib/blocklet/log.js +2 -2
- package/lib/blocklet/mode.js +2 -2
- package/lib/blocklet/notification/email.js +2 -2
- package/lib/blocklet/oauth/auth0.js +2 -2
- package/lib/blocklet/oauth/common-settings.js +2 -2
- package/lib/blocklet/page-group.js +2 -2
- package/lib/blocklet/preferences/index.js +2 -2
- package/lib/blocklet/publish/create-project.js +2 -2
- package/lib/blocklet/publish/create-release.js +2 -2
- package/lib/blocklet/purchase/component-purchase.js +2 -2
- package/lib/blocklet/resource-type.js +2 -2
- package/lib/blocklet/router/action/add-domain-alias.js +2 -2
- package/lib/blocklet/router/action/add-rule.js +2 -2
- package/lib/blocklet/router/action/config-routing-rule.js +2 -2
- package/lib/blocklet/router/action/update-rule.js +2 -2
- package/lib/blocklet/router/add-domain.js +2 -2
- package/lib/blocklet/router/dns-tip.js +2 -2
- package/lib/blocklet/router/rule-actions.js +2 -2
- package/lib/blocklet/router/rule-list.js +2 -2
- package/lib/blocklet/runtime-info.js +2 -2
- package/lib/blocklet/status.js +2 -2
- package/lib/blocklet/storage/action.js +2 -2
- package/lib/blocklet/storage/auto-backup.js +2 -2
- package/lib/blocklet/storage/auto-check-update.js +2 -2
- package/lib/blocklet/storage/backups.js +2 -2
- package/lib/blocklet/storage/connect-to.js +2 -2
- package/lib/blocklet/storage/disconnect.js +2 -2
- package/lib/blocklet/storage/item.js +2 -2
- package/lib/blocklet/storage/preview-nft.js +2 -2
- package/lib/blocklet/version.js +2 -2
- package/lib/clear-cache.js +2 -2
- package/lib/click-to-copy.js +2 -2
- package/lib/confirm.js +2 -2
- package/lib/contexts/blocklet-storage.js +2 -2
- package/lib/contexts/node.js +2 -2
- package/lib/delete-confirm.js +2 -2
- package/lib/did-address.js +2 -2
- package/lib/empty-spinner.js +2 -2
- package/lib/form/form-autocomplete-input.js +2 -2
- package/lib/form/form-select-input.js +2 -2
- package/lib/form/form-text-input.js +2 -2
- package/lib/hooks/blocklet.js +2 -2
- package/lib/hooks/url-evaluation.js +2 -2
- package/lib/hooks/use-backup-progress.js +2 -2
- package/lib/hooks/use-check-update-by-url.js +0 -1
- package/lib/hooks/use-components-by-blocklet-meta-url.js +42 -0
- package/lib/hooks/use-install-component-by-url.js +73 -0
- package/lib/hooks/use-navigation.js +2 -18
- package/lib/images.js +2 -2
- package/lib/invitation/invitation-app.js +2 -2
- package/lib/invitation/invitation-receive.js +2 -2
- package/lib/launch-blocklet/content-layout.js +2 -2
- package/lib/layout/addon.js +2 -2
- package/lib/locales/ar.js +13 -4
- package/lib/locales/de.js +13 -4
- package/lib/locales/en.js +6 -0
- package/lib/locales/es.js +13 -4
- package/lib/locales/fr.js +13 -4
- package/lib/locales/hi.js +13 -4
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +13 -4
- package/lib/locales/ja.js +13 -4
- package/lib/locales/ko.js +13 -4
- package/lib/locales/pt.js +13 -4
- package/lib/locales/ru.js +13 -4
- package/lib/locales/th.js +13 -4
- package/lib/locales/vi.js +13 -4
- package/lib/locales/zh-tw.js +13 -4
- package/lib/locales/zh.js +10 -3
- package/lib/logs/log-terminal.js +2 -2
- package/lib/nav-logo.js +2 -2
- package/lib/notifications/default-icon-variants.js +2 -2
- package/lib/notifications/notification.js +2 -2
- package/lib/notifications/tag.js +2 -2
- package/lib/passport-tag.js +2 -2
- package/lib/permission.js +2 -2
- package/lib/relative-time.js +2 -2
- package/lib/schema-form/index.js +2 -2
- package/lib/schema-form/passport-input.js +2 -2
- package/lib/schema-form/text-input.js +2 -2
- package/lib/subscription.js +2 -2
- package/lib/tag.js +2 -2
- package/lib/team/members/index.js +5 -4
- package/lib/team/members/member.js +3 -3
- package/lib/team/members/passport-item.js +2 -2
- package/lib/team/members/passports.js +2 -2
- package/lib/team/passports/color.js +2 -2
- package/lib/team/passports/detail.js +2 -2
- package/lib/team/passports/trusted-factories.js +2 -2
- package/lib/team/passports/trusted-issuer.js +2 -2
- package/lib/team/passports/trusted-issuers.js +2 -2
- package/lib/team/search-input.js +2 -2
- package/lib/util/space-gateway.js +2 -2
- package/lib/wrap-locale.js +2 -2
- package/package.json +25 -23
- package/es/blocklet/component/add.js +0 -95
- package/lib/blocklet/component/add.js +0 -100
|
@@ -9,523 +9,37 @@ import DialogActions from '@mui/material/DialogActions';
|
|
|
9
9
|
import UpdateIcon from '@mui/icons-material/Update';
|
|
10
10
|
import IconButton from '@mui/material/IconButton';
|
|
11
11
|
import AddIcon from '@mui/icons-material/Add';
|
|
12
|
-
import Badge from '@mui/material/Badge';
|
|
13
12
|
import SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined';
|
|
14
|
-
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
15
|
-
import LaunchIcon from '@mui/icons-material/Launch';
|
|
16
13
|
import Grid from '@mui/material/Grid';
|
|
17
14
|
import Tooltip from '@mui/material/Tooltip';
|
|
18
15
|
import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
|
|
19
16
|
import Checkbox from '@mui/material/Checkbox';
|
|
20
|
-
import RestartIcon from '@mui/icons-material/Replay';
|
|
21
|
-
import ReloadIcon from '@mui/icons-material/Autorenew';
|
|
22
|
-
import DeleteIcon from '@mui/icons-material/Delete';
|
|
23
17
|
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
24
18
|
import Switch from '@mui/material/Switch';
|
|
25
|
-
import { Icon } from '@iconify/react';
|
|
26
19
|
import { APP_STRUCT_VERSION } from '@abtnode/constant';
|
|
27
20
|
import Spinner from '@mui/material/CircularProgress';
|
|
28
|
-
import InfoRow from '@arcblock/ux/lib/InfoRow';
|
|
29
21
|
import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
30
22
|
import Button from '@arcblock/ux/lib/Button';
|
|
31
23
|
import Empty from '@arcblock/ux/lib/Empty';
|
|
32
|
-
import {
|
|
33
|
-
import normalizePathPrefix from '@abtnode/util/lib/normalize-path-prefix';
|
|
24
|
+
import { forEachChildSync, isInProgress } from '@blocklet/meta/lib/util';
|
|
34
25
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
35
26
|
import { useDeletingBlockletContext } from '../../contexts/deleting-blocklets';
|
|
36
|
-
import DidAddress from '../../did-address';
|
|
37
|
-
import Tag from '../../tag';
|
|
38
|
-
import BlockletSource from '../blocklet-source';
|
|
39
|
-
import BlockletStatus from '../status';
|
|
40
|
-
import BlockletVersion from '../version';
|
|
41
|
-
import Confirm from '../../confirm';
|
|
42
27
|
import AutoCheckUpdate from '../storage/auto-check-update';
|
|
43
28
|
import { useNodeContext } from '../../contexts/node';
|
|
44
|
-
import {
|
|
29
|
+
import { formatError, sleep, BlockletAdminRoles } from '../../util';
|
|
45
30
|
import Permission from '../../permission';
|
|
46
|
-
import BlockletBundleAvatar from '../bundle-avatar';
|
|
47
|
-
import BlockletMode from '../mode';
|
|
48
31
|
import ComponentConfiguration from './configuration';
|
|
49
|
-
import
|
|
50
|
-
import StartComponent from './start';
|
|
51
|
-
import Line from './line';
|
|
52
|
-
import AddComponent from './add';
|
|
32
|
+
import AddComponentButton from './add-component-button';
|
|
53
33
|
import AddRule from '../router/action/add-rule';
|
|
54
34
|
import RuleList from '../router/rule-list';
|
|
55
|
-
import
|
|
56
|
-
import
|
|
35
|
+
import useCheckUpdateByUrl from '../../hooks/use-check-update-by-url';
|
|
36
|
+
import useGetInstallComponentByUrl from '../../hooks/use-install-component-by-url';
|
|
37
|
+
import ComponentCell, { StyledBadge, StyledComponentRow } from './component-cell';
|
|
38
|
+
import OptionalComponentCell from './optional-component-cell';
|
|
39
|
+
import AddComponentDialog from './add-component-dialog';
|
|
57
40
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
58
41
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
59
|
-
|
|
60
|
-
if (!engine) {
|
|
61
|
-
return [];
|
|
62
|
-
}
|
|
63
|
-
return [{
|
|
64
|
-
name: t('common.name'),
|
|
65
|
-
value: engine.displayName
|
|
66
|
-
}, {
|
|
67
|
-
name: t('common.description'),
|
|
68
|
-
value: engine.description
|
|
69
|
-
}, {
|
|
70
|
-
name: t('common.version'),
|
|
71
|
-
value: /*#__PURE__*/_jsx(Tag, {
|
|
72
|
-
children: engine.version
|
|
73
|
-
})
|
|
74
|
-
}];
|
|
75
|
-
};
|
|
76
|
-
const getSourceInfo = blocklet => {
|
|
77
|
-
const {
|
|
78
|
-
source,
|
|
79
|
-
deployedFrom,
|
|
80
|
-
bundleSource
|
|
81
|
-
} = blocklet;
|
|
82
|
-
if (source) {
|
|
83
|
-
return {
|
|
84
|
-
source,
|
|
85
|
-
deployedFrom
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
if (!bundleSource) {
|
|
89
|
-
return {
|
|
90
|
-
source: 'upload',
|
|
91
|
-
deployedFrom
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
if (bundleSource.url) {
|
|
95
|
-
return {
|
|
96
|
-
source: 'url',
|
|
97
|
-
deployedFrom: deployedFrom || Array.isArray(bundleSource.url) ? bundleSource.url[0] : bundleSource.url
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
if (bundleSource.store) {
|
|
101
|
-
return {
|
|
102
|
-
source: 'registry',
|
|
103
|
-
deployedFrom: deployedFrom || Array.isArray(bundleSource.store) ? bundleSource.store[0] : bundleSource.store
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
return {};
|
|
107
|
-
};
|
|
108
|
-
const getComponentName = (componentId, app) => {
|
|
109
|
-
const ids = componentId.split('/').slice(1);
|
|
110
|
-
let parent = app;
|
|
111
|
-
let index = 0;
|
|
112
|
-
const names = [];
|
|
113
|
-
while (parent && index < ids.length) {
|
|
114
|
-
// eslint-disable-next-line no-loop-func
|
|
115
|
-
const component = parent.children.find(x => x.meta.did === ids[index]);
|
|
116
|
-
parent = component;
|
|
117
|
-
index++;
|
|
118
|
-
if (component) {
|
|
119
|
-
names.push(component.meta.title);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return names.join(' / ');
|
|
123
|
-
};
|
|
124
|
-
const isPack = component => component?.meta?.group === 'pack';
|
|
125
|
-
function ComponentItem({
|
|
126
|
-
blocklet,
|
|
127
|
-
ancestors,
|
|
128
|
-
depth,
|
|
129
|
-
onRemove,
|
|
130
|
-
onStart,
|
|
131
|
-
onStop,
|
|
132
|
-
onRestart,
|
|
133
|
-
onReload,
|
|
134
|
-
getComponentUrl,
|
|
135
|
-
app
|
|
136
|
-
}) {
|
|
137
|
-
const {
|
|
138
|
-
t,
|
|
139
|
-
locale
|
|
140
|
-
} = useContext(LocaleContext);
|
|
141
|
-
const [componentInfo, setComponentInfo] = useState();
|
|
142
|
-
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
|
143
|
-
const [loading, setLoading] = useState(false);
|
|
144
|
-
const [confirmSetting, setConfirmSetting] = useState(null);
|
|
145
|
-
const {
|
|
146
|
-
deletingBlocklets: deletingComponents
|
|
147
|
-
} = useDeletingBlockletContext();
|
|
148
|
-
let {
|
|
149
|
-
status
|
|
150
|
-
} = blocklet;
|
|
151
|
-
if (depth === 1 && deletingComponents.includes(blocklet.meta.did)) {
|
|
152
|
-
status = 'deleting';
|
|
153
|
-
}
|
|
154
|
-
const mountPoint = `/${blocklet.mountPoint || '/'}`.replace(/\/+/g, '/');
|
|
155
|
-
const href = getComponentUrl(mountPoint);
|
|
156
|
-
const renderRows = rows => rows.map(row => {
|
|
157
|
-
if (row.name === t('common.did') || row.name === t('blocklet.appId')) {
|
|
158
|
-
return /*#__PURE__*/_jsx(InfoRow, {
|
|
159
|
-
valueComponent: "div",
|
|
160
|
-
nameWidth: 120,
|
|
161
|
-
name: row.name,
|
|
162
|
-
nameFormatter: () => row.name,
|
|
163
|
-
children: row.value
|
|
164
|
-
}, row.name);
|
|
165
|
-
}
|
|
166
|
-
return /*#__PURE__*/_jsx(InfoRow, {
|
|
167
|
-
valueComponent: "div",
|
|
168
|
-
nameWidth: 120,
|
|
169
|
-
name: row.name,
|
|
170
|
-
children: row.value
|
|
171
|
-
}, row.name);
|
|
172
|
-
});
|
|
173
|
-
const sourceInfo = componentInfo ? getSourceInfo(componentInfo) : {};
|
|
174
|
-
const componentRows = componentInfo ? [{
|
|
175
|
-
name: t('common.name'),
|
|
176
|
-
value: getDisplayName(componentInfo, true)
|
|
177
|
-
}, {
|
|
178
|
-
name: t('common.version'),
|
|
179
|
-
value: /*#__PURE__*/_jsx(BlockletVersion, {
|
|
180
|
-
blocklet: componentInfo,
|
|
181
|
-
checkUpgrade: false
|
|
182
|
-
})
|
|
183
|
-
}, {
|
|
184
|
-
name: t('common.status'),
|
|
185
|
-
value: /*#__PURE__*/_jsx(BlockletStatus, {
|
|
186
|
-
status: status,
|
|
187
|
-
source: componentInfo.source,
|
|
188
|
-
progress: blocklet.progress
|
|
189
|
-
})
|
|
190
|
-
}, blocklet.status === 'running' ? {
|
|
191
|
-
name: t('blocklet.startedAt'),
|
|
192
|
-
value: formatToDatetime(blocklet.startedAt, locale)
|
|
193
|
-
} : null, blocklet.status !== 'running' ? {
|
|
194
|
-
name: t('blocklet.stoppedAt'),
|
|
195
|
-
value: formatToDatetime(blocklet.stoppedAt, locale)
|
|
196
|
-
} : null, blocklet.installedAt ? {
|
|
197
|
-
name: t('blocklet.installedAt'),
|
|
198
|
-
value: formatToDatetime(blocklet.installedAt, locale)
|
|
199
|
-
} : null, hasStartEngine(blocklet.meta) ? {
|
|
200
|
-
name: t('common.mountPoint'),
|
|
201
|
-
value: mountPoint
|
|
202
|
-
} : null, componentInfo.meta.group ? {
|
|
203
|
-
name: t('common.group'),
|
|
204
|
-
value: /*#__PURE__*/_jsx(Tag, {
|
|
205
|
-
type: "success",
|
|
206
|
-
children: componentInfo.meta.group
|
|
207
|
-
})
|
|
208
|
-
} : null, {
|
|
209
|
-
name: t('blocklet.overview.source'),
|
|
210
|
-
value: /*#__PURE__*/_jsx(BlockletSource, {
|
|
211
|
-
sourceInfo: sourceInfo,
|
|
212
|
-
blocklet: blocklet
|
|
213
|
-
})
|
|
214
|
-
}, {
|
|
215
|
-
name: t('blocklet.overview.deployedFrom'),
|
|
216
|
-
value: sourceInfo.deployedFrom || '-'
|
|
217
|
-
}, {
|
|
218
|
-
name: t('common.did'),
|
|
219
|
-
value: /*#__PURE__*/_jsx(DidAddress, {
|
|
220
|
-
did: componentInfo.meta.did
|
|
221
|
-
})
|
|
222
|
-
}, {
|
|
223
|
-
name: t('common.author'),
|
|
224
|
-
value: formatPerson(componentInfo.meta.author)
|
|
225
|
-
}, {
|
|
226
|
-
name: t('common.engine'),
|
|
227
|
-
value: getEngineRows(componentInfo.engine, t).map(({
|
|
228
|
-
name,
|
|
229
|
-
value
|
|
230
|
-
}) => /*#__PURE__*/_jsx(InfoRow, {
|
|
231
|
-
style: {
|
|
232
|
-
marginBottom: 4
|
|
233
|
-
},
|
|
234
|
-
nameWidth: 120,
|
|
235
|
-
name: name,
|
|
236
|
-
children: value
|
|
237
|
-
}, name))
|
|
238
|
-
}, blocklet.dependents?.length ? {
|
|
239
|
-
name: t('common.dependents'),
|
|
240
|
-
value: /*#__PURE__*/_jsx(Box, {
|
|
241
|
-
children: blocklet.dependents.map(x => /*#__PURE__*/_jsx(Box, {
|
|
242
|
-
children: `${getComponentName(x.id, app)} ${x.required ? `(${t('common.required')})` : ''}`
|
|
243
|
-
}, x.id))
|
|
244
|
-
})
|
|
245
|
-
} : null, blocklet.meta.resources?.length ? {
|
|
246
|
-
name: t('common.resource'),
|
|
247
|
-
value: blocklet.meta.resources.join(', ')
|
|
248
|
-
} : null].filter(Boolean) : [];
|
|
249
|
-
const appInProgress = isInProgress(app.status);
|
|
250
|
-
const componentInProgress = isInProgress(blocklet.status);
|
|
251
|
-
let deleteDisabledTip = '';
|
|
252
|
-
if (appInProgress || componentInProgress || depth === 1 && deletingComponents.includes(blocklet.meta.did)) {
|
|
253
|
-
deleteDisabledTip = t('blocklet.component.tip.stopBlocklet');
|
|
254
|
-
} else if (blocklet.dependents?.length) {
|
|
255
|
-
const requires = blocklet.dependents.filter(x => x.required);
|
|
256
|
-
if (requires.length) {
|
|
257
|
-
const names = requires.map(x => getComponentName(x.id, app));
|
|
258
|
-
deleteDisabledTip = t('blocklet.component.tip.requiredBy', {
|
|
259
|
-
name: names.join(', ')
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
return [/*#__PURE__*/_jsxs(StyledComponentRow, {
|
|
264
|
-
display: "flex",
|
|
265
|
-
py: 2,
|
|
266
|
-
className: "component-item",
|
|
267
|
-
justifyContent: "space-between",
|
|
268
|
-
alignItems: "center",
|
|
269
|
-
children: [/*#__PURE__*/_jsxs(Box, {
|
|
270
|
-
pl: 2,
|
|
271
|
-
width: {
|
|
272
|
-
xs: 300,
|
|
273
|
-
md: 400
|
|
274
|
-
},
|
|
275
|
-
display: "flex",
|
|
276
|
-
alignItems: "center",
|
|
277
|
-
children: [/*#__PURE__*/_jsx(BlockletBundleAvatar, {
|
|
278
|
-
blocklet: blocklet,
|
|
279
|
-
ancestors: ancestors
|
|
280
|
-
}), /*#__PURE__*/_jsxs(Box, {
|
|
281
|
-
ml: "16px",
|
|
282
|
-
children: [/*#__PURE__*/_jsxs(Box, {
|
|
283
|
-
className: "component-header",
|
|
284
|
-
onClick: () => setComponentInfo(blocklet),
|
|
285
|
-
children: [/*#__PURE__*/_jsx(Box, {
|
|
286
|
-
className: "component-name",
|
|
287
|
-
children: getDisplayName(blocklet, true)
|
|
288
|
-
}), /*#__PURE__*/_jsx(Box, {
|
|
289
|
-
className: "component-version",
|
|
290
|
-
children: blocklet?.meta?.version
|
|
291
|
-
})]
|
|
292
|
-
}), /*#__PURE__*/_jsxs(Box, {
|
|
293
|
-
display: "flex",
|
|
294
|
-
alignItems: "center",
|
|
295
|
-
sx: {
|
|
296
|
-
mt: '2px',
|
|
297
|
-
ml: -0.5
|
|
298
|
-
},
|
|
299
|
-
children: [status !== 'unknown' && /*#__PURE__*/_jsx(BlockletStatus, {
|
|
300
|
-
style: {
|
|
301
|
-
marginLeft: 4
|
|
302
|
-
},
|
|
303
|
-
status: status,
|
|
304
|
-
source: blocklet.source,
|
|
305
|
-
progress: blocklet.progress
|
|
306
|
-
}), /*#__PURE__*/_jsx(BlockletMode, {
|
|
307
|
-
style: {
|
|
308
|
-
marginLeft: 4
|
|
309
|
-
},
|
|
310
|
-
mode: blocklet.mode || ''
|
|
311
|
-
}), !!blocklet.dependents?.length && /*#__PURE__*/_jsx(Tooltip, {
|
|
312
|
-
title: [`${t('common.dependents')}: `, blocklet.dependents.map(x => /*#__PURE__*/_jsx(Box, {
|
|
313
|
-
pl: 1,
|
|
314
|
-
children: `${getComponentName(x.id, app)} ${x.required ? `(${t('common.required')})` : ''}`
|
|
315
|
-
}, x.id))],
|
|
316
|
-
children: /*#__PURE__*/_jsx(Box, {
|
|
317
|
-
display: "flex",
|
|
318
|
-
color: "primary.main",
|
|
319
|
-
ml: 1,
|
|
320
|
-
children: /*#__PURE__*/_jsx(Icon, {
|
|
321
|
-
icon: "octicon:package-dependents-16"
|
|
322
|
-
})
|
|
323
|
-
})
|
|
324
|
-
})]
|
|
325
|
-
})]
|
|
326
|
-
})]
|
|
327
|
-
}, blocklet), hasStartEngine(blocklet.meta) && /*#__PURE__*/_jsx(Box, {
|
|
328
|
-
sx: {
|
|
329
|
-
display: {
|
|
330
|
-
xs: 'none',
|
|
331
|
-
md: 'flex'
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
alignItems: "center",
|
|
335
|
-
flexGrow: "1",
|
|
336
|
-
children: /*#__PURE__*/_jsx("a", {
|
|
337
|
-
target: "_blank",
|
|
338
|
-
href: href,
|
|
339
|
-
rel: "noopener noreferrer",
|
|
340
|
-
title: href,
|
|
341
|
-
children: /*#__PURE__*/_jsx(Box, {
|
|
342
|
-
maxWidth: 400,
|
|
343
|
-
sx: {
|
|
344
|
-
color: 'secondary.main',
|
|
345
|
-
fontSize: 18,
|
|
346
|
-
px: 2
|
|
347
|
-
},
|
|
348
|
-
overflow: "hidden",
|
|
349
|
-
whiteSpace: "nowrap",
|
|
350
|
-
textOverflow: "ellipsis",
|
|
351
|
-
children: normalizePathPrefix(mountPoint)
|
|
352
|
-
})
|
|
353
|
-
})
|
|
354
|
-
}, mountPoint), /*#__PURE__*/_jsxs(Box, {
|
|
355
|
-
display: "flex",
|
|
356
|
-
alignItems: "center",
|
|
357
|
-
children: [hasStartEngine(blocklet.meta) && /*#__PURE__*/_jsx(Tooltip, {
|
|
358
|
-
title: t('common.visit'),
|
|
359
|
-
children: /*#__PURE__*/_jsx("a", {
|
|
360
|
-
target: "_blank",
|
|
361
|
-
href: href,
|
|
362
|
-
rel: "noopener noreferrer",
|
|
363
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
|
364
|
-
size: "small",
|
|
365
|
-
children: /*#__PURE__*/_jsx(LaunchIcon, {})
|
|
366
|
-
})
|
|
367
|
-
})
|
|
368
|
-
}), /*#__PURE__*/_jsx(ComponentConfiguration, {
|
|
369
|
-
blocklet: blocklet,
|
|
370
|
-
ancestors: ancestors,
|
|
371
|
-
children: ({
|
|
372
|
-
open
|
|
373
|
-
}) => /*#__PURE__*/_jsx(Tooltip, {
|
|
374
|
-
title: t('common.config'),
|
|
375
|
-
children: /*#__PURE__*/_jsx(StyledBadge, {
|
|
376
|
-
color: "error",
|
|
377
|
-
badgeContent: "",
|
|
378
|
-
variant: "dot",
|
|
379
|
-
invisible: !getComponentMissingConfigs(blocklet, ancestors[0]).length,
|
|
380
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
|
381
|
-
onClick: open,
|
|
382
|
-
size: "small",
|
|
383
|
-
children: /*#__PURE__*/_jsx(SettingsOutlinedIcon, {})
|
|
384
|
-
})
|
|
385
|
-
})
|
|
386
|
-
}, "config")
|
|
387
|
-
}), /*#__PURE__*/_jsx(StartComponent, {
|
|
388
|
-
blocklet: app,
|
|
389
|
-
component: blocklet,
|
|
390
|
-
onStart: onStart,
|
|
391
|
-
onStop: onStop,
|
|
392
|
-
disabled: !['starting', 'stopping'].includes(app.status) && isInProgress(app.status)
|
|
393
|
-
}), /*#__PURE__*/_jsx(Actions, {
|
|
394
|
-
"data-cy": "component-actions",
|
|
395
|
-
actions: [hasStartEngine(blocklet.meta) ? {
|
|
396
|
-
icon: /*#__PURE__*/_jsx(InfoOutlinedIcon, {}),
|
|
397
|
-
text: t('common.detail'),
|
|
398
|
-
onClick: () => {
|
|
399
|
-
setComponentInfo(blocklet);
|
|
400
|
-
}
|
|
401
|
-
} : null, !isPack(blocklet) && {
|
|
402
|
-
icon: /*#__PURE__*/_jsx(RestartIcon, {}),
|
|
403
|
-
text: t('common.restart'),
|
|
404
|
-
onClick: () => {
|
|
405
|
-
setConfirmSetting({
|
|
406
|
-
title: `${t('common.restart')} ${blocklet.meta.title}`,
|
|
407
|
-
description: t('blocklet.action.restartDescription'),
|
|
408
|
-
confirm: t('blocklet.action.confirmRestart'),
|
|
409
|
-
cancel: t('common.cancel'),
|
|
410
|
-
onConfirm: async () => {
|
|
411
|
-
setLoading(true);
|
|
412
|
-
await onRestart(blocklet);
|
|
413
|
-
setLoading(false);
|
|
414
|
-
},
|
|
415
|
-
onCancel: () => setConfirmSetting(null)
|
|
416
|
-
});
|
|
417
|
-
},
|
|
418
|
-
disabled: appInProgress || componentInProgress || blocklet.status !== 'running'
|
|
419
|
-
}, !isPack(blocklet) && {
|
|
420
|
-
icon: /*#__PURE__*/_jsx(ReloadIcon, {}),
|
|
421
|
-
text: t('common.reload'),
|
|
422
|
-
onClick: async () => {
|
|
423
|
-
setLoading(true);
|
|
424
|
-
await onReload(blocklet);
|
|
425
|
-
setLoading(false);
|
|
426
|
-
},
|
|
427
|
-
disabled: loading || appInProgress || componentInProgress || blocklet.status !== 'running'
|
|
428
|
-
}, {
|
|
429
|
-
icon: /*#__PURE__*/_jsx(DeleteIcon, {}),
|
|
430
|
-
text: t('common.delete'),
|
|
431
|
-
onClick: () => {
|
|
432
|
-
setShowDeleteConfirm(true);
|
|
433
|
-
},
|
|
434
|
-
disabled: appInProgress || componentInProgress || !!deleteDisabledTip,
|
|
435
|
-
tip: deleteDisabledTip
|
|
436
|
-
}].filter(Boolean)
|
|
437
|
-
})]
|
|
438
|
-
}, "actions")]
|
|
439
|
-
}, "group-not-gateway-box"), /*#__PURE__*/_jsx(Line, {
|
|
440
|
-
depth: 2
|
|
441
|
-
}, "line"), !!componentInfo && /*#__PURE__*/_jsx(Dialog, {
|
|
442
|
-
open: true,
|
|
443
|
-
fullWidth: true,
|
|
444
|
-
maxWidth: "md",
|
|
445
|
-
onClose: () => {
|
|
446
|
-
setComponentInfo(null);
|
|
447
|
-
},
|
|
448
|
-
children: /*#__PURE__*/_jsxs(Box, {
|
|
449
|
-
paddingY: 1.5,
|
|
450
|
-
children: [/*#__PURE__*/_jsx(DialogTitle, {
|
|
451
|
-
children: t('common.componentBasicInfo')
|
|
452
|
-
}), /*#__PURE__*/_jsx(DialogContent, {
|
|
453
|
-
children: renderRows(componentRows)
|
|
454
|
-
})]
|
|
455
|
-
}, "dialog-wrapper")
|
|
456
|
-
}, "base-info-dialog"), /*#__PURE__*/_jsx(DeleteComponent, {
|
|
457
|
-
blocklet: app,
|
|
458
|
-
component: blocklet,
|
|
459
|
-
remove: async (...param) => {
|
|
460
|
-
setLoading(true);
|
|
461
|
-
try {
|
|
462
|
-
await onRemove(...param);
|
|
463
|
-
} catch {
|
|
464
|
-
// ignore
|
|
465
|
-
}
|
|
466
|
-
setLoading(false);
|
|
467
|
-
setShowDeleteConfirm(false);
|
|
468
|
-
},
|
|
469
|
-
onCancel: () => setShowDeleteConfirm(false),
|
|
470
|
-
hideBtn: true,
|
|
471
|
-
showConfirm: showDeleteConfirm
|
|
472
|
-
}, "delete-component"), confirmSetting && /*#__PURE__*/_jsx(Confirm, {
|
|
473
|
-
title: confirmSetting.title,
|
|
474
|
-
description: confirmSetting.description,
|
|
475
|
-
confirm: confirmSetting.confirm,
|
|
476
|
-
cancel: confirmSetting.cancel,
|
|
477
|
-
params: confirmSetting.params,
|
|
478
|
-
onConfirm: confirmSetting.onConfirm,
|
|
479
|
-
onCancel: confirmSetting.onCancel
|
|
480
|
-
}, "confirm-setting")];
|
|
481
|
-
}
|
|
482
|
-
ComponentItem.propTypes = {
|
|
483
|
-
blocklet: PropTypes.object.isRequired,
|
|
484
|
-
ancestors: PropTypes.array,
|
|
485
|
-
depth: PropTypes.number,
|
|
486
|
-
onRemove: PropTypes.func,
|
|
487
|
-
onStart: PropTypes.func,
|
|
488
|
-
onStop: PropTypes.func,
|
|
489
|
-
onRestart: PropTypes.func,
|
|
490
|
-
onReload: PropTypes.func,
|
|
491
|
-
getComponentUrl: PropTypes.func,
|
|
492
|
-
app: PropTypes.object
|
|
493
|
-
};
|
|
494
|
-
ComponentItem.defaultProps = {
|
|
495
|
-
ancestors: [],
|
|
496
|
-
depth: 0,
|
|
497
|
-
onRemove: () => {},
|
|
498
|
-
onStart: () => {},
|
|
499
|
-
onStop: () => {},
|
|
500
|
-
onRestart: () => {},
|
|
501
|
-
onReload: () => {},
|
|
502
|
-
getComponentUrl: () => window.location.origin,
|
|
503
|
-
app: null
|
|
504
|
-
};
|
|
505
|
-
const StyledBadge = styled(Badge)`
|
|
506
|
-
.BaseBadge-badge {
|
|
507
|
-
top: ${props => props.top * 8 || 6}px;
|
|
508
|
-
right: ${props => props.right * 8 || 6}px;
|
|
509
|
-
}
|
|
510
|
-
`;
|
|
511
|
-
const StyledComponentRow = styled(Box)`
|
|
512
|
-
.component-header {
|
|
513
|
-
display: flex;
|
|
514
|
-
align-items: center;
|
|
515
|
-
align-items: flex-end;
|
|
516
|
-
cursor: pointer;
|
|
517
|
-
}
|
|
518
|
-
.component-name {
|
|
519
|
-
color: #222;
|
|
520
|
-
font-size: 16px;
|
|
521
|
-
}
|
|
522
|
-
.component-version {
|
|
523
|
-
color: #999;
|
|
524
|
-
font-size: 12px;
|
|
525
|
-
margin-left: 4px;
|
|
526
|
-
transform: translateY(-1px);
|
|
527
|
-
}
|
|
528
|
-
`;
|
|
42
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
529
43
|
export default function BlockletComponent({
|
|
530
44
|
blocklet,
|
|
531
45
|
onUpdate,
|
|
@@ -549,6 +63,7 @@ export default function BlockletComponent({
|
|
|
549
63
|
const [updateConfirm, setUpdateConfirm] = useState(null);
|
|
550
64
|
const [showSettings, setShowSettings] = useState(null);
|
|
551
65
|
const [showContainer, setShowContainer] = useState(false);
|
|
66
|
+
const [installComponentMeta, setInstallComponentMeta] = useState(null);
|
|
552
67
|
const needMigration = blocklet && blocklet.structVersion !== APP_STRUCT_VERSION;
|
|
553
68
|
|
|
554
69
|
// update dot is not used but maybe useful in the further
|
|
@@ -729,21 +244,21 @@ export default function BlockletComponent({
|
|
|
729
244
|
});
|
|
730
245
|
};
|
|
731
246
|
useCheckUpdateByUrl(checkForUpdates);
|
|
247
|
+
const _installComponentMeta = useGetInstallComponentByUrl({
|
|
248
|
+
blocklet,
|
|
249
|
+
scrollToComponent: true
|
|
250
|
+
});
|
|
251
|
+
const parseInstallComponentMeta = installComponentMeta || _installComponentMeta;
|
|
732
252
|
return /*#__PURE__*/_jsxs(Div, {
|
|
733
253
|
component: "div",
|
|
734
254
|
...rest,
|
|
735
|
-
children: [/*#__PURE__*/_jsxs(
|
|
255
|
+
children: [/*#__PURE__*/_jsxs(TitleRow, {
|
|
736
256
|
display: "flex",
|
|
737
|
-
|
|
738
|
-
alignItems: "center",
|
|
739
|
-
children: [/*#__PURE__*/_jsxs(Box, {
|
|
740
|
-
className: "title",
|
|
257
|
+
children: [/*#__PURE__*/_jsxs(TitleItem, {
|
|
741
258
|
flexDirection: "row",
|
|
259
|
+
className: "title",
|
|
742
260
|
display: "flex",
|
|
743
261
|
alignItems: "center",
|
|
744
|
-
style: {
|
|
745
|
-
marginLeft: '1em'
|
|
746
|
-
},
|
|
747
262
|
children: [t('common.components'), !needMigration && /*#__PURE__*/_jsx(Permission, {
|
|
748
263
|
permission: inService ? '' : 'mutate_blocklets',
|
|
749
264
|
role: inService ? BlockletAdminRoles : [],
|
|
@@ -791,6 +306,7 @@ export default function BlockletComponent({
|
|
|
791
306
|
variant: "text",
|
|
792
307
|
color: "primary",
|
|
793
308
|
"data-cy": "add-rule",
|
|
309
|
+
className: "sm-hide-icon",
|
|
794
310
|
onClick: open,
|
|
795
311
|
children: [/*#__PURE__*/_jsx(AddIcon, {
|
|
796
312
|
style: {
|
|
@@ -799,7 +315,7 @@ export default function BlockletComponent({
|
|
|
799
315
|
}
|
|
800
316
|
}), t('router.rule.add.title')]
|
|
801
317
|
})
|
|
802
|
-
}), !needMigration && /*#__PURE__*/_jsx(
|
|
318
|
+
}), !needMigration && /*#__PURE__*/_jsx(AddComponentButton, {
|
|
803
319
|
blocklet: blocklet,
|
|
804
320
|
serverVersion: info.version,
|
|
805
321
|
children: ({
|
|
@@ -809,6 +325,7 @@ export default function BlockletComponent({
|
|
|
809
325
|
variant: "text",
|
|
810
326
|
color: "primary",
|
|
811
327
|
"data-cy": "add-component",
|
|
328
|
+
className: "sm-hide-icon",
|
|
812
329
|
onClick: open,
|
|
813
330
|
children: [/*#__PURE__*/_jsx(AddIcon, {
|
|
814
331
|
style: {
|
|
@@ -838,34 +355,37 @@ export default function BlockletComponent({
|
|
|
838
355
|
})]
|
|
839
356
|
})
|
|
840
357
|
})]
|
|
841
|
-
}), components?.length ? /*#__PURE__*/_jsxs(
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
358
|
+
}), components?.length ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
359
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
360
|
+
mt: 2,
|
|
361
|
+
children: [blocklet.meta.group !== 'gateway' && /*#__PURE__*/_jsx(ComponentCell, {
|
|
362
|
+
blocklet: blocklet,
|
|
363
|
+
app: blocklet,
|
|
364
|
+
onRemove: removeComponent,
|
|
365
|
+
onStart: startComponent,
|
|
366
|
+
onStop: stopComponent,
|
|
367
|
+
onReload: reloadComponent,
|
|
368
|
+
onRestart: restartComponent,
|
|
369
|
+
getComponentUrl: getComponentUrl
|
|
370
|
+
}, `0-${blocklet.meta.did}`), blocklet.children.map(component => /*#__PURE__*/_jsx(ComponentCell, {
|
|
371
|
+
depth: 1,
|
|
372
|
+
blocklet: component,
|
|
373
|
+
ancestors: [blocklet],
|
|
374
|
+
app: blocklet,
|
|
375
|
+
onRemove: removeComponent,
|
|
376
|
+
onStart: startComponent,
|
|
377
|
+
onStop: stopComponent,
|
|
378
|
+
onReload: reloadComponent,
|
|
379
|
+
onRestart: restartComponent,
|
|
380
|
+
getComponentUrl: getComponentUrl
|
|
381
|
+
}, `1-${component.meta.did}`))]
|
|
382
|
+
}, `top-blocklet-${blocklet.meta.did}`), blocklet.optionalComponents?.map(component => /*#__PURE__*/_jsx(StyledComponentRow, {
|
|
383
|
+
children: /*#__PURE__*/_jsx(OptionalComponentCell, {
|
|
384
|
+
setInstallComponentMeta: setInstallComponentMeta,
|
|
385
|
+
...component
|
|
386
|
+
})
|
|
387
|
+
}, component.meta.did))]
|
|
388
|
+
}) : /*#__PURE__*/_jsx(Box, {
|
|
869
389
|
mt: 8,
|
|
870
390
|
children: /*#__PURE__*/_jsx(Empty, {
|
|
871
391
|
children: t('blocklet.component.noComponent')
|
|
@@ -978,6 +498,11 @@ export default function BlockletComponent({
|
|
|
978
498
|
})
|
|
979
499
|
})]
|
|
980
500
|
})
|
|
501
|
+
}), /*#__PURE__*/_jsx(AddComponentDialog, {
|
|
502
|
+
selectedMeta: parseInstallComponentMeta,
|
|
503
|
+
blocklet: blocklet,
|
|
504
|
+
showDialog: !!parseInstallComponentMeta,
|
|
505
|
+
setShowDialog: () => setInstallComponentMeta(null)
|
|
981
506
|
})]
|
|
982
507
|
});
|
|
983
508
|
}
|
|
@@ -1009,4 +534,25 @@ const Div = styled.div`
|
|
|
1009
534
|
.component-item {
|
|
1010
535
|
animation: showDelay 0.75s ease 1;
|
|
1011
536
|
}
|
|
537
|
+
`;
|
|
538
|
+
const TitleRow = styled(Box)`
|
|
539
|
+
${props => props.theme.breakpoints.up('sm')} {
|
|
540
|
+
flex-direction: row;
|
|
541
|
+
justify-content: space-between;
|
|
542
|
+
align-items: center;
|
|
543
|
+
}
|
|
544
|
+
${props => props.theme.breakpoints.down('sm')} {
|
|
545
|
+
flex-direction: column;
|
|
546
|
+
justify-content: flex-end;
|
|
547
|
+
align-items: flex-end;
|
|
548
|
+
.sm-hide-icon > svg {
|
|
549
|
+
display: none;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
`;
|
|
553
|
+
const TitleItem = styled(Box)`
|
|
554
|
+
${props => props.theme.breakpoints.down('sm')} {
|
|
555
|
+
width: 100%;
|
|
556
|
+
justify-content: space-between;
|
|
557
|
+
}
|
|
1012
558
|
`;
|