@abtnode/ux 1.8.68-beta-500af7e5 → 1.8.69-beta-e0666d0d
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/storage.js
CHANGED
|
@@ -15,6 +15,8 @@ var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
|
15
15
|
var _lodash = require("lodash");
|
|
16
16
|
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
17
17
|
var _material = require("@mui/material");
|
|
18
|
+
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
19
|
+
var _util = require("@blocklet/meta/lib/util");
|
|
18
20
|
var _blocklet = require("../../lib/contexts/blocklet");
|
|
19
21
|
var _node = require("../contexts/node");
|
|
20
22
|
var _toast = _interopRequireDefault(require("../../lib/toast"));
|
|
@@ -34,12 +36,12 @@ const Container = (0, _styled.default)('div')(_templateObject || (_templateObjec
|
|
|
34
36
|
|
|
35
37
|
/**
|
|
36
38
|
* @description 实时显示备份的进度
|
|
37
|
-
* @param {{
|
|
39
|
+
* @param {{appPid: string}} {appPid}
|
|
38
40
|
* @return {{message: string, progress: number, completed: boolean}}
|
|
39
41
|
*/
|
|
40
42
|
function useBackupProgress(_ref) {
|
|
41
43
|
let {
|
|
42
|
-
|
|
44
|
+
appPid
|
|
43
45
|
} = _ref;
|
|
44
46
|
const [progress, setProgress] = (0, _react.useState)({
|
|
45
47
|
message: '',
|
|
@@ -50,14 +52,14 @@ function useBackupProgress(_ref) {
|
|
|
50
52
|
const webSocketClient = node.ws.getWsClient();
|
|
51
53
|
(0, _react.useEffect)(() => {
|
|
52
54
|
webSocketClient.on(_constant.BlockletEvents.backupProgress, data => {
|
|
53
|
-
if (
|
|
55
|
+
if (appPid === (data === null || data === void 0 ? void 0 : data.appPid)) {
|
|
54
56
|
setProgress(preValue => _objectSpread(_objectSpread({}, preValue), data));
|
|
55
57
|
}
|
|
56
58
|
});
|
|
57
59
|
return () => {
|
|
58
60
|
webSocketClient.off(_constant.BlockletEvents.backupProgress);
|
|
59
61
|
};
|
|
60
|
-
}, [
|
|
62
|
+
}, [appPid, webSocketClient]);
|
|
61
63
|
return progress;
|
|
62
64
|
}
|
|
63
65
|
|
|
@@ -100,16 +102,11 @@ function Storage() {
|
|
|
100
102
|
const [gatewayUrl, setGatewayUrl] = (0, _react.useState)('');
|
|
101
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) || '');
|
|
102
104
|
const progress = useBackupProgress({
|
|
103
|
-
|
|
105
|
+
appPid: blocklet === null || blocklet === void 0 ? void 0 : blocklet.appPid
|
|
104
106
|
});
|
|
105
107
|
const [isLoading, setIsLoading] = (0, _react.useState)(false);
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
} = blocklet;
|
|
109
|
-
const {
|
|
110
|
-
title: appName,
|
|
111
|
-
description: appDescription
|
|
112
|
-
} = blocklet.meta;
|
|
108
|
+
const appName = (0, _util.getAppName)(blocklet);
|
|
109
|
+
const appDescription = (0, _util.getAppDescription)(blocklet);
|
|
113
110
|
const {
|
|
114
111
|
appUrl,
|
|
115
112
|
isReady
|
|
@@ -162,7 +159,7 @@ function Storage() {
|
|
|
162
159
|
baseURL: (0, _urlJoin.default)(gatewayUrl, 'space')
|
|
163
160
|
}).get,
|
|
164
161
|
extraParams: {
|
|
165
|
-
appDid,
|
|
162
|
+
appDid: blocklet.appPid,
|
|
166
163
|
appName,
|
|
167
164
|
appDescription,
|
|
168
165
|
scopes: 'list:object read:object write:object',
|
|
@@ -186,7 +183,7 @@ function Storage() {
|
|
|
186
183
|
setIsLoading(true);
|
|
187
184
|
await api.backupToSpaces({
|
|
188
185
|
input: {
|
|
189
|
-
|
|
186
|
+
appPid: blocklet.appPid
|
|
190
187
|
}
|
|
191
188
|
});
|
|
192
189
|
_toast.default.success(t('storage.spaces.backupSuccessfully'));
|
|
@@ -246,7 +243,7 @@ function Storage() {
|
|
|
246
243
|
fontWeight: "fontWeightBold",
|
|
247
244
|
children: t('storage.spaces.connected')
|
|
248
245
|
})]
|
|
249
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
246
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
250
247
|
onClick: onBackup,
|
|
251
248
|
loading: isLoading,
|
|
252
249
|
variant: "contained",
|
|
@@ -256,6 +253,9 @@ function Storage() {
|
|
|
256
253
|
children: t('storage.spaces.backup')
|
|
257
254
|
})]
|
|
258
255
|
}), isLoading && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
256
|
+
sx: {
|
|
257
|
+
overflow: 'hidden'
|
|
258
|
+
},
|
|
259
259
|
display: "flex",
|
|
260
260
|
flexDirection: "column",
|
|
261
261
|
justifyContent: "center",
|
|
@@ -291,6 +291,8 @@ function Storage() {
|
|
|
291
291
|
})]
|
|
292
292
|
})]
|
|
293
293
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
|
|
294
|
+
forceConnected: false,
|
|
295
|
+
saveConnect: false,
|
|
294
296
|
prefix: authorizeConnect.prefix,
|
|
295
297
|
open: authorizeConnect.open,
|
|
296
298
|
popup: true,
|
|
@@ -27,6 +27,7 @@ var _constant = require("@abtnode/constant");
|
|
|
27
27
|
var _toast = _interopRequireDefault(require("../../toast"));
|
|
28
28
|
var _node = require("../../contexts/node");
|
|
29
29
|
var _team = require("../../contexts/team");
|
|
30
|
+
var _blocklet = require("../../contexts/blocklet");
|
|
30
31
|
var _permission = _interopRequireDefault(require("../../permission"));
|
|
31
32
|
var _util = require("../../util");
|
|
32
33
|
var _inviteMember = _interopRequireDefault(require("./invite-member"));
|
|
@@ -52,14 +53,14 @@ const getCount = (counts, name) => {
|
|
|
52
53
|
const item = counts.find(x => x.key === name);
|
|
53
54
|
return (item === null || item === void 0 ? void 0 : item.value) || 0;
|
|
54
55
|
};
|
|
55
|
-
const isFromExternal = (user,
|
|
56
|
+
const isFromExternal = (user, appIdList) => {
|
|
56
57
|
const list = user.passports || [];
|
|
57
58
|
if (!list.length) {
|
|
58
59
|
return false;
|
|
59
60
|
}
|
|
60
61
|
return !list.some(z => {
|
|
61
62
|
var _z$issuer;
|
|
62
|
-
return ((_z$issuer = z.issuer) === null || _z$issuer === void 0 ? void 0 : _z$issuer.id)
|
|
63
|
+
return appIdList.includes((_z$issuer = z.issuer) === null || _z$issuer === void 0 ? void 0 : _z$issuer.id);
|
|
63
64
|
});
|
|
64
65
|
};
|
|
65
66
|
function SimpleInfo(_ref) {
|
|
@@ -113,9 +114,11 @@ function MemberList(_ref2) {
|
|
|
113
114
|
let {
|
|
114
115
|
type
|
|
115
116
|
} = _ref2;
|
|
117
|
+
const {
|
|
118
|
+
appIdList
|
|
119
|
+
} = (0, _blocklet.useBlockletContext)();
|
|
116
120
|
const {
|
|
117
121
|
teamDid,
|
|
118
|
-
teamIssuerDid,
|
|
119
122
|
invitations,
|
|
120
123
|
roles,
|
|
121
124
|
refresh,
|
|
@@ -184,7 +187,7 @@ function MemberList(_ref2) {
|
|
|
184
187
|
}).then(res => {
|
|
185
188
|
setLoading(false);
|
|
186
189
|
(res.users || []).forEach(x => {
|
|
187
|
-
x.isFromExternal = isFromExternal(x,
|
|
190
|
+
x.isFromExternal = isFromExternal(x, appIdList);
|
|
188
191
|
x.avatar = (0, _util2.parseAvatar)(x.avatar, teamDid, inService);
|
|
189
192
|
|
|
190
193
|
// for backwards compatibility
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.8.
|
|
6
|
+
"version": "1.8.69-beta-e0666d0d",
|
|
7
7
|
"description": "UX components shared across abtnode packages",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@abtnode/auth": "1.8.
|
|
25
|
-
"@abtnode/constant": "1.8.
|
|
26
|
-
"@abtnode/util": "1.8.
|
|
24
|
+
"@abtnode/auth": "1.8.69-beta-e0666d0d",
|
|
25
|
+
"@abtnode/constant": "1.8.69-beta-e0666d0d",
|
|
26
|
+
"@abtnode/util": "1.8.69-beta-e0666d0d",
|
|
27
27
|
"@arcblock/did-connect": "^2.5.5",
|
|
28
28
|
"@arcblock/did-motif": "^1.1.10",
|
|
29
29
|
"@arcblock/icons": "^2.5.5",
|
|
30
30
|
"@arcblock/terminal": "^2.5.5",
|
|
31
31
|
"@arcblock/ux": "^2.5.5",
|
|
32
|
-
"@blocklet/constant": "1.8.
|
|
32
|
+
"@blocklet/constant": "1.8.69-beta-e0666d0d",
|
|
33
33
|
"@blocklet/launcher-layout": "^1.9.61",
|
|
34
34
|
"@blocklet/list": "^0.11.4",
|
|
35
|
-
"@blocklet/meta": "1.8.
|
|
35
|
+
"@blocklet/meta": "1.8.69-beta-e0666d0d",
|
|
36
36
|
"@blocklet/ui-react": "^2.5.5",
|
|
37
37
|
"@emotion/react": "^11.10.4",
|
|
38
38
|
"@emotion/styled": "^11.10.4",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"@babel/preset-react": "^7.18.6",
|
|
87
87
|
"babel-plugin-inline-react-svg": "^1.1.2"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "acf0373591eaa3aff76483edc4e648afc543f1f7"
|
|
90
90
|
}
|