@abtnode/ux 1.8.68 → 1.8.69-beta-54faead3
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 +55 -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 +171 -129
- 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/index.js +7 -4
- 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,79 @@ 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");
|
|
18
|
+
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
19
|
+
var _util = require("@blocklet/meta/lib/util");
|
|
19
20
|
var _blocklet = require("../../lib/contexts/blocklet");
|
|
20
21
|
var _node = require("../contexts/node");
|
|
21
22
|
var _toast = _interopRequireDefault(require("../../lib/toast"));
|
|
23
|
+
var _spaceGatewaySelector = _interopRequireDefault(require("./component/space-gateway-selector"));
|
|
22
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
var _templateObject
|
|
25
|
+
var _templateObject;
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
function
|
|
27
|
+
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); }
|
|
28
|
+
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
29
|
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
30
|
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
31
|
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
32
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
30
33
|
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
|
-
|
|
34
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
35
|
+
const Container = (0, _styled.default)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n overflow-y: auto;\n"])));
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @description 实时显示备份的进度
|
|
39
|
+
* @param {{appPid: string}} {appPid}
|
|
40
|
+
* @return {{message: string, progress: number, completed: boolean}}
|
|
41
|
+
*/
|
|
42
|
+
function useBackupProgress(_ref) {
|
|
43
|
+
let {
|
|
44
|
+
appPid
|
|
45
|
+
} = _ref;
|
|
46
|
+
const [progress, setProgress] = (0, _react.useState)({
|
|
47
|
+
message: '',
|
|
48
|
+
progress: 0,
|
|
49
|
+
completed: false
|
|
50
|
+
});
|
|
51
|
+
const node = (0, _node.useNodeContext)();
|
|
52
|
+
const webSocketClient = node.ws.getWsClient();
|
|
53
|
+
(0, _react.useEffect)(() => {
|
|
54
|
+
webSocketClient.on(_constant.BlockletEvents.backupProgress, data => {
|
|
55
|
+
if (appPid === (data === null || data === void 0 ? void 0 : data.appPid)) {
|
|
56
|
+
setProgress(preValue => _objectSpread(_objectSpread({}, preValue), data));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return () => {
|
|
60
|
+
webSocketClient.off(_constant.BlockletEvents.backupProgress);
|
|
61
|
+
};
|
|
62
|
+
}, [appPid, webSocketClient]);
|
|
63
|
+
return progress;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
*
|
|
69
|
+
* @param {import('@abtnode/client').BlockletState} blocklet
|
|
70
|
+
* @return {*}
|
|
71
|
+
*/
|
|
72
|
+
function useAppUrl(blocklet) {
|
|
73
|
+
var _blocklet$site, _blocklet$site$domain, _blocklet$site$domain2;
|
|
74
|
+
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) => {
|
|
75
|
+
if (a.accessibility.accessible && b.accessibility.accessible) {
|
|
76
|
+
return +a.isProtected - +b.isProtected;
|
|
77
|
+
}
|
|
78
|
+
return +b.accessibility.accessible - +a.accessibility.accessible;
|
|
79
|
+
})) === null || _blocklet$site$domain2 === void 0 ? void 0 : _blocklet$site$domain2.map(domainAlias => domainAlias.accessibility.url);
|
|
80
|
+
const appUrl = appUrls === null || appUrls === void 0 ? void 0 : appUrls[0];
|
|
45
81
|
|
|
82
|
+
// 授权的时候提供 appUrl, 因为 appUrl 可能很久都拿不到值,所以加一个 loading 效果过渡一下
|
|
83
|
+
return {
|
|
84
|
+
appUrl,
|
|
85
|
+
isReady: Boolean(appUrl)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function Storage() {
|
|
89
|
+
var _blocklet$environment;
|
|
46
90
|
/** @type {{ api: import('@abtnode/client').ABTNodeClient }} */
|
|
47
91
|
const {
|
|
48
92
|
api
|
|
@@ -51,41 +95,36 @@ function Storage() {
|
|
|
51
95
|
t,
|
|
52
96
|
locale
|
|
53
97
|
} = (0, _react.useContext)(_context.LocaleContext);
|
|
54
|
-
const [errorMessage, setErrorMessage] = (0, _react.useState)(false);
|
|
55
98
|
/** @type {{ blocklet: import('@abtnode/client').BlockletState }} */
|
|
56
99
|
const {
|
|
57
100
|
blocklet
|
|
58
101
|
} = (0, _blocklet.useBlockletContext)();
|
|
102
|
+
const [gatewayUrl, setGatewayUrl] = (0, _react.useState)('');
|
|
59
103
|
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
|
|
104
|
+
const progress = useBackupProgress({
|
|
105
|
+
appPid: blocklet === null || blocklet === void 0 ? void 0 : blocklet.appPid
|
|
106
|
+
});
|
|
61
107
|
const [isLoading, setIsLoading] = (0, _react.useState)(false);
|
|
108
|
+
const appName = (0, _util.getAppName)(blocklet);
|
|
109
|
+
const appDescription = (0, _util.getAppDescription)(blocklet);
|
|
62
110
|
const {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
title: appName,
|
|
67
|
-
description: appDescription
|
|
68
|
-
} = blocklet.meta;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
* @param {string} did
|
|
73
|
-
* @param {string} storageEndpoint
|
|
74
|
-
*/
|
|
111
|
+
appUrl,
|
|
112
|
+
isReady
|
|
113
|
+
} = useAppUrl(blocklet);
|
|
75
114
|
async function saveStorageEndpoint(did, storageEndpoint) {
|
|
76
115
|
await api.configBlocklet({
|
|
77
116
|
input: {
|
|
78
117
|
did: [did],
|
|
79
118
|
configs: [{
|
|
80
119
|
key: _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACES_URL,
|
|
81
|
-
value:
|
|
120
|
+
value: gatewayUrl
|
|
82
121
|
}, {
|
|
83
122
|
key: _constant.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT,
|
|
84
123
|
value: storageEndpoint
|
|
85
124
|
}]
|
|
86
125
|
}
|
|
87
126
|
}).then(() => {
|
|
88
|
-
_toast.default.success(t('storage.
|
|
127
|
+
_toast.default.success(t('storage.spaces.connected', locale));
|
|
89
128
|
}).catch(error => {
|
|
90
129
|
console.error(error);
|
|
91
130
|
_toast.default.error(error.message);
|
|
@@ -101,49 +140,41 @@ function Storage() {
|
|
|
101
140
|
}, 3000);
|
|
102
141
|
};
|
|
103
142
|
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
|
-
}
|
|
143
|
+
open: false
|
|
115
144
|
});
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
145
|
+
|
|
146
|
+
// eslint-disable-next-line no-shadow
|
|
147
|
+
const handleOnClickAuthorize = async gatewayUrl => {
|
|
148
|
+
if ((0, _lodash.isEmpty)(gatewayUrl)) {
|
|
149
|
+
_toast.default.error(t('storage.spaces.addressCannotEmpty', locale));
|
|
119
150
|
return;
|
|
120
151
|
}
|
|
152
|
+
setGatewayUrl(gatewayUrl);
|
|
121
153
|
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
122
|
-
|
|
123
|
-
|
|
154
|
+
action: 'one-click-authorization',
|
|
155
|
+
checkTimeout: 1000 * 300,
|
|
156
|
+
prefix: (0, _urlJoin.default)(gatewayUrl, 'space/api/did'),
|
|
157
|
+
baseUrl: new URL(gatewayUrl).origin,
|
|
124
158
|
checkFn: _axios.default.create({
|
|
125
|
-
baseURL: (0, _urlJoin.default)(
|
|
159
|
+
baseURL: (0, _urlJoin.default)(gatewayUrl, 'space')
|
|
126
160
|
}).get,
|
|
127
161
|
extraParams: {
|
|
128
|
-
appDid,
|
|
162
|
+
appDid: blocklet.appPid,
|
|
129
163
|
appName,
|
|
130
164
|
appDescription,
|
|
131
|
-
scopes: 'list:object read:object write:object'
|
|
165
|
+
scopes: 'list:object read:object write:object',
|
|
166
|
+
appUrl,
|
|
167
|
+
referrer: window.location.href
|
|
168
|
+
},
|
|
169
|
+
onClose: () => {
|
|
170
|
+
// eslint-disable-next-line no-shadow
|
|
171
|
+
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
172
|
+
open: false
|
|
173
|
+
}));
|
|
132
174
|
},
|
|
133
175
|
open: true
|
|
134
176
|
}));
|
|
135
177
|
};
|
|
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
178
|
const onBackup = async () => {
|
|
148
179
|
try {
|
|
149
180
|
if (isLoading) {
|
|
@@ -152,10 +183,10 @@ function Storage() {
|
|
|
152
183
|
setIsLoading(true);
|
|
153
184
|
await api.backupToSpaces({
|
|
154
185
|
input: {
|
|
155
|
-
|
|
186
|
+
appPid: blocklet.appPid
|
|
156
187
|
}
|
|
157
188
|
});
|
|
158
|
-
_toast.default.success(t('storage.
|
|
189
|
+
_toast.default.success(t('storage.spaces.backupSuccessfully'));
|
|
159
190
|
} catch (error) {
|
|
160
191
|
_toast.default.error(error.message);
|
|
161
192
|
console.error(error);
|
|
@@ -166,89 +197,102 @@ function Storage() {
|
|
|
166
197
|
(0, _react.useEffect)(() => {
|
|
167
198
|
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
168
199
|
messages: {
|
|
169
|
-
title: t('storage.
|
|
200
|
+
title: t('storage.spaces.authorize.title', {
|
|
170
201
|
appName
|
|
171
202
|
}),
|
|
172
|
-
scan: t('storage.
|
|
203
|
+
scan: t('storage.spaces.authorize.scan', {
|
|
173
204
|
appName
|
|
174
205
|
}),
|
|
175
206
|
confirm: '',
|
|
176
207
|
success: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
177
208
|
gutterBottom: true,
|
|
178
|
-
children: t('storage.
|
|
209
|
+
children: t('storage.spaces.authorize.success')
|
|
179
210
|
})
|
|
180
211
|
}
|
|
181
212
|
}));
|
|
182
213
|
}, [appName, locale, t]);
|
|
214
|
+
(0, _react.useEffect)(() => {
|
|
215
|
+
if (progress !== null && progress !== void 0 && progress.completed) {
|
|
216
|
+
setIsLoading(false);
|
|
217
|
+
} else if (progress !== null && progress !== void 0 && progress.message) {
|
|
218
|
+
setIsLoading(true);
|
|
219
|
+
}
|
|
220
|
+
}, [progress === null || progress === void 0 ? void 0 : progress.completed, progress === null || progress === void 0 ? void 0 : progress.message, t]);
|
|
183
221
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
},
|
|
189
|
-
label: t('storage.didSpaces.label'),
|
|
190
|
-
value: didSpacesUrl,
|
|
191
|
-
onChange: onDidSpacesUrlChange,
|
|
192
|
-
autoFocus: true,
|
|
193
|
-
size: "small",
|
|
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",
|
|
222
|
+
style: {
|
|
223
|
+
maxWidth: '720px'
|
|
224
|
+
},
|
|
225
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_spaceGatewaySelector.default, {
|
|
219
226
|
sx: {
|
|
220
|
-
marginTop: '
|
|
227
|
+
marginTop: '24px',
|
|
228
|
+
marginBottom: '40px'
|
|
221
229
|
},
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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, {
|
|
230
|
+
onSelect: handleOnClickAuthorize,
|
|
231
|
+
endpoint: endpoint,
|
|
232
|
+
loading: !isReady
|
|
233
|
+
}), endpoint && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
234
|
+
mt: 3,
|
|
235
235
|
display: "flex",
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
236
|
+
alignItems: "center",
|
|
237
|
+
justifyContent: "space-between",
|
|
238
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
239
|
+
display: "inline",
|
|
240
|
+
children: [t('storage.spaces.tips'), ": \xA0", ' ', /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
241
|
+
display: "inline",
|
|
242
|
+
color: "primary.main",
|
|
243
|
+
fontWeight: "fontWeightBold",
|
|
244
|
+
children: t('storage.spaces.connected')
|
|
245
|
+
})]
|
|
246
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
243
247
|
onClick: onBackup,
|
|
244
248
|
loading: isLoading,
|
|
245
249
|
variant: "contained",
|
|
246
250
|
color: "primary",
|
|
247
251
|
"data-cy": "add-domain-alias",
|
|
248
252
|
disabled: !endpoint || isLoading,
|
|
249
|
-
children: t('storage.
|
|
250
|
-
})
|
|
253
|
+
children: t('storage.spaces.backup')
|
|
254
|
+
})]
|
|
255
|
+
}), isLoading && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
256
|
+
sx: {
|
|
257
|
+
overflow: 'hidden'
|
|
258
|
+
},
|
|
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, {
|
|
294
|
+
forceConnected: false,
|
|
295
|
+
saveConnect: false,
|
|
252
296
|
prefix: authorizeConnect.prefix,
|
|
253
297
|
open: authorizeConnect.open,
|
|
254
298
|
popup: true,
|
|
@@ -264,6 +308,4 @@ function Storage() {
|
|
|
264
308
|
})]
|
|
265
309
|
});
|
|
266
310
|
}
|
|
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
311
|
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