@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
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
+
import { useContext, useState } from 'react';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import Badge from '@mui/material/Badge';
|
|
6
|
+
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
7
|
+
import LaunchIcon from '@mui/icons-material/Launch';
|
|
8
|
+
import RestartIcon from '@mui/icons-material/Replay';
|
|
9
|
+
import ReloadIcon from '@mui/icons-material/Autorenew';
|
|
10
|
+
import IconButton from '@mui/material/IconButton';
|
|
11
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
12
|
+
import Dialog from '@mui/material/Dialog';
|
|
13
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
14
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
|
15
|
+
import { Icon } from '@iconify/react';
|
|
16
|
+
import InfoRow from '@arcblock/ux/lib/InfoRow';
|
|
17
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
18
|
+
import Box from '@mui/material/Box';
|
|
19
|
+
import normalizePathPrefix from '@abtnode/util/lib/normalize-path-prefix';
|
|
20
|
+
import { getComponentMissingConfigs, getDisplayName, isInProgress, hasStartEngine } from '@blocklet/meta/lib/util';
|
|
21
|
+
import SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined';
|
|
22
|
+
import { useDeletingBlockletContext } from '../../contexts/deleting-blocklets';
|
|
23
|
+
import Tag from '../../tag';
|
|
24
|
+
import ComponentConfiguration from './configuration';
|
|
25
|
+
import { formatPerson, formatToDatetime } from '../../util';
|
|
26
|
+
import DidAddress from '../../did-address';
|
|
27
|
+
import BlockletSource from '../blocklet-source';
|
|
28
|
+
import BlockletStatus from '../status';
|
|
29
|
+
import BlockletVersion from '../version';
|
|
30
|
+
import Confirm from '../../confirm';
|
|
31
|
+
import BlockletBundleAvatar from '../bundle-avatar';
|
|
32
|
+
import BlockletMode from '../mode';
|
|
33
|
+
import DeleteComponent from './delete';
|
|
34
|
+
import StartComponent from './start';
|
|
35
|
+
import Line from './line';
|
|
36
|
+
import Actions from '../../actions';
|
|
37
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
38
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
39
|
+
const getEngineRows = (engine, t) => {
|
|
40
|
+
if (!engine) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
return [{
|
|
44
|
+
name: t('common.name'),
|
|
45
|
+
value: engine.displayName
|
|
46
|
+
}, {
|
|
47
|
+
name: t('common.description'),
|
|
48
|
+
value: engine.description
|
|
49
|
+
}, {
|
|
50
|
+
name: t('common.version'),
|
|
51
|
+
value: /*#__PURE__*/_jsx(Tag, {
|
|
52
|
+
children: engine.version
|
|
53
|
+
})
|
|
54
|
+
}];
|
|
55
|
+
};
|
|
56
|
+
const getSourceInfo = blocklet => {
|
|
57
|
+
const {
|
|
58
|
+
source,
|
|
59
|
+
deployedFrom,
|
|
60
|
+
bundleSource
|
|
61
|
+
} = blocklet;
|
|
62
|
+
if (source) {
|
|
63
|
+
return {
|
|
64
|
+
source,
|
|
65
|
+
deployedFrom
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (!bundleSource) {
|
|
69
|
+
return {
|
|
70
|
+
source: 'upload',
|
|
71
|
+
deployedFrom
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (bundleSource.url) {
|
|
75
|
+
return {
|
|
76
|
+
source: 'url',
|
|
77
|
+
deployedFrom: deployedFrom || Array.isArray(bundleSource.url) ? bundleSource.url[0] : bundleSource.url
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (bundleSource.store) {
|
|
81
|
+
return {
|
|
82
|
+
source: 'registry',
|
|
83
|
+
deployedFrom: deployedFrom || Array.isArray(bundleSource.store) ? bundleSource.store[0] : bundleSource.store
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return {};
|
|
87
|
+
};
|
|
88
|
+
const getComponentName = (componentId, app) => {
|
|
89
|
+
const ids = componentId.split('/').slice(1);
|
|
90
|
+
let parent = app;
|
|
91
|
+
let index = 0;
|
|
92
|
+
const names = [];
|
|
93
|
+
while (parent && index < ids.length) {
|
|
94
|
+
// eslint-disable-next-line no-loop-func
|
|
95
|
+
const component = parent.children.find(x => x.meta.did === ids[index]);
|
|
96
|
+
parent = component;
|
|
97
|
+
index++;
|
|
98
|
+
if (component) {
|
|
99
|
+
names.push(component.meta.title);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return names.join(' / ');
|
|
103
|
+
};
|
|
104
|
+
const isPack = component => component?.meta?.group === 'pack';
|
|
105
|
+
export default function ComponentCell({
|
|
106
|
+
blocklet,
|
|
107
|
+
ancestors,
|
|
108
|
+
depth,
|
|
109
|
+
onRemove,
|
|
110
|
+
onStart,
|
|
111
|
+
onStop,
|
|
112
|
+
onRestart,
|
|
113
|
+
onReload,
|
|
114
|
+
getComponentUrl,
|
|
115
|
+
app
|
|
116
|
+
}) {
|
|
117
|
+
const {
|
|
118
|
+
t,
|
|
119
|
+
locale
|
|
120
|
+
} = useContext(LocaleContext);
|
|
121
|
+
const [componentInfo, setComponentInfo] = useState();
|
|
122
|
+
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
|
123
|
+
const [loading, setLoading] = useState(false);
|
|
124
|
+
const [confirmSetting, setConfirmSetting] = useState(null);
|
|
125
|
+
const {
|
|
126
|
+
deletingBlocklets: deletingComponents
|
|
127
|
+
} = useDeletingBlockletContext();
|
|
128
|
+
let {
|
|
129
|
+
status
|
|
130
|
+
} = blocklet;
|
|
131
|
+
if (depth === 1 && deletingComponents.includes(blocklet.meta.did)) {
|
|
132
|
+
status = 'deleting';
|
|
133
|
+
}
|
|
134
|
+
const mountPoint = `/${blocklet.mountPoint || '/'}`.replace(/\/+/g, '/');
|
|
135
|
+
const href = getComponentUrl(mountPoint);
|
|
136
|
+
const renderRows = rows => rows.map(row => {
|
|
137
|
+
if (row.name === t('common.did') || row.name === t('blocklet.appId')) {
|
|
138
|
+
return /*#__PURE__*/_jsx(InfoRow, {
|
|
139
|
+
valueComponent: "div",
|
|
140
|
+
nameWidth: 120,
|
|
141
|
+
name: row.name,
|
|
142
|
+
nameFormatter: () => row.name,
|
|
143
|
+
children: row.value
|
|
144
|
+
}, row.name);
|
|
145
|
+
}
|
|
146
|
+
return /*#__PURE__*/_jsx(InfoRow, {
|
|
147
|
+
valueComponent: "div",
|
|
148
|
+
nameWidth: 120,
|
|
149
|
+
name: row.name,
|
|
150
|
+
children: row.value
|
|
151
|
+
}, row.name);
|
|
152
|
+
});
|
|
153
|
+
const sourceInfo = componentInfo ? getSourceInfo(componentInfo) : {};
|
|
154
|
+
const componentRows = componentInfo ? [{
|
|
155
|
+
name: t('common.name'),
|
|
156
|
+
value: getDisplayName(componentInfo, true)
|
|
157
|
+
}, {
|
|
158
|
+
name: t('common.version'),
|
|
159
|
+
value: /*#__PURE__*/_jsx(BlockletVersion, {
|
|
160
|
+
blocklet: componentInfo,
|
|
161
|
+
checkUpgrade: false
|
|
162
|
+
})
|
|
163
|
+
}, {
|
|
164
|
+
name: t('common.status'),
|
|
165
|
+
value: /*#__PURE__*/_jsx(BlockletStatus, {
|
|
166
|
+
status: status,
|
|
167
|
+
source: componentInfo.source,
|
|
168
|
+
progress: blocklet.progress
|
|
169
|
+
})
|
|
170
|
+
}, blocklet.status === 'running' ? {
|
|
171
|
+
name: t('blocklet.startedAt'),
|
|
172
|
+
value: formatToDatetime(blocklet.startedAt, locale)
|
|
173
|
+
} : null, blocklet.status !== 'running' ? {
|
|
174
|
+
name: t('blocklet.stoppedAt'),
|
|
175
|
+
value: formatToDatetime(blocklet.stoppedAt, locale)
|
|
176
|
+
} : null, blocklet.installedAt ? {
|
|
177
|
+
name: t('blocklet.installedAt'),
|
|
178
|
+
value: formatToDatetime(blocklet.installedAt, locale)
|
|
179
|
+
} : null, hasStartEngine(blocklet.meta) ? {
|
|
180
|
+
name: t('common.mountPoint'),
|
|
181
|
+
value: mountPoint
|
|
182
|
+
} : null, componentInfo.meta.group ? {
|
|
183
|
+
name: t('common.group'),
|
|
184
|
+
value: /*#__PURE__*/_jsx(Tag, {
|
|
185
|
+
type: "success",
|
|
186
|
+
children: componentInfo.meta.group
|
|
187
|
+
})
|
|
188
|
+
} : null, {
|
|
189
|
+
name: t('blocklet.overview.source'),
|
|
190
|
+
value: /*#__PURE__*/_jsx(BlockletSource, {
|
|
191
|
+
sourceInfo: sourceInfo,
|
|
192
|
+
blocklet: blocklet
|
|
193
|
+
})
|
|
194
|
+
}, {
|
|
195
|
+
name: t('blocklet.overview.deployedFrom'),
|
|
196
|
+
value: sourceInfo.deployedFrom || '-'
|
|
197
|
+
}, {
|
|
198
|
+
name: t('common.did'),
|
|
199
|
+
value: /*#__PURE__*/_jsx(DidAddress, {
|
|
200
|
+
did: componentInfo.meta.did
|
|
201
|
+
})
|
|
202
|
+
}, {
|
|
203
|
+
name: t('common.author'),
|
|
204
|
+
value: formatPerson(componentInfo.meta.author)
|
|
205
|
+
}, {
|
|
206
|
+
name: t('common.engine'),
|
|
207
|
+
value: getEngineRows(componentInfo.engine, t).map(({
|
|
208
|
+
name,
|
|
209
|
+
value
|
|
210
|
+
}) => /*#__PURE__*/_jsx(InfoRow, {
|
|
211
|
+
style: {
|
|
212
|
+
marginBottom: 4
|
|
213
|
+
},
|
|
214
|
+
nameWidth: 120,
|
|
215
|
+
name: name,
|
|
216
|
+
children: value
|
|
217
|
+
}, name))
|
|
218
|
+
}, blocklet.dependents?.length ? {
|
|
219
|
+
name: t('common.dependents'),
|
|
220
|
+
value: /*#__PURE__*/_jsx(Box, {
|
|
221
|
+
children: blocklet.dependents.map(x => /*#__PURE__*/_jsx(Box, {
|
|
222
|
+
children: `${getComponentName(x.id, app)} ${x.required ? `(${t('common.required')})` : ''}`
|
|
223
|
+
}, x.id))
|
|
224
|
+
})
|
|
225
|
+
} : null, blocklet.meta.resources?.length ? {
|
|
226
|
+
name: t('common.resource'),
|
|
227
|
+
value: blocklet.meta.resources.join(', ')
|
|
228
|
+
} : null].filter(Boolean) : [];
|
|
229
|
+
const appInProgress = isInProgress(app.status);
|
|
230
|
+
const componentInProgress = isInProgress(blocklet.status);
|
|
231
|
+
let deleteDisabledTip = '';
|
|
232
|
+
if (appInProgress || componentInProgress || depth === 1 && deletingComponents.includes(blocklet.meta.did)) {
|
|
233
|
+
deleteDisabledTip = t('blocklet.component.tip.stopBlocklet');
|
|
234
|
+
} else if (blocklet.dependents?.length) {
|
|
235
|
+
const requires = blocklet.dependents.filter(x => x.required);
|
|
236
|
+
if (requires.length) {
|
|
237
|
+
const names = requires.map(x => getComponentName(x.id, app));
|
|
238
|
+
deleteDisabledTip = t('blocklet.component.tip.requiredBy', {
|
|
239
|
+
name: names.join(', ')
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return [/*#__PURE__*/_jsxs(StyledComponentRow, {
|
|
244
|
+
display: "flex",
|
|
245
|
+
py: 2,
|
|
246
|
+
className: "component-item",
|
|
247
|
+
justifyContent: "flex-start",
|
|
248
|
+
alignItems: "center",
|
|
249
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
250
|
+
width: {
|
|
251
|
+
xs: 300,
|
|
252
|
+
md: 300
|
|
253
|
+
},
|
|
254
|
+
display: "flex",
|
|
255
|
+
alignItems: "center",
|
|
256
|
+
children: [/*#__PURE__*/_jsx(BlockletBundleAvatar, {
|
|
257
|
+
blocklet: blocklet,
|
|
258
|
+
ancestors: ancestors
|
|
259
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
260
|
+
ml: "16px",
|
|
261
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
262
|
+
className: "component-header",
|
|
263
|
+
onClick: () => setComponentInfo(blocklet),
|
|
264
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
265
|
+
className: "component-name",
|
|
266
|
+
children: getDisplayName(blocklet, true)
|
|
267
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
268
|
+
className: "component-version",
|
|
269
|
+
children: blocklet?.meta?.version
|
|
270
|
+
})]
|
|
271
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
272
|
+
display: "flex",
|
|
273
|
+
alignItems: "center",
|
|
274
|
+
sx: {
|
|
275
|
+
mt: '2px',
|
|
276
|
+
ml: -0.5
|
|
277
|
+
},
|
|
278
|
+
children: [status !== 'unknown' && /*#__PURE__*/_jsx(BlockletStatus, {
|
|
279
|
+
style: {
|
|
280
|
+
marginLeft: 4
|
|
281
|
+
},
|
|
282
|
+
status: status,
|
|
283
|
+
source: blocklet.source,
|
|
284
|
+
progress: blocklet.progress
|
|
285
|
+
}), /*#__PURE__*/_jsx(BlockletMode, {
|
|
286
|
+
style: {
|
|
287
|
+
marginLeft: 4
|
|
288
|
+
},
|
|
289
|
+
mode: blocklet.mode || ''
|
|
290
|
+
}), !!blocklet.dependents?.length && /*#__PURE__*/_jsx(Tooltip, {
|
|
291
|
+
title: [`${t('common.dependents')}: `, blocklet.dependents.map(x => /*#__PURE__*/_jsx(Box, {
|
|
292
|
+
pl: 1,
|
|
293
|
+
children: `${getComponentName(x.id, app)} ${x.required ? `(${t('common.required')})` : ''}`
|
|
294
|
+
}, x.id))],
|
|
295
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
296
|
+
display: "flex",
|
|
297
|
+
color: "primary.main",
|
|
298
|
+
ml: 1,
|
|
299
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
300
|
+
icon: "octicon:package-dependents-16"
|
|
301
|
+
})
|
|
302
|
+
})
|
|
303
|
+
})]
|
|
304
|
+
})]
|
|
305
|
+
})]
|
|
306
|
+
}, blocklet), hasStartEngine(blocklet.meta) && /*#__PURE__*/_jsx(Box, {
|
|
307
|
+
sx: {
|
|
308
|
+
display: {
|
|
309
|
+
xs: 'none',
|
|
310
|
+
md: 'flex'
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
alignItems: "center",
|
|
314
|
+
flexGrow: "1",
|
|
315
|
+
children: /*#__PURE__*/_jsx("a", {
|
|
316
|
+
target: "_blank",
|
|
317
|
+
href: href,
|
|
318
|
+
rel: "noopener noreferrer",
|
|
319
|
+
title: href,
|
|
320
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
321
|
+
maxWidth: 400,
|
|
322
|
+
sx: {
|
|
323
|
+
color: 'secondary.main',
|
|
324
|
+
fontSize: 16,
|
|
325
|
+
px: 2
|
|
326
|
+
},
|
|
327
|
+
overflow: "hidden",
|
|
328
|
+
whiteSpace: "nowrap",
|
|
329
|
+
textOverflow: "ellipsis",
|
|
330
|
+
children: normalizePathPrefix(mountPoint)
|
|
331
|
+
})
|
|
332
|
+
})
|
|
333
|
+
}, mountPoint), /*#__PURE__*/_jsx("div", {
|
|
334
|
+
style: {
|
|
335
|
+
flex: 1
|
|
336
|
+
}
|
|
337
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
338
|
+
display: "flex",
|
|
339
|
+
alignItems: "center",
|
|
340
|
+
children: [hasStartEngine(blocklet.meta) && /*#__PURE__*/_jsx(Tooltip, {
|
|
341
|
+
title: t('common.visit'),
|
|
342
|
+
children: /*#__PURE__*/_jsx("a", {
|
|
343
|
+
target: "_blank",
|
|
344
|
+
href: href,
|
|
345
|
+
rel: "noopener noreferrer",
|
|
346
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
347
|
+
size: "small",
|
|
348
|
+
children: /*#__PURE__*/_jsx(LaunchIcon, {})
|
|
349
|
+
})
|
|
350
|
+
})
|
|
351
|
+
}), /*#__PURE__*/_jsx(ComponentConfiguration, {
|
|
352
|
+
blocklet: blocklet,
|
|
353
|
+
ancestors: ancestors,
|
|
354
|
+
children: ({
|
|
355
|
+
open
|
|
356
|
+
}) => /*#__PURE__*/_jsx(Tooltip, {
|
|
357
|
+
title: t('common.config'),
|
|
358
|
+
children: /*#__PURE__*/_jsx(StyledBadge, {
|
|
359
|
+
color: "error",
|
|
360
|
+
badgeContent: "",
|
|
361
|
+
variant: "dot",
|
|
362
|
+
invisible: !getComponentMissingConfigs(blocklet, ancestors[0]).length,
|
|
363
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
364
|
+
onClick: open,
|
|
365
|
+
size: "small",
|
|
366
|
+
children: /*#__PURE__*/_jsx(SettingsOutlinedIcon, {})
|
|
367
|
+
})
|
|
368
|
+
})
|
|
369
|
+
}, "config")
|
|
370
|
+
}), /*#__PURE__*/_jsx(StartComponent, {
|
|
371
|
+
blocklet: app,
|
|
372
|
+
component: blocklet,
|
|
373
|
+
onStart: onStart,
|
|
374
|
+
onStop: onStop,
|
|
375
|
+
disabled: !['starting', 'stopping'].includes(app.status) && isInProgress(app.status)
|
|
376
|
+
}), /*#__PURE__*/_jsx(Actions, {
|
|
377
|
+
"data-cy": "component-actions",
|
|
378
|
+
actions: [hasStartEngine(blocklet.meta) ? {
|
|
379
|
+
icon: /*#__PURE__*/_jsx(InfoOutlinedIcon, {}),
|
|
380
|
+
text: t('common.detail'),
|
|
381
|
+
onClick: () => {
|
|
382
|
+
setComponentInfo(blocklet);
|
|
383
|
+
}
|
|
384
|
+
} : null, !isPack(blocklet) && {
|
|
385
|
+
icon: /*#__PURE__*/_jsx(RestartIcon, {}),
|
|
386
|
+
text: t('common.restart'),
|
|
387
|
+
onClick: () => {
|
|
388
|
+
setConfirmSetting({
|
|
389
|
+
title: `${t('common.restart')} ${blocklet.meta.title}`,
|
|
390
|
+
description: t('blocklet.action.restartDescription'),
|
|
391
|
+
confirm: t('blocklet.action.confirmRestart'),
|
|
392
|
+
cancel: t('common.cancel'),
|
|
393
|
+
onConfirm: async () => {
|
|
394
|
+
setLoading(true);
|
|
395
|
+
await onRestart(blocklet);
|
|
396
|
+
setLoading(false);
|
|
397
|
+
},
|
|
398
|
+
onCancel: () => setConfirmSetting(null)
|
|
399
|
+
});
|
|
400
|
+
},
|
|
401
|
+
disabled: appInProgress || componentInProgress || blocklet.status !== 'running'
|
|
402
|
+
}, !isPack(blocklet) && {
|
|
403
|
+
icon: /*#__PURE__*/_jsx(ReloadIcon, {}),
|
|
404
|
+
text: t('common.reload'),
|
|
405
|
+
onClick: async () => {
|
|
406
|
+
setLoading(true);
|
|
407
|
+
await onReload(blocklet);
|
|
408
|
+
setLoading(false);
|
|
409
|
+
},
|
|
410
|
+
disabled: loading || appInProgress || componentInProgress || blocklet.status !== 'running'
|
|
411
|
+
}, {
|
|
412
|
+
icon: /*#__PURE__*/_jsx(DeleteIcon, {}),
|
|
413
|
+
text: t('common.delete'),
|
|
414
|
+
onClick: () => {
|
|
415
|
+
setShowDeleteConfirm(true);
|
|
416
|
+
},
|
|
417
|
+
disabled: appInProgress || componentInProgress || !!deleteDisabledTip,
|
|
418
|
+
tip: deleteDisabledTip
|
|
419
|
+
}].filter(Boolean)
|
|
420
|
+
})]
|
|
421
|
+
}, "actions")]
|
|
422
|
+
}, "group-not-gateway-box"), /*#__PURE__*/_jsx(Line, {}, "line"), !!componentInfo && /*#__PURE__*/_jsx(Dialog, {
|
|
423
|
+
open: true,
|
|
424
|
+
fullWidth: true,
|
|
425
|
+
maxWidth: "md",
|
|
426
|
+
onClose: () => {
|
|
427
|
+
setComponentInfo(null);
|
|
428
|
+
},
|
|
429
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
430
|
+
paddingY: 1.5,
|
|
431
|
+
children: [/*#__PURE__*/_jsx(DialogTitle, {
|
|
432
|
+
children: t('common.componentBasicInfo')
|
|
433
|
+
}), /*#__PURE__*/_jsx(DialogContent, {
|
|
434
|
+
children: renderRows(componentRows)
|
|
435
|
+
})]
|
|
436
|
+
}, "dialog-wrapper")
|
|
437
|
+
}, "base-info-dialog"), /*#__PURE__*/_jsx(DeleteComponent, {
|
|
438
|
+
blocklet: app,
|
|
439
|
+
component: blocklet,
|
|
440
|
+
remove: async (...param) => {
|
|
441
|
+
setLoading(true);
|
|
442
|
+
try {
|
|
443
|
+
await onRemove(...param);
|
|
444
|
+
} catch {
|
|
445
|
+
// ignore
|
|
446
|
+
}
|
|
447
|
+
setLoading(false);
|
|
448
|
+
setShowDeleteConfirm(false);
|
|
449
|
+
},
|
|
450
|
+
onCancel: () => setShowDeleteConfirm(false),
|
|
451
|
+
hideBtn: true,
|
|
452
|
+
showConfirm: showDeleteConfirm
|
|
453
|
+
}, "delete-component"), confirmSetting && /*#__PURE__*/_jsx(Confirm, {
|
|
454
|
+
title: confirmSetting.title,
|
|
455
|
+
description: confirmSetting.description,
|
|
456
|
+
confirm: confirmSetting.confirm,
|
|
457
|
+
cancel: confirmSetting.cancel,
|
|
458
|
+
params: confirmSetting.params,
|
|
459
|
+
onConfirm: confirmSetting.onConfirm,
|
|
460
|
+
onCancel: confirmSetting.onCancel
|
|
461
|
+
}, "confirm-setting")];
|
|
462
|
+
}
|
|
463
|
+
ComponentCell.propTypes = {
|
|
464
|
+
blocklet: PropTypes.object.isRequired,
|
|
465
|
+
ancestors: PropTypes.array,
|
|
466
|
+
depth: PropTypes.number,
|
|
467
|
+
onRemove: PropTypes.func,
|
|
468
|
+
onStart: PropTypes.func,
|
|
469
|
+
onStop: PropTypes.func,
|
|
470
|
+
onRestart: PropTypes.func,
|
|
471
|
+
onReload: PropTypes.func,
|
|
472
|
+
getComponentUrl: PropTypes.func,
|
|
473
|
+
app: PropTypes.object
|
|
474
|
+
};
|
|
475
|
+
ComponentCell.defaultProps = {
|
|
476
|
+
ancestors: [],
|
|
477
|
+
depth: 0,
|
|
478
|
+
onRemove: () => {},
|
|
479
|
+
onStart: () => {},
|
|
480
|
+
onStop: () => {},
|
|
481
|
+
onRestart: () => {},
|
|
482
|
+
onReload: () => {},
|
|
483
|
+
getComponentUrl: () => window.location.origin,
|
|
484
|
+
app: null
|
|
485
|
+
};
|
|
486
|
+
export const StyledBadge = styled(Badge)`
|
|
487
|
+
.BaseBadge-badge {
|
|
488
|
+
top: ${props => props.top * 8 || 6}px;
|
|
489
|
+
right: ${props => props.right * 8 || 6}px;
|
|
490
|
+
}
|
|
491
|
+
`;
|
|
492
|
+
export const StyledComponentRow = styled(Box)`
|
|
493
|
+
.component-header {
|
|
494
|
+
display: flex;
|
|
495
|
+
align-items: center;
|
|
496
|
+
align-items: flex-end;
|
|
497
|
+
cursor: pointer;
|
|
498
|
+
}
|
|
499
|
+
.component-name {
|
|
500
|
+
color: #222;
|
|
501
|
+
font-size: 16px;
|
|
502
|
+
}
|
|
503
|
+
.component-version {
|
|
504
|
+
color: #999;
|
|
505
|
+
font-size: 12px;
|
|
506
|
+
margin-left: 4px;
|
|
507
|
+
transform: translateY(-1px);
|
|
508
|
+
}
|
|
509
|
+
`;
|