@abtnode/ux 1.16.27-beta-4022dde0 → 1.16.27-beta-21d213c5
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/blocklet/component/shorten-label.js +17 -3
- package/lib/blocklet/publish/blocklet-card.js +59 -0
- package/lib/blocklet/publish/create-release/branding.js +109 -89
- package/lib/blocklet/publish/create-release/header.js +2 -2
- package/lib/blocklet/publish/create-release/index.js +2 -1
- package/lib/blocklet/publish/create-release/release-stepper.js +2 -2
- package/lib/blocklet/publish/create-release/tree.js +1 -1
- package/lib/blocklet/publish/project-list.js +46 -15
- package/lib/blocklet/publish/release-list.js +10 -3
- package/lib/blocklet/router/action/add-domain-alias.js +2 -46
- package/lib/blocklet/router/add-domain.js +203 -67
- package/lib/contexts/domain.js +1 -22
- package/lib/locales/ar.js +7 -6
- package/lib/locales/de.js +7 -6
- package/lib/locales/en.js +4 -5
- package/lib/locales/es.js +7 -6
- package/lib/locales/fr.js +7 -6
- package/lib/locales/hi.js +7 -6
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +7 -6
- package/lib/locales/ja.js +7 -6
- package/lib/locales/ko.js +7 -6
- package/lib/locales/pt.js +7 -6
- package/lib/locales/ru.js +7 -6
- package/lib/locales/th.js +7 -6
- package/lib/locales/vi.js +6 -5
- package/lib/locales/zh-tw.js +7 -6
- package/lib/locales/zh.js +6 -5
- package/package.json +8 -7
|
@@ -9,26 +9,40 @@ function shortenString(str, maxLength = 10) {
|
|
|
9
9
|
}
|
|
10
10
|
function ShortenLabel({
|
|
11
11
|
children,
|
|
12
|
-
maxLength
|
|
12
|
+
maxLength,
|
|
13
|
+
sx,
|
|
14
|
+
hiddenTip
|
|
13
15
|
}) {
|
|
14
16
|
if (children?.length <= maxLength) {
|
|
15
17
|
return /*#__PURE__*/_jsx(Typography, {
|
|
18
|
+
sx: sx,
|
|
16
19
|
children: children
|
|
17
20
|
});
|
|
18
21
|
}
|
|
22
|
+
if (hiddenTip) {
|
|
23
|
+
return /*#__PURE__*/_jsx(Typography, {
|
|
24
|
+
sx: sx,
|
|
25
|
+
children: shortenString(children, maxLength)
|
|
26
|
+
});
|
|
27
|
+
}
|
|
19
28
|
return /*#__PURE__*/_jsx(Tooltip, {
|
|
20
29
|
title: children,
|
|
21
30
|
placement: "top",
|
|
22
31
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
32
|
+
sx: sx,
|
|
23
33
|
children: shortenString(children, maxLength)
|
|
24
34
|
})
|
|
25
35
|
});
|
|
26
36
|
}
|
|
27
37
|
ShortenLabel.propTypes = {
|
|
28
38
|
children: PropTypes.string.isRequired,
|
|
29
|
-
maxLength: PropTypes.number
|
|
39
|
+
maxLength: PropTypes.number,
|
|
40
|
+
sx: PropTypes.object,
|
|
41
|
+
hiddenTip: PropTypes.bool
|
|
30
42
|
};
|
|
31
43
|
ShortenLabel.defaultProps = {
|
|
32
|
-
maxLength: 10
|
|
44
|
+
maxLength: 10,
|
|
45
|
+
sx: null,
|
|
46
|
+
hiddenTip: false
|
|
33
47
|
};
|
|
34
48
|
export default ShortenLabel;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
|
|
2
|
+
import { Avatar, Box } from '@mui/material';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import ShortenLabel from '../component/shorten-label';
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
function BlockletCard({
|
|
8
|
+
did,
|
|
9
|
+
projectId,
|
|
10
|
+
title,
|
|
11
|
+
logo,
|
|
12
|
+
describe
|
|
13
|
+
}) {
|
|
14
|
+
const uploadLogoPrefix = `${WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${did}/${projectId}/logo/upload`;
|
|
15
|
+
const logoUrl = `${uploadLogoPrefix}/${logo}`;
|
|
16
|
+
const [hover, setHover] = useState(false);
|
|
17
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
18
|
+
sx: {
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flexDirection: 'row',
|
|
21
|
+
color: hover ? 'primary.main' : 'grey.900',
|
|
22
|
+
gap: 1
|
|
23
|
+
},
|
|
24
|
+
onPointerEnter: () => setHover(true),
|
|
25
|
+
onPointerLeave: () => setHover(false),
|
|
26
|
+
children: [/*#__PURE__*/_jsx(Avatar, {
|
|
27
|
+
sx: {
|
|
28
|
+
borderRadius: 1
|
|
29
|
+
},
|
|
30
|
+
src: logoUrl
|
|
31
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
32
|
+
children: [/*#__PURE__*/_jsx(ShortenLabel, {
|
|
33
|
+
hiddenTip: true,
|
|
34
|
+
maxLength: "24",
|
|
35
|
+
sx: {
|
|
36
|
+
fontSize: '14px',
|
|
37
|
+
fontWeight: '500'
|
|
38
|
+
},
|
|
39
|
+
children: title || '/'
|
|
40
|
+
}), /*#__PURE__*/_jsx(ShortenLabel, {
|
|
41
|
+
hiddenTip: true,
|
|
42
|
+
maxLength: "58",
|
|
43
|
+
sx: {
|
|
44
|
+
fontSize: '12px',
|
|
45
|
+
color: hover ? 'primary.main' : 'grey.700'
|
|
46
|
+
},
|
|
47
|
+
children: describe || '/'
|
|
48
|
+
})]
|
|
49
|
+
})]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
BlockletCard.propTypes = {
|
|
53
|
+
projectId: PropTypes.string.isRequired,
|
|
54
|
+
did: PropTypes.string.isRequired,
|
|
55
|
+
title: PropTypes.string.isRequired,
|
|
56
|
+
logo: PropTypes.string.isRequired,
|
|
57
|
+
describe: PropTypes.string.isRequired
|
|
58
|
+
};
|
|
59
|
+
export default BlockletCard;
|
|
@@ -113,8 +113,104 @@ function Branding({
|
|
|
113
113
|
const uploadScreenshotPrefix = `${WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${blocklet.meta.did}/${projectId}/screenshot/upload`;
|
|
114
114
|
const logoUrl = params?.blockletLogo ? `${uploadLogoPrefix}/${params.blockletLogo}` : `${WELLKNOWN_SERVICE_PATH_PREFIX}/static/images/logo.png`;
|
|
115
115
|
const screenshotUrls = (params?.blockletScreenshots || []).filter(Boolean).map(x => `${uploadScreenshotPrefix}/${x}`);
|
|
116
|
+
const checkCanUpload = () => {
|
|
117
|
+
if (readOnly) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
if (!projectId || projectId === UNOWNED_DID) {
|
|
121
|
+
Toast.error(t('blocklet.publish.errorTip.noFirstDid'));
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
};
|
|
116
126
|
return /*#__PURE__*/_jsxs(Content, {
|
|
117
|
-
children: [/*#__PURE__*/
|
|
127
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
128
|
+
display: "flex",
|
|
129
|
+
className: "section",
|
|
130
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
131
|
+
sx: {
|
|
132
|
+
flex: 1
|
|
133
|
+
},
|
|
134
|
+
children: [/*#__PURE__*/_jsx(TextField, {
|
|
135
|
+
disabled: loading || readOnly,
|
|
136
|
+
label: `Blocklet ${t('common.title')}`,
|
|
137
|
+
placeholder: `Blocklet ${t('common.title')}`,
|
|
138
|
+
InputProps: {
|
|
139
|
+
'data-cy': 'blocklet-title',
|
|
140
|
+
readOnly
|
|
141
|
+
},
|
|
142
|
+
autoComplete: "off",
|
|
143
|
+
variant: "outlined",
|
|
144
|
+
fullWidth: true,
|
|
145
|
+
required: true,
|
|
146
|
+
value: params.blockletTitle || '',
|
|
147
|
+
onChange: e => {
|
|
148
|
+
setParamsErrTip({
|
|
149
|
+
blockletTitle: ''
|
|
150
|
+
});
|
|
151
|
+
setParams({
|
|
152
|
+
blockletTitle: e.target.value
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
error: !!paramsErrTip.blockletTitle,
|
|
156
|
+
helperText: paramsErrTip.blockletTitle || ''
|
|
157
|
+
}), /*#__PURE__*/_jsx(TextField, {
|
|
158
|
+
required: true,
|
|
159
|
+
label: "Blocklet DID",
|
|
160
|
+
fullWidth: true,
|
|
161
|
+
readonly: true,
|
|
162
|
+
disabled: true,
|
|
163
|
+
autoComplete: "off",
|
|
164
|
+
variant: "outlined",
|
|
165
|
+
InputProps: {
|
|
166
|
+
'data-cy': 'export-blocklet-did',
|
|
167
|
+
endAdornment: projectId === UNOWNED_DID && /*#__PURE__*/_jsx(InputAdornment, {
|
|
168
|
+
position: "end",
|
|
169
|
+
children: /*#__PURE__*/_jsx(ConnectStoreButton, {
|
|
170
|
+
blocklet: blocklet,
|
|
171
|
+
store: wantToConnectStore,
|
|
172
|
+
onChangeStore: setWantToConnectStore,
|
|
173
|
+
disabled: !params.blockletTitle || readOnly || loading,
|
|
174
|
+
loading: loading,
|
|
175
|
+
onClick: handleConnectByStudio
|
|
176
|
+
})
|
|
177
|
+
})
|
|
178
|
+
},
|
|
179
|
+
error: !!paramsErrTip.projectId,
|
|
180
|
+
helperText: paramsErrTip.projectId || '',
|
|
181
|
+
value: projectId === UNOWNED_DID ? '' : projectId,
|
|
182
|
+
sx: {
|
|
183
|
+
mt: 3
|
|
184
|
+
}
|
|
185
|
+
}), /*#__PURE__*/_jsx(TextField, {
|
|
186
|
+
disabled: loading || readOnly,
|
|
187
|
+
label: `Blocklet ${t('common.description')}`,
|
|
188
|
+
placeholder: `Blocklet ${t('common.description')}`,
|
|
189
|
+
InputProps: {
|
|
190
|
+
'data-cy': 'blocklet-description',
|
|
191
|
+
readOnly
|
|
192
|
+
},
|
|
193
|
+
required: true,
|
|
194
|
+
autoComplete: "off",
|
|
195
|
+
variant: "outlined",
|
|
196
|
+
fullWidth: true,
|
|
197
|
+
value: params.blockletDescription || '',
|
|
198
|
+
onChange: e => {
|
|
199
|
+
setParamsErrTip({
|
|
200
|
+
blockletDescription: ''
|
|
201
|
+
});
|
|
202
|
+
setParams({
|
|
203
|
+
blockletDescription: e.target.value
|
|
204
|
+
});
|
|
205
|
+
},
|
|
206
|
+
error: !!paramsErrTip.blockletDescription,
|
|
207
|
+
helperText: paramsErrTip.blockletDescription || '',
|
|
208
|
+
sx: {
|
|
209
|
+
mt: 3
|
|
210
|
+
}
|
|
211
|
+
})]
|
|
212
|
+
})
|
|
213
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
118
214
|
display: "flex",
|
|
119
215
|
mt: 3,
|
|
120
216
|
className: "section full-width",
|
|
@@ -143,7 +239,12 @@ function Branding({
|
|
|
143
239
|
},
|
|
144
240
|
alt: "Blocklet Logo",
|
|
145
241
|
src: initLogoUrl || logoUrl,
|
|
146
|
-
onClick: () =>
|
|
242
|
+
onClick: () => {
|
|
243
|
+
if (!checkCanUpload()) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
uploaderLogoRef.current.open();
|
|
247
|
+
}
|
|
147
248
|
})
|
|
148
249
|
})]
|
|
149
250
|
}), /*#__PURE__*/_jsxs(Box, {
|
|
@@ -191,7 +292,12 @@ function Branding({
|
|
|
191
292
|
justifyContent: "center",
|
|
192
293
|
alignItems: "center",
|
|
193
294
|
fontSize: 40,
|
|
194
|
-
onClick: () =>
|
|
295
|
+
onClick: () => {
|
|
296
|
+
if (!checkCanUpload()) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
uploaderScreenshotRef.current.open();
|
|
300
|
+
},
|
|
195
301
|
children: "+"
|
|
196
302
|
})]
|
|
197
303
|
})]
|
|
@@ -251,92 +357,6 @@ function Branding({
|
|
|
251
357
|
}
|
|
252
358
|
}, "uploader-screenshot")
|
|
253
359
|
})]
|
|
254
|
-
}), /*#__PURE__*/_jsx(Box, {
|
|
255
|
-
display: "flex",
|
|
256
|
-
className: "section",
|
|
257
|
-
children: /*#__PURE__*/_jsxs(Box, {
|
|
258
|
-
sx: {
|
|
259
|
-
flex: 1
|
|
260
|
-
},
|
|
261
|
-
children: [/*#__PURE__*/_jsx(TextField, {
|
|
262
|
-
disabled: loading || readOnly,
|
|
263
|
-
label: `Blocklet ${t('common.title')}`,
|
|
264
|
-
placeholder: `Blocklet ${t('common.title')}`,
|
|
265
|
-
InputProps: {
|
|
266
|
-
'data-cy': 'blocklet-title',
|
|
267
|
-
readOnly
|
|
268
|
-
},
|
|
269
|
-
autoComplete: "off",
|
|
270
|
-
variant: "outlined",
|
|
271
|
-
fullWidth: true,
|
|
272
|
-
required: true,
|
|
273
|
-
value: params.blockletTitle || '',
|
|
274
|
-
onChange: e => {
|
|
275
|
-
setParamsErrTip({
|
|
276
|
-
blockletTitle: ''
|
|
277
|
-
});
|
|
278
|
-
setParams({
|
|
279
|
-
blockletTitle: e.target.value
|
|
280
|
-
});
|
|
281
|
-
},
|
|
282
|
-
error: !!paramsErrTip.blockletTitle,
|
|
283
|
-
helperText: paramsErrTip.blockletTitle || ''
|
|
284
|
-
}), /*#__PURE__*/_jsx(TextField, {
|
|
285
|
-
required: true,
|
|
286
|
-
label: "Blocklet DID",
|
|
287
|
-
fullWidth: true,
|
|
288
|
-
readonly: true,
|
|
289
|
-
disabled: true,
|
|
290
|
-
autoComplete: "off",
|
|
291
|
-
variant: "outlined",
|
|
292
|
-
InputProps: {
|
|
293
|
-
'data-cy': 'export-blocklet-did',
|
|
294
|
-
endAdornment: projectId === UNOWNED_DID && /*#__PURE__*/_jsx(InputAdornment, {
|
|
295
|
-
position: "end",
|
|
296
|
-
children: /*#__PURE__*/_jsx(ConnectStoreButton, {
|
|
297
|
-
blocklet: blocklet,
|
|
298
|
-
store: wantToConnectStore,
|
|
299
|
-
onChangeStore: setWantToConnectStore,
|
|
300
|
-
disabled: !params.blockletTitle || readOnly || loading,
|
|
301
|
-
loading: loading,
|
|
302
|
-
onClick: handleConnectByStudio
|
|
303
|
-
})
|
|
304
|
-
})
|
|
305
|
-
},
|
|
306
|
-
error: !!paramsErrTip.projectId,
|
|
307
|
-
helperText: paramsErrTip.projectId || '',
|
|
308
|
-
value: projectId === UNOWNED_DID ? '' : projectId,
|
|
309
|
-
sx: {
|
|
310
|
-
mt: 3
|
|
311
|
-
}
|
|
312
|
-
}), /*#__PURE__*/_jsx(TextField, {
|
|
313
|
-
disabled: loading || readOnly,
|
|
314
|
-
label: `Blocklet ${t('common.description')}`,
|
|
315
|
-
placeholder: `Blocklet ${t('common.description')}`,
|
|
316
|
-
InputProps: {
|
|
317
|
-
'data-cy': 'blocklet-description',
|
|
318
|
-
readOnly
|
|
319
|
-
},
|
|
320
|
-
required: true,
|
|
321
|
-
autoComplete: "off",
|
|
322
|
-
variant: "outlined",
|
|
323
|
-
fullWidth: true,
|
|
324
|
-
value: params.blockletDescription || '',
|
|
325
|
-
onChange: e => {
|
|
326
|
-
setParamsErrTip({
|
|
327
|
-
blockletDescription: ''
|
|
328
|
-
});
|
|
329
|
-
setParams({
|
|
330
|
-
blockletDescription: e.target.value
|
|
331
|
-
});
|
|
332
|
-
},
|
|
333
|
-
error: !!paramsErrTip.blockletDescription,
|
|
334
|
-
helperText: paramsErrTip.blockletDescription || '',
|
|
335
|
-
sx: {
|
|
336
|
-
mt: 3
|
|
337
|
-
}
|
|
338
|
-
})]
|
|
339
|
-
})
|
|
340
360
|
})]
|
|
341
361
|
});
|
|
342
362
|
}
|
|
@@ -156,7 +156,7 @@ function Header({
|
|
|
156
156
|
concurrency: 2
|
|
157
157
|
});
|
|
158
158
|
} catch (err) {
|
|
159
|
-
Toast.error(err.message);
|
|
159
|
+
Toast.error(err?.response?.data?.error?.message || err.message);
|
|
160
160
|
setLoading(false);
|
|
161
161
|
setParamsErrTip({
|
|
162
162
|
resources: 'Invalid save the resource'
|
|
@@ -188,7 +188,7 @@ function Header({
|
|
|
188
188
|
componentDid
|
|
189
189
|
}, '*');
|
|
190
190
|
}
|
|
191
|
-
if (mode === 'create') {
|
|
191
|
+
if (mode === 'create' || mode === 'new-release') {
|
|
192
192
|
const id = res?.release?.id;
|
|
193
193
|
navigate(`../${projectId}/view/${id}`, {
|
|
194
194
|
replace: true
|
|
@@ -311,7 +311,7 @@ export default function CreateRelease({
|
|
|
311
311
|
label: componentsUrlTitle || t('common.components'),
|
|
312
312
|
description: t('blocklet.publish.steps.blocklets')
|
|
313
313
|
}, {
|
|
314
|
-
label:
|
|
314
|
+
label: t('blocklet.publish.versionTitle'),
|
|
315
315
|
description: t('blocklet.publish.steps.version')
|
|
316
316
|
}];
|
|
317
317
|
const nowStep = steps[activeStep] || steps[steps.length - 1];
|
|
@@ -330,6 +330,7 @@ export default function CreateRelease({
|
|
|
330
330
|
isPublished: isPublished,
|
|
331
331
|
loading: loading,
|
|
332
332
|
setLoading: setLoading,
|
|
333
|
+
initLogoUrl: initLogoUrl,
|
|
333
334
|
releaseId: releaseId,
|
|
334
335
|
projectId: projectId,
|
|
335
336
|
resourceComponents: resourceComponents,
|
|
@@ -110,7 +110,7 @@ export default function ReleaseStepper({
|
|
|
110
110
|
mr: 1
|
|
111
111
|
},
|
|
112
112
|
disabled: error || !ok,
|
|
113
|
-
children:
|
|
113
|
+
children: t('common.continue')
|
|
114
114
|
}), index > 0 && /*#__PURE__*/_jsx(Button, {
|
|
115
115
|
disabled: index === 0,
|
|
116
116
|
onClick: handleBack,
|
|
@@ -118,7 +118,7 @@ export default function ReleaseStepper({
|
|
|
118
118
|
mt: 1,
|
|
119
119
|
mr: 1
|
|
120
120
|
},
|
|
121
|
-
children:
|
|
121
|
+
children: t('common.back')
|
|
122
122
|
})]
|
|
123
123
|
})
|
|
124
124
|
})]
|
|
@@ -128,7 +128,7 @@ export default function Tree({
|
|
|
128
128
|
tabIndex: -1,
|
|
129
129
|
disableRipple: true,
|
|
130
130
|
onClick: event => handleNodeSelect(event, node.id),
|
|
131
|
-
disabled: disabled
|
|
131
|
+
disabled: node.disabled || disabled
|
|
132
132
|
}),
|
|
133
133
|
label: /*#__PURE__*/_jsxs(Box, {
|
|
134
134
|
className: "content",
|
|
@@ -19,7 +19,7 @@ import Toast from '@arcblock/ux/lib/Toast';
|
|
|
19
19
|
import Tag from '@arcblock/ux/lib/Tag';
|
|
20
20
|
import RelativeTime from '@arcblock/ux/lib/RelativeTime';
|
|
21
21
|
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
22
|
-
import { Tooltip, Typography } from '@mui/material';
|
|
22
|
+
import { Tooltip, Typography, useMediaQuery } from '@mui/material';
|
|
23
23
|
import { useSessionContext } from '../../contexts/session';
|
|
24
24
|
import { useBlockletContext } from '../../contexts/blocklet';
|
|
25
25
|
import { useNodeContext } from '../../contexts/node';
|
|
@@ -28,6 +28,7 @@ import DidAddress from '../../did-address';
|
|
|
28
28
|
import Confirm from '../../confirm';
|
|
29
29
|
import BlockletBundleAvatar from '../bundle-avatar';
|
|
30
30
|
import ShortenLabel from '../component/shorten-label';
|
|
31
|
+
import BlockletCard from './blocklet-card';
|
|
31
32
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
32
33
|
export default function ProjectList({
|
|
33
34
|
initUrl
|
|
@@ -50,6 +51,7 @@ export default function ProjectList({
|
|
|
50
51
|
} = useBlockletContext();
|
|
51
52
|
const [deleteConfirm, setDeleteConfirm] = useState(null);
|
|
52
53
|
const [openDidConnect, setOpenDidConnect] = useState(false);
|
|
54
|
+
const smallScreen = useMediaQuery(theme => theme.breakpoints.down('xl'));
|
|
53
55
|
const {
|
|
54
56
|
componentDid = ''
|
|
55
57
|
} = useParams();
|
|
@@ -148,39 +150,68 @@ export default function ProjectList({
|
|
|
148
150
|
const columns = [{
|
|
149
151
|
label: 'Blocklet',
|
|
150
152
|
name: 'blockletTitle',
|
|
153
|
+
minWidth: 160,
|
|
151
154
|
options: {
|
|
152
155
|
customBodyRenderLite: rawIndex => {
|
|
153
156
|
const project = projects[rawIndex];
|
|
154
157
|
return /*#__PURE__*/_jsx(Link, {
|
|
155
158
|
to: `${project.id}`,
|
|
156
|
-
children:
|
|
159
|
+
children: /*#__PURE__*/_jsx(BlockletCard, {
|
|
160
|
+
did: blocklet.meta.did,
|
|
161
|
+
projectId: project.id,
|
|
162
|
+
logo: project.blockletLogo,
|
|
163
|
+
title: project.blockletTitle,
|
|
164
|
+
describe: project.blockletDescription
|
|
165
|
+
})
|
|
157
166
|
});
|
|
158
167
|
}
|
|
159
168
|
}
|
|
169
|
+
}, {
|
|
170
|
+
label: 'Version',
|
|
171
|
+
name: 'blockletVersion',
|
|
172
|
+
options: {
|
|
173
|
+
customBodyRender: value => {
|
|
174
|
+
return value ? /*#__PURE__*/_jsx(Tag, {
|
|
175
|
+
type: "success",
|
|
176
|
+
children: value
|
|
177
|
+
}) : '';
|
|
178
|
+
}
|
|
179
|
+
}
|
|
160
180
|
}, {
|
|
161
181
|
label: 'DID',
|
|
162
182
|
name: 'blockletDid',
|
|
163
183
|
options: {
|
|
164
|
-
customBodyRender:
|
|
184
|
+
customBodyRender: did => {
|
|
165
185
|
return /*#__PURE__*/_jsx(DidAddress, {
|
|
166
186
|
size: 14,
|
|
167
|
-
|
|
168
|
-
|
|
187
|
+
compact: true,
|
|
188
|
+
responsive: false,
|
|
189
|
+
did: did
|
|
169
190
|
});
|
|
170
191
|
}
|
|
171
192
|
}
|
|
172
|
-
}, {
|
|
173
|
-
label: '
|
|
174
|
-
name: '
|
|
193
|
+
}, smallScreen || componentDid ? null : {
|
|
194
|
+
label: t('common.createdBy'),
|
|
195
|
+
name: 'createdBy',
|
|
175
196
|
options: {
|
|
176
|
-
customBodyRender:
|
|
177
|
-
return
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
197
|
+
customBodyRender: did => {
|
|
198
|
+
return /*#__PURE__*/_jsx(DidAddress, {
|
|
199
|
+
onClick: () => {
|
|
200
|
+
navigate(`/.well-known/service/admin/members?did=${did}`);
|
|
201
|
+
},
|
|
202
|
+
style: {
|
|
203
|
+
cursor: 'pointer'
|
|
204
|
+
},
|
|
205
|
+
size: 14,
|
|
206
|
+
compact: true,
|
|
207
|
+
copyable: false,
|
|
208
|
+
showQrcode: false,
|
|
209
|
+
responsive: false,
|
|
210
|
+
did: did
|
|
211
|
+
});
|
|
181
212
|
}
|
|
182
213
|
}
|
|
183
|
-
}, componentDid ? null : {
|
|
214
|
+
}, smallScreen || componentDid ? null : {
|
|
184
215
|
label: t('common.scope'),
|
|
185
216
|
name: 'componentDid',
|
|
186
217
|
options: {
|
|
@@ -209,7 +240,7 @@ export default function ProjectList({
|
|
|
209
240
|
}, value);
|
|
210
241
|
}
|
|
211
242
|
}
|
|
212
|
-
}, tenantScope ? null : {
|
|
243
|
+
}, smallScreen || tenantScope ? null : {
|
|
213
244
|
label: t('blocklet.publish.tenantScope'),
|
|
214
245
|
name: 'tenantScope',
|
|
215
246
|
options: {
|
|
@@ -25,6 +25,7 @@ import { useBlockletContext } from '../../contexts/blocklet';
|
|
|
25
25
|
import { useNodeContext } from '../../contexts/node';
|
|
26
26
|
import EmptySpinner from '../../empty-spinner';
|
|
27
27
|
import Confirm from '../../confirm';
|
|
28
|
+
import BlockletCard from './blocklet-card';
|
|
28
29
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
29
30
|
export default function ReleaseList() {
|
|
30
31
|
const {
|
|
@@ -156,7 +157,7 @@ export default function ReleaseList() {
|
|
|
156
157
|
},
|
|
157
158
|
children: t('blocklet.publish.createReleaseTip')
|
|
158
159
|
}), /*#__PURE__*/_jsx(Link, {
|
|
159
|
-
to: "create",
|
|
160
|
+
to: "create/none",
|
|
160
161
|
children: /*#__PURE__*/_jsx(Button, {
|
|
161
162
|
variant: "contained",
|
|
162
163
|
children: t('blocklet.publish.createRelease')
|
|
@@ -168,12 +169,19 @@ export default function ReleaseList() {
|
|
|
168
169
|
const columns = [{
|
|
169
170
|
label: t('common.version'),
|
|
170
171
|
name: 'blockletVersion',
|
|
172
|
+
minWidth: 160,
|
|
171
173
|
options: {
|
|
172
174
|
customBodyRenderLite: rawIndex => {
|
|
173
175
|
const release = releases[rawIndex];
|
|
174
176
|
return /*#__PURE__*/_jsx(Link, {
|
|
175
177
|
to: `view/${release.id}`,
|
|
176
|
-
children:
|
|
178
|
+
children: /*#__PURE__*/_jsx(BlockletCard, {
|
|
179
|
+
did: blocklet.meta.did,
|
|
180
|
+
projectId: project.id,
|
|
181
|
+
logo: release.blockletLogo,
|
|
182
|
+
title: release.blockletVersion,
|
|
183
|
+
describe: release.blockletTitle
|
|
184
|
+
})
|
|
177
185
|
});
|
|
178
186
|
}
|
|
179
187
|
}
|
|
@@ -334,7 +342,6 @@ export default function ReleaseList() {
|
|
|
334
342
|
})]
|
|
335
343
|
});
|
|
336
344
|
}
|
|
337
|
-
ReleaseList.propTypes = {};
|
|
338
345
|
const Main = styled(Box)`
|
|
339
346
|
.header {
|
|
340
347
|
display: flex;
|
|
@@ -6,11 +6,8 @@ import MenuItem from '@mui/material/MenuItem';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import useSetState from 'react-use/lib/useSetState';
|
|
8
8
|
import Confirm from '../../../confirm';
|
|
9
|
-
import { DomainProvider
|
|
10
|
-
import { useNodeContext } from '../../../contexts/node';
|
|
11
|
-
import { sleep } from '../../../util';
|
|
9
|
+
import { DomainProvider } from '../../../contexts/domain';
|
|
12
10
|
import AddDomain from '../add-domain';
|
|
13
|
-
import { parseDomainFromURL } from '../util';
|
|
14
11
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
12
|
function AddDomainAliasComponent({
|
|
16
13
|
id,
|
|
@@ -24,56 +21,17 @@ function AddDomainAliasComponent({
|
|
|
24
21
|
const {
|
|
25
22
|
t
|
|
26
23
|
} = useLocaleContext();
|
|
27
|
-
const {
|
|
28
|
-
api
|
|
29
|
-
} = useNodeContext();
|
|
30
24
|
const [state, setState] = useSetState({
|
|
31
25
|
loading: false,
|
|
32
26
|
confirmSetting: null
|
|
33
27
|
});
|
|
34
28
|
const cnameDomain = systemDomains.find(item => isDidDomain(item));
|
|
35
|
-
const domainContext = useDomainContext();
|
|
36
29
|
const onCancel = () => {
|
|
37
30
|
setState({
|
|
38
31
|
loading: false,
|
|
39
32
|
confirmSetting: null
|
|
40
33
|
});
|
|
41
34
|
};
|
|
42
|
-
const onConfirm = async params => {
|
|
43
|
-
if (state.loading) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
setState({
|
|
47
|
-
loading: true
|
|
48
|
-
});
|
|
49
|
-
try {
|
|
50
|
-
const domain = parseDomainFromURL(params.domain);
|
|
51
|
-
const validateResult = await domainContext.validateDomain(domain, params.type);
|
|
52
|
-
if (!validateResult) {
|
|
53
|
-
// eslint-disable-next-line consistent-return
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
await api.addDomainAlias({
|
|
57
|
-
input: {
|
|
58
|
-
id,
|
|
59
|
-
domainAlias: domain,
|
|
60
|
-
teamDid
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
await sleep(2000);
|
|
64
|
-
setState({
|
|
65
|
-
confirmSetting: null
|
|
66
|
-
});
|
|
67
|
-
} catch (error) {
|
|
68
|
-
domainContext.setError(error.message);
|
|
69
|
-
// eslint-disable-next-line consistent-return
|
|
70
|
-
return false; // 防止 Dialog 关闭
|
|
71
|
-
} finally {
|
|
72
|
-
setState({
|
|
73
|
-
loading: false
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
35
|
const setting = {
|
|
78
36
|
title: title || t('router.domainAlias.add.title'),
|
|
79
37
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
@@ -108,7 +66,6 @@ function AddDomainAliasComponent({
|
|
|
108
66
|
domain: '',
|
|
109
67
|
__disableConfirm: true
|
|
110
68
|
},
|
|
111
|
-
onConfirm,
|
|
112
69
|
onCancel
|
|
113
70
|
};
|
|
114
71
|
const onMenuItemClick = e => {
|
|
@@ -139,14 +96,13 @@ function AddDomainAliasComponent({
|
|
|
139
96
|
confirm: state.confirmSetting.confirm,
|
|
140
97
|
cancel: state.confirmSetting.cancel,
|
|
141
98
|
params: state.confirmSetting.params,
|
|
142
|
-
onConfirm: state.confirmSetting.onConfirm,
|
|
143
99
|
onCancel: state.confirmSetting.onCancel,
|
|
144
100
|
showConfirm: false,
|
|
145
101
|
showCancel: true,
|
|
146
102
|
displayError: false,
|
|
147
103
|
color: "primary",
|
|
148
104
|
loading: state.loading,
|
|
149
|
-
maxWidth: "
|
|
105
|
+
maxWidth: "sm"
|
|
150
106
|
})]
|
|
151
107
|
});
|
|
152
108
|
}
|