@abtnode/ux 1.8.67 → 1.8.68-beta-500af7e5
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 +3 -3
- package/lib/blocklet/actions.js +3 -3
- package/lib/blocklet/audit-logs.js +5 -2
- package/lib/blocklet/component/add.js +9 -7
- package/lib/blocklet/component/index.js +5 -5
- package/lib/blocklet/component/select-store.js +3 -1
- package/lib/blocklet/component/space-gateway-selector.js +174 -0
- package/lib/blocklet/component/store-blocklet-list.js +3 -3
- package/lib/blocklet/configuration.js +3 -1
- package/lib/blocklet/install-from-url.js +125 -82
- package/lib/blocklet/overview.js +18 -5
- package/lib/blocklet/preferences/app-sk.js +54 -8
- package/lib/blocklet/router/action/add-domain-alias.js +3 -3
- package/lib/blocklet/router/action/add-rule.js +3 -3
- package/lib/blocklet/router/action/delete-domain-alias.js +3 -3
- package/lib/blocklet/router/action/delete-rule.js +3 -3
- package/lib/blocklet/router/action/update-rule.js +3 -3
- package/lib/blocklet/status.js +3 -3
- package/lib/blocklet/storage.js +161 -121
- package/lib/blocklet/version.js +3 -3
- package/lib/confirm.js +3 -3
- package/lib/form/form-text-input.js +106 -11
- package/lib/invitation/invitation.js +2 -2
- package/lib/issue-passport.js +0 -1
- package/lib/locales/en.js +18 -5
- package/lib/locales/zh.js +16 -4
- package/lib/logs/download.js +5 -5
- package/lib/lost-passport.js +0 -2
- package/lib/store/add.js +3 -3
- package/lib/team/members/invite-member.js +3 -3
- package/lib/team/members/issue-passport.js +3 -3
- package/lib/team/members/member.js +2 -2
- package/lib/team/members/transfer-node.js +4 -4
- package/lib/team/passports/color.js +3 -3
- package/lib/team/passports/detail.js +4 -4
- package/lib/team/passports/index.js +3 -3
- package/lib/team/passports/mutate-role.js +3 -3
- package/lib/team/passports/trusted-issuer.js +3 -3
- package/lib/util/index.js +0 -18
- package/package.json +14 -14
package/lib/blocklet/storage.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = Storage;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
7
8
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
8
9
|
var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
|
|
9
|
-
var _react = require("react");
|
|
10
10
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
11
11
|
var _constant = require("@blocklet/constant");
|
|
12
12
|
var _axios = _interopRequireDefault(require("axios"));
|
|
@@ -14,35 +14,77 @@ var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
|
14
14
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
15
15
|
var _lodash = require("lodash");
|
|
16
16
|
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
17
|
-
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
18
17
|
var _material = require("@mui/material");
|
|
19
18
|
var _blocklet = require("../../lib/contexts/blocklet");
|
|
20
19
|
var _node = require("../contexts/node");
|
|
21
20
|
var _toast = _interopRequireDefault(require("../../lib/toast"));
|
|
21
|
+
var _spaceGatewaySelector = _interopRequireDefault(require("./component/space-gateway-selector"));
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
var _templateObject
|
|
23
|
+
var _templateObject;
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
function
|
|
25
|
+
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); }
|
|
26
|
+
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; }
|
|
26
27
|
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; }
|
|
27
28
|
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; }
|
|
28
29
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
29
30
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
30
31
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
32
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
33
|
+
const Container = (0, _styled.default)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n overflow-y: auto;\n"])));
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @description 实时显示备份的进度
|
|
37
|
+
* @param {{appDid: string}} {appDid}
|
|
38
|
+
* @return {{message: string, progress: number, completed: boolean}}
|
|
39
|
+
*/
|
|
40
|
+
function useBackupProgress(_ref) {
|
|
41
|
+
let {
|
|
42
|
+
appDid
|
|
43
|
+
} = _ref;
|
|
44
|
+
const [progress, setProgress] = (0, _react.useState)({
|
|
45
|
+
message: '',
|
|
46
|
+
progress: 0,
|
|
47
|
+
completed: false
|
|
48
|
+
});
|
|
49
|
+
const node = (0, _node.useNodeContext)();
|
|
50
|
+
const webSocketClient = node.ws.getWsClient();
|
|
51
|
+
(0, _react.useEffect)(() => {
|
|
52
|
+
webSocketClient.on(_constant.BlockletEvents.backupProgress, data => {
|
|
53
|
+
if (appDid === (data === null || data === void 0 ? void 0 : data.did)) {
|
|
54
|
+
setProgress(preValue => _objectSpread(_objectSpread({}, preValue), data));
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return () => {
|
|
58
|
+
webSocketClient.off(_constant.BlockletEvents.backupProgress);
|
|
59
|
+
};
|
|
60
|
+
}, [appDid, webSocketClient]);
|
|
61
|
+
return progress;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
*
|
|
67
|
+
* @param {import('@abtnode/client').BlockletState} blocklet
|
|
68
|
+
* @return {*}
|
|
69
|
+
*/
|
|
70
|
+
function useAppUrl(blocklet) {
|
|
71
|
+
var _blocklet$site, _blocklet$site$domain, _blocklet$site$domain2;
|
|
72
|
+
const appUrls = blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$site = blocklet.site) === null || _blocklet$site === void 0 ? void 0 : (_blocklet$site$domain = _blocklet$site.domainAliases) === null || _blocklet$site$domain === void 0 ? void 0 : (_blocklet$site$domain2 = _blocklet$site$domain.sort((a, b) => {
|
|
73
|
+
if (a.accessibility.accessible && b.accessibility.accessible) {
|
|
74
|
+
return +a.isProtected - +b.isProtected;
|
|
75
|
+
}
|
|
76
|
+
return +b.accessibility.accessible - +a.accessibility.accessible;
|
|
77
|
+
})) === null || _blocklet$site$domain2 === void 0 ? void 0 : _blocklet$site$domain2.map(domainAlias => domainAlias.accessibility.url);
|
|
78
|
+
const appUrl = appUrls === null || appUrls === void 0 ? void 0 : appUrls[0];
|
|
45
79
|
|
|
80
|
+
// 授权的时候提供 appUrl, 因为 appUrl 可能很久都拿不到值,所以加一个 loading 效果过渡一下
|
|
81
|
+
return {
|
|
82
|
+
appUrl,
|
|
83
|
+
isReady: Boolean(appUrl)
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function Storage() {
|
|
87
|
+
var _blocklet$environment;
|
|
46
88
|
/** @type {{ api: import('@abtnode/client').ABTNodeClient }} */
|
|
47
89
|
const {
|
|
48
90
|
api
|
|
@@ -51,13 +93,15 @@ function Storage() {
|
|
|
51
93
|
t,
|
|
52
94
|
locale
|
|
53
95
|
} = (0, _react.useContext)(_context.LocaleContext);
|
|
54
|
-
const [errorMessage, setErrorMessage] = (0, _react.useState)(false);
|
|
55
96
|
/** @type {{ blocklet: import('@abtnode/client').BlockletState }} */
|
|
56
97
|
const {
|
|
57
98
|
blocklet
|
|
58
99
|
} = (0, _blocklet.useBlockletContext)();
|
|
100
|
+
const [gatewayUrl, setGatewayUrl] = (0, _react.useState)('');
|
|
59
101
|
const [endpoint, setEndpoint] = (0, _react.useState)(((_blocklet$environment = blocklet.environments.find(e => e.key === _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT)) === null || _blocklet$environment === void 0 ? void 0 : _blocklet$environment.value) || '');
|
|
60
|
-
const
|
|
102
|
+
const progress = useBackupProgress({
|
|
103
|
+
appDid: blocklet === null || blocklet === void 0 ? void 0 : blocklet.appDid
|
|
104
|
+
});
|
|
61
105
|
const [isLoading, setIsLoading] = (0, _react.useState)(false);
|
|
62
106
|
const {
|
|
63
107
|
appDid
|
|
@@ -66,26 +110,24 @@ function Storage() {
|
|
|
66
110
|
title: appName,
|
|
67
111
|
description: appDescription
|
|
68
112
|
} = blocklet.meta;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
* @param {string} storageEndpoint
|
|
74
|
-
*/
|
|
113
|
+
const {
|
|
114
|
+
appUrl,
|
|
115
|
+
isReady
|
|
116
|
+
} = useAppUrl(blocklet);
|
|
75
117
|
async function saveStorageEndpoint(did, storageEndpoint) {
|
|
76
118
|
await api.configBlocklet({
|
|
77
119
|
input: {
|
|
78
120
|
did: [did],
|
|
79
121
|
configs: [{
|
|
80
122
|
key: _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACES_URL,
|
|
81
|
-
value:
|
|
123
|
+
value: gatewayUrl
|
|
82
124
|
}, {
|
|
83
125
|
key: _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT,
|
|
84
126
|
value: storageEndpoint
|
|
85
127
|
}]
|
|
86
128
|
}
|
|
87
129
|
}).then(() => {
|
|
88
|
-
_toast.default.success(t('storage.
|
|
130
|
+
_toast.default.success(t('storage.spaces.connected', locale));
|
|
89
131
|
}).catch(error => {
|
|
90
132
|
console.error(error);
|
|
91
133
|
_toast.default.error(error.message);
|
|
@@ -101,49 +143,41 @@ function Storage() {
|
|
|
101
143
|
}, 3000);
|
|
102
144
|
};
|
|
103
145
|
const [authorizeConnect, setAuthorizeConnect] = (0, _react.useState)({
|
|
104
|
-
open: false
|
|
105
|
-
action: 'one-click-authorization',
|
|
106
|
-
checkTimeout: 1000 * 300,
|
|
107
|
-
checkFn: _axios.default.create({
|
|
108
|
-
baseURL: (0, _urlJoin.default)(didSpacesUrl, 'space')
|
|
109
|
-
}).get,
|
|
110
|
-
onClose: () => {
|
|
111
|
-
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
112
|
-
open: false
|
|
113
|
-
}));
|
|
114
|
-
}
|
|
146
|
+
open: false
|
|
115
147
|
});
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
148
|
+
|
|
149
|
+
// eslint-disable-next-line no-shadow
|
|
150
|
+
const handleOnClickAuthorize = async gatewayUrl => {
|
|
151
|
+
if ((0, _lodash.isEmpty)(gatewayUrl)) {
|
|
152
|
+
_toast.default.error(t('storage.spaces.addressCannotEmpty', locale));
|
|
119
153
|
return;
|
|
120
154
|
}
|
|
155
|
+
setGatewayUrl(gatewayUrl);
|
|
121
156
|
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
122
|
-
|
|
123
|
-
|
|
157
|
+
action: 'one-click-authorization',
|
|
158
|
+
checkTimeout: 1000 * 300,
|
|
159
|
+
prefix: (0, _urlJoin.default)(gatewayUrl, 'space/api/did'),
|
|
160
|
+
baseUrl: new URL(gatewayUrl).origin,
|
|
124
161
|
checkFn: _axios.default.create({
|
|
125
|
-
baseURL: (0, _urlJoin.default)(
|
|
162
|
+
baseURL: (0, _urlJoin.default)(gatewayUrl, 'space')
|
|
126
163
|
}).get,
|
|
127
164
|
extraParams: {
|
|
128
165
|
appDid,
|
|
129
166
|
appName,
|
|
130
167
|
appDescription,
|
|
131
|
-
scopes: 'list:object read:object write:object'
|
|
168
|
+
scopes: 'list:object read:object write:object',
|
|
169
|
+
appUrl,
|
|
170
|
+
referrer: window.location.href
|
|
171
|
+
},
|
|
172
|
+
onClose: () => {
|
|
173
|
+
// eslint-disable-next-line no-shadow
|
|
174
|
+
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
175
|
+
open: false
|
|
176
|
+
}));
|
|
132
177
|
},
|
|
133
178
|
open: true
|
|
134
179
|
}));
|
|
135
180
|
};
|
|
136
|
-
const onDidSpacesUrlChange = event => {
|
|
137
|
-
const {
|
|
138
|
-
value
|
|
139
|
-
} = event.target;
|
|
140
|
-
if ((0, _lodash.isEmpty)(value)) {
|
|
141
|
-
setErrorMessage(t('storage.didSpaces.addressCannotEmpty', locale));
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
setErrorMessage(null);
|
|
145
|
-
setDidSpacesUrl(value);
|
|
146
|
-
};
|
|
147
181
|
const onBackup = async () => {
|
|
148
182
|
try {
|
|
149
183
|
if (isLoading) {
|
|
@@ -155,7 +189,7 @@ function Storage() {
|
|
|
155
189
|
did: blocklet.appDid
|
|
156
190
|
}
|
|
157
191
|
});
|
|
158
|
-
_toast.default.success(t('storage.
|
|
192
|
+
_toast.default.success(t('storage.spaces.backupSuccessfully'));
|
|
159
193
|
} catch (error) {
|
|
160
194
|
_toast.default.error(error.message);
|
|
161
195
|
console.error(error);
|
|
@@ -166,88 +200,96 @@ function Storage() {
|
|
|
166
200
|
(0, _react.useEffect)(() => {
|
|
167
201
|
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
168
202
|
messages: {
|
|
169
|
-
title: t('storage.
|
|
203
|
+
title: t('storage.spaces.authorize.title', {
|
|
170
204
|
appName
|
|
171
205
|
}),
|
|
172
|
-
scan: t('storage.
|
|
206
|
+
scan: t('storage.spaces.authorize.scan', {
|
|
173
207
|
appName
|
|
174
208
|
}),
|
|
175
209
|
confirm: '',
|
|
176
210
|
success: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
177
211
|
gutterBottom: true,
|
|
178
|
-
children: t('storage.
|
|
212
|
+
children: t('storage.spaces.authorize.success')
|
|
179
213
|
})
|
|
180
214
|
}
|
|
181
215
|
}));
|
|
182
216
|
}, [appName, locale, t]);
|
|
217
|
+
(0, _react.useEffect)(() => {
|
|
218
|
+
if (progress !== null && progress !== void 0 && progress.completed) {
|
|
219
|
+
setIsLoading(false);
|
|
220
|
+
} else if (progress !== null && progress !== void 0 && progress.message) {
|
|
221
|
+
setIsLoading(true);
|
|
222
|
+
}
|
|
223
|
+
}, [progress === null || progress === void 0 ? void 0 : progress.completed, progress === null || progress === void 0 ? void 0 : progress.message, t]);
|
|
183
224
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
|
184
|
-
|
|
185
|
-
|
|
225
|
+
style: {
|
|
226
|
+
maxWidth: '720px'
|
|
227
|
+
},
|
|
228
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_spaceGatewaySelector.default, {
|
|
186
229
|
sx: {
|
|
187
|
-
marginTop: '
|
|
230
|
+
marginTop: '24px',
|
|
231
|
+
marginBottom: '40px'
|
|
188
232
|
},
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
error: !!errorMessage,
|
|
195
|
-
helperText: errorMessage,
|
|
196
|
-
InputProps: {
|
|
197
|
-
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
198
|
-
variant: "contained",
|
|
199
|
-
onClick: handleOnClickAuthorize,
|
|
200
|
-
size: "small",
|
|
201
|
-
sx: {
|
|
202
|
-
position: 'absolute',
|
|
203
|
-
right: 0,
|
|
204
|
-
display: 'flex',
|
|
205
|
-
justifyContent: 'center',
|
|
206
|
-
alignItems: 'center',
|
|
207
|
-
width: '140px',
|
|
208
|
-
height: '100%'
|
|
209
|
-
},
|
|
210
|
-
children: endpoint ? t('storage.didSpaces.reAuthorization') : t('storage.didSpaces.goToAuthorization')
|
|
211
|
-
})
|
|
212
|
-
},
|
|
213
|
-
children: options.map(option => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
214
|
-
value: option.value,
|
|
215
|
-
children: option.label
|
|
216
|
-
}, option.value))
|
|
217
|
-
}), endpoint && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
218
|
-
color: "text.secondary",
|
|
219
|
-
sx: {
|
|
220
|
-
marginTop: '20px'
|
|
221
|
-
},
|
|
222
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
223
|
-
display: "flex",
|
|
224
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
225
|
-
display: "inline",
|
|
226
|
-
children: [t('storage.didSpaces.tips'), ": \xA0", ' ', /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
227
|
-
display: "inline",
|
|
228
|
-
color: "primary.main",
|
|
229
|
-
fontWeight: "fontWeightBold",
|
|
230
|
-
children: t('storage.didSpaces.getSpacesAuthorizeSuccessfully')
|
|
231
|
-
})]
|
|
232
|
-
})
|
|
233
|
-
})
|
|
234
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
233
|
+
onSelect: handleOnClickAuthorize,
|
|
234
|
+
endpoint: endpoint,
|
|
235
|
+
loading: !isReady
|
|
236
|
+
}), endpoint && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
237
|
+
mt: 3,
|
|
235
238
|
display: "flex",
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
239
|
+
alignItems: "center",
|
|
240
|
+
justifyContent: "space-between",
|
|
241
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
242
|
+
display: "inline",
|
|
243
|
+
children: [t('storage.spaces.tips'), ": \xA0", ' ', /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
244
|
+
display: "inline",
|
|
245
|
+
color: "primary.main",
|
|
246
|
+
fontWeight: "fontWeightBold",
|
|
247
|
+
children: t('storage.spaces.connected')
|
|
248
|
+
})]
|
|
249
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
243
250
|
onClick: onBackup,
|
|
244
251
|
loading: isLoading,
|
|
245
252
|
variant: "contained",
|
|
246
253
|
color: "primary",
|
|
247
254
|
"data-cy": "add-domain-alias",
|
|
248
255
|
disabled: !endpoint || isLoading,
|
|
249
|
-
children: t('storage.
|
|
250
|
-
})
|
|
256
|
+
children: t('storage.spaces.backup')
|
|
257
|
+
})]
|
|
258
|
+
}), isLoading && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
259
|
+
display: "flex",
|
|
260
|
+
flexDirection: "column",
|
|
261
|
+
justifyContent: "center",
|
|
262
|
+
textAlign: "center",
|
|
263
|
+
marginTop: "16px",
|
|
264
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
265
|
+
color: "primary",
|
|
266
|
+
children: progress === null || progress === void 0 ? void 0 : progress.message
|
|
267
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
268
|
+
sx: {
|
|
269
|
+
display: 'flex',
|
|
270
|
+
alignItems: 'center'
|
|
271
|
+
},
|
|
272
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
273
|
+
sx: {
|
|
274
|
+
width: '100%',
|
|
275
|
+
mr: 1
|
|
276
|
+
},
|
|
277
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.LinearProgress, {
|
|
278
|
+
color: "primary",
|
|
279
|
+
variant: "determinate",
|
|
280
|
+
value: progress === null || progress === void 0 ? void 0 : progress.progress
|
|
281
|
+
})
|
|
282
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
283
|
+
sx: {
|
|
284
|
+
minWidth: 35
|
|
285
|
+
},
|
|
286
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Typography.default, {
|
|
287
|
+
variant: "body2",
|
|
288
|
+
color: "text.secondary",
|
|
289
|
+
children: [progress === null || progress === void 0 ? void 0 : progress.progress, "%"]
|
|
290
|
+
})
|
|
291
|
+
})]
|
|
292
|
+
})]
|
|
251
293
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
|
|
252
294
|
prefix: authorizeConnect.prefix,
|
|
253
295
|
open: authorizeConnect.open,
|
|
@@ -264,6 +306,4 @@ function Storage() {
|
|
|
264
306
|
})]
|
|
265
307
|
});
|
|
266
308
|
}
|
|
267
|
-
const Container = (0, _styled.default)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n overflow-y: auto;\n"])));
|
|
268
|
-
const StorageUrlTextField = (0, _styled.default)(_material.TextField)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: 56px;\n width: 580px;\n ", " {\n width: 75%;\n }\n input.MuiInputBase-input {\n width: calc(100% - 144px);\n }\n"])), props => props.theme.breakpoints.down('md'));
|
|
269
309
|
Storage.propTypes = {};
|
package/lib/blocklet/version.js
CHANGED
|
@@ -8,7 +8,7 @@ var _react = require("react");
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _semver = _interopRequireDefault(require("semver"));
|
|
10
10
|
var _notistack = require("notistack");
|
|
11
|
-
var
|
|
11
|
+
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
12
12
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
13
13
|
var _ArrowUpward = _interopRequireDefault(require("@mui/icons-material/ArrowUpward"));
|
|
14
14
|
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
@@ -130,8 +130,8 @@ function Version(_ref) {
|
|
|
130
130
|
},
|
|
131
131
|
disabled: loading,
|
|
132
132
|
onClick: () => setConfirmSetting(setting),
|
|
133
|
-
children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
134
|
-
size:
|
|
133
|
+
children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
|
|
134
|
+
size: 16
|
|
135
135
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowUpward.default, {
|
|
136
136
|
style: {
|
|
137
137
|
fontSize: 16,
|
package/lib/confirm.js
CHANGED
|
@@ -8,7 +8,7 @@ var _react = require("react");
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
10
|
var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
|
|
11
|
-
var
|
|
11
|
+
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
12
12
|
var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
|
|
13
13
|
var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
|
|
14
14
|
var _DialogContentText = _interopRequireDefault(require("@mui/material/DialogContentText"));
|
|
@@ -118,8 +118,8 @@ function ConfirmDialog(_ref) {
|
|
|
118
118
|
variant: "contained",
|
|
119
119
|
"data-cy": "submit-confirm-dialog",
|
|
120
120
|
autoFocus: true,
|
|
121
|
-
children: [loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
122
|
-
size:
|
|
121
|
+
children: [loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
|
|
122
|
+
size: 16
|
|
123
123
|
}), confirm]
|
|
124
124
|
})]
|
|
125
125
|
})]
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = FormTextInput;
|
|
7
|
-
var _react = require("react");
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
10
10
|
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
@@ -13,11 +13,21 @@ var _EditIcon = _interopRequireDefault(require("@arcblock/icons/lib/EditIcon"));
|
|
|
13
13
|
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
14
14
|
var _Done = _interopRequireDefault(require("@mui/icons-material/Done"));
|
|
15
15
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
16
|
+
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
17
|
+
var _ButtonGroup = _interopRequireDefault(require("@mui/material/ButtonGroup"));
|
|
18
|
+
var _ArrowDropDown = _interopRequireDefault(require("@mui/icons-material/ArrowDropDown"));
|
|
19
|
+
var _ClickAwayListener = _interopRequireDefault(require("@mui/material/ClickAwayListener"));
|
|
20
|
+
var _Paper = _interopRequireDefault(require("@mui/material/Paper"));
|
|
21
|
+
var _Popper = _interopRequireDefault(require("@mui/material/Popper"));
|
|
22
|
+
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
23
|
+
var _MenuList = _interopRequireDefault(require("@mui/material/MenuList"));
|
|
16
24
|
var _required = _interopRequireDefault(require("./required"));
|
|
17
25
|
var _formWrapper = _interopRequireDefault(require("./form-wrapper"));
|
|
18
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
const _excluded = ["label", "disabled", "required", "initialValue", "onChange", "placeholder", "style", "onSubmit", "secure", "formatterBeforeSubmit"];
|
|
27
|
+
const _excluded = ["label", "disabled", "required", "initialValue", "onChange", "placeholder", "style", "onSubmit", "secure", "triggers", "formatterBeforeSubmit"];
|
|
20
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
|
+
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); }
|
|
30
|
+
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; }
|
|
21
31
|
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; }
|
|
22
32
|
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; }
|
|
23
33
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -25,7 +35,91 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
25
35
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
26
36
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
27
37
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
28
|
-
function
|
|
38
|
+
function InputTriggers(_ref) {
|
|
39
|
+
let {
|
|
40
|
+
triggers,
|
|
41
|
+
onEnterEdit,
|
|
42
|
+
disabled
|
|
43
|
+
} = _ref;
|
|
44
|
+
const anchorRef = _react.default.useRef(null);
|
|
45
|
+
const [open, setOpen] = _react.default.useState(false);
|
|
46
|
+
const handleTriggerClick = cb => {
|
|
47
|
+
setOpen(false);
|
|
48
|
+
cb();
|
|
49
|
+
};
|
|
50
|
+
const handleToggle = () => {
|
|
51
|
+
setOpen(prevOpen => !prevOpen);
|
|
52
|
+
};
|
|
53
|
+
const handleClose = event => {
|
|
54
|
+
if (anchorRef.current && anchorRef.current.contains(event.target)) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
setOpen(false);
|
|
58
|
+
};
|
|
59
|
+
if (triggers.length === 0) {
|
|
60
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
61
|
+
"data-cy": "schema-form-item-edit",
|
|
62
|
+
onClick: onEnterEdit,
|
|
63
|
+
disabled: disabled,
|
|
64
|
+
size: "large",
|
|
65
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditIcon.default, {})
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
69
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_ButtonGroup.default, {
|
|
70
|
+
variant: "outlined",
|
|
71
|
+
ref: anchorRef,
|
|
72
|
+
"aria-label": "split button",
|
|
73
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
74
|
+
"data-cy": "schema-form-item-edit",
|
|
75
|
+
onClick: onEnterEdit,
|
|
76
|
+
disabled: disabled,
|
|
77
|
+
size: "large",
|
|
78
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditIcon.default, {})
|
|
79
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
80
|
+
size: "small",
|
|
81
|
+
"aria-controls": open ? 'split-button-menu' : undefined,
|
|
82
|
+
"aria-expanded": open ? 'true' : undefined,
|
|
83
|
+
onClick: handleToggle,
|
|
84
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowDropDown.default, {})
|
|
85
|
+
})]
|
|
86
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Popper.default, {
|
|
87
|
+
sx: {
|
|
88
|
+
zIndex: 9999
|
|
89
|
+
},
|
|
90
|
+
open: open,
|
|
91
|
+
anchorEl: anchorRef.current,
|
|
92
|
+
role: undefined,
|
|
93
|
+
placement: "bottom-end",
|
|
94
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Paper.default, {
|
|
95
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickAwayListener.default, {
|
|
96
|
+
onClickAway: handleClose,
|
|
97
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuList.default, {
|
|
98
|
+
id: "split-button-menu",
|
|
99
|
+
autoFocusItem: true,
|
|
100
|
+
children: triggers.map(x => /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
101
|
+
onClick: () => handleTriggerClick(x.handler),
|
|
102
|
+
children: x.title
|
|
103
|
+
}, x.key))
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
})]
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
InputTriggers.propTypes = {
|
|
111
|
+
triggers: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
112
|
+
key: _propTypes.default.string.isRequired,
|
|
113
|
+
title: _propTypes.default.string.isRequired,
|
|
114
|
+
handler: _propTypes.default.func.isRequired
|
|
115
|
+
})),
|
|
116
|
+
onEnterEdit: _propTypes.default.func.isRequired,
|
|
117
|
+
disabled: _propTypes.default.bool.isRequired
|
|
118
|
+
};
|
|
119
|
+
InputTriggers.defaultProps = {
|
|
120
|
+
triggers: []
|
|
121
|
+
};
|
|
122
|
+
function FormTextInput(_ref2) {
|
|
29
123
|
let {
|
|
30
124
|
label,
|
|
31
125
|
disabled,
|
|
@@ -36,9 +130,10 @@ function FormTextInput(_ref) {
|
|
|
36
130
|
style,
|
|
37
131
|
onSubmit,
|
|
38
132
|
secure,
|
|
133
|
+
triggers,
|
|
39
134
|
formatterBeforeSubmit
|
|
40
|
-
} =
|
|
41
|
-
rest = _objectWithoutProperties(
|
|
135
|
+
} = _ref2,
|
|
136
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
42
137
|
const [editing, setEditing] = (0, _react.useState)(false);
|
|
43
138
|
const [loading, setLoading] = (0, _react.useState)(false);
|
|
44
139
|
const [defaultValue, setDefaultValue] = (0, _react.useState)(secure && initialValue === '__encrypted__' ? '' : initialValue);
|
|
@@ -133,12 +228,10 @@ function FormTextInput(_ref) {
|
|
|
133
228
|
size: "large",
|
|
134
229
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Close.default, {})
|
|
135
230
|
})]
|
|
136
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
disabled: disabled
|
|
140
|
-
size: "large",
|
|
141
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_EditIcon.default, {})
|
|
231
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(InputTriggers, {
|
|
232
|
+
triggers: triggers,
|
|
233
|
+
onEnterEdit: () => setEditing(true),
|
|
234
|
+
disabled: disabled
|
|
142
235
|
})
|
|
143
236
|
})]
|
|
144
237
|
})]
|
|
@@ -155,6 +248,7 @@ FormTextInput.propTypes = {
|
|
|
155
248
|
required: _propTypes.default.bool,
|
|
156
249
|
disabled: _propTypes.default.bool,
|
|
157
250
|
secure: _propTypes.default.bool,
|
|
251
|
+
triggers: _propTypes.default.array,
|
|
158
252
|
formatterBeforeSubmit: _propTypes.default.func
|
|
159
253
|
};
|
|
160
254
|
FormTextInput.defaultProps = {
|
|
@@ -167,5 +261,6 @@ FormTextInput.defaultProps = {
|
|
|
167
261
|
required: false,
|
|
168
262
|
disabled: false,
|
|
169
263
|
secure: false,
|
|
264
|
+
triggers: [],
|
|
170
265
|
formatterBeforeSubmit: null
|
|
171
266
|
};
|
|
@@ -7,7 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
8
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
9
|
var _ahooks = require("ahooks");
|
|
10
|
-
var
|
|
10
|
+
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
11
11
|
var _Result = _interopRequireDefault(require("@arcblock/ux/lib/Result"));
|
|
12
12
|
var _invitationPassport = _interopRequireDefault(require("./invitation-passport"));
|
|
13
13
|
var _invitationReceive = _interopRequireDefault(require("./invitation-receive"));
|
|
@@ -30,7 +30,7 @@ function Invitation(_ref) {
|
|
|
30
30
|
} = _ref;
|
|
31
31
|
const state = (0, _ahooks.useRequest)(getDataFn);
|
|
32
32
|
if (state.loading) {
|
|
33
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
33
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {});
|
|
34
34
|
}
|
|
35
35
|
if (state.error) {
|
|
36
36
|
var _state$error, _state$error$response;
|
package/lib/issue-passport.js
CHANGED