@abtnode/ux 1.8.26 → 1.8.27
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 +137 -0
- package/lib/blocklet/actions.js +501 -0
- package/lib/blocklet/audit-logs.js +226 -0
- package/lib/blocklet/avatar.js +123 -0
- package/lib/blocklet/blocklet-source.js +69 -0
- package/lib/blocklet/component/configuration.js +150 -0
- package/lib/blocklet/component/delete.js +138 -0
- package/lib/blocklet/component/environment.js +334 -0
- package/lib/blocklet/component/index.js +837 -0
- package/lib/blocklet/component/setting.js +174 -0
- package/lib/blocklet/configuration.js +531 -0
- package/lib/blocklet/disk-info.js +115 -0
- package/lib/blocklet/icons.js +36 -0
- package/lib/blocklet/log.js +70 -0
- package/lib/blocklet/mode.js +47 -0
- package/lib/blocklet/overview.js +218 -0
- package/lib/blocklet/runtime-info.js +111 -0
- package/lib/blocklet/status.js +125 -0
- package/lib/blocklet/util.js +141 -0
- package/lib/blocklet/version.js +216 -0
- package/lib/click-to-copy.js +51 -0
- package/lib/confirm.js +175 -0
- package/lib/contexts/audit-log.js +155 -0
- package/lib/contexts/deleting-blocklets.js +91 -0
- package/lib/contexts/node.js +34 -0
- package/lib/contexts/session.js +22 -0
- package/lib/contexts/team.js +22 -0
- package/lib/did-address.js +95 -0
- package/lib/dot.js +25 -0
- package/lib/hooks/mobile-width.js +24 -0
- package/lib/icons/long-arrow.svg +5 -0
- package/lib/locales/en.js +1046 -38
- package/lib/locales/zh.js +1049 -36
- package/lib/logs/clock.js +25 -0
- package/lib/logs/log-terminal.js +198 -0
- package/lib/passport-tag.js +58 -0
- package/lib/permission.js +84 -0
- package/lib/relative-time.js +74 -0
- package/lib/table-icons.js +59 -0
- package/lib/table.js +19 -0
- package/lib/tag.js +48 -0
- package/lib/team/members/actions.js +115 -0
- package/lib/team/members/index.js +544 -0
- package/lib/team/members/invitations.js +229 -0
- package/lib/team/members/invite-member.js +241 -0
- package/lib/team/members/issue-passport.js +178 -0
- package/lib/team/members/member.js +336 -0
- package/lib/team/members/passport-issuances.js +181 -0
- package/lib/team/members/passports.js +377 -0
- package/lib/team/members/toggle-user-approval.js +154 -0
- package/lib/team/members/transfer-node.js +295 -0
- package/lib/team/members/util.js +27 -0
- package/lib/team/passports/detail.js +304 -0
- package/lib/team/passports/index.js +256 -0
- package/lib/team/passports/mutate-role.js +230 -0
- package/lib/team/passports/trusted-issuer.js +339 -0
- package/lib/team/passports/trusted-issuers.js +284 -0
- package/lib/team/search-input.js +51 -0
- package/lib/team/styles/dialog.js +19 -0
- package/lib/team/styles/list-header.js +19 -0
- package/lib/util/index.js +642 -6
- package/package.json +32 -9
|
@@ -0,0 +1,837 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = BlockletComponent;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _semver = _interopRequireDefault(require("semver"));
|
|
15
|
+
|
|
16
|
+
var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
|
|
17
|
+
|
|
18
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
19
|
+
|
|
20
|
+
var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
|
|
21
|
+
|
|
22
|
+
var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
|
|
23
|
+
|
|
24
|
+
var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
|
|
25
|
+
|
|
26
|
+
var _Update = _interopRequireDefault(require("@mui/icons-material/Update"));
|
|
27
|
+
|
|
28
|
+
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
29
|
+
|
|
30
|
+
var _Add = _interopRequireDefault(require("@mui/icons-material/Add"));
|
|
31
|
+
|
|
32
|
+
var _Badge = _interopRequireDefault(require("@mui/material/Badge"));
|
|
33
|
+
|
|
34
|
+
var _SettingsOutlined = _interopRequireDefault(require("@mui/icons-material/SettingsOutlined"));
|
|
35
|
+
|
|
36
|
+
var _InfoOutlined = _interopRequireDefault(require("@mui/icons-material/InfoOutlined"));
|
|
37
|
+
|
|
38
|
+
var _Launch = _interopRequireDefault(require("@mui/icons-material/Launch"));
|
|
39
|
+
|
|
40
|
+
var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
|
|
41
|
+
|
|
42
|
+
var _Collapse = _interopRequireDefault(require("@mui/material/Collapse"));
|
|
43
|
+
|
|
44
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
45
|
+
|
|
46
|
+
var _ArrowForward = _interopRequireDefault(require("@mui/icons-material/ArrowForward"));
|
|
47
|
+
|
|
48
|
+
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
49
|
+
|
|
50
|
+
var _ChevronRight = _interopRequireDefault(require("@mui/icons-material/ChevronRight"));
|
|
51
|
+
|
|
52
|
+
var _Spinner = _interopRequireDefault(require("@arcblock/ux/lib/Spinner"));
|
|
53
|
+
|
|
54
|
+
var _InfoRow = _interopRequireDefault(require("@arcblock/ux/lib/InfoRow"));
|
|
55
|
+
|
|
56
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
57
|
+
|
|
58
|
+
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
59
|
+
|
|
60
|
+
var _Empty = _interopRequireDefault(require("@arcblock/ux/lib/Empty"));
|
|
61
|
+
|
|
62
|
+
var _util = require("@blocklet/meta/lib/util");
|
|
63
|
+
|
|
64
|
+
var _deletingBlocklets = require("../../contexts/deleting-blocklets");
|
|
65
|
+
|
|
66
|
+
var _didAddress = _interopRequireDefault(require("../../did-address"));
|
|
67
|
+
|
|
68
|
+
var _tag = _interopRequireDefault(require("../../tag"));
|
|
69
|
+
|
|
70
|
+
var _toast = _interopRequireDefault(require("../../toast"));
|
|
71
|
+
|
|
72
|
+
var _blockletSource = _interopRequireDefault(require("../blocklet-source"));
|
|
73
|
+
|
|
74
|
+
var _runtimeInfo = _interopRequireDefault(require("../runtime-info"));
|
|
75
|
+
|
|
76
|
+
var _status = _interopRequireDefault(require("../status"));
|
|
77
|
+
|
|
78
|
+
var _version = _interopRequireDefault(require("../version"));
|
|
79
|
+
|
|
80
|
+
var _node = require("../../contexts/node");
|
|
81
|
+
|
|
82
|
+
var _util2 = require("../../util");
|
|
83
|
+
|
|
84
|
+
var _permission = _interopRequireDefault(require("../../permission"));
|
|
85
|
+
|
|
86
|
+
var _avatar = _interopRequireDefault(require("../avatar"));
|
|
87
|
+
|
|
88
|
+
var _mode = _interopRequireDefault(require("../mode"));
|
|
89
|
+
|
|
90
|
+
var _configuration = _interopRequireDefault(require("./configuration"));
|
|
91
|
+
|
|
92
|
+
var _delete = _interopRequireDefault(require("./delete"));
|
|
93
|
+
|
|
94
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
95
|
+
|
|
96
|
+
const _excluded = ["blocklet", "onUpdate", "getComponentUrl", "AddComponent"];
|
|
97
|
+
|
|
98
|
+
var _templateObject, _templateObject2;
|
|
99
|
+
|
|
100
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
101
|
+
|
|
102
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
103
|
+
|
|
104
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
105
|
+
|
|
106
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
107
|
+
|
|
108
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
109
|
+
|
|
110
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
111
|
+
|
|
112
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
113
|
+
|
|
114
|
+
const getEngineRows = (engine, t) => {
|
|
115
|
+
if (!engine) {
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return [{
|
|
120
|
+
name: t('common.name'),
|
|
121
|
+
value: engine.displayName
|
|
122
|
+
}, {
|
|
123
|
+
name: t('common.description'),
|
|
124
|
+
value: engine.description
|
|
125
|
+
}, {
|
|
126
|
+
name: t('common.version'),
|
|
127
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_tag.default, {
|
|
128
|
+
children: engine.version
|
|
129
|
+
})
|
|
130
|
+
}];
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const getSourceInfo = blocklet => {
|
|
134
|
+
const {
|
|
135
|
+
source,
|
|
136
|
+
deployedFrom,
|
|
137
|
+
bundleSource
|
|
138
|
+
} = blocklet;
|
|
139
|
+
|
|
140
|
+
if (source) {
|
|
141
|
+
return {
|
|
142
|
+
source,
|
|
143
|
+
deployedFrom
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (!bundleSource) {
|
|
148
|
+
return {
|
|
149
|
+
source: 'upload',
|
|
150
|
+
deployedFrom
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (bundleSource.url) {
|
|
155
|
+
return {
|
|
156
|
+
source: 'url',
|
|
157
|
+
deployedFrom: deployedFrom || Array.isArray(bundleSource.url) ? bundleSource.url[0] : bundleSource.url
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (bundleSource.store) {
|
|
162
|
+
return {
|
|
163
|
+
source: 'registry',
|
|
164
|
+
deployedFrom: deployedFrom || Array.isArray(bundleSource.store) ? bundleSource.store[0] : bundleSource.store
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return {};
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
function ComponentItem(_ref) {
|
|
172
|
+
var _blocklet$children;
|
|
173
|
+
|
|
174
|
+
let {
|
|
175
|
+
blocklet,
|
|
176
|
+
ancestors,
|
|
177
|
+
depth,
|
|
178
|
+
onRemove,
|
|
179
|
+
getComponentUrl
|
|
180
|
+
} = _ref;
|
|
181
|
+
const {
|
|
182
|
+
t
|
|
183
|
+
} = (0, _react.useContext)(_context.LocaleContext);
|
|
184
|
+
const [expand, setExpand] = (0, _react.useState)(true);
|
|
185
|
+
const [componentInfo, setComponentInfo] = (0, _react.useState)();
|
|
186
|
+
const {
|
|
187
|
+
deletingBlocklets: deletingComponents
|
|
188
|
+
} = (0, _deletingBlocklets.useDeletingBlockletContext)();
|
|
189
|
+
let {
|
|
190
|
+
status
|
|
191
|
+
} = blocklet;
|
|
192
|
+
|
|
193
|
+
if (depth <= 1 && deletingComponents.includes(blocklet.meta.did)) {
|
|
194
|
+
status = 'deleting';
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const mountPoint = "/".concat(ancestors.map(x => x.mountPoint || '/').join('/'), "/").concat(blocklet.mountPoint || '/').replace(/\/+/g, '/'); // hide root's status and only display specific status
|
|
198
|
+
|
|
199
|
+
const showStatus = !!ancestors.length && ['downloading', 'deleting', 'starting'].includes(status);
|
|
200
|
+
const canExpand = depth > 0 && blocklet.children.length > 0;
|
|
201
|
+
const expandIcon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
202
|
+
size: "small",
|
|
203
|
+
children: expand ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {
|
|
204
|
+
fontSize: "inherit"
|
|
205
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChevronRight.default, {
|
|
206
|
+
fontSize: "inherit"
|
|
207
|
+
})
|
|
208
|
+
});
|
|
209
|
+
const root = ancestors[0] || blocklet;
|
|
210
|
+
const href = getComponentUrl(mountPoint);
|
|
211
|
+
|
|
212
|
+
const renderRows = rows => rows.map(row => {
|
|
213
|
+
if (row.name === t('common.did') || row.name === t('blocklet.appId')) {
|
|
214
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InfoRow.default, {
|
|
215
|
+
valueComponent: "div",
|
|
216
|
+
nameWidth: 120,
|
|
217
|
+
name: row.name,
|
|
218
|
+
nameFormatter: () => row.name,
|
|
219
|
+
children: row.value
|
|
220
|
+
}, row.name);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InfoRow.default, {
|
|
224
|
+
valueComponent: "div",
|
|
225
|
+
nameWidth: 120,
|
|
226
|
+
name: row.name,
|
|
227
|
+
children: row.value
|
|
228
|
+
}, row.name);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
const sourceInfo = componentInfo ? getSourceInfo(componentInfo) : {};
|
|
232
|
+
const componentRows = componentInfo ? [{
|
|
233
|
+
name: t('common.name'),
|
|
234
|
+
value: (0, _util.getDisplayName)(componentInfo, true)
|
|
235
|
+
}, {
|
|
236
|
+
name: t('common.version'),
|
|
237
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_version.default, {
|
|
238
|
+
blocklet: componentInfo,
|
|
239
|
+
checkUpgrade: false
|
|
240
|
+
})
|
|
241
|
+
}, {
|
|
242
|
+
name: t('common.status'),
|
|
243
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_status.default, {
|
|
244
|
+
status: status,
|
|
245
|
+
source: componentInfo.source
|
|
246
|
+
})
|
|
247
|
+
}, {
|
|
248
|
+
name: t('common.mountPoint'),
|
|
249
|
+
value: mountPoint
|
|
250
|
+
}, {
|
|
251
|
+
name: t('common.group'),
|
|
252
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_tag.default, {
|
|
253
|
+
type: "success",
|
|
254
|
+
children: componentInfo.meta.group
|
|
255
|
+
})
|
|
256
|
+
}, {
|
|
257
|
+
name: t('blocklet.overview.source'),
|
|
258
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockletSource.default, {
|
|
259
|
+
sourceInfo: sourceInfo,
|
|
260
|
+
blocklet: blocklet
|
|
261
|
+
})
|
|
262
|
+
}, {
|
|
263
|
+
name: t('blocklet.overview.deployedFrom'),
|
|
264
|
+
value: sourceInfo.deployedFrom || '-'
|
|
265
|
+
}, {
|
|
266
|
+
name: t('common.did'),
|
|
267
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_didAddress.default, {
|
|
268
|
+
did: componentInfo.meta.did
|
|
269
|
+
})
|
|
270
|
+
}, {
|
|
271
|
+
name: t('common.author'),
|
|
272
|
+
value: (0, _util2.formatPerson)(componentInfo.meta.author)
|
|
273
|
+
}, {
|
|
274
|
+
name: t('common.runtimeInfo'),
|
|
275
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_runtimeInfo.default, {
|
|
276
|
+
blocklet: componentInfo,
|
|
277
|
+
noRunningMessage: t('--')
|
|
278
|
+
})
|
|
279
|
+
}, {
|
|
280
|
+
name: t('common.engine'),
|
|
281
|
+
value: getEngineRows(componentInfo.engine, t).map(_ref2 => {
|
|
282
|
+
let {
|
|
283
|
+
name,
|
|
284
|
+
value
|
|
285
|
+
} = _ref2;
|
|
286
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InfoRow.default, {
|
|
287
|
+
style: {
|
|
288
|
+
marginBottom: 4
|
|
289
|
+
},
|
|
290
|
+
nameWidth: 120,
|
|
291
|
+
name: name,
|
|
292
|
+
children: value
|
|
293
|
+
}, name);
|
|
294
|
+
})
|
|
295
|
+
}].filter(Boolean) : [];
|
|
296
|
+
let deleteDisabledTip = '';
|
|
297
|
+
|
|
298
|
+
if (depth !== 1 || !blocklet.dynamic) {
|
|
299
|
+
deleteDisabledTip = t('blocklet.component.tip.notDynamic');
|
|
300
|
+
} else if ((0, _util2.isInProgress)(root.status) || depth === 1 && deletingComponents.includes(blocklet.meta.did)) {
|
|
301
|
+
deleteDisabledTip = t('blocklet.component.tip.stopBlocklet');
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return [(depth > 0 || blocklet.meta.group !== 'gateway') && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
305
|
+
display: "flex",
|
|
306
|
+
py: 2,
|
|
307
|
+
className: "component-item",
|
|
308
|
+
justifyContent: "space-between",
|
|
309
|
+
alignItems: "center",
|
|
310
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
311
|
+
pl: Math.max((depth - 1) * 2, 0),
|
|
312
|
+
width: {
|
|
313
|
+
xs: 300,
|
|
314
|
+
md: 400
|
|
315
|
+
},
|
|
316
|
+
display: "flex",
|
|
317
|
+
alignItems: "center",
|
|
318
|
+
style: {
|
|
319
|
+
cursor: canExpand ? 'pointer' : 'cursor'
|
|
320
|
+
},
|
|
321
|
+
onClick: () => canExpand && setExpand(!expand),
|
|
322
|
+
children: [canExpand ? expandIcon : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
323
|
+
width: 28
|
|
324
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_avatar.default, {
|
|
325
|
+
blocklet: blocklet,
|
|
326
|
+
ancestors: ancestors
|
|
327
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
328
|
+
ml: "16px",
|
|
329
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
330
|
+
style: {
|
|
331
|
+
color: '#222',
|
|
332
|
+
fontSize: 18
|
|
333
|
+
},
|
|
334
|
+
children: (0, _util.getDisplayName)(blocklet, true)
|
|
335
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
336
|
+
display: "flex",
|
|
337
|
+
alignItems: "center",
|
|
338
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_version.default, {
|
|
339
|
+
blocklet: blocklet,
|
|
340
|
+
checkUpgrade: false
|
|
341
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_mode.default, {
|
|
342
|
+
style: {
|
|
343
|
+
marginLeft: 4
|
|
344
|
+
},
|
|
345
|
+
mode: blocklet.mode || ''
|
|
346
|
+
}), showStatus && /*#__PURE__*/(0, _jsxRuntime.jsx)(_status.default, {
|
|
347
|
+
style: {
|
|
348
|
+
marginLeft: 4
|
|
349
|
+
},
|
|
350
|
+
status: status,
|
|
351
|
+
source: blocklet.source
|
|
352
|
+
})]
|
|
353
|
+
})]
|
|
354
|
+
})]
|
|
355
|
+
}, blocklet), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
356
|
+
sx: {
|
|
357
|
+
display: {
|
|
358
|
+
xs: 'none',
|
|
359
|
+
md: 'flex'
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
alignItems: "center",
|
|
363
|
+
flexGrow: "1",
|
|
364
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
365
|
+
target: "_blank",
|
|
366
|
+
href: href,
|
|
367
|
+
rel: "noopener noreferrer",
|
|
368
|
+
title: href,
|
|
369
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
370
|
+
maxWidth: 400,
|
|
371
|
+
sx: {
|
|
372
|
+
color: 'secondary.main',
|
|
373
|
+
fontSize: 18,
|
|
374
|
+
px: 2
|
|
375
|
+
},
|
|
376
|
+
overflow: "hidden",
|
|
377
|
+
whiteSpace: "nowrap",
|
|
378
|
+
textOverflow: "ellipsis",
|
|
379
|
+
children: mountPoint
|
|
380
|
+
})
|
|
381
|
+
})
|
|
382
|
+
}, mountPoint), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
383
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
384
|
+
title: t('common.visit'),
|
|
385
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
386
|
+
target: "_blank",
|
|
387
|
+
href: href,
|
|
388
|
+
rel: "noopener noreferrer",
|
|
389
|
+
title: href,
|
|
390
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
391
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Launch.default, {})
|
|
392
|
+
})
|
|
393
|
+
})
|
|
394
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
395
|
+
title: t('common.overview'),
|
|
396
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
397
|
+
onClick: () => setComponentInfo(blocklet),
|
|
398
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InfoOutlined.default, {})
|
|
399
|
+
})
|
|
400
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_configuration.default, {
|
|
401
|
+
blocklet: blocklet,
|
|
402
|
+
ancestors: ancestors,
|
|
403
|
+
children: _ref3 => {
|
|
404
|
+
let {
|
|
405
|
+
open
|
|
406
|
+
} = _ref3;
|
|
407
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
408
|
+
title: t('common.config'),
|
|
409
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledBadge, {
|
|
410
|
+
color: "error",
|
|
411
|
+
badgeContent: "",
|
|
412
|
+
variant: "dot",
|
|
413
|
+
invisible: !(0, _util.getComponentMissingConfigs)(blocklet, ancestors).length,
|
|
414
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
415
|
+
onClick: open,
|
|
416
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SettingsOutlined.default, {})
|
|
417
|
+
})
|
|
418
|
+
})
|
|
419
|
+
}, "config");
|
|
420
|
+
}
|
|
421
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_delete.default, {
|
|
422
|
+
blocklet: root,
|
|
423
|
+
component: blocklet,
|
|
424
|
+
remove: onRemove,
|
|
425
|
+
disabled: !!deleteDisabledTip,
|
|
426
|
+
tip: deleteDisabledTip
|
|
427
|
+
})]
|
|
428
|
+
}, "actions")]
|
|
429
|
+
}, "group-not-gateway-box"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
430
|
+
ml: Math.max((depth - 1) * 2, 0),
|
|
431
|
+
sx: {
|
|
432
|
+
borderBottom: 1,
|
|
433
|
+
borderColor: 'rgba(0,0,0,0.12)'
|
|
434
|
+
}
|
|
435
|
+
}, "group-collapse-box"), (_blocklet$children = blocklet.children) !== null && _blocklet$children !== void 0 && _blocklet$children.length ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Collapse.default, {
|
|
436
|
+
in: expand,
|
|
437
|
+
children: blocklet.children.map(x => /*#__PURE__*/(0, _jsxRuntime.jsx)(ComponentItem, {
|
|
438
|
+
blocklet: x,
|
|
439
|
+
ancestors: [...ancestors, blocklet],
|
|
440
|
+
depth: depth + 1,
|
|
441
|
+
onRemove: onRemove,
|
|
442
|
+
getComponentUrl: getComponentUrl
|
|
443
|
+
}, "".concat(depth + 1, "-").concat(x.meta.did)))
|
|
444
|
+
}, "blocklet-collapse") : null, !!componentInfo && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.default, {
|
|
445
|
+
open: true,
|
|
446
|
+
fullWidth: true,
|
|
447
|
+
maxWidth: "md",
|
|
448
|
+
onClose: () => {
|
|
449
|
+
setComponentInfo(null);
|
|
450
|
+
},
|
|
451
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
452
|
+
paddingY: 1.5,
|
|
453
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_DialogTitle.default, {
|
|
454
|
+
children: t('common.componentBasicInfo')
|
|
455
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DialogContent.default, {
|
|
456
|
+
children: renderRows(componentRows)
|
|
457
|
+
})]
|
|
458
|
+
}, "dialog-wrapper")
|
|
459
|
+
}, "base-info-dialog")];
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
ComponentItem.propTypes = {
|
|
463
|
+
blocklet: _propTypes.default.object.isRequired,
|
|
464
|
+
ancestors: _propTypes.default.array,
|
|
465
|
+
depth: _propTypes.default.number,
|
|
466
|
+
onRemove: _propTypes.default.func,
|
|
467
|
+
getComponentUrl: _propTypes.default.func
|
|
468
|
+
};
|
|
469
|
+
ComponentItem.defaultProps = {
|
|
470
|
+
ancestors: [],
|
|
471
|
+
depth: 0,
|
|
472
|
+
onRemove: () => {},
|
|
473
|
+
getComponentUrl: () => window.location.origin
|
|
474
|
+
};
|
|
475
|
+
const StyledBadge = (0, _styled.default)(_Badge.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .BaseBadge-badge {\n top: ", "px;\n right: ", "px;\n }\n"])), props => props.top * 8 || 6, props => props.right * 8 || 6);
|
|
476
|
+
|
|
477
|
+
function BlockletComponent(_ref4) {
|
|
478
|
+
var _blocklet$meta;
|
|
479
|
+
|
|
480
|
+
let {
|
|
481
|
+
blocklet,
|
|
482
|
+
onUpdate,
|
|
483
|
+
getComponentUrl,
|
|
484
|
+
AddComponent
|
|
485
|
+
} = _ref4,
|
|
486
|
+
rest = _objectWithoutProperties(_ref4, _excluded);
|
|
487
|
+
|
|
488
|
+
const {
|
|
489
|
+
t
|
|
490
|
+
} = (0, _react.useContext)(_context.LocaleContext);
|
|
491
|
+
const {
|
|
492
|
+
api,
|
|
493
|
+
inService
|
|
494
|
+
} = (0, _node.useNodeContext)();
|
|
495
|
+
const {
|
|
496
|
+
addDeletingDid,
|
|
497
|
+
removeDeletingDid,
|
|
498
|
+
matchDeletingDid
|
|
499
|
+
} = (0, _deletingBlocklets.useDeletingBlockletContext)();
|
|
500
|
+
const [loading, setLoading] = (0, _react.useState)(false);
|
|
501
|
+
const [updateConfirm, setUpdateConfirm] = (0, _react.useState)(null);
|
|
502
|
+
const [showUpdateDot, setShowUpdateDot] = (0, _react.useState)(false);
|
|
503
|
+
const components = [...blocklet.children] || [];
|
|
504
|
+
|
|
505
|
+
if (blocklet.meta.group !== 'gateway') {
|
|
506
|
+
// add root blocklet to table list
|
|
507
|
+
components.unshift(blocklet);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
matchDeletingDid(components.map(e => e.meta.did));
|
|
511
|
+
(0, _react.useEffect)(() => {
|
|
512
|
+
if (blocklet && !(0, _util2.isInProgress)(blocklet.status)) {
|
|
513
|
+
api.getLatestBlockletVersion({
|
|
514
|
+
input: {
|
|
515
|
+
did: blocklet.meta.did,
|
|
516
|
+
version: blocklet.meta.version
|
|
517
|
+
}
|
|
518
|
+
}).then(res => {
|
|
519
|
+
const {
|
|
520
|
+
version
|
|
521
|
+
} = res.data || {};
|
|
522
|
+
|
|
523
|
+
if (version && _semver.default.gt(version, blocklet.meta.version)) {
|
|
524
|
+
setShowUpdateDot(true);
|
|
525
|
+
}
|
|
526
|
+
}).catch(err => {
|
|
527
|
+
console.error(err.message);
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
}, [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.did]); // eslint-disable-line
|
|
531
|
+
|
|
532
|
+
const checkForUpdates = async () => {
|
|
533
|
+
if (loading) {
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
setLoading(true);
|
|
538
|
+
|
|
539
|
+
try {
|
|
540
|
+
// check app version
|
|
541
|
+
const {
|
|
542
|
+
version,
|
|
543
|
+
registryUrl
|
|
544
|
+
} = (await api.getLatestBlockletVersion({
|
|
545
|
+
input: {
|
|
546
|
+
did: blocklet.meta.did,
|
|
547
|
+
version: blocklet.meta.version
|
|
548
|
+
}
|
|
549
|
+
})).data || {};
|
|
550
|
+
|
|
551
|
+
if (version && _semver.default.gt(version, blocklet.meta.version)) {
|
|
552
|
+
setUpdateConfirm({
|
|
553
|
+
type: 'app',
|
|
554
|
+
params: {
|
|
555
|
+
version,
|
|
556
|
+
registryUrl
|
|
557
|
+
},
|
|
558
|
+
list: [{
|
|
559
|
+
name: (0, _util.getDisplayName)(blocklet),
|
|
560
|
+
version: blocklet.meta.version,
|
|
561
|
+
newVersion: version
|
|
562
|
+
}]
|
|
563
|
+
});
|
|
564
|
+
setLoading(false);
|
|
565
|
+
return;
|
|
566
|
+
} // check child component version
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
const {
|
|
570
|
+
updateId,
|
|
571
|
+
updateList
|
|
572
|
+
} = (await api.checkComponentsForUpdates({
|
|
573
|
+
input: {
|
|
574
|
+
did: blocklet.meta.did
|
|
575
|
+
}
|
|
576
|
+
})).preUpdateInfo || {};
|
|
577
|
+
setLoading(false);
|
|
578
|
+
|
|
579
|
+
if (!updateId) {
|
|
580
|
+
_toast.default.info(t('blocklet.component.noUpdate'));
|
|
581
|
+
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
const list = [];
|
|
586
|
+
(0, _util.forEachChildSync)(blocklet, (b, _ref5) => {
|
|
587
|
+
let {
|
|
588
|
+
id,
|
|
589
|
+
ancestors
|
|
590
|
+
} = _ref5;
|
|
591
|
+
const updateItem = updateList.find(x => x.id === id);
|
|
592
|
+
|
|
593
|
+
if (updateItem) {
|
|
594
|
+
const name = ancestors.slice(1).concat(b).map(x => x.meta.title || x.meta.name).join(' / ');
|
|
595
|
+
list.push({
|
|
596
|
+
name,
|
|
597
|
+
version: b.meta.version,
|
|
598
|
+
newVersion: updateItem.meta.version
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
setUpdateConfirm({
|
|
603
|
+
type: 'child',
|
|
604
|
+
params: {
|
|
605
|
+
updateId
|
|
606
|
+
},
|
|
607
|
+
list
|
|
608
|
+
});
|
|
609
|
+
} catch (err) {
|
|
610
|
+
setLoading(false);
|
|
611
|
+
|
|
612
|
+
_toast.default.error((0, _util2.formatError)(err));
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
const onConfirmUpdate = async () => {
|
|
617
|
+
if (loading) {
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
let fn;
|
|
622
|
+
let input;
|
|
623
|
+
|
|
624
|
+
if (updateConfirm.type === 'app') {
|
|
625
|
+
fn = api.upgradeBlocklet.bind(api);
|
|
626
|
+
input = {
|
|
627
|
+
did: blocklet.meta.did,
|
|
628
|
+
version: updateConfirm.params.version,
|
|
629
|
+
registryUrl: updateConfirm.params.registryUrl || ''
|
|
630
|
+
};
|
|
631
|
+
} else {
|
|
632
|
+
fn = api.upgradeComponents.bind(api);
|
|
633
|
+
input = {
|
|
634
|
+
updateId: updateConfirm.params.updateId,
|
|
635
|
+
rootDid: blocklet.meta.did
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
try {
|
|
640
|
+
setLoading(true);
|
|
641
|
+
await fn({
|
|
642
|
+
input
|
|
643
|
+
});
|
|
644
|
+
setLoading(false);
|
|
645
|
+
setUpdateConfirm(null);
|
|
646
|
+
setShowUpdateDot(null);
|
|
647
|
+
} catch (error) {
|
|
648
|
+
setLoading(false);
|
|
649
|
+
|
|
650
|
+
_toast.default.error((0, _util2.formatError)(error));
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
const removeComponent = async (d, type) => {
|
|
655
|
+
addDeletingDid(d.meta.did);
|
|
656
|
+
|
|
657
|
+
try {
|
|
658
|
+
await api.deleteComponent({
|
|
659
|
+
input: {
|
|
660
|
+
did: d.meta.did,
|
|
661
|
+
keepData: type === 'keepData',
|
|
662
|
+
rootDid: blocklet.meta.did
|
|
663
|
+
}
|
|
664
|
+
});
|
|
665
|
+
await (0, _util2.sleep)(800);
|
|
666
|
+
} catch (err) {
|
|
667
|
+
_toast.default.error((0, _util2.formatError)(err));
|
|
668
|
+
|
|
669
|
+
removeDeletingDid(d.meta.did);
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Div, _objectSpread(_objectSpread({
|
|
674
|
+
component: "div"
|
|
675
|
+
}, rest), {}, {
|
|
676
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
677
|
+
display: "flex",
|
|
678
|
+
justifyContent: "space-between",
|
|
679
|
+
alignItems: "center",
|
|
680
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
681
|
+
className: "title",
|
|
682
|
+
children: [t('common.components'), /*#__PURE__*/(0, _jsxRuntime.jsx)(_permission.default, {
|
|
683
|
+
permission: inService ? '' : 'mutate_blocklet',
|
|
684
|
+
role: inService ? _util2.BlockletAdminRoles : [],
|
|
685
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledBadge, {
|
|
686
|
+
top: 1.2,
|
|
687
|
+
right: 0.4,
|
|
688
|
+
color: "error",
|
|
689
|
+
badgeContent: "",
|
|
690
|
+
variant: "dot",
|
|
691
|
+
invisible: !showUpdateDot,
|
|
692
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
693
|
+
disabled: loading || (0, _util2.isInProgress)(blocklet.status),
|
|
694
|
+
color: "secondary",
|
|
695
|
+
onClick: () => {
|
|
696
|
+
checkForUpdates();
|
|
697
|
+
},
|
|
698
|
+
"data-cy": "check-for-updates",
|
|
699
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
700
|
+
mr: 0.5,
|
|
701
|
+
display: "flex",
|
|
702
|
+
children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {
|
|
703
|
+
size: [16, 10]
|
|
704
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Update.default, {
|
|
705
|
+
style: {
|
|
706
|
+
fontSize: '1em'
|
|
707
|
+
}
|
|
708
|
+
})
|
|
709
|
+
}), t('blocklet.component.checkUpdateTitle')]
|
|
710
|
+
})
|
|
711
|
+
})
|
|
712
|
+
})]
|
|
713
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_permission.default, {
|
|
714
|
+
permission: "mutate_blocklet",
|
|
715
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(AddComponent, {
|
|
716
|
+
blocklet: blocklet,
|
|
717
|
+
children: _ref6 => {
|
|
718
|
+
let {
|
|
719
|
+
open
|
|
720
|
+
} = _ref6;
|
|
721
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
722
|
+
disabled: loading || (0, _util2.isInProgress)(blocklet.status),
|
|
723
|
+
variant: "text",
|
|
724
|
+
color: "primary",
|
|
725
|
+
"data-cy": "add-component",
|
|
726
|
+
onClick: open,
|
|
727
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Add.default, {
|
|
728
|
+
style: {
|
|
729
|
+
fontSize: '1.3em',
|
|
730
|
+
marginRight: 4
|
|
731
|
+
}
|
|
732
|
+
}), t('blocklet.component.add')]
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
})
|
|
736
|
+
})]
|
|
737
|
+
}), components && components.length ? [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
738
|
+
mt: 2,
|
|
739
|
+
ml: {
|
|
740
|
+
xs: '-16px',
|
|
741
|
+
md: '-28px'
|
|
742
|
+
},
|
|
743
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ComponentItem, {
|
|
744
|
+
blocklet: blocklet,
|
|
745
|
+
onRemove: removeComponent,
|
|
746
|
+
getComponentUrl: getComponentUrl
|
|
747
|
+
}, "0-".concat(blocklet.meta.did))
|
|
748
|
+
}, "top-blocklet-".concat(blocklet.meta.did))] : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
749
|
+
mt: 8,
|
|
750
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Empty.default, {
|
|
751
|
+
children: t('blocklet.component.noComponent')
|
|
752
|
+
})
|
|
753
|
+
}), !!updateConfirm && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dialog.default, {
|
|
754
|
+
open: true,
|
|
755
|
+
fullWidth: true,
|
|
756
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
757
|
+
paddingY: 1.5,
|
|
758
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_DialogTitle.default, {
|
|
759
|
+
children: t('blocklet.component.updateTitle')
|
|
760
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
761
|
+
component: _DialogContent.default,
|
|
762
|
+
py: 4,
|
|
763
|
+
ml: 4,
|
|
764
|
+
children: updateConfirm.list.map(x => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
765
|
+
mt: 3,
|
|
766
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
767
|
+
item: true,
|
|
768
|
+
xs: 5,
|
|
769
|
+
children: x.name
|
|
770
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Grid.default, {
|
|
771
|
+
fontSize: "h6.fontSize",
|
|
772
|
+
container: true,
|
|
773
|
+
spacing: 3,
|
|
774
|
+
alignItems: "center",
|
|
775
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
776
|
+
item: true,
|
|
777
|
+
xs: 2,
|
|
778
|
+
children: x.version
|
|
779
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
780
|
+
item: true,
|
|
781
|
+
xs: 1,
|
|
782
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowForward.default, {
|
|
783
|
+
style: {
|
|
784
|
+
fontSize: '0.9em'
|
|
785
|
+
}
|
|
786
|
+
})
|
|
787
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Grid.default, {
|
|
788
|
+
item: true,
|
|
789
|
+
xs: 2,
|
|
790
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
791
|
+
color: "secondary.main",
|
|
792
|
+
children: x.newVersion
|
|
793
|
+
})
|
|
794
|
+
})]
|
|
795
|
+
})]
|
|
796
|
+
}, "".concat(x.name, "-").concat(x.newVersion)))
|
|
797
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_DialogActions.default, {
|
|
798
|
+
style: {
|
|
799
|
+
padding: '8px 24px 24px'
|
|
800
|
+
},
|
|
801
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
802
|
+
onClick: () => {
|
|
803
|
+
setUpdateConfirm(null);
|
|
804
|
+
},
|
|
805
|
+
children: t('common.cancel')
|
|
806
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
807
|
+
onClick: e => {
|
|
808
|
+
e.stopPropagation();
|
|
809
|
+
onConfirmUpdate();
|
|
810
|
+
},
|
|
811
|
+
color: "primary",
|
|
812
|
+
disabled: loading,
|
|
813
|
+
variant: "contained",
|
|
814
|
+
autoFocus: true,
|
|
815
|
+
children: [loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {
|
|
816
|
+
size: [16, 10]
|
|
817
|
+
}), t('common.update')]
|
|
818
|
+
})]
|
|
819
|
+
})]
|
|
820
|
+
})
|
|
821
|
+
})]
|
|
822
|
+
}));
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
BlockletComponent.propTypes = {
|
|
826
|
+
blocklet: _propTypes.default.object.isRequired,
|
|
827
|
+
onUpdate: _propTypes.default.func,
|
|
828
|
+
getComponentUrl: _propTypes.default.func,
|
|
829
|
+
AddComponent: _propTypes.default.element
|
|
830
|
+
};
|
|
831
|
+
BlockletComponent.defaultProps = {
|
|
832
|
+
onUpdate: () => {},
|
|
833
|
+
getComponentUrl: () => window.location.origin,
|
|
834
|
+
AddComponent: () => {}
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
const Div = _styled.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .title {\n font-size: 1.2rem;\n font-weight: bold;\n margin-bottom: ", ";\n }\n\n @keyframes showDelay {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n }\n\n .component-item {\n animation: showDelay 0.75s ease 1;\n }\n"])), props => props.theme.spacing(1));
|