@abtnode/ux 1.8.25 → 1.8.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/actions.js +137 -0
- package/lib/blocklet/actions.js +501 -0
- package/lib/blocklet/audit-logs.js +226 -0
- package/lib/blocklet/avatar.js +123 -0
- package/lib/blocklet/blocklet-source.js +69 -0
- package/lib/blocklet/component/configuration.js +150 -0
- package/lib/blocklet/component/delete.js +138 -0
- package/lib/blocklet/component/environment.js +334 -0
- package/lib/blocklet/component/index.js +837 -0
- package/lib/blocklet/component/setting.js +174 -0
- package/lib/blocklet/configuration.js +531 -0
- package/lib/blocklet/disk-info.js +115 -0
- package/lib/blocklet/icons.js +36 -0
- package/lib/blocklet/log.js +70 -0
- package/lib/blocklet/mode.js +47 -0
- package/lib/blocklet/overview.js +218 -0
- package/lib/blocklet/runtime-info.js +111 -0
- package/lib/blocklet/status.js +125 -0
- package/lib/blocklet/util.js +141 -0
- package/lib/blocklet/version.js +216 -0
- package/lib/click-to-copy.js +51 -0
- package/lib/confirm.js +175 -0
- package/lib/contexts/audit-log.js +155 -0
- package/lib/contexts/deleting-blocklets.js +91 -0
- package/lib/contexts/node.js +34 -0
- package/lib/contexts/session.js +22 -0
- package/lib/contexts/team.js +22 -0
- package/lib/did-address.js +95 -0
- package/lib/dot.js +25 -0
- package/lib/hooks/mobile-width.js +24 -0
- package/lib/icons/long-arrow.svg +5 -0
- package/lib/locales/en.js +1046 -38
- package/lib/locales/zh.js +1049 -36
- package/lib/logs/clock.js +25 -0
- package/lib/logs/log-terminal.js +198 -0
- package/lib/passport-tag.js +58 -0
- package/lib/permission.js +84 -0
- package/lib/relative-time.js +74 -0
- package/lib/table-icons.js +59 -0
- package/lib/table.js +19 -0
- package/lib/tag.js +48 -0
- package/lib/team/members/actions.js +115 -0
- package/lib/team/members/index.js +544 -0
- package/lib/team/members/invitations.js +229 -0
- package/lib/team/members/invite-member.js +241 -0
- package/lib/team/members/issue-passport.js +178 -0
- package/lib/team/members/member.js +336 -0
- package/lib/team/members/passport-issuances.js +181 -0
- package/lib/team/members/passports.js +377 -0
- package/lib/team/members/toggle-user-approval.js +154 -0
- package/lib/team/members/transfer-node.js +295 -0
- package/lib/team/members/util.js +27 -0
- package/lib/team/passports/detail.js +304 -0
- package/lib/team/passports/index.js +256 -0
- package/lib/team/passports/mutate-role.js +230 -0
- package/lib/team/passports/trusted-issuer.js +339 -0
- package/lib/team/passports/trusted-issuers.js +284 -0
- package/lib/team/search-input.js +51 -0
- package/lib/team/styles/dialog.js +19 -0
- package/lib/team/styles/list-header.js +19 -0
- package/lib/util/index.js +642 -6
- package/package.json +32 -9
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = DeleteComponent;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _Delete = _interopRequireDefault(require("@mui/icons-material/Delete"));
|
|
15
|
+
|
|
16
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
17
|
+
|
|
18
|
+
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
19
|
+
|
|
20
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
21
|
+
|
|
22
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
23
|
+
|
|
24
|
+
var _Radio = _interopRequireDefault(require("@mui/material/Radio"));
|
|
25
|
+
|
|
26
|
+
var _RadioGroup = _interopRequireDefault(require("@mui/material/RadioGroup"));
|
|
27
|
+
|
|
28
|
+
var _FormControlLabel = _interopRequireDefault(require("@mui/material/FormControlLabel"));
|
|
29
|
+
|
|
30
|
+
var _confirm = _interopRequireDefault(require("../../confirm"));
|
|
31
|
+
|
|
32
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
33
|
+
|
|
34
|
+
var _templateObject;
|
|
35
|
+
|
|
36
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
|
+
|
|
38
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
39
|
+
|
|
40
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
|
+
|
|
42
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
43
|
+
|
|
44
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
45
|
+
|
|
46
|
+
function DeleteComponent(_ref) {
|
|
47
|
+
let {
|
|
48
|
+
component,
|
|
49
|
+
remove,
|
|
50
|
+
disabled,
|
|
51
|
+
tip
|
|
52
|
+
} = _ref;
|
|
53
|
+
const {
|
|
54
|
+
t
|
|
55
|
+
} = (0, _react.useContext)(_context.LocaleContext);
|
|
56
|
+
const [loading, setLoading] = (0, _react.useState)(false);
|
|
57
|
+
const [deleteSetting, setDeleteSetting] = (0, _react.useState)(null);
|
|
58
|
+
|
|
59
|
+
const deleteComponent = async param => {
|
|
60
|
+
setLoading(true);
|
|
61
|
+
await remove(param.component, param.removeType);
|
|
62
|
+
setLoading(false);
|
|
63
|
+
setDeleteSetting(null);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const componentDisabled = disabled || loading;
|
|
67
|
+
const btn = /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledButton, {
|
|
68
|
+
disabled: componentDisabled,
|
|
69
|
+
onClick: () => setDeleteSetting({
|
|
70
|
+
title: t('blocklet.component.delete'),
|
|
71
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
72
|
+
description: (params, setParams) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Typography.default, {
|
|
73
|
+
component: "div",
|
|
74
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
75
|
+
gutterBottom: true,
|
|
76
|
+
children: t('blocklet.action.removeComponentDescription')
|
|
77
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_RadioGroup.default, {
|
|
78
|
+
name: "removeType",
|
|
79
|
+
value: params.removeType,
|
|
80
|
+
onChange: e => setParams(_objectSpread(_objectSpread({}, params), {}, {
|
|
81
|
+
removeType: e.target.value
|
|
82
|
+
})),
|
|
83
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControlLabel.default, {
|
|
84
|
+
value: "keepData",
|
|
85
|
+
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Radio.default, {}),
|
|
86
|
+
label: t('blocklet.action.removeComponentKeepData')
|
|
87
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormControlLabel.default, {
|
|
88
|
+
value: "complete",
|
|
89
|
+
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Radio.default, {}),
|
|
90
|
+
label: t('blocklet.action.removeComponentComplete')
|
|
91
|
+
})]
|
|
92
|
+
})]
|
|
93
|
+
}),
|
|
94
|
+
confirm: t('common.confirm'),
|
|
95
|
+
cancel: t('common.cancel'),
|
|
96
|
+
params: {
|
|
97
|
+
component,
|
|
98
|
+
removeType: 'keepData'
|
|
99
|
+
},
|
|
100
|
+
onConfirm: deleteComponent,
|
|
101
|
+
onCancel: () => setDeleteSetting(null)
|
|
102
|
+
}),
|
|
103
|
+
"data-cy": "delete-component-btn",
|
|
104
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Delete.default, {
|
|
105
|
+
disabled: componentDisabled
|
|
106
|
+
})
|
|
107
|
+
});
|
|
108
|
+
const btnWithToolTip = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
|
|
109
|
+
title: tip || t('common.delete'),
|
|
110
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
111
|
+
children: btn
|
|
112
|
+
})
|
|
113
|
+
});
|
|
114
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
115
|
+
children: [btnWithToolTip, deleteSetting && /*#__PURE__*/(0, _jsxRuntime.jsx)(_confirm.default, {
|
|
116
|
+
title: deleteSetting.title,
|
|
117
|
+
description: deleteSetting.description,
|
|
118
|
+
confirm: deleteSetting.confirm,
|
|
119
|
+
cancel: deleteSetting.cancel,
|
|
120
|
+
params: deleteSetting.params,
|
|
121
|
+
onConfirm: deleteSetting.onConfirm,
|
|
122
|
+
onCancel: deleteSetting.onCancel
|
|
123
|
+
})]
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
DeleteComponent.propTypes = {
|
|
128
|
+
component: _propTypes.default.object.isRequired,
|
|
129
|
+
remove: _propTypes.default.func,
|
|
130
|
+
disabled: _propTypes.default.bool,
|
|
131
|
+
tip: _propTypes.default.string
|
|
132
|
+
};
|
|
133
|
+
DeleteComponent.defaultProps = {
|
|
134
|
+
remove: async () => {},
|
|
135
|
+
disabled: false,
|
|
136
|
+
tip: ''
|
|
137
|
+
};
|
|
138
|
+
const StyledButton = (0, _styled.default)(_IconButton.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.Mui-disabled {\n opacity: 0.5;\n }\n"])));
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = ComponentEnvironment;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
11
|
+
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
|
|
14
|
+
var _core = _interopRequireDefault(require("@material-table/core"));
|
|
15
|
+
|
|
16
|
+
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
17
|
+
|
|
18
|
+
var _Alert = _interopRequireDefault(require("@mui/material/Alert"));
|
|
19
|
+
|
|
20
|
+
var _constant = require("@blocklet/constant");
|
|
21
|
+
|
|
22
|
+
var _util = require("@blocklet/meta/lib/util");
|
|
23
|
+
|
|
24
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
25
|
+
|
|
26
|
+
var _clickToCopy = _interopRequireDefault(require("../../click-to-copy"));
|
|
27
|
+
|
|
28
|
+
var _toast = _interopRequireDefault(require("../../toast"));
|
|
29
|
+
|
|
30
|
+
var _node = require("../../contexts/node");
|
|
31
|
+
|
|
32
|
+
var _tableIcons = _interopRequireDefault(require("../../table-icons"));
|
|
33
|
+
|
|
34
|
+
var _table = _interopRequireDefault(require("../../table"));
|
|
35
|
+
|
|
36
|
+
var _permission = _interopRequireDefault(require("../../permission"));
|
|
37
|
+
|
|
38
|
+
var _util2 = require("../../util");
|
|
39
|
+
|
|
40
|
+
var _icons = _interopRequireDefault(require("../icons"));
|
|
41
|
+
|
|
42
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
43
|
+
|
|
44
|
+
var _templateObject, _templateObject2;
|
|
45
|
+
|
|
46
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
47
|
+
|
|
48
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
49
|
+
|
|
50
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
51
|
+
|
|
52
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
53
|
+
|
|
54
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
55
|
+
|
|
56
|
+
function ComponentEnvironment(_ref) {
|
|
57
|
+
let {
|
|
58
|
+
blocklet,
|
|
59
|
+
ancestors
|
|
60
|
+
} = _ref;
|
|
61
|
+
const node = (0, _node.useNodeContext)();
|
|
62
|
+
const {
|
|
63
|
+
inService
|
|
64
|
+
} = node;
|
|
65
|
+
const {
|
|
66
|
+
t
|
|
67
|
+
} = (0, _react.useContext)(_context.LocaleContext);
|
|
68
|
+
const dids = [...ancestors.map(x => x.meta.did), blocklet.meta.did];
|
|
69
|
+
|
|
70
|
+
const onConfigChanged = () => _toast.default.success(t('blocklet.config.changedTip'));
|
|
71
|
+
|
|
72
|
+
const isConfigEditable = x => x.custom;
|
|
73
|
+
|
|
74
|
+
if ((0, _util2.isInstalling)(blocklet.status)) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (blocklet.status === 'unknown' && (0, _util2.isInstalling)(blocklet.status)) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const onAddConfig = async data => {
|
|
83
|
+
if (!data.key.trim() || !data.value.trim()) {
|
|
84
|
+
_toast.default.error(t('blocklet.config.environment.keyValueRequired'));
|
|
85
|
+
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (data.key.startsWith('BLOCKLET_')) {
|
|
90
|
+
_toast.default.error(t('blocklet.config.environment.invalidKey'));
|
|
91
|
+
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
data.custom = true;
|
|
96
|
+
const result = await node.api.configBlocklet({
|
|
97
|
+
input: {
|
|
98
|
+
did: dids,
|
|
99
|
+
configs: [data]
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
if (result.code === 'ok') {
|
|
104
|
+
onConfigChanged(result.blocklet);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const onEditConfig = async (newData, oldData) => {
|
|
109
|
+
// only required field can't be empty
|
|
110
|
+
if (newData.required && (!newData.key.trim() || !newData.value.trim())) {
|
|
111
|
+
_toast.default.error(t('blocklet.config.environment.keyValueRequired'));
|
|
112
|
+
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (newData.key.startsWith('BLOCKLET_') && !_constant.BLOCKLET_CONFIGURABLE_KEY[newData.key]) {
|
|
117
|
+
_toast.default.error(t('blocklet.config.environment.invalidKey'));
|
|
118
|
+
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (newData.key === _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_CLUSTER_SIZE) {
|
|
123
|
+
const errMessage = (0, _util2.isValidClusterSize)(newData);
|
|
124
|
+
|
|
125
|
+
if (errMessage) {
|
|
126
|
+
_toast.default.error(errMessage);
|
|
127
|
+
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const configs = [newData];
|
|
133
|
+
|
|
134
|
+
if (newData.key !== oldData.key) {
|
|
135
|
+
configs.push({
|
|
136
|
+
key: oldData.key
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
const result = await node.api.configBlocklet({
|
|
142
|
+
input: {
|
|
143
|
+
did: dids,
|
|
144
|
+
configs
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
if (result.code === 'ok') {
|
|
149
|
+
onConfigChanged(result.blocklet);
|
|
150
|
+
}
|
|
151
|
+
} catch (err) {
|
|
152
|
+
_toast.default.error((0, _util2.formatError)(err));
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const onDeleteConfig = async data => {
|
|
157
|
+
if (data.required) {
|
|
158
|
+
_toast.default.error(t('blocklet.config.environment.deleteForbidden'));
|
|
159
|
+
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const result = await node.api.configBlocklet({
|
|
164
|
+
input: {
|
|
165
|
+
did: dids,
|
|
166
|
+
configs: [{
|
|
167
|
+
key: data.key
|
|
168
|
+
}]
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
if (result.code === 'ok') {
|
|
173
|
+
onConfigChanged(result.blocklet);
|
|
174
|
+
}
|
|
175
|
+
}; // configs
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
const componentConfigs = (blocklet.configs || []).filter(x => !_constant.BLOCKLET_CONFIGURABLE_KEY[x.key]);
|
|
179
|
+
const sharedConfigObj = (0, _util.getSharedConfigObj)(blocklet, ancestors);
|
|
180
|
+
const missingRequiredConfigs = (0, _util.getComponentMissingConfigs)(blocklet, ancestors);
|
|
181
|
+
const configs = componentConfigs.map(x => _objectSpread(_objectSpread({}, x), {}, {
|
|
182
|
+
value: sharedConfigObj[x.key] || x.value
|
|
183
|
+
}));
|
|
184
|
+
const hasBWAConfig = configs.some(x => x.key && x.key.startsWith('BWA_'));
|
|
185
|
+
const action = {
|
|
186
|
+
onRowAdd: onAddConfig,
|
|
187
|
+
onRowUpdate: onEditConfig,
|
|
188
|
+
onRowDelete: onDeleteConfig,
|
|
189
|
+
// environment declare in blocklet.yml can't be deleted, only custom env can be deleted
|
|
190
|
+
isDeletable: isConfigEditable
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const onColumns = () => [{
|
|
194
|
+
title: t('common.key'),
|
|
195
|
+
field: 'key',
|
|
196
|
+
initialEditValue: 'Key',
|
|
197
|
+
width: '30%',
|
|
198
|
+
render: d => /*#__PURE__*/(0, _jsxRuntime.jsx)(_clickToCopy.default, {
|
|
199
|
+
value: d.value,
|
|
200
|
+
style: {
|
|
201
|
+
color: d.required && !d.value ? '#ff4436' : '#222222',
|
|
202
|
+
fontWeight: d.required ? 'bold' : 'normal'
|
|
203
|
+
},
|
|
204
|
+
children: d.key
|
|
205
|
+
}),
|
|
206
|
+
editComponent: props => {
|
|
207
|
+
const {
|
|
208
|
+
value,
|
|
209
|
+
rowData,
|
|
210
|
+
onChange: _onChange
|
|
211
|
+
} = props;
|
|
212
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(EditDiv, {
|
|
213
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
214
|
+
fullWidth: true,
|
|
215
|
+
size: "small",
|
|
216
|
+
disabled: isConfigEditable(rowData) === false,
|
|
217
|
+
value: value,
|
|
218
|
+
onChange: e => _onChange(e.target.value),
|
|
219
|
+
variant: "outlined",
|
|
220
|
+
label: "Key",
|
|
221
|
+
placeholder: t('blocklet.config.environment.key'),
|
|
222
|
+
margin: "dense",
|
|
223
|
+
autoFocus: true
|
|
224
|
+
})
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}, {
|
|
228
|
+
title: t('common.value'),
|
|
229
|
+
field: 'value',
|
|
230
|
+
initialEditValue: 'Value',
|
|
231
|
+
width: 'calc((100% - (96px + 30%)) / 1)',
|
|
232
|
+
render: d => {
|
|
233
|
+
if (d.secure) {
|
|
234
|
+
return '******';
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (!d.value) {
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_clickToCopy.default, {
|
|
242
|
+
unstyled: true,
|
|
243
|
+
value: d.value,
|
|
244
|
+
style: {
|
|
245
|
+
wordBreak: 'break-all'
|
|
246
|
+
},
|
|
247
|
+
children: d.value
|
|
248
|
+
});
|
|
249
|
+
},
|
|
250
|
+
// eslint-disable-next-line no-shadow
|
|
251
|
+
editComponent: props => {
|
|
252
|
+
const {
|
|
253
|
+
value,
|
|
254
|
+
rowData,
|
|
255
|
+
onChange: _onChange2
|
|
256
|
+
} = props;
|
|
257
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(EditDiv, {
|
|
258
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
259
|
+
fullWidth: true,
|
|
260
|
+
size: "small",
|
|
261
|
+
value: value === '__encrypted__' ? '' : value,
|
|
262
|
+
onChange: e => _onChange2(e.target.value),
|
|
263
|
+
variant: "outlined",
|
|
264
|
+
label: t('common.value'),
|
|
265
|
+
placeholder: t('blocklet.config.environment.value'),
|
|
266
|
+
margin: "dense",
|
|
267
|
+
autoFocus: true
|
|
268
|
+
}), rowData.description && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
269
|
+
style: {
|
|
270
|
+
marginLeft: 12
|
|
271
|
+
},
|
|
272
|
+
children: rowData.description
|
|
273
|
+
})]
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
}];
|
|
277
|
+
|
|
278
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Div, {
|
|
279
|
+
children: [!!missingRequiredConfigs.length && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
|
|
280
|
+
severity: "error",
|
|
281
|
+
style: {
|
|
282
|
+
marginTop: 24
|
|
283
|
+
},
|
|
284
|
+
children: t('blocklet.config.missingRequired')
|
|
285
|
+
}), hasBWAConfig && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Alert.default, {
|
|
286
|
+
severity: "info",
|
|
287
|
+
children: t('blocklet.config.environment.tip')
|
|
288
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_permission.default, {
|
|
289
|
+
permission: inService ? '' : 'mutate_blocklet',
|
|
290
|
+
role: inService ? _util2.BlockletAdminRoles : [],
|
|
291
|
+
children: hasPermission => /*#__PURE__*/(0, _jsxRuntime.jsx)(_table.default, {
|
|
292
|
+
className: (0, _util2.isBlockletDev)(blocklet) ? 'readonly-block config-table' : 'config-table',
|
|
293
|
+
"data-disabled-text": t('blocklet.config.disabledText'),
|
|
294
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_core.default, {
|
|
295
|
+
title: /*#__PURE__*/(0, _jsxRuntime.jsx)("h4", {
|
|
296
|
+
children: t('common.environment')
|
|
297
|
+
}),
|
|
298
|
+
columns: onColumns(),
|
|
299
|
+
icons: _objectSpread(_objectSpread({}, _icons.default), _tableIcons.default),
|
|
300
|
+
options: {
|
|
301
|
+
emptyRowsWhenPaging: false,
|
|
302
|
+
actionsColumnIndex: -1,
|
|
303
|
+
tableLayout: 'auto',
|
|
304
|
+
maxBodyHeight: '100%',
|
|
305
|
+
paging: false,
|
|
306
|
+
search: false
|
|
307
|
+
},
|
|
308
|
+
localization: {
|
|
309
|
+
header: {
|
|
310
|
+
actions: t('common.actions')
|
|
311
|
+
},
|
|
312
|
+
body: {
|
|
313
|
+
emptyDataSourceMessage: t('common.noData')
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
data: configs,
|
|
317
|
+
editable: hasPermission ? action : {}
|
|
318
|
+
})
|
|
319
|
+
})
|
|
320
|
+
})]
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
ComponentEnvironment.propTypes = {
|
|
325
|
+
blocklet: _propTypes.default.object.isRequired,
|
|
326
|
+
ancestors: _propTypes.default.array
|
|
327
|
+
};
|
|
328
|
+
ComponentEnvironment.defaultProps = {
|
|
329
|
+
ancestors: []
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .readonly-block {\n position: relative;\n &::after {\n content: attr(data-disabled-text);\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: rgba(230, 230, 230, 0.7);\n font-size: 24px;\n letter-spacing: 2px;\n color: #e33371;\n padding: 20px;\n word-break: break-all;\n word-wrap: break-word;\n z-index: 10;\n }\n }\n .config-table {\n margin-bottom: 24px;\n position: relative;\n .hide-control {\n position: absolute;\n top: 10px;\n left: 200px;\n @media (max-width: ", "px) {\n left: 160px;\n }\n }\n\n .MuiToolbar-root {\n display: flex;\n }\n\n .MuiTableRow-head {\n display: none;\n }\n\n &.hide-header {\n .MuiToolbar-root {\n display: none;\n }\n }\n }\n\n .accordion {\n margin-bottom: 16px;\n &:last-of-type {\n margin-bottom: 0;\n }\n padding: 8px 0 8px 0px;\n &.MuiAccordion-root {\n background: transparent;\n box-shadow: none;\n border: 1px solid #ddd;\n border-radius: 4px;\n &::before,\n &::after {\n height: 0;\n }\n .MuiAccordionSummary-root {\n padding-left: 0;\n }\n .accordion-title {\n font-weight: bold;\n padding-left: 16px;\n }\n }\n }\n"])), props => props.theme.breakpoints.values.sm);
|
|
333
|
+
|
|
334
|
+
const EditDiv = _styled.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: 60px;\n"])));
|