@abtnode/ux 1.8.37 → 1.8.39
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/access/config-access.js +299 -0
- package/lib/blocklet/access/index.js +220 -0
- package/lib/blocklet/avatar.js +9 -9
- package/lib/blocklet/component/environment.js +1 -1
- package/lib/blocklet/configuration.js +5 -87
- package/lib/blocklet/overview.js +21 -12
- package/lib/blocklet/preferences/index.js +73 -8
- package/lib/blocklet/runtime-info.js +1 -0
- package/lib/layout/feedback.js +8 -10
- package/lib/locales/en.js +7 -2
- package/lib/locales/zh.js +7 -2
- package/lib/team/passports/color.js +1 -1
- package/lib/team/passports/detail.js +39 -31
- package/lib/who-can-access/config.js +13 -13
- package/package.json +9 -9
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = ConfigAccess;
|
|
7
|
+
exports.getComponentWhoCanAccess = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _get = _interopRequireDefault(require("lodash/get"));
|
|
10
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
13
|
+
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
14
|
+
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
15
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
16
|
+
var _Edit = _interopRequireDefault(require("@mui/icons-material/Edit"));
|
|
17
|
+
var _useTheme = _interopRequireDefault(require("@mui/material/styles/useTheme"));
|
|
18
|
+
var _Group = _interopRequireDefault(require("@mui/icons-material/Group"));
|
|
19
|
+
var _Chip = _interopRequireDefault(require("@mui/material/Chip"));
|
|
20
|
+
var _ListItemText = _interopRequireDefault(require("@mui/material/ListItemText"));
|
|
21
|
+
var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
|
|
22
|
+
var _constant = require("@blocklet/constant");
|
|
23
|
+
var _constant2 = require("@abtnode/constant");
|
|
24
|
+
var _util = require("@blocklet/meta/lib/util");
|
|
25
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
26
|
+
var _Dialog = _interopRequireDefault(require("@arcblock/ux/lib/Dialog"));
|
|
27
|
+
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
28
|
+
var _Spinner = _interopRequireDefault(require("@arcblock/ux/lib/Spinner"));
|
|
29
|
+
var _node = require("../../contexts/node");
|
|
30
|
+
var _team = require("../../contexts/team");
|
|
31
|
+
var _util2 = require("../../util");
|
|
32
|
+
var _toast = _interopRequireDefault(require("../../toast"));
|
|
33
|
+
var _config = _interopRequireDefault(require("../../who-can-access/config"));
|
|
34
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
35
|
+
var _templateObject, _templateObject2;
|
|
36
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
38
|
+
const CONFIG_ROLE = 'roles';
|
|
39
|
+
const Configs = [..._config.default, {
|
|
40
|
+
value: CONFIG_ROLE,
|
|
41
|
+
icon: _Group.default,
|
|
42
|
+
title: {
|
|
43
|
+
zh: '指定通行证可访问',
|
|
44
|
+
en: 'Accessible to passports'
|
|
45
|
+
},
|
|
46
|
+
description: {
|
|
47
|
+
zh: '只有指定的通行证可以访问',
|
|
48
|
+
en: 'Only specified passports can access'
|
|
49
|
+
}
|
|
50
|
+
}];
|
|
51
|
+
const getAccess = (whoCanAccess, roleStore) => {
|
|
52
|
+
if (whoCanAccess && whoCanAccess.startsWith(_constant2.WHO_CAN_ACCESS_PREFIX_ROLES)) {
|
|
53
|
+
const roleNames = (0, _util.getRolesFromAuthConfig)({
|
|
54
|
+
whoCanAccess
|
|
55
|
+
});
|
|
56
|
+
const filterRoles = roleStore.filter(x => roleNames.includes(x.name));
|
|
57
|
+
return {
|
|
58
|
+
access: CONFIG_ROLE,
|
|
59
|
+
roles: filterRoles
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
access: whoCanAccess,
|
|
64
|
+
roles: []
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const getComponentWhoCanAccess = function getComponentWhoCanAccess(component, app) {
|
|
68
|
+
let {
|
|
69
|
+
roles = []
|
|
70
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
71
|
+
const access = (component.configs || []).find(x => x.key === _constant.BLOCKLET_CONFIGURABLE_KEY.COMPONENT_ACCESS_WHO);
|
|
72
|
+
if (access) {
|
|
73
|
+
return getAccess(access.value, roles);
|
|
74
|
+
}
|
|
75
|
+
if (app && (0, _get.default)(app, 'settings.whoCanAccess') && (0, _get.default)(app, 'settings.whoCanAccess') !== _constant2.WHO_CAN_ACCESS.ALL) {
|
|
76
|
+
return getAccess((0, _get.default)(app, 'settings.whoCanAccess'), roles);
|
|
77
|
+
}
|
|
78
|
+
const service = (0, _util.findServiceFromMeta)(component.meta, _constant2.NODE_SERVICES.AUTH);
|
|
79
|
+
if ((0, _get.default)(service, 'config.whoCanAccess')) {
|
|
80
|
+
return getAccess(service.config.whoCanAccess, roles);
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
access: _constant2.WHO_CAN_ACCESS.ALL,
|
|
84
|
+
roles: []
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
exports.getComponentWhoCanAccess = getComponentWhoCanAccess;
|
|
88
|
+
function ConfigAccess(_ref) {
|
|
89
|
+
let {
|
|
90
|
+
blocklet,
|
|
91
|
+
ancestors,
|
|
92
|
+
children
|
|
93
|
+
} = _ref;
|
|
94
|
+
const theme = (0, _useTheme.default)();
|
|
95
|
+
const [showDialog, setShowDialog] = (0, _react.useState)('');
|
|
96
|
+
const {
|
|
97
|
+
t,
|
|
98
|
+
locale
|
|
99
|
+
} = (0, _context.useLocaleContext)();
|
|
100
|
+
const {
|
|
101
|
+
api
|
|
102
|
+
} = (0, _node.useNodeContext)();
|
|
103
|
+
const {
|
|
104
|
+
roles: roleList
|
|
105
|
+
} = (0, _team.useTeamContext)();
|
|
106
|
+
const [loading, setLoading] = (0, _react.useState)('');
|
|
107
|
+
const root = ancestors[0] || blocklet;
|
|
108
|
+
const {
|
|
109
|
+
access: defaultValue,
|
|
110
|
+
roles: defaultRoles
|
|
111
|
+
} = getComponentWhoCanAccess(blocklet, root, {
|
|
112
|
+
roles: roleList
|
|
113
|
+
});
|
|
114
|
+
const [whoCanAccess, setWhoCanAccess] = (0, _react.useState)(defaultValue);
|
|
115
|
+
const [roles, setRoles] = (0, _react.useState)(defaultRoles);
|
|
116
|
+
const dids = [...ancestors.map(x => x.meta.did), blocklet.meta.did];
|
|
117
|
+
const iconStyle = {
|
|
118
|
+
marginRight: 4,
|
|
119
|
+
fontSize: 18,
|
|
120
|
+
verticalAlign: 'text-bottom',
|
|
121
|
+
color: theme.palette.text.secondary
|
|
122
|
+
};
|
|
123
|
+
const componentName = ancestors.concat(blocklet).map(x => (0, _util.getDisplayName)(x, true)).join(' / ');
|
|
124
|
+
if ((0, _util2.isInstalling)(blocklet.status)) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
if (blocklet.status === 'unknown' && (0, _util2.isInstalling)(blocklet.status)) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
const onClose = () => {
|
|
131
|
+
setShowDialog(false);
|
|
132
|
+
};
|
|
133
|
+
const onOpen = e => {
|
|
134
|
+
e.stopPropagation();
|
|
135
|
+
// eslint-disable-next-line no-unused-expressions
|
|
136
|
+
setShowDialog(true);
|
|
137
|
+
};
|
|
138
|
+
const onWhoCanAccessChange = e => {
|
|
139
|
+
const {
|
|
140
|
+
value
|
|
141
|
+
} = e.target;
|
|
142
|
+
setWhoCanAccess(value);
|
|
143
|
+
};
|
|
144
|
+
const onRolesChange = e => {
|
|
145
|
+
setRoles(roleList.filter(x => (e.target.value || []).includes(x.name)));
|
|
146
|
+
};
|
|
147
|
+
const onConfirm = async () => {
|
|
148
|
+
if (loading) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
setLoading(true);
|
|
152
|
+
try {
|
|
153
|
+
let value = whoCanAccess;
|
|
154
|
+
if (value === CONFIG_ROLE) {
|
|
155
|
+
value = "".concat(_constant2.WHO_CAN_ACCESS_PREFIX_ROLES).concat(roles.map(x => x.name).join(','));
|
|
156
|
+
}
|
|
157
|
+
await api.updateWhoCanAccess({
|
|
158
|
+
input: {
|
|
159
|
+
did: dids,
|
|
160
|
+
whoCanAccess: value
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
_toast.default.success(t('blocklet.config.access.updatedTip'));
|
|
164
|
+
onClose();
|
|
165
|
+
setLoading(false);
|
|
166
|
+
} catch (err) {
|
|
167
|
+
setLoading(false);
|
|
168
|
+
_toast.default.error((0, _util2.formatError)(err));
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
const disabled = loading || whoCanAccess === CONFIG_ROLE && !roles.length;
|
|
172
|
+
return [typeof children === 'function' ? children({
|
|
173
|
+
open: onOpen
|
|
174
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
175
|
+
onClick: onOpen,
|
|
176
|
+
"data-cy": "action-config-component",
|
|
177
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Edit.default, {})
|
|
178
|
+
}), showDialog && /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledDialog, {
|
|
179
|
+
open: true,
|
|
180
|
+
fullWidth: true,
|
|
181
|
+
title: componentName,
|
|
182
|
+
onClose: onClose,
|
|
183
|
+
PaperProps: {
|
|
184
|
+
style: {
|
|
185
|
+
minHeight: 'auto'
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
actions: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
189
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
190
|
+
onClick: onClose,
|
|
191
|
+
color: "inherit",
|
|
192
|
+
children: t('common.cancel')
|
|
193
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
194
|
+
onClick: onConfirm,
|
|
195
|
+
color: "primary",
|
|
196
|
+
disabled: disabled,
|
|
197
|
+
variant: "contained",
|
|
198
|
+
autoFocus: true,
|
|
199
|
+
children: [loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {
|
|
200
|
+
size: [16, 10]
|
|
201
|
+
}), t('common.confirm')]
|
|
202
|
+
})]
|
|
203
|
+
}),
|
|
204
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
205
|
+
mt: 4,
|
|
206
|
+
mb: 3,
|
|
207
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
208
|
+
label: t('blocklet.config.access.description'),
|
|
209
|
+
select: true,
|
|
210
|
+
fullWidth: true,
|
|
211
|
+
value: whoCanAccess,
|
|
212
|
+
onChange: onWhoCanAccessChange,
|
|
213
|
+
SelectProps: {
|
|
214
|
+
renderValue: selected => {
|
|
215
|
+
const d = Configs.find(x => x.value === selected);
|
|
216
|
+
return d ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
217
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(d.icon, {
|
|
218
|
+
style: iconStyle
|
|
219
|
+
}), d.title[locale]]
|
|
220
|
+
}) : null;
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
children: Configs.map(d => {
|
|
224
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledMenuItem, {
|
|
225
|
+
value: d.value,
|
|
226
|
+
sx: {
|
|
227
|
+
display: 'block'
|
|
228
|
+
},
|
|
229
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
230
|
+
display: "flex",
|
|
231
|
+
alignItems: "center",
|
|
232
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(d.icon, {
|
|
233
|
+
style: iconStyle
|
|
234
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
235
|
+
children: d.title[locale]
|
|
236
|
+
})]
|
|
237
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
238
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
239
|
+
className: "tip",
|
|
240
|
+
children: d.description[locale]
|
|
241
|
+
})
|
|
242
|
+
})]
|
|
243
|
+
});
|
|
244
|
+
})
|
|
245
|
+
})
|
|
246
|
+
}), whoCanAccess === CONFIG_ROLE && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
247
|
+
mt: 4,
|
|
248
|
+
mb: 3,
|
|
249
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
250
|
+
label: t('blocklet.config.access.description'),
|
|
251
|
+
select: true,
|
|
252
|
+
fullWidth: true,
|
|
253
|
+
value: roles.map(x => x.name),
|
|
254
|
+
onChange: onRolesChange,
|
|
255
|
+
SelectProps: {
|
|
256
|
+
multiple: true,
|
|
257
|
+
renderValue: selected => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
258
|
+
sx: {
|
|
259
|
+
display: 'flex',
|
|
260
|
+
flexWrap: 'wrap',
|
|
261
|
+
gap: 0.5
|
|
262
|
+
},
|
|
263
|
+
children: selected.map(value => {
|
|
264
|
+
const role = roleList.find(x => x.name === value);
|
|
265
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, {
|
|
266
|
+
label: role.title
|
|
267
|
+
}, role.text);
|
|
268
|
+
})
|
|
269
|
+
})
|
|
270
|
+
},
|
|
271
|
+
children: roleList.map(_ref2 => {
|
|
272
|
+
let {
|
|
273
|
+
name,
|
|
274
|
+
title
|
|
275
|
+
} = _ref2;
|
|
276
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, {
|
|
277
|
+
value: name,
|
|
278
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.default, {
|
|
279
|
+
checked: roles.some(x => x.name === name)
|
|
280
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
|
|
281
|
+
primary: title
|
|
282
|
+
})]
|
|
283
|
+
}, name);
|
|
284
|
+
})
|
|
285
|
+
})
|
|
286
|
+
})]
|
|
287
|
+
})];
|
|
288
|
+
}
|
|
289
|
+
ConfigAccess.propTypes = {
|
|
290
|
+
blocklet: _propTypes.default.object.isRequired,
|
|
291
|
+
ancestors: _propTypes.default.array,
|
|
292
|
+
children: _propTypes.default.any
|
|
293
|
+
};
|
|
294
|
+
ConfigAccess.defaultProps = {
|
|
295
|
+
ancestors: [],
|
|
296
|
+
children: null
|
|
297
|
+
};
|
|
298
|
+
const StyledDialog = (0, _styled.default)(_Dialog.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .MuiDialogContent-root {\n padding-top: 0;\n margin-top: -32px;\n }\n .MuiToolbar-root {\n padding-right: 12px;\n }\n .ux-dialog_right {\n padding-right: 20px;\n }\n"])));
|
|
299
|
+
const StyledMenuItem = (0, _styled.default)(_MenuItem.default)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .tip {\n font-size: 12px;\n color: ", ";\n }\n"])), props => props.theme.palette.text.secondary);
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = BlockletAccess;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _useTheme = _interopRequireDefault(require("@mui/material/styles/useTheme"));
|
|
11
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
12
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
13
|
+
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
14
|
+
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
15
|
+
var _ChevronRight = _interopRequireDefault(require("@mui/icons-material/ChevronRight"));
|
|
16
|
+
var _Collapse = _interopRequireDefault(require("@mui/material/Collapse"));
|
|
17
|
+
var _Launch = _interopRequireDefault(require("@mui/icons-material/Launch"));
|
|
18
|
+
var _EditIcon = _interopRequireDefault(require("@arcblock/icons/lib/EditIcon"));
|
|
19
|
+
var _util = require("@blocklet/meta/lib/util");
|
|
20
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
21
|
+
var _Empty = _interopRequireDefault(require("@arcblock/ux/lib/Empty"));
|
|
22
|
+
var _blocklet = require("../../contexts/blocklet");
|
|
23
|
+
var _team = require("../../contexts/team");
|
|
24
|
+
var _util2 = require("../../util");
|
|
25
|
+
var _line = _interopRequireDefault(require("../component/line"));
|
|
26
|
+
var _avatar = _interopRequireDefault(require("../avatar"));
|
|
27
|
+
var _configAccess = _interopRequireWildcard(require("./config-access"));
|
|
28
|
+
var _config = _interopRequireDefault(require("../../who-can-access/config"));
|
|
29
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
30
|
+
var _templateObject;
|
|
31
|
+
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); }
|
|
32
|
+
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; }
|
|
33
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
34
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
35
|
+
function ComponentItem(_ref) {
|
|
36
|
+
var _blocklet$children;
|
|
37
|
+
let {
|
|
38
|
+
blocklet,
|
|
39
|
+
ancestors,
|
|
40
|
+
depth
|
|
41
|
+
} = _ref;
|
|
42
|
+
const theme = (0, _useTheme.default)();
|
|
43
|
+
const {
|
|
44
|
+
t,
|
|
45
|
+
locale
|
|
46
|
+
} = (0, _context.useLocaleContext)();
|
|
47
|
+
const {
|
|
48
|
+
roles: roleList
|
|
49
|
+
} = (0, _team.useTeamContext)();
|
|
50
|
+
const [expand, setExpand] = (0, _react.useState)(true);
|
|
51
|
+
const {
|
|
52
|
+
recommendedDomain: domain
|
|
53
|
+
} = (0, _blocklet.useBlockletContext)();
|
|
54
|
+
const app = ancestors[0] || blocklet;
|
|
55
|
+
const mountPoint = "/".concat(ancestors.map(x => x.mountPoint || '/').join('/'), "/").concat(blocklet.mountPoint || '/').replace(/\/+/g, '/');
|
|
56
|
+
const href = (0, _util2.getBlockletUrl)({
|
|
57
|
+
blocklet: app,
|
|
58
|
+
domain: {
|
|
59
|
+
value: domain
|
|
60
|
+
},
|
|
61
|
+
mountPoint,
|
|
62
|
+
params: (0, _util2.getBlockletUrlParams)(app, locale)
|
|
63
|
+
});
|
|
64
|
+
const iconStyle = {
|
|
65
|
+
fill: theme.palette.text.secondary
|
|
66
|
+
};
|
|
67
|
+
const canExpand = depth > 0 && blocklet.children.length > 0;
|
|
68
|
+
const expandIcon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
69
|
+
size: "small",
|
|
70
|
+
children: expand ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {
|
|
71
|
+
fontSize: "inherit"
|
|
72
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChevronRight.default, {
|
|
73
|
+
fontSize: "inherit"
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
const {
|
|
77
|
+
access: whoCanAccess,
|
|
78
|
+
roles
|
|
79
|
+
} = (0, _configAccess.getComponentWhoCanAccess)(blocklet, app, {
|
|
80
|
+
roles: roleList
|
|
81
|
+
});
|
|
82
|
+
let accessConfig;
|
|
83
|
+
if (whoCanAccess !== 'roles') {
|
|
84
|
+
accessConfig = _config.default.find(x => x.value === whoCanAccess) || _config.default[2];
|
|
85
|
+
} else {
|
|
86
|
+
const str = roles.map(x => x.title).join('/');
|
|
87
|
+
accessConfig = {
|
|
88
|
+
title: {
|
|
89
|
+
zh: "\u53EA\u6709 ".concat(str, " \u53EF\u4EE5\u8BBF\u95EE"),
|
|
90
|
+
en: "Only ".concat(str, " can access")
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return [(depth > 0 || blocklet.meta.group !== 'gateway') && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
95
|
+
display: "flex",
|
|
96
|
+
py: 2,
|
|
97
|
+
className: "component-item",
|
|
98
|
+
justifyContent: "space-between",
|
|
99
|
+
alignItems: "center",
|
|
100
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
101
|
+
pl: Math.max((depth - 1) * 2, 0),
|
|
102
|
+
width: {
|
|
103
|
+
xs: 300,
|
|
104
|
+
md: 400
|
|
105
|
+
},
|
|
106
|
+
display: "flex",
|
|
107
|
+
alignItems: "center",
|
|
108
|
+
style: {
|
|
109
|
+
cursor: canExpand ? 'pointer' : 'cursor'
|
|
110
|
+
},
|
|
111
|
+
onClick: () => canExpand && setExpand(!expand),
|
|
112
|
+
children: [canExpand ? expandIcon : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
113
|
+
width: 28
|
|
114
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_avatar.default, {
|
|
115
|
+
blocklet: blocklet,
|
|
116
|
+
ancestors: ancestors
|
|
117
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
118
|
+
ml: "16px",
|
|
119
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
120
|
+
style: {
|
|
121
|
+
color: '#222',
|
|
122
|
+
fontSize: 18
|
|
123
|
+
},
|
|
124
|
+
children: (0, _util.getDisplayName)(blocklet, true)
|
|
125
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
126
|
+
display: "flex",
|
|
127
|
+
alignItems: "center",
|
|
128
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
129
|
+
color: "text.secondary",
|
|
130
|
+
children: accessConfig.title[locale]
|
|
131
|
+
})
|
|
132
|
+
})]
|
|
133
|
+
})]
|
|
134
|
+
}, blocklet), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
135
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
136
|
+
title: t('common.visit'),
|
|
137
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
138
|
+
target: "_blank",
|
|
139
|
+
href: href,
|
|
140
|
+
rel: "noopener noreferrer",
|
|
141
|
+
title: href,
|
|
142
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
143
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Launch.default, {})
|
|
144
|
+
})
|
|
145
|
+
})
|
|
146
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_configAccess.default, {
|
|
147
|
+
blocklet: blocklet,
|
|
148
|
+
ancestors: ancestors,
|
|
149
|
+
children: _ref2 => {
|
|
150
|
+
let {
|
|
151
|
+
open
|
|
152
|
+
} = _ref2;
|
|
153
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
154
|
+
title: t('common.edit'),
|
|
155
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
156
|
+
onClick: open,
|
|
157
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditIcon.default, {
|
|
158
|
+
style: iconStyle
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
})]
|
|
164
|
+
}, "actions")]
|
|
165
|
+
}, "group-not-gateway-box"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_line.default, {
|
|
166
|
+
depth: depth
|
|
167
|
+
}), (_blocklet$children = blocklet.children) !== null && _blocklet$children !== void 0 && _blocklet$children.length ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Collapse.default, {
|
|
168
|
+
in: expand,
|
|
169
|
+
children: blocklet.children.map(x => /*#__PURE__*/(0, _jsxRuntime.jsx)(ComponentItem, {
|
|
170
|
+
blocklet: x,
|
|
171
|
+
ancestors: [...ancestors, blocklet],
|
|
172
|
+
depth: depth + 1
|
|
173
|
+
}, "".concat(depth + 1, "-").concat(x.meta.did)))
|
|
174
|
+
}, "blocklet-collapse") : null];
|
|
175
|
+
}
|
|
176
|
+
ComponentItem.propTypes = {
|
|
177
|
+
blocklet: _propTypes.default.object.isRequired,
|
|
178
|
+
ancestors: _propTypes.default.array,
|
|
179
|
+
depth: _propTypes.default.number
|
|
180
|
+
};
|
|
181
|
+
ComponentItem.defaultProps = {
|
|
182
|
+
ancestors: [],
|
|
183
|
+
depth: 0
|
|
184
|
+
};
|
|
185
|
+
function BlockletAccess() {
|
|
186
|
+
const {
|
|
187
|
+
t
|
|
188
|
+
} = (0, _context.useLocaleContext)();
|
|
189
|
+
const {
|
|
190
|
+
blocklet
|
|
191
|
+
} = (0, _blocklet.useBlockletContext)();
|
|
192
|
+
const components = [...blocklet.children] || [];
|
|
193
|
+
if (blocklet.meta.group !== 'gateway') {
|
|
194
|
+
// add root blocklet to table list
|
|
195
|
+
components.unshift(blocklet);
|
|
196
|
+
}
|
|
197
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Div, {
|
|
198
|
+
component: "div",
|
|
199
|
+
children: components && components.length ? [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
200
|
+
mt: 2,
|
|
201
|
+
ml: {
|
|
202
|
+
xs: '-12px',
|
|
203
|
+
md: '-24px'
|
|
204
|
+
},
|
|
205
|
+
style: {
|
|
206
|
+
maxWidth: 1080
|
|
207
|
+
},
|
|
208
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ComponentItem, {
|
|
209
|
+
blocklet: blocklet
|
|
210
|
+
}, "0-".concat(blocklet.meta.did))
|
|
211
|
+
}, "top-blocklet-".concat(blocklet.meta.did))] : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
212
|
+
mt: 8,
|
|
213
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Empty.default, {
|
|
214
|
+
children: t('blocklet.component.noComponent')
|
|
215
|
+
})
|
|
216
|
+
})
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
BlockletAccess.propTypes = {};
|
|
220
|
+
const Div = (0, _styled.default)(_Box.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .title {\n font-size: 1.2rem;\n font-weight: bold;\n margin-top: ", ";\n margin-bottom: ", ";\n &.first {\n margin-top: 0;\n }\n }\n"])), props => props.theme.spacing(5), props => props.theme.spacing(3));
|
package/lib/blocklet/avatar.js
CHANGED
|
@@ -32,18 +32,18 @@ function BlockletAvatar(_ref) {
|
|
|
32
32
|
const {
|
|
33
33
|
inService
|
|
34
34
|
} = node;
|
|
35
|
-
|
|
35
|
+
const search = "?version=".concat(blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.version);
|
|
36
|
+
let logoUrl = inService ? (0, _urlJoin.default)(_util.APP_PREFIX, _constant.WELLKNOWN_SERVICE_PATH_PREFIX, '/blocklet/logo', search) : (0, _urlJoin.default)(node.prefix, 'blocklet.png');
|
|
36
37
|
const {
|
|
37
38
|
variant
|
|
38
39
|
} = rest;
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
40
|
+
if (blocklet.source === 'registry' && blocklet.deployedFrom && blocklet.meta.logo) {
|
|
41
|
+
logoUrl = (0, _urlJoin.default)(blocklet.deployedFrom, (0, _util.formatRegistryLogoPath)(blocklet.meta.bundleDid, blocklet.meta.logo), search);
|
|
42
|
+
} else {
|
|
43
|
+
const prefix = window.env.apiPrefix || '/';
|
|
44
|
+
const components = ancestors.concat(blocklet);
|
|
45
|
+
const list = inService ? components.slice(1) : components;
|
|
46
|
+
logoUrl = (0, _urlJoin.default)(prefix, "/blocklet/logo".concat(list.map(x => "/".concat(x.meta.did)).join('')), search);
|
|
47
47
|
}
|
|
48
48
|
const setFallBackUrl = inService ? () => {} : ev => {
|
|
49
49
|
ev.target.src = "".concat(node.prefix, "/blocklet.png");
|
|
@@ -54,7 +54,7 @@ function ComponentEnvironment(_ref) {
|
|
|
54
54
|
_toast.default.error(t('blocklet.config.environment.keyValueRequired'));
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
if (data.key.startsWith('BLOCKLET_')) {
|
|
57
|
+
if (data.key.startsWith('BLOCKLET_') || data.key.startsWith('COMPONENT_')) {
|
|
58
58
|
_toast.default.error(t('blocklet.config.environment.invalidKey'));
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
@@ -28,7 +28,6 @@ var _util = require("@blocklet/meta/lib/util");
|
|
|
28
28
|
var _toast = _interopRequireDefault(require("../toast"));
|
|
29
29
|
var _schemaForm = _interopRequireDefault(require("../schema-form"));
|
|
30
30
|
var _formTextInput = _interopRequireDefault(require("../form/form-text-input"));
|
|
31
|
-
var _config = _interopRequireDefault(require("../who-can-access/config"));
|
|
32
31
|
var _node = require("../contexts/node");
|
|
33
32
|
var _util2 = require("../util");
|
|
34
33
|
var _permission = require("../permission");
|
|
@@ -56,8 +55,7 @@ function BlockletEnvironment(_ref) {
|
|
|
56
55
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
57
56
|
const node = (0, _node.useNodeContext)();
|
|
58
57
|
const {
|
|
59
|
-
t
|
|
60
|
-
locale
|
|
58
|
+
t
|
|
61
59
|
} = (0, _react.useContext)(_context.LocaleContext);
|
|
62
60
|
const [cpuCores, setCpuCores] = (0, _react.useState)('');
|
|
63
61
|
const [loading, setLoading] = (0, _react.useState)('');
|
|
@@ -145,30 +143,6 @@ function BlockletEnvironment(_ref) {
|
|
|
145
143
|
defaultValue[item.key] = value;
|
|
146
144
|
return _objectSpread({}, props);
|
|
147
145
|
});
|
|
148
|
-
const onWhoCanAccessChange = async e => {
|
|
149
|
-
if (loading) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
setLoading(true);
|
|
153
|
-
try {
|
|
154
|
-
const {
|
|
155
|
-
value
|
|
156
|
-
} = e.target;
|
|
157
|
-
const {
|
|
158
|
-
blocklet: data
|
|
159
|
-
} = await node.api.updateWhoCanAccess({
|
|
160
|
-
input: {
|
|
161
|
-
did: blocklet.meta.did,
|
|
162
|
-
whoCanAccess: value
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
onUpdate(data);
|
|
166
|
-
} catch (err) {
|
|
167
|
-
_toast.default.error(err.message);
|
|
168
|
-
} finally {
|
|
169
|
-
setLoading(false);
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
146
|
const onPublicToStoreChange = async e => {
|
|
173
147
|
if (loading) {
|
|
174
148
|
return;
|
|
@@ -193,12 +167,6 @@ function BlockletEnvironment(_ref) {
|
|
|
193
167
|
setLoading(false);
|
|
194
168
|
}
|
|
195
169
|
};
|
|
196
|
-
const iconStyle = {
|
|
197
|
-
marginRight: 4,
|
|
198
|
-
fontSize: 18,
|
|
199
|
-
verticalAlign: 'text-bottom',
|
|
200
|
-
color: theme.palette.text.secondary
|
|
201
|
-
};
|
|
202
170
|
const onSubmitConfig = async value => {
|
|
203
171
|
if (value.key === _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE) {
|
|
204
172
|
const errMessage = (0, _util2.isValidClusterSize)(value);
|
|
@@ -208,8 +176,7 @@ function BlockletEnvironment(_ref) {
|
|
|
208
176
|
}
|
|
209
177
|
}
|
|
210
178
|
const params = [_objectSpread(_objectSpread({}, (0, _omit.default)(editingItem, ['childDid', 'componentType', 'componentProps'])), {}, {
|
|
211
|
-
value
|
|
212
|
-
custom: true
|
|
179
|
+
value
|
|
213
180
|
})];
|
|
214
181
|
try {
|
|
215
182
|
setLoading(true);
|
|
@@ -244,8 +211,7 @@ function BlockletEnvironment(_ref) {
|
|
|
244
211
|
did: blocklet.meta.did,
|
|
245
212
|
configs: [{
|
|
246
213
|
key: _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE,
|
|
247
|
-
value: checked ? 'no' : 'yes'
|
|
248
|
-
custom: true
|
|
214
|
+
value: checked ? 'no' : 'yes'
|
|
249
215
|
}]
|
|
250
216
|
}
|
|
251
217
|
});
|
|
@@ -333,54 +299,7 @@ function BlockletEnvironment(_ref) {
|
|
|
333
299
|
}
|
|
334
300
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
335
301
|
className: "config-form",
|
|
336
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
337
|
-
className: "config-item",
|
|
338
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
339
|
-
className: "config-label",
|
|
340
|
-
children: [t('blocklet.config.access.title'), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
341
|
-
className: "config-desc",
|
|
342
|
-
children: t('blocklet.config.access.description')
|
|
343
|
-
})]
|
|
344
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
345
|
-
disabled: disabled,
|
|
346
|
-
select: true,
|
|
347
|
-
size: "small",
|
|
348
|
-
value: whoCanAccess,
|
|
349
|
-
onChange: onWhoCanAccessChange,
|
|
350
|
-
SelectProps: {
|
|
351
|
-
renderValue: selected => {
|
|
352
|
-
const d = _config.default.find(x => x.value === selected);
|
|
353
|
-
return d ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
354
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(d.icon, {
|
|
355
|
-
style: iconStyle
|
|
356
|
-
}), d.title[locale]]
|
|
357
|
-
}) : null;
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
children: _config.default.map(d => {
|
|
361
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledMenuItem, {
|
|
362
|
-
value: d.value,
|
|
363
|
-
sx: {
|
|
364
|
-
display: 'block'
|
|
365
|
-
},
|
|
366
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
367
|
-
display: "flex",
|
|
368
|
-
alignItems: "center",
|
|
369
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(d.icon, {
|
|
370
|
-
style: iconStyle
|
|
371
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
372
|
-
children: d.title[locale]
|
|
373
|
-
})]
|
|
374
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
375
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
376
|
-
className: "tip",
|
|
377
|
-
children: d.description[locale]
|
|
378
|
-
})
|
|
379
|
-
})]
|
|
380
|
-
});
|
|
381
|
-
})
|
|
382
|
-
})]
|
|
383
|
-
}), whoCanAccess === 'all' && blocklet.source === 'registry' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
302
|
+
children: [whoCanAccess === 'all' && blocklet.source === 'registry' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
384
303
|
className: "config-item",
|
|
385
304
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
386
305
|
className: "config-label",
|
|
@@ -588,7 +507,6 @@ function BlockletEnvironment(_ref) {
|
|
|
588
507
|
key: _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK,
|
|
589
508
|
description: t('blocklet.config.sk'),
|
|
590
509
|
value: blocklet.environments.find(x => x.key === 'BLOCKLET_APP_SK').value,
|
|
591
|
-
custom: true,
|
|
592
510
|
secure: true
|
|
593
511
|
}],
|
|
594
512
|
defaultValue: {
|
|
@@ -631,5 +549,5 @@ BlockletEnvironment.defaultProps = {
|
|
|
631
549
|
onUpdate: () => {},
|
|
632
550
|
hasPermission: false
|
|
633
551
|
};
|
|
634
|
-
const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .config-form {\n flex-grow: 1;\n overflow-y: auto;\n ", " {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n max-height: 60vh;\n }\n }\n\n .config-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 16px 0;\n }\n\n .config-label {\n font-weight: bold;\n }\n\n .config-desc {\n font-weight: normal;\n font-size: 12px;\n color: #666;\n }\n\n .form-item {\n margin-top: 0;\n }\n"])), props => props.theme.breakpoints.down('md'));
|
|
552
|
+
const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-top: 24px;\n .config-form {\n flex-grow: 1;\n overflow-y: auto;\n ", " {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n max-height: 60vh;\n }\n }\n\n .config-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 16px 0;\n }\n\n .config-label {\n font-weight: bold;\n }\n\n .config-desc {\n font-weight: normal;\n font-size: 12px;\n color: #666;\n }\n\n .form-item {\n margin-top: 0;\n }\n"])), props => props.theme.breakpoints.down('md'));
|
|
635
553
|
const StyledMenuItem = (0, _styled.default)(_MenuItem.default)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .tip {\n font-size: 12px;\n color: ", ";\n }\n"])), props => props.theme.palette.text.secondary);
|
package/lib/blocklet/overview.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = BlockletOverview;
|
|
7
|
-
var _react = require("react");
|
|
8
7
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
9
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
@@ -18,6 +17,7 @@ var _util = require("@blocklet/meta/lib/util");
|
|
|
18
17
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
19
18
|
var _Empty = _interopRequireDefault(require("@arcblock/ux/lib/Empty"));
|
|
20
19
|
var _blocklet = require("../contexts/blocklet");
|
|
20
|
+
var _node = require("../contexts/node");
|
|
21
21
|
var _util2 = require("../util");
|
|
22
22
|
var _didAddress = _interopRequireDefault(require("../did-address"));
|
|
23
23
|
var _blockletSource = _interopRequireDefault(require("./blocklet-source"));
|
|
@@ -44,7 +44,7 @@ function DomainLink(_ref) {
|
|
|
44
44
|
} = _ref;
|
|
45
45
|
const {
|
|
46
46
|
t
|
|
47
|
-
} = (0,
|
|
47
|
+
} = (0, _context.useLocaleContext)();
|
|
48
48
|
const {
|
|
49
49
|
href,
|
|
50
50
|
accessibility
|
|
@@ -113,7 +113,11 @@ function BlockletOverview(_ref2) {
|
|
|
113
113
|
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
114
114
|
const {
|
|
115
115
|
t
|
|
116
|
-
} = (0,
|
|
116
|
+
} = (0, _context.useLocaleContext)();
|
|
117
|
+
const {
|
|
118
|
+
info: nodeInfo,
|
|
119
|
+
inService
|
|
120
|
+
} = (0, _node.useNodeContext)();
|
|
117
121
|
const {
|
|
118
122
|
loadingRuntimeInfo
|
|
119
123
|
} = (0, _blocklet.useBlockletContext)();
|
|
@@ -183,21 +187,26 @@ function BlockletOverview(_ref2) {
|
|
|
183
187
|
did: blocklet.settings.owner.did
|
|
184
188
|
}) : '--'
|
|
185
189
|
}].filter(Boolean);
|
|
190
|
+
if (inService) {
|
|
191
|
+
infoRows.push({
|
|
192
|
+
name: t('common.serverDid'),
|
|
193
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_didAddress.default, {
|
|
194
|
+
did: nodeInfo.did
|
|
195
|
+
})
|
|
196
|
+
}, {
|
|
197
|
+
name: t('common.serverVersion'),
|
|
198
|
+
value: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tag.default, {
|
|
199
|
+
children: nodeInfo.version
|
|
200
|
+
})
|
|
201
|
+
});
|
|
202
|
+
}
|
|
186
203
|
const engineRows = getEngineRows(blocklet.engine, t);
|
|
187
204
|
const renderRows = rows => rows.map(row => {
|
|
188
|
-
if (row.name === t('common.did') || row.name === t('blocklet.appId')) {
|
|
189
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InfoRow.default, {
|
|
190
|
-
valueComponent: "div",
|
|
191
|
-
nameWidth: 120,
|
|
192
|
-
name: row.name,
|
|
193
|
-
nameFormatter: () => row.name,
|
|
194
|
-
children: row.value
|
|
195
|
-
}, row.name);
|
|
196
|
-
}
|
|
197
205
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InfoRow.default, {
|
|
198
206
|
valueComponent: "div",
|
|
199
207
|
nameWidth: 120,
|
|
200
208
|
name: row.name,
|
|
209
|
+
nameFormatter: () => row.name,
|
|
201
210
|
children: row.value
|
|
202
211
|
}, row.name);
|
|
203
212
|
});
|
|
@@ -12,11 +12,16 @@ var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
|
12
12
|
var _constant = require("@abtnode/constant");
|
|
13
13
|
var _material = require("@mui/material");
|
|
14
14
|
var _TuneRounded = _interopRequireDefault(require("@mui/icons-material/TuneRounded"));
|
|
15
|
+
var _Key = _interopRequireDefault(require("@mui/icons-material/Key"));
|
|
16
|
+
var _SettingsOutlined = _interopRequireDefault(require("@mui/icons-material/SettingsOutlined"));
|
|
17
|
+
var _ChevronRight = _interopRequireDefault(require("@mui/icons-material/ChevronRight"));
|
|
18
|
+
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
15
19
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
16
20
|
var _Tabs = _interopRequireDefault(require("@arcblock/ux/lib/Tabs"));
|
|
17
21
|
var _util = require("@blocklet/meta/lib/util");
|
|
18
22
|
var _avatar = _interopRequireDefault(require("../avatar"));
|
|
19
23
|
var _configuration = _interopRequireDefault(require("../configuration"));
|
|
24
|
+
var _index = _interopRequireDefault(require("../access/index"));
|
|
20
25
|
var _node = require("../../contexts/node");
|
|
21
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
27
|
var _templateObject;
|
|
@@ -36,7 +41,7 @@ const addComponentTabs = function addComponentTabs(tabs, blocklet) {
|
|
|
36
41
|
const key = [...ancestors.map(x => x.meta.did), blocklet.meta.did].join('/');
|
|
37
42
|
tabs.push({
|
|
38
43
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
39
|
-
pl: (depth - 1) * 2,
|
|
44
|
+
pl: Math.max(1, depth - 1) * 2,
|
|
40
45
|
display: "flex",
|
|
41
46
|
alignItems: "center",
|
|
42
47
|
justifyContent: "flex-start",
|
|
@@ -76,6 +81,7 @@ function BlockletPreferences(_ref) {
|
|
|
76
81
|
inService
|
|
77
82
|
} = (0, _node.useNodeContext)();
|
|
78
83
|
const [current, setCurrent] = (0, _react.useState)('general');
|
|
84
|
+
const [expandPref, setExpandPref] = (0, _react.useState)(true);
|
|
79
85
|
const tabs = [{
|
|
80
86
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
81
87
|
display: "flex",
|
|
@@ -95,14 +101,73 @@ function BlockletPreferences(_ref) {
|
|
|
95
101
|
})]
|
|
96
102
|
}, "general"),
|
|
97
103
|
value: 'general'
|
|
104
|
+
}, {
|
|
105
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
106
|
+
display: "flex",
|
|
107
|
+
alignItems: "center",
|
|
108
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Key.default, {
|
|
109
|
+
sx: {
|
|
110
|
+
fontSize: 24
|
|
111
|
+
}
|
|
112
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
113
|
+
ml: "16px",
|
|
114
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
115
|
+
style: {
|
|
116
|
+
color: '#222'
|
|
117
|
+
},
|
|
118
|
+
children: t('common.access')
|
|
119
|
+
})
|
|
120
|
+
})]
|
|
121
|
+
}, "access"),
|
|
122
|
+
value: 'access'
|
|
123
|
+
}, {
|
|
124
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
125
|
+
display: "flex",
|
|
126
|
+
alignItems: "center",
|
|
127
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
128
|
+
ml: -2,
|
|
129
|
+
style: {
|
|
130
|
+
transform: 'translateY(2px)'
|
|
131
|
+
},
|
|
132
|
+
children: expandPref ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {
|
|
133
|
+
fontSize: "inherit"
|
|
134
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChevronRight.default, {
|
|
135
|
+
fontSize: "inherit"
|
|
136
|
+
})
|
|
137
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SettingsOutlined.default, {
|
|
138
|
+
sx: {
|
|
139
|
+
fontSize: 24
|
|
140
|
+
}
|
|
141
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
142
|
+
ml: "16px",
|
|
143
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
144
|
+
style: {
|
|
145
|
+
color: '#222'
|
|
146
|
+
},
|
|
147
|
+
children: t('common.preferences')
|
|
148
|
+
})
|
|
149
|
+
})]
|
|
150
|
+
}, "preference"),
|
|
151
|
+
value: 'preference'
|
|
98
152
|
}];
|
|
99
|
-
|
|
153
|
+
if (expandPref) {
|
|
154
|
+
addComponentTabs(tabs, blocklet);
|
|
155
|
+
}
|
|
156
|
+
const onTabChange = x => {
|
|
157
|
+
if (x === 'preference') {
|
|
158
|
+
setExpandPref(!expandPref);
|
|
159
|
+
} else {
|
|
160
|
+
setCurrent(x);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
100
163
|
let content = null;
|
|
101
164
|
if (current === 'general') {
|
|
102
165
|
content = /*#__PURE__*/(0, _jsxRuntime.jsx)(_configuration.default, {
|
|
103
166
|
blocklet: blocklet,
|
|
104
167
|
onUpdate: onUpdate
|
|
105
168
|
});
|
|
169
|
+
} else if (current === 'access') {
|
|
170
|
+
content = /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.default, {});
|
|
106
171
|
} else {
|
|
107
172
|
// eslint-disable-next-line no-nested-ternary
|
|
108
173
|
const pathPrefix = inService ? _constant.WELLKNOWN_SERVICE_PATH_PREFIX : process.env.NODE_ENV === 'production' ? info.routing.adminPath : '';
|
|
@@ -125,16 +190,16 @@ function BlockletPreferences(_ref) {
|
|
|
125
190
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Grid, {
|
|
126
191
|
container: true,
|
|
127
192
|
spacing: 4,
|
|
128
|
-
columns:
|
|
193
|
+
columns: 24,
|
|
129
194
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
130
195
|
item: true,
|
|
131
|
-
sm:
|
|
132
|
-
md:
|
|
196
|
+
sm: 7,
|
|
197
|
+
md: 5,
|
|
133
198
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tabs.default, {
|
|
134
199
|
tabs: tabs,
|
|
135
200
|
current: current,
|
|
136
201
|
orientation: "vertical",
|
|
137
|
-
onChange:
|
|
202
|
+
onChange: onTabChange,
|
|
138
203
|
sx: {
|
|
139
204
|
borderRight: 1,
|
|
140
205
|
height: '100%',
|
|
@@ -143,8 +208,8 @@ function BlockletPreferences(_ref) {
|
|
|
143
208
|
})
|
|
144
209
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Grid, {
|
|
145
210
|
item: true,
|
|
146
|
-
sm:
|
|
147
|
-
md:
|
|
211
|
+
sm: 17,
|
|
212
|
+
md: 19,
|
|
148
213
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
149
214
|
style: {
|
|
150
215
|
minHeight: '66vh',
|
package/lib/layout/feedback.js
CHANGED
|
@@ -14,16 +14,15 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
14
14
|
|
|
15
15
|
function Feedback(_ref) {
|
|
16
16
|
let {
|
|
17
|
-
|
|
18
|
-
version,
|
|
19
|
-
bundleName
|
|
17
|
+
infos
|
|
20
18
|
} = _ref;
|
|
21
19
|
const {
|
|
22
20
|
t
|
|
23
21
|
} = (0, _context.useLocaleContext)();
|
|
22
|
+
const infoStr = infos.map(x => "* ".concat(x.label, ": ").concat(x.value)).join('\n');
|
|
24
23
|
const feedbackUrl = new URL('https://github.com/blocklet/blocklet-site/issues/new');
|
|
25
24
|
feedbackUrl.searchParams.set('title', '[Feedback]');
|
|
26
|
-
feedbackUrl.searchParams.set('body', "
|
|
25
|
+
feedbackUrl.searchParams.set('body', "<!-- [Enter feedback here] -->\n\n\n\n<!--\nDocument Details\n".concat(infoStr, "\n* Page: ").concat(window.location.href, "\n-->\n"));
|
|
27
26
|
return (0, _jsxRuntime.jsx)(_material.Box, {
|
|
28
27
|
sx: {
|
|
29
28
|
mx: {
|
|
@@ -46,12 +45,11 @@ function Feedback(_ref) {
|
|
|
46
45
|
});
|
|
47
46
|
}
|
|
48
47
|
Feedback.propTypes = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
infos: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
49
|
+
label: _propTypes.default.string,
|
|
50
|
+
value: _propTypes.default.string
|
|
51
|
+
}))
|
|
52
52
|
};
|
|
53
53
|
Feedback.defaultProps = {
|
|
54
|
-
|
|
55
|
-
version: '',
|
|
56
|
-
bundleName: ''
|
|
54
|
+
infos: []
|
|
57
55
|
};
|
package/lib/locales/en.js
CHANGED
|
@@ -60,6 +60,7 @@ module.exports = {
|
|
|
60
60
|
},
|
|
61
61
|
common: {
|
|
62
62
|
about: 'About',
|
|
63
|
+
access: 'Access',
|
|
63
64
|
general: 'General',
|
|
64
65
|
preferences: 'Preferences',
|
|
65
66
|
auditLogs: 'Audit Trail',
|
|
@@ -228,6 +229,8 @@ module.exports = {
|
|
|
228
229
|
scheduleSuccess: 'successfully scheduled',
|
|
229
230
|
search: 'Search',
|
|
230
231
|
security: 'Security',
|
|
232
|
+
serverDid: 'Server DID',
|
|
233
|
+
serverVersion: 'Server Version',
|
|
231
234
|
setting: 'Settings',
|
|
232
235
|
start: 'Start',
|
|
233
236
|
status: 'Status',
|
|
@@ -366,7 +369,8 @@ module.exports = {
|
|
|
366
369
|
}
|
|
367
370
|
},
|
|
368
371
|
publicToStore: 'Public On Store',
|
|
369
|
-
publicInstanceTip: 'The access address of this blocklet will be displayed in the Store (along with your DID for accepting donations)'
|
|
372
|
+
publicInstanceTip: 'The access address of this blocklet will be displayed in the Store (along with your DID for accepting donations)',
|
|
373
|
+
updatedTip: 'Access Control Modified'
|
|
370
374
|
},
|
|
371
375
|
disabledText: 'Please edit environment variables in ".env" file or "blocklet.yml" file',
|
|
372
376
|
changedTip: 'Configuration updated, please restart Blocklet',
|
|
@@ -376,7 +380,7 @@ module.exports = {
|
|
|
376
380
|
key: 'Configuration key',
|
|
377
381
|
value: 'Configuration value',
|
|
378
382
|
keyValueRequired: 'Configuration key and value must be specified',
|
|
379
|
-
invalidKey: 'Configuration key must not start with BLOCKLET_',
|
|
383
|
+
invalidKey: 'Configuration key must not start with BLOCKLET_ or COMPONENT_',
|
|
380
384
|
deleteForbidden: 'This configuration is required and should not be deleted',
|
|
381
385
|
tip: 'Configurations prefixed with BWA_ should not contain sensitive information because they will be sent to the browser'
|
|
382
386
|
}
|
|
@@ -1033,6 +1037,7 @@ module.exports = {
|
|
|
1033
1037
|
dialog: {
|
|
1034
1038
|
title: 'Authorization Required',
|
|
1035
1039
|
freeDescription: 'You need to present Blocklet Server Ownership NFT or Blocklet Server Passport to launch application',
|
|
1040
|
+
freeServerlessDescription: 'Please provide serverless NFT',
|
|
1036
1041
|
nonFreeDescription: 'You need to present application purchase NFT and Blocklet Server NFT to launch application',
|
|
1037
1042
|
confirm: 'Confirm on your DID Wallet',
|
|
1038
1043
|
success: 'Authorization Successfully',
|
package/lib/locales/zh.js
CHANGED
|
@@ -64,6 +64,7 @@ module.exports = {
|
|
|
64
64
|
},
|
|
65
65
|
common: {
|
|
66
66
|
about: '关于',
|
|
67
|
+
access: '访问',
|
|
67
68
|
general: '通用',
|
|
68
69
|
preferences: '偏好',
|
|
69
70
|
auditLogs: '审计记录',
|
|
@@ -234,6 +235,8 @@ module.exports = {
|
|
|
234
235
|
scheduleSuccess: '成功加入任务队列',
|
|
235
236
|
search: '搜索',
|
|
236
237
|
security: '安全',
|
|
238
|
+
serverDid: '服务器 DID',
|
|
239
|
+
serverVersion: '服务器版本',
|
|
237
240
|
setting: '设置',
|
|
238
241
|
start: '启动',
|
|
239
242
|
status: '状态',
|
|
@@ -372,7 +375,8 @@ module.exports = {
|
|
|
372
375
|
}
|
|
373
376
|
},
|
|
374
377
|
publicToStore: '在 Store 公开',
|
|
375
|
-
publicInstanceTip: '此应用的访问地址将展示在 Store 中(同时也会展示你的 DID,用于接受捐赠)'
|
|
378
|
+
publicInstanceTip: '此应用的访问地址将展示在 Store 中(同时也会展示你的 DID,用于接受捐赠)',
|
|
379
|
+
updatedTip: '访问控制已修改'
|
|
376
380
|
},
|
|
377
381
|
disabledText: '请在 ".env" 文件或 "blocklet.yml" 文件中编辑环境变量',
|
|
378
382
|
changedTip: '配置已更新,请重启 Blocklet',
|
|
@@ -382,7 +386,7 @@ module.exports = {
|
|
|
382
386
|
key: '配置键',
|
|
383
387
|
value: '配置值',
|
|
384
388
|
keyValueRequired: '键和值不能为空',
|
|
385
|
-
invalidKey: '键不能以 BLOCKLET_ 开头',
|
|
389
|
+
invalidKey: '键不能以 BLOCKLET_ 或 COMPONENT_ 开头',
|
|
386
390
|
deleteForbidden: '该配置项是必填项,不能删除',
|
|
387
391
|
tip: '包含 BWA_ 前缀的配置项不应该包含敏感信息,因为他们会被发送到前端页面'
|
|
388
392
|
}
|
|
@@ -1039,6 +1043,7 @@ module.exports = {
|
|
|
1039
1043
|
dialog: {
|
|
1040
1044
|
title: '需要您的授权',
|
|
1041
1045
|
freeDescription: '你需要提供节点所有权 NFT 或节点通行证凭据来启动应用',
|
|
1046
|
+
freeServerlessDescription: '请提供无服务 NFT',
|
|
1042
1047
|
nonFreeDescription: '你需要提供应用购买凭证和节点通行证来启动应用',
|
|
1043
1048
|
confirm: '在您的 DID 钱包上确认',
|
|
1044
1049
|
success: '授权成功',
|
|
@@ -81,7 +81,7 @@ function PassportColor(_ref) {
|
|
|
81
81
|
disabled: loading,
|
|
82
82
|
variant: "contained",
|
|
83
83
|
autoFocus: true,
|
|
84
|
-
"data-cy": "
|
|
84
|
+
"data-cy": "color-btn-confirm",
|
|
85
85
|
children: [loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.default, {
|
|
86
86
|
size: [16, 10]
|
|
87
87
|
}), t('common.save')]
|
|
@@ -117,6 +117,39 @@ function PassportDetail(_ref) {
|
|
|
117
117
|
}, [teamDid, roleName]); // eslint-disable-line
|
|
118
118
|
|
|
119
119
|
const readPermissionsOnly = isNodeTeam || !hasPermission;
|
|
120
|
+
let bindPermission = null;
|
|
121
|
+
if (isNodeTeam) {
|
|
122
|
+
bindPermission = /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
123
|
+
className: "bind",
|
|
124
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
125
|
+
className: "title",
|
|
126
|
+
children: t('common.permission')
|
|
127
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
128
|
+
className: "list",
|
|
129
|
+
children: binds
|
|
130
|
+
// if readonly, show obtained permissions only
|
|
131
|
+
.filter(x => readPermissionsOnly ? x.bind : true).map(x => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
132
|
+
className: "item",
|
|
133
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControlLabel.default, {
|
|
134
|
+
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.default, {
|
|
135
|
+
disabled: readPermissionsOnly,
|
|
136
|
+
checked: x.bind,
|
|
137
|
+
onChange: () => {
|
|
138
|
+
setBinds(state => state.map(y => {
|
|
139
|
+
if (y.name === x.name) {
|
|
140
|
+
y.bind = !y.bind;
|
|
141
|
+
}
|
|
142
|
+
return y;
|
|
143
|
+
}));
|
|
144
|
+
},
|
|
145
|
+
name: x.name
|
|
146
|
+
}),
|
|
147
|
+
label: x.description
|
|
148
|
+
})
|
|
149
|
+
}))
|
|
150
|
+
})]
|
|
151
|
+
});
|
|
152
|
+
}
|
|
120
153
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Dialog.default, {
|
|
121
154
|
title: t('common.passport'),
|
|
122
155
|
onClose: onCancel,
|
|
@@ -149,11 +182,12 @@ function PassportDetail(_ref) {
|
|
|
149
182
|
"data-cy": "delete-passport-".concat(role.name),
|
|
150
183
|
size: "large",
|
|
151
184
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DeleteIcon.default, {
|
|
185
|
+
"data-cy": "close-passport-dialog",
|
|
152
186
|
fill: "#bfbfbf"
|
|
153
187
|
})
|
|
154
188
|
})]
|
|
155
189
|
}),
|
|
156
|
-
actions: !readPermissionsOnly && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
190
|
+
actions: isNodeTeam && !readPermissionsOnly && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
157
191
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
158
192
|
onClick: onCancel,
|
|
159
193
|
color: "inherit",
|
|
@@ -182,38 +216,12 @@ function PassportDetail(_ref) {
|
|
|
182
216
|
children: role.title
|
|
183
217
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
184
218
|
className: "description",
|
|
219
|
+
style: {
|
|
220
|
+
marginTop: isNodeTeam ? 16 : 48
|
|
221
|
+
},
|
|
185
222
|
children: role.description
|
|
186
223
|
})]
|
|
187
|
-
}),
|
|
188
|
-
className: "bind",
|
|
189
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
190
|
-
className: "title",
|
|
191
|
-
children: t('common.permission')
|
|
192
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
193
|
-
className: "list",
|
|
194
|
-
children: binds
|
|
195
|
-
// if readonly, show obtained permissions only
|
|
196
|
-
.filter(x => readPermissionsOnly ? x.bind : true).map(x => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
197
|
-
className: "item",
|
|
198
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControlLabel.default, {
|
|
199
|
-
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.default, {
|
|
200
|
-
disabled: readPermissionsOnly,
|
|
201
|
-
checked: x.bind,
|
|
202
|
-
onChange: () => {
|
|
203
|
-
setBinds(state => state.map(y => {
|
|
204
|
-
if (y.name === x.name) {
|
|
205
|
-
y.bind = !y.bind;
|
|
206
|
-
}
|
|
207
|
-
return y;
|
|
208
|
-
}));
|
|
209
|
-
},
|
|
210
|
-
name: x.name
|
|
211
|
-
}),
|
|
212
|
-
label: x.description
|
|
213
|
-
})
|
|
214
|
-
}))
|
|
215
|
-
})]
|
|
216
|
-
})]
|
|
224
|
+
}), bindPermission]
|
|
217
225
|
})]
|
|
218
226
|
}), updateForm && /*#__PURE__*/(0, _jsxRuntime.jsx)(_mutateRole.default, {
|
|
219
227
|
teamDid: teamDid,
|
|
@@ -6,19 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _Lock = _interopRequireDefault(require("@mui/icons-material/Lock"));
|
|
8
8
|
var _ContactMail = _interopRequireDefault(require("@mui/icons-material/ContactMail"));
|
|
9
|
-
var
|
|
9
|
+
var _Public = _interopRequireDefault(require("@mui/icons-material/Public"));
|
|
10
10
|
var _constant = require("@abtnode/constant");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
var _default = [{
|
|
13
|
-
value: _constant.WHO_CAN_ACCESS.
|
|
14
|
-
icon:
|
|
13
|
+
value: _constant.WHO_CAN_ACCESS.ALL,
|
|
14
|
+
icon: _Public.default,
|
|
15
15
|
title: {
|
|
16
|
-
zh: '
|
|
17
|
-
en: '
|
|
16
|
+
zh: '所有人可访问',
|
|
17
|
+
en: 'Accessible to all'
|
|
18
18
|
},
|
|
19
19
|
description: {
|
|
20
|
-
zh: '
|
|
21
|
-
en: '
|
|
20
|
+
zh: '向所有人开放,无需通行证即可访问应用',
|
|
21
|
+
en: 'Open to the world anyone can access without passport'
|
|
22
22
|
}
|
|
23
23
|
}, {
|
|
24
24
|
value: _constant.WHO_CAN_ACCESS.INVITED,
|
|
@@ -32,15 +32,15 @@ var _default = [{
|
|
|
32
32
|
en: 'You can invite members later in the admin page'
|
|
33
33
|
}
|
|
34
34
|
}, {
|
|
35
|
-
value: _constant.WHO_CAN_ACCESS.
|
|
36
|
-
icon:
|
|
35
|
+
value: _constant.WHO_CAN_ACCESS.OWNER,
|
|
36
|
+
icon: _Lock.default,
|
|
37
37
|
title: {
|
|
38
|
-
zh: '
|
|
39
|
-
en: '
|
|
38
|
+
zh: '只有应用所有者可以访问',
|
|
39
|
+
en: 'Only Owner of the blocklet can access'
|
|
40
40
|
},
|
|
41
41
|
description: {
|
|
42
|
-
zh: '
|
|
43
|
-
en: '
|
|
42
|
+
zh: '必须提供所有者通行证才能访问应用',
|
|
43
|
+
en: 'You must provide owner passport to access this application'
|
|
44
44
|
}
|
|
45
45
|
}];
|
|
46
46
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.8.
|
|
6
|
+
"version": "1.8.39",
|
|
7
7
|
"description": "UX components shared across abtnode packages",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@abtnode/auth": "1.8.
|
|
25
|
-
"@abtnode/constant": "1.8.
|
|
26
|
-
"@abtnode/util": "1.8.
|
|
24
|
+
"@abtnode/auth": "1.8.39",
|
|
25
|
+
"@abtnode/constant": "1.8.39",
|
|
26
|
+
"@abtnode/util": "1.8.39",
|
|
27
27
|
"@arcblock/did-connect": "^2.4.52",
|
|
28
28
|
"@arcblock/did-motif": "^1.1.10",
|
|
29
29
|
"@arcblock/icons": "^2.4.52",
|
|
30
30
|
"@arcblock/terminal": "^2.4.52",
|
|
31
31
|
"@arcblock/ux": "^2.4.52",
|
|
32
|
-
"@blocklet/constant": "1.8.
|
|
33
|
-
"@blocklet/launcher-layout": "^1.9.
|
|
34
|
-
"@blocklet/list": "^0.10.
|
|
35
|
-
"@blocklet/meta": "1.8.
|
|
32
|
+
"@blocklet/constant": "1.8.39",
|
|
33
|
+
"@blocklet/launcher-layout": "^1.9.12",
|
|
34
|
+
"@blocklet/list": "^0.10.36",
|
|
35
|
+
"@blocklet/meta": "1.8.39",
|
|
36
36
|
"@emotion/react": "^11.10.4",
|
|
37
37
|
"@emotion/styled": "^11.10.4",
|
|
38
38
|
"@material-table/core": "^0.2.48",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"@babel/preset-react": "^7.18.6",
|
|
77
77
|
"babel-plugin-inline-react-svg": "^1.1.2"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "cf2223c4d9a999993b2be1c943dd75b4221593c3"
|
|
80
80
|
}
|