@abtnode/ux 1.16.26-beta-351de484 → 1.16.26-beta-63f52a83

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