@abtnode/ux 1.16.17-beta-d282d63e → 1.16.17-beta-1cab4b42
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/publish/create-project.js +33 -21
- package/es/blocklet/publish/create-release.js +150 -67
- package/es/blocklet/publish/project-list.js +26 -2
- package/es/blocklet/publish/release-list.js +21 -0
- package/es/blocklet/publish/resource.js +129 -22
- package/es/blocklet/publish/tree.js +235 -0
- package/es/blocklet/router/util.js +2 -1
- package/es/locales/en.js +3 -1
- package/es/locales/zh.js +3 -1
- package/es/team/members/toggle-user-approval.js +4 -1
- package/lib/blocklet/publish/create-project.js +33 -21
- package/lib/blocklet/publish/create-release.js +145 -64
- package/lib/blocklet/publish/project-list.js +26 -2
- package/lib/blocklet/publish/release-list.js +21 -0
- package/lib/blocklet/publish/resource.js +115 -20
- package/lib/blocklet/publish/tree.js +199 -0
- package/lib/blocklet/router/util.js +2 -1
- package/lib/locales/en.js +3 -1
- package/lib/locales/zh.js +3 -1
- package/lib/team/members/toggle-user-approval.js +4 -1
- package/package.json +18 -18
|
@@ -18,17 +18,19 @@ var _Breadcrumbs = _interopRequireDefault(require("@mui/material/Breadcrumbs"));
|
|
|
18
18
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
19
19
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
20
20
|
var _DeleteOutline = _interopRequireDefault(require("@mui/icons-material/DeleteOutline"));
|
|
21
|
+
var _InputAdornment = _interopRequireDefault(require("@mui/material/InputAdornment"));
|
|
21
22
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
22
23
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
23
24
|
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
24
|
-
var _Tabs = _interopRequireDefault(require("@arcblock/ux/lib/Tabs"));
|
|
25
25
|
var _Empty = _interopRequireDefault(require("@arcblock/ux/lib/Empty"));
|
|
26
|
+
var _Tabs = _interopRequireDefault(require("@arcblock/ux/lib/Tabs"));
|
|
26
27
|
var _constant = require("@blocklet/constant");
|
|
27
28
|
var _constant2 = require("@abtnode/constant");
|
|
28
29
|
var _bundleAvatar = _interopRequireDefault(require("../bundle-avatar"));
|
|
29
30
|
var _node = require("../../contexts/node");
|
|
30
31
|
var _blocklet = require("../../contexts/blocklet");
|
|
31
32
|
var _emptySpinner = _interopRequireDefault(require("../../empty-spinner"));
|
|
33
|
+
var _util = require("../../util");
|
|
32
34
|
var _resource = _interopRequireDefault(require("./resource"));
|
|
33
35
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
34
36
|
var _templateObject;
|
|
@@ -41,10 +43,49 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
41
43
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
42
44
|
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
43
45
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
44
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
46
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
47
|
+
const allowedFileTypes = ['image/*', '.jpg', '.jpeg', '.png', '.gif', '.svg'];
|
|
48
|
+
const maxFileSize = 1024 * 1024 * 10; // 10 MB
|
|
49
|
+
|
|
50
|
+
// eslint-disable-next-line import/no-unresolved
|
|
45
51
|
const UploaderComponent = /*#__PURE__*/(0, _react.lazy)(() => Promise.resolve().then(() => _interopRequireWildcard(require('@blocklet/uploader/react'))).then(res => ({
|
|
46
52
|
default: res.Uploader
|
|
47
53
|
})));
|
|
54
|
+
const validateParams = (params, status, t) => {
|
|
55
|
+
const errors = [];
|
|
56
|
+
if (!params.blockletTitle) {
|
|
57
|
+
errors.push({
|
|
58
|
+
param: 'blockletTitle',
|
|
59
|
+
message: t('blocklet.publish.errorTip.noTitle')
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (!params.blockletVersion) {
|
|
63
|
+
errors.push({
|
|
64
|
+
param: 'blockletVersion',
|
|
65
|
+
message: t('blocklet.publish.errorTip.noVersion')
|
|
66
|
+
});
|
|
67
|
+
} else if (!_semver.default.valid(params.blockletVersion)) {
|
|
68
|
+
errors.push({
|
|
69
|
+
param: 'blockletVersion',
|
|
70
|
+
message: 'Invalid Blocklet Version'
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (status === _constant.PROJECT.RELEASE_STATUS.published) {
|
|
74
|
+
if (!params.blockletDescription) {
|
|
75
|
+
errors.push({
|
|
76
|
+
param: 'blockletDescription',
|
|
77
|
+
message: t('blocklet.publish.errorTip.noDescription')
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (!params.note) {
|
|
81
|
+
errors.push({
|
|
82
|
+
param: 'note',
|
|
83
|
+
message: t('blocklet.publish.errorTip.noNote')
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return errors.length ? errors : null;
|
|
88
|
+
};
|
|
48
89
|
const addComponentTabs = _ref => {
|
|
49
90
|
let {
|
|
50
91
|
tabs,
|
|
@@ -54,7 +95,6 @@ const addComponentTabs = _ref => {
|
|
|
54
95
|
const key = blocklet.meta.did;
|
|
55
96
|
tabs.push({
|
|
56
97
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
57
|
-
ml: -4,
|
|
58
98
|
display: "flex",
|
|
59
99
|
alignItems: "center",
|
|
60
100
|
justifyContent: "flex-start",
|
|
@@ -63,7 +103,7 @@ const addComponentTabs = _ref => {
|
|
|
63
103
|
blocklet: blocklet,
|
|
64
104
|
ancestors: ancestors
|
|
65
105
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
66
|
-
ml: "
|
|
106
|
+
ml: "4px",
|
|
67
107
|
className: "text",
|
|
68
108
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
69
109
|
children: blocklet.meta.title
|
|
@@ -73,9 +113,13 @@ const addComponentTabs = _ref => {
|
|
|
73
113
|
value: key
|
|
74
114
|
});
|
|
75
115
|
};
|
|
76
|
-
const pickParams = release =>
|
|
116
|
+
const pickParams = release => {
|
|
117
|
+
const params = (0, _pick.default)(release, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'note']);
|
|
118
|
+
params.blockletScreenshots || (params.blockletScreenshots = []);
|
|
119
|
+
return params;
|
|
120
|
+
};
|
|
77
121
|
function CreateRelease(_ref2) {
|
|
78
|
-
var _tabs
|
|
122
|
+
var _tabs$, _params$blockletIntro, _params$note;
|
|
79
123
|
let rest = Object.assign({}, (_objectDestructuringEmpty(_ref2), _ref2));
|
|
80
124
|
const navigate = (0, _reactRouterDom.useNavigate)();
|
|
81
125
|
const {
|
|
@@ -89,6 +133,7 @@ function CreateRelease(_ref2) {
|
|
|
89
133
|
blocklet
|
|
90
134
|
} = (0, _blocklet.useBlockletContext)();
|
|
91
135
|
const [params, setParams] = (0, _useSetState.default)(null);
|
|
136
|
+
const [paramsErrTip, setParamsErrTip] = (0, _react.useState)({});
|
|
92
137
|
const [loading, setLoading] = (0, _react.useState)(false);
|
|
93
138
|
const [release, setRelease] = (0, _react.useState)(null);
|
|
94
139
|
const {
|
|
@@ -99,7 +144,7 @@ function CreateRelease(_ref2) {
|
|
|
99
144
|
const releaseId = inputReleaseId === 'create' ? '' : inputReleaseId;
|
|
100
145
|
const mode = inputReleaseId === 'create' ? 'create' : 'edit';
|
|
101
146
|
const tabs = [];
|
|
102
|
-
const resourceComponents = ((blocklet === null || blocklet === void 0 ? void 0 : blocklet.children) || []).filter(x => x.meta.capabilities.
|
|
147
|
+
const resourceComponents = ((blocklet === null || blocklet === void 0 ? void 0 : blocklet.children) || []).filter(x => x.meta.capabilities.resourceExportApi);
|
|
103
148
|
resourceComponents.forEach(item => {
|
|
104
149
|
addComponentTabs({
|
|
105
150
|
tabs,
|
|
@@ -128,7 +173,7 @@ function CreateRelease(_ref2) {
|
|
|
128
173
|
setParams(pickParams(data));
|
|
129
174
|
}).catch(err => {
|
|
130
175
|
setLoading(false);
|
|
131
|
-
_Toast.default.error(
|
|
176
|
+
_Toast.default.error((0, _util.formatError)(err));
|
|
132
177
|
});
|
|
133
178
|
};
|
|
134
179
|
const getRelease = () => {
|
|
@@ -144,7 +189,7 @@ function CreateRelease(_ref2) {
|
|
|
144
189
|
setRelease(res === null || res === void 0 ? void 0 : res.release);
|
|
145
190
|
}).catch(err => {
|
|
146
191
|
setLoading(false);
|
|
147
|
-
_Toast.default.error(
|
|
192
|
+
_Toast.default.error((0, _util.formatError)(err));
|
|
148
193
|
});
|
|
149
194
|
};
|
|
150
195
|
const getData = () => {
|
|
@@ -164,28 +209,21 @@ function CreateRelease(_ref2) {
|
|
|
164
209
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
165
210
|
|
|
166
211
|
const onRelease = status => {
|
|
167
|
-
|
|
168
|
-
|
|
212
|
+
const errors = validateParams(params, status, t);
|
|
213
|
+
if (errors) {
|
|
214
|
+
_Toast.default.error(errors.map(x => x.message).join('; '));
|
|
215
|
+
setParamsErrTip(errors.reduce((acc, x) => _objectSpread(_objectSpread({}, acc), {}, {
|
|
216
|
+
[x.param]: x.message
|
|
217
|
+
}), {}));
|
|
169
218
|
return;
|
|
170
219
|
}
|
|
171
|
-
if (!params.blockletVersion) {
|
|
172
|
-
_Toast.default.error(t('blocklet.publish.errorTip.noVersion'));
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
if (status === _constant.PROJECT.RELEASE_STATUS.published) {
|
|
176
|
-
if (!params.blockletDescription) {
|
|
177
|
-
_Toast.default.error(t('blocklet.publish.errorTip.noDescription'));
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
if (!params.note) {
|
|
181
|
-
_Toast.default.error(t('blocklet.publish.errorTip.noNote'));
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
220
|
const _params = _objectSpread({}, params);
|
|
186
221
|
_params.blockletVersion = _semver.default.valid(_params.blockletVersion);
|
|
187
222
|
if (!_params.blockletVersion) {
|
|
188
223
|
_Toast.default.error('Invalid Blocklet Version');
|
|
224
|
+
setParamsErrTip({
|
|
225
|
+
blockletVersion: 'Invalid Blocklet Version'
|
|
226
|
+
});
|
|
189
227
|
return;
|
|
190
228
|
}
|
|
191
229
|
_params.blockletTitle = (_params.blockletTitle || '').trim();
|
|
@@ -214,7 +252,7 @@ function CreateRelease(_ref2) {
|
|
|
214
252
|
});
|
|
215
253
|
}
|
|
216
254
|
}).catch(err => {
|
|
217
|
-
_Toast.default.error(
|
|
255
|
+
_Toast.default.error((0, _util.formatError)(err));
|
|
218
256
|
});
|
|
219
257
|
};
|
|
220
258
|
if (!params && loading) {
|
|
@@ -304,56 +342,77 @@ function CreateRelease(_ref2) {
|
|
|
304
342
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
305
343
|
label: "Blocklet ".concat(t('common.title')),
|
|
306
344
|
placeholder: "Blocklet ".concat(t('common.title')),
|
|
307
|
-
|
|
345
|
+
InputProps: {
|
|
308
346
|
'data-cy': 'blocklet-title',
|
|
309
347
|
readOnly
|
|
310
348
|
},
|
|
311
349
|
autoComplete: "off",
|
|
312
350
|
variant: "outlined",
|
|
313
351
|
fullWidth: true,
|
|
352
|
+
required: true,
|
|
314
353
|
value: params.blockletTitle || '',
|
|
315
354
|
onChange: e => {
|
|
355
|
+
setParamsErrTip({
|
|
356
|
+
blockletTitle: ''
|
|
357
|
+
});
|
|
316
358
|
setParams({
|
|
317
359
|
blockletTitle: e.target.value
|
|
318
360
|
});
|
|
319
|
-
}
|
|
361
|
+
},
|
|
362
|
+
error: !!paramsErrTip.blockletTitle,
|
|
363
|
+
helperText: paramsErrTip.blockletTitle || ''
|
|
320
364
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
321
365
|
label: "Blocklet ".concat(t('common.description')),
|
|
322
366
|
placeholder: "Blocklet ".concat(t('common.description')),
|
|
323
|
-
|
|
367
|
+
InputProps: {
|
|
324
368
|
'data-cy': 'blocklet-description',
|
|
325
369
|
readOnly
|
|
326
370
|
},
|
|
371
|
+
required: true,
|
|
327
372
|
autoComplete: "off",
|
|
328
373
|
variant: "outlined",
|
|
329
374
|
fullWidth: true,
|
|
330
375
|
value: params.blockletDescription || '',
|
|
331
376
|
onChange: e => {
|
|
377
|
+
setParamsErrTip({
|
|
378
|
+
blockletDescription: ''
|
|
379
|
+
});
|
|
332
380
|
setParams({
|
|
333
381
|
blockletDescription: e.target.value
|
|
334
382
|
});
|
|
335
383
|
},
|
|
384
|
+
error: !!paramsErrTip.blockletDescription,
|
|
385
|
+
helperText: paramsErrTip.blockletDescription || '',
|
|
336
386
|
sx: {
|
|
337
387
|
mt: 3
|
|
338
388
|
}
|
|
339
389
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
340
390
|
label: "Blocklet ".concat(t('common.introduction')),
|
|
341
391
|
placeholder: "Blocklet ".concat(t('common.introduction')),
|
|
342
|
-
|
|
392
|
+
InputProps: {
|
|
343
393
|
'data-cy': 'export-blocklet-introduction',
|
|
344
|
-
readOnly
|
|
394
|
+
readOnly,
|
|
395
|
+
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_InputAdornment.default, {
|
|
396
|
+
position: "end",
|
|
397
|
+
children: [(params === null || params === void 0 ? void 0 : (_params$blockletIntro = params.blockletIntroduction) === null || _params$blockletIntro === void 0 ? void 0 : _params$blockletIntro.length) || 0, " / ", _constant.PROJECT.MAX_INTRO_LENGTH]
|
|
398
|
+
})
|
|
345
399
|
},
|
|
346
400
|
autoComplete: "off",
|
|
347
401
|
variant: "outlined",
|
|
348
402
|
fullWidth: true,
|
|
349
403
|
multiline: true,
|
|
350
|
-
|
|
404
|
+
minRows: 4,
|
|
351
405
|
value: params.blockletIntroduction || '',
|
|
352
406
|
onChange: e => {
|
|
407
|
+
setParamsErrTip({
|
|
408
|
+
blockletIntroduction: ''
|
|
409
|
+
});
|
|
353
410
|
setParams({
|
|
354
|
-
blockletIntroduction: e.target.value
|
|
411
|
+
blockletIntroduction: e.target.value.slice(0, _constant.PROJECT.MAX_INTRO_LENGTH)
|
|
355
412
|
});
|
|
356
413
|
},
|
|
414
|
+
error: !!paramsErrTip.blockletIntroduction,
|
|
415
|
+
helperText: paramsErrTip.blockletIntroduction || '',
|
|
357
416
|
sx: {
|
|
358
417
|
mt: 3
|
|
359
418
|
}
|
|
@@ -372,9 +431,10 @@ function CreateRelease(_ref2) {
|
|
|
372
431
|
flex: 1
|
|
373
432
|
},
|
|
374
433
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
434
|
+
required: true,
|
|
375
435
|
label: "Blocklet ".concat(t('common.version')),
|
|
376
436
|
placeholder: "Blocklet ".concat(t('common.version')),
|
|
377
|
-
|
|
437
|
+
InputProps: {
|
|
378
438
|
'data-cy': 'blocklet-version',
|
|
379
439
|
readOnly
|
|
380
440
|
},
|
|
@@ -383,27 +443,42 @@ function CreateRelease(_ref2) {
|
|
|
383
443
|
fullWidth: true,
|
|
384
444
|
value: params.blockletVersion,
|
|
385
445
|
onChange: e => {
|
|
446
|
+
setParamsErrTip({
|
|
447
|
+
blockletVersion: ''
|
|
448
|
+
});
|
|
386
449
|
setParams({
|
|
387
450
|
blockletVersion: e.target.value
|
|
388
451
|
});
|
|
389
|
-
}
|
|
452
|
+
},
|
|
453
|
+
error: !!paramsErrTip.blockletVersion,
|
|
454
|
+
helperText: paramsErrTip.blockletVersion || ''
|
|
390
455
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
391
456
|
label: t('blocklet.publish.releaseNote'),
|
|
392
457
|
autoComplete: "off",
|
|
393
458
|
variant: "outlined",
|
|
394
|
-
|
|
459
|
+
InputProps: {
|
|
395
460
|
'data-cy': 'release-note',
|
|
396
|
-
readOnly
|
|
461
|
+
readOnly,
|
|
462
|
+
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_InputAdornment.default, {
|
|
463
|
+
position: "end",
|
|
464
|
+
children: [(params === null || params === void 0 ? void 0 : (_params$note = params.note) === null || _params$note === void 0 ? void 0 : _params$note.length) || 0, " / ", _constant.PROJECT.MAX_NOTE_LENGTH]
|
|
465
|
+
})
|
|
397
466
|
},
|
|
398
467
|
fullWidth: true,
|
|
399
468
|
multiline: true,
|
|
400
|
-
|
|
469
|
+
minRows: 4,
|
|
470
|
+
required: true,
|
|
401
471
|
value: params.note,
|
|
402
472
|
onChange: e => {
|
|
473
|
+
setParamsErrTip({
|
|
474
|
+
note: ''
|
|
475
|
+
});
|
|
403
476
|
setParams({
|
|
404
|
-
note: e.target.value
|
|
477
|
+
note: e.target.value.slice(0, _constant.PROJECT.MAX_NOTE_LENGTH)
|
|
405
478
|
});
|
|
406
479
|
},
|
|
480
|
+
error: !!paramsErrTip.note,
|
|
481
|
+
helperText: paramsErrTip.note || '',
|
|
407
482
|
sx: {
|
|
408
483
|
mt: 3
|
|
409
484
|
}
|
|
@@ -503,11 +578,19 @@ function CreateRelease(_ref2) {
|
|
|
503
578
|
setParams({
|
|
504
579
|
blockletLogo: result.data.filename
|
|
505
580
|
});
|
|
581
|
+
uploaderLogoRef.current.close();
|
|
506
582
|
},
|
|
507
|
-
plugins: [
|
|
583
|
+
plugins: [],
|
|
508
584
|
apiPathProps: {
|
|
509
585
|
uploader: uploadLogoPrefix,
|
|
510
586
|
disableMediaKitPrefix: true
|
|
587
|
+
},
|
|
588
|
+
coreProps: {
|
|
589
|
+
restrictions: {
|
|
590
|
+
allowedFileTypes,
|
|
591
|
+
maxFileSize,
|
|
592
|
+
maxNumberOfFiles: 1
|
|
593
|
+
}
|
|
511
594
|
}
|
|
512
595
|
}, "uploader-screenshot"), /*#__PURE__*/(0, _jsxRuntime.jsx)(UploaderComponent, {
|
|
513
596
|
id: "\u200Buploader-screenshot",
|
|
@@ -520,38 +603,46 @@ function CreateRelease(_ref2) {
|
|
|
520
603
|
setParams({
|
|
521
604
|
blockletScreenshots
|
|
522
605
|
});
|
|
606
|
+
uploaderScreenshotRef.current.close();
|
|
523
607
|
},
|
|
524
|
-
plugins: [
|
|
608
|
+
plugins: [],
|
|
525
609
|
apiPathProps: {
|
|
526
610
|
uploader: uploadScreenshotPrefix,
|
|
527
611
|
disableMediaKitPrefix: true
|
|
612
|
+
},
|
|
613
|
+
coreProps: {
|
|
614
|
+
restrictions: {
|
|
615
|
+
allowedFileTypes,
|
|
616
|
+
maxFileSize,
|
|
617
|
+
maxNumberOfFiles: 5 - screenshotUrls.length
|
|
618
|
+
}
|
|
528
619
|
}
|
|
529
620
|
}, "uploader-screenshot")]
|
|
530
621
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
531
622
|
display: "flex",
|
|
532
623
|
mt: 3,
|
|
533
624
|
className: "section full-width",
|
|
534
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
625
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
535
626
|
className: "left",
|
|
536
|
-
children:
|
|
627
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
537
628
|
variant: "h3",
|
|
538
629
|
children: t('blocklet.publish.resourceTitle')
|
|
539
|
-
})
|
|
630
|
+
})
|
|
631
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
632
|
+
sx: {
|
|
633
|
+
flex: 1
|
|
634
|
+
},
|
|
635
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tabs.default, {
|
|
540
636
|
tabs: tabs,
|
|
541
637
|
current: tab,
|
|
542
|
-
orientation: "vertical",
|
|
543
638
|
onChange: onTabChange,
|
|
544
639
|
sx: {
|
|
545
|
-
|
|
640
|
+
ml: -2,
|
|
641
|
+
mt: -1.5
|
|
546
642
|
}
|
|
547
|
-
})
|
|
548
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
549
|
-
sx: {
|
|
550
|
-
flex: 1
|
|
551
|
-
},
|
|
552
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
643
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
553
644
|
children: resourceContent
|
|
554
|
-
})
|
|
645
|
+
})]
|
|
555
646
|
})]
|
|
556
647
|
})]
|
|
557
648
|
})]
|
|
@@ -559,7 +650,7 @@ function CreateRelease(_ref2) {
|
|
|
559
650
|
}
|
|
560
651
|
CreateRelease.propTypes = {};
|
|
561
652
|
CreateRelease.defaultProps = {};
|
|
562
|
-
const Main = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .sticky-header {\n margin-top: -12px;\n padding: 12px 0;\n position: sticky;\n top: 0;\n z-index: 99;\n display: flex;\n align-items: center;\n justify-content: space-between;\n background-color: #fff;\n padding-bottom: 12px;\n border-bottom: ", ";\n }\n .screenshot {\n margin-bottom: 16px;\n max-width: 200px;\n max-height: 140px;\n width: 200px;\n height: 140px;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #eee;\n margin-right: 16px;\n position: relative;\n .action {\n visibility: hidden;\n position: absolute;\n top: 0px;\n right: 0px;\n background-color: rgba(0, 0, 0, 0.2);\n color: rgba(255, 255, 255, 0.8);\n }\n &:hover .action {\n visibility: visible;\n }\n }\n .screenshot img {\n width: 100%; /* \u56FE\u50CF\u5BBD\u5EA6\u586B\u5145\u5BB9\u5668 */\n height: auto; /* \u56FE\u50CF\u9AD8\u5EA6\u81EA\u9002\u5E94 */\n }\n .section {\n max-width: 800px;\n &.full-width {\n max-width: 100%;\n }\n .MuiTypography-h3 {\n font-size: 1.1rem;\n font-weight: 700;\n }\n .left {\n flex-shrink: 0;\n width: 140px;\n }\n .MuiTabs-
|
|
653
|
+
const Main = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .sticky-header {\n margin-top: -12px;\n padding: 12px 0;\n position: sticky;\n top: 0;\n z-index: 99;\n display: flex;\n align-items: center;\n justify-content: space-between;\n background-color: #fff;\n padding-bottom: 12px;\n border-bottom: ", ";\n }\n .screenshot {\n margin-bottom: 16px;\n max-width: 200px;\n max-height: 140px;\n width: 200px;\n height: 140px;\n overflow: hidden;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #eee;\n margin-right: 16px;\n position: relative;\n .action {\n visibility: hidden;\n position: absolute;\n top: 0px;\n right: 0px;\n background-color: rgba(0, 0, 0, 0.2);\n color: rgba(255, 255, 255, 0.8);\n }\n &:hover .action {\n visibility: visible;\n }\n }\n .screenshot img {\n width: 100%; /* \u56FE\u50CF\u5BBD\u5EA6\u586B\u5145\u5BB9\u5668 */\n height: auto; /* \u56FE\u50CF\u9AD8\u5EA6\u81EA\u9002\u5E94 */\n }\n .section {\n max-width: 800px;\n &.full-width {\n max-width: 100%;\n }\n .MuiTypography-h3 {\n font-size: 1.1rem;\n font-weight: 700;\n }\n .left {\n flex-shrink: 0;\n width: 140px;\n }\n .MuiTabs-indicator {\n display: none;\n }\n .MuiTypography-subtitle1 {\n width: 120px;\n font-weight: 700;\n font-size: 1rem;\n ", " {\n width: 80px;\n }\n }\n }\n .MuiButtonBase-root {\n a {\n color: inherit;\n }\n }\n .MuiInputBase-multiline .MuiInputAdornment-positionEnd {\n align-self: flex-end;\n .MuiTypography-root {\n font-size: 0.8rem;\n }\n font-size: 0.8rem;\n }\n"])), _ref3 => {
|
|
563
654
|
let {
|
|
564
655
|
theme
|
|
565
656
|
} = _ref3;
|
|
@@ -568,15 +659,5 @@ const Main = _styled.default.div(_templateObject || (_templateObject = _taggedTe
|
|
|
568
659
|
let {
|
|
569
660
|
theme
|
|
570
661
|
} = _ref4;
|
|
571
|
-
return theme.palette.text.primary;
|
|
572
|
-
}, _ref5 => {
|
|
573
|
-
let {
|
|
574
|
-
theme
|
|
575
|
-
} = _ref5;
|
|
576
|
-
return theme.palette.primary.main;
|
|
577
|
-
}, _ref6 => {
|
|
578
|
-
let {
|
|
579
|
-
theme
|
|
580
|
-
} = _ref6;
|
|
581
662
|
return theme.breakpoints.down('sm');
|
|
582
663
|
});
|
|
@@ -14,6 +14,8 @@ var _Delete = _interopRequireDefault(require("@mui/icons-material/Delete"));
|
|
|
14
14
|
var _Datatable = _interopRequireDefault(require("@arcblock/ux/lib/Datatable"));
|
|
15
15
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
16
16
|
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
17
|
+
var _Tag = _interopRequireDefault(require("@arcblock/ux/lib/Tag"));
|
|
18
|
+
var _RelativeTime = _interopRequireDefault(require("@arcblock/ux/lib/RelativeTime"));
|
|
17
19
|
var _blocklet = require("../../contexts/blocklet");
|
|
18
20
|
var _node = require("../../contexts/node");
|
|
19
21
|
var _emptySpinner = _interopRequireDefault(require("../../empty-spinner"));
|
|
@@ -114,7 +116,7 @@ function ProjectList() {
|
|
|
114
116
|
});
|
|
115
117
|
}
|
|
116
118
|
const columns = [{
|
|
117
|
-
label:
|
|
119
|
+
label: 'Blocklet',
|
|
118
120
|
name: 'blockletTitle',
|
|
119
121
|
options: {
|
|
120
122
|
customBodyRenderLite: rawIndex => {
|
|
@@ -126,7 +128,7 @@ function ProjectList() {
|
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
}, {
|
|
129
|
-
label:
|
|
131
|
+
label: 'DID',
|
|
130
132
|
name: 'blockletDid',
|
|
131
133
|
options: {
|
|
132
134
|
customBodyRender: e => {
|
|
@@ -137,6 +139,28 @@ function ProjectList() {
|
|
|
137
139
|
});
|
|
138
140
|
}
|
|
139
141
|
}
|
|
142
|
+
}, {
|
|
143
|
+
label: 'Version',
|
|
144
|
+
name: 'blockletVersion',
|
|
145
|
+
options: {
|
|
146
|
+
customBodyRender: value => {
|
|
147
|
+
return value ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tag.default, {
|
|
148
|
+
type: "success",
|
|
149
|
+
children: value
|
|
150
|
+
}) : '';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}, {
|
|
154
|
+
label: t('common.updatedAt'),
|
|
155
|
+
name: 'updatedAt',
|
|
156
|
+
options: {
|
|
157
|
+
customBodyRender: value => {
|
|
158
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RelativeTime.default, {
|
|
159
|
+
value: Number(value),
|
|
160
|
+
locale: locale
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
140
164
|
}, {
|
|
141
165
|
label: t('common.actions'),
|
|
142
166
|
name: 'actions',
|
|
@@ -21,6 +21,8 @@ var _constant = require("@abtnode/constant");
|
|
|
21
21
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
22
22
|
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
23
23
|
var _Tag = _interopRequireDefault(require("@arcblock/ux/lib/Tag"));
|
|
24
|
+
var _RelativeTime = _interopRequireDefault(require("@arcblock/ux/lib/RelativeTime"));
|
|
25
|
+
var _constant2 = require("@blocklet/constant");
|
|
24
26
|
var _blocklet = require("../../contexts/blocklet");
|
|
25
27
|
var _node = require("../../contexts/node");
|
|
26
28
|
var _emptySpinner = _interopRequireDefault(require("../../empty-spinner"));
|
|
@@ -196,6 +198,21 @@ function ReleaseList() {
|
|
|
196
198
|
});
|
|
197
199
|
}
|
|
198
200
|
}
|
|
201
|
+
}, {
|
|
202
|
+
label: t('common.lastPublishedAt'),
|
|
203
|
+
name: 'updatedAt',
|
|
204
|
+
options: {
|
|
205
|
+
customBodyRenderLite: rawIndex => {
|
|
206
|
+
const release = releases[rawIndex];
|
|
207
|
+
if (release.status !== _constant2.PROJECT.RELEASE_STATUS.published) {
|
|
208
|
+
return '';
|
|
209
|
+
}
|
|
210
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_RelativeTime.default, {
|
|
211
|
+
value: Number(release.updatedAt),
|
|
212
|
+
locale: locale
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
199
216
|
}, {
|
|
200
217
|
label: t('common.actions'),
|
|
201
218
|
name: 'actions',
|
|
@@ -204,11 +221,15 @@ function ReleaseList() {
|
|
|
204
221
|
const release = releases[rawIndex];
|
|
205
222
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
206
223
|
display: "flex",
|
|
224
|
+
alignItems: "center",
|
|
207
225
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
208
226
|
color: "primary",
|
|
209
227
|
"aria-label": "download",
|
|
210
228
|
disabled: release.status !== 'published',
|
|
211
229
|
children: release.status === 'published' ? /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
230
|
+
style: {
|
|
231
|
+
display: 'flex'
|
|
232
|
+
},
|
|
212
233
|
href: (0, _urlJoin.default)("".concat(_constant.WELLKNOWN_SERVICE_PATH_PREFIX, "/api/project/").concat(blocklet.meta.did, "/").concat(project.id, "/").concat(release.id, "/download/").concat((release.files || [])[0])),
|
|
213
234
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Download.default, {
|
|
214
235
|
sx: {
|