@abtnode/ux 1.16.11-beta-f9719c31 → 1.16.11-beta-3c2391e3
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.
|
@@ -17,7 +17,7 @@ var _propTypes = require("prop-types");
|
|
|
17
17
|
var _node = require("../../contexts/node");
|
|
18
18
|
var _blocklet = require("../../../lib/contexts/blocklet");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
const _excluded = ["progress"];
|
|
20
|
+
const _excluded = ["progress", "spaceGateways"];
|
|
21
21
|
/**
|
|
22
22
|
* @description
|
|
23
23
|
* @param {{ blocklet: import('@abtnode/client').BlockletState }} { blocklet }
|
|
@@ -34,6 +34,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
34
34
|
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; }
|
|
35
35
|
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; }
|
|
36
36
|
function useBackups(_ref) {
|
|
37
|
+
var _blocklet$meta2;
|
|
37
38
|
let {
|
|
38
39
|
blocklet,
|
|
39
40
|
loading,
|
|
@@ -59,39 +60,26 @@ function useBackups(_ref) {
|
|
|
59
60
|
// eslint-disable-next-line require-await
|
|
60
61
|
(0, _ahooks.useAsyncEffect)(async () => {
|
|
61
62
|
fetchBackups();
|
|
62
|
-
}, [blocklet, progress, loading]);
|
|
63
|
+
}, [blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta2 = blocklet.meta) === null || _blocklet$meta2 === void 0 ? void 0 : _blocklet$meta2.did, progress, loading]);
|
|
63
64
|
return {
|
|
64
65
|
backups
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const {
|
|
78
|
-
spaceGateways: _spaceGateways
|
|
79
|
-
} = await api.getBlockletSpaceGateways({
|
|
80
|
-
input: {
|
|
81
|
-
did: blocklet.meta.did
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
setSpaceGateways([...(_spaceGateways !== null && _spaceGateways !== void 0 ? _spaceGateways : [])]);
|
|
85
|
-
}, [blocklet]);
|
|
86
|
-
return {
|
|
87
|
-
spaceGateways
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
function SpacesBackupRecords(_ref3) {
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @description
|
|
71
|
+
* @param {{
|
|
72
|
+
* progress: any,
|
|
73
|
+
* spaceGateways: Array<import('./connected').SpaceGateway>
|
|
74
|
+
* }} { progress, spaceGateways, ...rest }
|
|
75
|
+
* @return {*}
|
|
76
|
+
*/
|
|
77
|
+
function SpacesBackupRecords(_ref2) {
|
|
91
78
|
let {
|
|
92
|
-
progress
|
|
93
|
-
|
|
94
|
-
|
|
79
|
+
progress,
|
|
80
|
+
spaceGateways
|
|
81
|
+
} = _ref2,
|
|
82
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
95
83
|
const {
|
|
96
84
|
t,
|
|
97
85
|
locale
|
|
@@ -105,11 +93,6 @@ function SpacesBackupRecords(_ref3) {
|
|
|
105
93
|
blocklet,
|
|
106
94
|
progress
|
|
107
95
|
});
|
|
108
|
-
const {
|
|
109
|
-
spaceGateways
|
|
110
|
-
} = useSpaceGateways({
|
|
111
|
-
blocklet
|
|
112
|
-
});
|
|
113
96
|
const columns = [{
|
|
114
97
|
label: 'DID Spaces',
|
|
115
98
|
name: 'target',
|
|
@@ -206,11 +189,16 @@ function SpacesBackupRecords(_ref3) {
|
|
|
206
189
|
}), " \xA0", /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
207
190
|
style: {
|
|
208
191
|
display: 'flex',
|
|
209
|
-
alignItems: 'center'
|
|
192
|
+
alignItems: 'center',
|
|
193
|
+
flexShrink: 0
|
|
210
194
|
},
|
|
211
195
|
title: message,
|
|
212
196
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Icon, {
|
|
213
197
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_HelpOutline.default, {
|
|
198
|
+
style: {
|
|
199
|
+
width: '24px',
|
|
200
|
+
height: '24px'
|
|
201
|
+
},
|
|
214
202
|
color: "error"
|
|
215
203
|
})
|
|
216
204
|
})
|
|
@@ -251,7 +239,8 @@ function SpacesBackupRecords(_ref3) {
|
|
|
251
239
|
});
|
|
252
240
|
}
|
|
253
241
|
SpacesBackupRecords.propTypes = {
|
|
254
|
-
progress: _propTypes.object.isRequired
|
|
242
|
+
progress: _propTypes.object.isRequired,
|
|
243
|
+
spaceGateways: _propTypes.array.isRequired
|
|
255
244
|
};
|
|
256
245
|
var _default = SpacesBackupRecords;
|
|
257
246
|
exports.default = _default;
|
|
@@ -11,12 +11,12 @@ var _context = require("@arcblock/ux/lib/Locale/context");
|
|
|
11
11
|
var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
|
|
12
12
|
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
13
13
|
var _isUrl = _interopRequireDefault(require("is-url"));
|
|
14
|
-
var _ahooks = require("ahooks");
|
|
15
14
|
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
16
15
|
var _constant = require("@blocklet/constant");
|
|
17
16
|
var _SplitButton = _interopRequireDefault(require("@arcblock/ux/lib/SplitButton"));
|
|
18
17
|
var _Dialog = _interopRequireDefault(require("@arcblock/ux/lib/Dialog"));
|
|
19
18
|
var _Alert = _interopRequireDefault(require("@arcblock/ux/lib/Alert"));
|
|
19
|
+
var _propTypes = require("prop-types");
|
|
20
20
|
var _blocklet = require("../../../lib/contexts/blocklet");
|
|
21
21
|
var _api = require("../../util/api");
|
|
22
22
|
var _util = require("../../util");
|
|
@@ -24,6 +24,15 @@ var _node = require("../../contexts/node");
|
|
|
24
24
|
var _useBlockletInfoForConnectDidSpaces = _interopRequireDefault(require("../../hooks/use-blocklet-info-for-connect-did-spaces"));
|
|
25
25
|
var _spaces = require("../../util/spaces");
|
|
26
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
+
const _excluded = ["spaceGateways", "refreshSpaceGateways"];
|
|
28
|
+
/**
|
|
29
|
+
* @description
|
|
30
|
+
* @param {{
|
|
31
|
+
* spaceGateways: Array<import('./connected').SpaceGateway>,
|
|
32
|
+
* refreshSpaceGateways: () => void,
|
|
33
|
+
* }} { spaceGateways, refreshSpaceGateways, ...rest }
|
|
34
|
+
* @return {*}
|
|
35
|
+
*/
|
|
27
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
37
|
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); }
|
|
29
38
|
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; }
|
|
@@ -32,14 +41,16 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
32
41
|
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; }
|
|
33
42
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
34
43
|
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); }
|
|
35
|
-
function
|
|
44
|
+
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; }
|
|
45
|
+
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; }
|
|
36
46
|
function ConnectTo(_ref) {
|
|
37
|
-
let
|
|
47
|
+
let {
|
|
48
|
+
spaceGateways,
|
|
49
|
+
refreshSpaceGateways
|
|
50
|
+
} = _ref,
|
|
51
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
38
52
|
const {
|
|
39
|
-
blocklet
|
|
40
|
-
actions: {
|
|
41
|
-
refreshBlocklet
|
|
42
|
-
}
|
|
53
|
+
blocklet
|
|
43
54
|
} = (0, _blocklet.useBlockletContext)();
|
|
44
55
|
const {
|
|
45
56
|
info,
|
|
@@ -49,23 +60,11 @@ function ConnectTo(_ref) {
|
|
|
49
60
|
t,
|
|
50
61
|
locale
|
|
51
62
|
} = (0, _context.useLocaleContext)();
|
|
52
|
-
const [spaceGateways, setSpaceGateways] = (0, _react.useState)( /** @type {Array<SpaceGateway>} */
|
|
53
|
-
[]);
|
|
54
63
|
const spaceBackupEndpoint = (0, _react.useMemo)(() => (0, _spaces.getSpaceBackupEndpoint)(blocklet === null || blocklet === void 0 ? void 0 : blocklet.environments), [blocklet]);
|
|
55
64
|
const [url, setUrl] = (0, _react.useState)('');
|
|
56
65
|
const [loading, setLoading] = (0, _react.useState)(false);
|
|
57
66
|
const [open, setOpen] = (0, _react.useState)(false);
|
|
58
67
|
const [errorMessage, setErrorMessage] = (0, _react.useState)('');
|
|
59
|
-
(0, _ahooks.useAsyncEffect)(async () => {
|
|
60
|
-
const {
|
|
61
|
-
spaceGateways: _spaceGateways
|
|
62
|
-
} = await nodeApi.getBlockletSpaceGateways({
|
|
63
|
-
input: {
|
|
64
|
-
did: blocklet.meta.did
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
setSpaceGateways(_spaceGateways !== null && _spaceGateways !== void 0 ? _spaceGateways : []);
|
|
68
|
-
}, [blocklet]);
|
|
69
68
|
const blockletInfo = (0, _useBlockletInfoForConnectDidSpaces.default)({
|
|
70
69
|
blocklet
|
|
71
70
|
});
|
|
@@ -131,7 +130,7 @@ function ConnectTo(_ref) {
|
|
|
131
130
|
}));
|
|
132
131
|
const endpoint = decrypt(response.endpoint);
|
|
133
132
|
const space = response.space ? decrypt(response.space) : {};
|
|
134
|
-
await
|
|
133
|
+
await addSpaceGateway(_objectSpread(_objectSpread({
|
|
135
134
|
endpoint
|
|
136
135
|
}, {
|
|
137
136
|
did: (0, _spaces.getDIDSpaceDidFromEndpoint)(endpoint),
|
|
@@ -149,7 +148,7 @@ function ConnectTo(_ref) {
|
|
|
149
148
|
* }} {endpoint, name, did}
|
|
150
149
|
* @returns {Promise<void>}
|
|
151
150
|
*/
|
|
152
|
-
const
|
|
151
|
+
const addSpaceGateway = async _ref2 => {
|
|
153
152
|
var _endpoint$replace, _endpoint$replace$tri, _spaceGateway$name;
|
|
154
153
|
let {
|
|
155
154
|
endpoint,
|
|
@@ -198,7 +197,7 @@ function ConnectTo(_ref) {
|
|
|
198
197
|
_Toast.default.success(t('storage.spaces.connectedWithName', {
|
|
199
198
|
name: (_spaceGateway$name = spaceGateway === null || spaceGateway === void 0 ? void 0 : spaceGateway.name) !== null && _spaceGateway$name !== void 0 ? _spaceGateway$name : 'DID Spaces'
|
|
200
199
|
}));
|
|
201
|
-
|
|
200
|
+
refreshSpaceGateways();
|
|
202
201
|
};
|
|
203
202
|
const handleUseWalletConnect = () => {
|
|
204
203
|
setAuthorizeFromNftConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
@@ -372,6 +371,9 @@ function ConnectTo(_ref) {
|
|
|
372
371
|
})]
|
|
373
372
|
});
|
|
374
373
|
}
|
|
375
|
-
ConnectTo.propTypes = {
|
|
374
|
+
ConnectTo.propTypes = {
|
|
375
|
+
spaceGateways: _propTypes.array.isRequired,
|
|
376
|
+
refreshSpaceGateways: _propTypes.func.isRequired
|
|
377
|
+
};
|
|
376
378
|
var _default = ConnectTo;
|
|
377
379
|
exports.default = _default;
|
|
@@ -22,6 +22,63 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
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); }
|
|
24
24
|
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; }
|
|
25
|
+
/**
|
|
26
|
+
* @description
|
|
27
|
+
* @param {{
|
|
28
|
+
* blockletDid: string,
|
|
29
|
+
* setLoading: (bool: boolean) => void,
|
|
30
|
+
* refreshBlocklet: Function
|
|
31
|
+
* }} { blockletDid, setLoading = () => undefined, refreshBlocklet }
|
|
32
|
+
* @return {{
|
|
33
|
+
* spaceGateways: Array<SpaceGateway>
|
|
34
|
+
* refreshSpaceGateways: Function
|
|
35
|
+
* }} {spaceGateways}
|
|
36
|
+
*/function useSpaceGateways(_ref) {
|
|
37
|
+
let {
|
|
38
|
+
blockletDid,
|
|
39
|
+
setLoading = () => undefined
|
|
40
|
+
} = _ref;
|
|
41
|
+
const [refresh, setRefresh] = (0, _react.useState)(false);
|
|
42
|
+
const [spaceGateways, setSpaceGateways] = (0, _react.useState)([]);
|
|
43
|
+
const {
|
|
44
|
+
api: nodeApi
|
|
45
|
+
} = (0, _node.useNodeContext)();
|
|
46
|
+
const refreshSpaceGateways = () => {
|
|
47
|
+
setRefresh(x => !x);
|
|
48
|
+
};
|
|
49
|
+
(0, _ahooks.useAsyncEffect)(async () => {
|
|
50
|
+
try {
|
|
51
|
+
if (!blockletDid) {
|
|
52
|
+
setSpaceGateways([]);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
setLoading(true);
|
|
56
|
+
const {
|
|
57
|
+
spaceGateways: _spaceGateways
|
|
58
|
+
} = await nodeApi.getBlockletSpaceGateways({
|
|
59
|
+
input: {
|
|
60
|
+
did: blockletDid
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const latestSpaceGateways = await (0, _spaceGateway.updateSpaceGatewaysFromDIDSpaces)({
|
|
64
|
+
blockletDid,
|
|
65
|
+
nodeApi,
|
|
66
|
+
spaceGateways: _spaceGateways
|
|
67
|
+
});
|
|
68
|
+
setSpaceGateways(latestSpaceGateways !== null && latestSpaceGateways !== void 0 ? latestSpaceGateways : []);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.error(error);
|
|
71
|
+
_Toast.default.error((0, _util.formatError)(error));
|
|
72
|
+
} finally {
|
|
73
|
+
setLoading(false);
|
|
74
|
+
}
|
|
75
|
+
}, [blockletDid, refresh]);
|
|
76
|
+
return {
|
|
77
|
+
refreshSpaceGateways,
|
|
78
|
+
spaceGateways
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
25
82
|
/**
|
|
26
83
|
* @typedef {{
|
|
27
84
|
* did: string,
|
|
@@ -30,7 +87,10 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
30
87
|
* endpoint: string
|
|
31
88
|
* protected?: boolean,
|
|
32
89
|
* }} SpaceGateway
|
|
33
|
-
*/
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
function Connected() {
|
|
93
|
+
var _blocklet$meta;
|
|
34
94
|
const {
|
|
35
95
|
t
|
|
36
96
|
} = (0, _context.useLocaleContext)();
|
|
@@ -44,38 +104,20 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
44
104
|
const {
|
|
45
105
|
api: nodeApi
|
|
46
106
|
} = (0, _node.useNodeContext)();
|
|
47
|
-
const [spaceGateways, setSpaceGateways] = (0, _react.useState)( /** @type {Array<SpaceGateway>} */
|
|
48
|
-
[]);
|
|
49
107
|
const backupEndpoint = (0, _react.useMemo)(() => (0, _spaces.getSpaceBackupEndpoint)(blocklet === null || blocklet === void 0 ? void 0 : blocklet.environments), [blocklet]);
|
|
50
108
|
const progress = (0, _useBackupProgress.default)({
|
|
51
109
|
appDid: blocklet === null || blocklet === void 0 ? void 0 : blocklet.appDid
|
|
52
110
|
});
|
|
53
111
|
const [loading, setLoading] = (0, _react.useState)(false);
|
|
112
|
+
const {
|
|
113
|
+
spaceGateways,
|
|
114
|
+
refreshSpaceGateways
|
|
115
|
+
} = useSpaceGateways({
|
|
116
|
+
blockletDid: blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.did,
|
|
117
|
+
setLoading,
|
|
118
|
+
refreshBlocklet
|
|
119
|
+
});
|
|
54
120
|
const shouldShowLoading = loading && !(spaceGateways !== null && spaceGateways !== void 0 && spaceGateways.length);
|
|
55
|
-
(0, _ahooks.useAsyncEffect)(async () => {
|
|
56
|
-
try {
|
|
57
|
-
setLoading(true);
|
|
58
|
-
const {
|
|
59
|
-
spaceGateways: _spaceGateways
|
|
60
|
-
} = await nodeApi.getBlockletSpaceGateways({
|
|
61
|
-
input: {
|
|
62
|
-
did: blocklet.meta.did
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
const latestSpaceGateways = await (0, _spaceGateway.updateSpaceGatewaysFromDIDSpaces)({
|
|
66
|
-
blockletDid: blocklet.meta.did,
|
|
67
|
-
nodeApi,
|
|
68
|
-
spaceGateways: _spaceGateways,
|
|
69
|
-
refreshBlocklet
|
|
70
|
-
});
|
|
71
|
-
setSpaceGateways(latestSpaceGateways !== null && latestSpaceGateways !== void 0 ? latestSpaceGateways : []);
|
|
72
|
-
} catch (error) {
|
|
73
|
-
console.error(error);
|
|
74
|
-
_Toast.default.error((0, _util.formatError)(error));
|
|
75
|
-
} finally {
|
|
76
|
-
setLoading(false);
|
|
77
|
-
}
|
|
78
|
-
}, [blocklet]);
|
|
79
121
|
|
|
80
122
|
/**
|
|
81
123
|
*
|
|
@@ -99,7 +141,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
99
141
|
_Toast.default.success(t('storage.spaces.gateway.delete.succeeded', {
|
|
100
142
|
name: "(".concat(spaceGateway.name, ")")
|
|
101
143
|
}));
|
|
102
|
-
|
|
144
|
+
refreshSpaceGateways();
|
|
103
145
|
};
|
|
104
146
|
const onBackupNow = async () => {
|
|
105
147
|
await nodeApi.backupBlocklet({
|
|
@@ -126,7 +168,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
126
168
|
style: {
|
|
127
169
|
fontSize: '1rem'
|
|
128
170
|
},
|
|
129
|
-
display: "inline-flex"
|
|
171
|
+
display: "inline-flex",
|
|
172
|
+
spaceGateways: spaceGateways,
|
|
173
|
+
refreshSpaceGateways: refreshSpaceGateways
|
|
130
174
|
})]
|
|
131
175
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
132
176
|
children: shouldShowLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
@@ -142,13 +186,15 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
142
186
|
connected: spaceGateways.findIndex(s => s.endpoint === backupEndpoint) === index,
|
|
143
187
|
onDelete: onDeleteGateway,
|
|
144
188
|
onBackupNow: onBackupNow,
|
|
145
|
-
progress: progress
|
|
189
|
+
progress: progress,
|
|
190
|
+
refreshSpaceGateways: refreshSpaceGateways
|
|
146
191
|
}, spaceGateway.endpoint);
|
|
147
192
|
})
|
|
148
193
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_backups.default, {
|
|
149
194
|
sx: {
|
|
150
195
|
marginTop: '24px'
|
|
151
196
|
},
|
|
197
|
+
spaceGateways: spaceGateways,
|
|
152
198
|
progress: progress
|
|
153
199
|
})]
|
|
154
200
|
});
|
|
@@ -30,7 +30,7 @@ var _useBlockletInfoForConnectDidSpaces = _interopRequireDefault(require("../../
|
|
|
30
30
|
var _spaces = require("../../util/spaces");
|
|
31
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
32
32
|
var _templateObject;
|
|
33
|
-
const _excluded = ["spaceGateway", "connected", "progress", "onDelete", "onBackupNow"];
|
|
33
|
+
const _excluded = ["spaceGateway", "connected", "progress", "onDelete", "onBackupNow", "refreshSpaceGateways"];
|
|
34
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
35
|
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); }
|
|
36
36
|
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; }
|
|
@@ -113,6 +113,10 @@ SpaceDisconnected.defaultProps = {
|
|
|
113
113
|
* @param {{
|
|
114
114
|
* spaceGateway: import('./connected').SpaceGateway
|
|
115
115
|
* connected: boolean,
|
|
116
|
+
* progress: any,
|
|
117
|
+
* onDelete: (spaceGateway: import('./connected').SpaceGateway) => Promise<void>,
|
|
118
|
+
* onBackupNow: () => Promise<void>,
|
|
119
|
+
* refreshSpaceGateways: () => void
|
|
116
120
|
* }} { spaceGateway }
|
|
117
121
|
*/
|
|
118
122
|
function SpaceItem(_ref) {
|
|
@@ -121,7 +125,8 @@ function SpaceItem(_ref) {
|
|
|
121
125
|
connected,
|
|
122
126
|
progress,
|
|
123
127
|
onDelete,
|
|
124
|
-
onBackupNow
|
|
128
|
+
onBackupNow,
|
|
129
|
+
refreshSpaceGateways
|
|
125
130
|
} = _ref,
|
|
126
131
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
127
132
|
const {
|
|
@@ -131,10 +136,7 @@ function SpaceItem(_ref) {
|
|
|
131
136
|
const [loading, setLoading] = (0, _react.useState)(false);
|
|
132
137
|
/** @type {{ blocklet: import('@abtnode/client').BlockletState }} */
|
|
133
138
|
const {
|
|
134
|
-
blocklet
|
|
135
|
-
actions: {
|
|
136
|
-
refreshBlocklet
|
|
137
|
-
}
|
|
139
|
+
blocklet
|
|
138
140
|
} = (0, _blocklet.useBlockletContext)();
|
|
139
141
|
const {
|
|
140
142
|
api: nodeApi,
|
|
@@ -286,7 +288,7 @@ function SpaceItem(_ref) {
|
|
|
286
288
|
setAuthorizeConnect(preValue => _objectSpread(_objectSpread({}, preValue), {}, {
|
|
287
289
|
open: false
|
|
288
290
|
}));
|
|
289
|
-
|
|
291
|
+
refreshSpaceGateways();
|
|
290
292
|
};
|
|
291
293
|
const _onBackupNow = async () => {
|
|
292
294
|
try {
|
|
@@ -553,6 +555,7 @@ SpaceItem.propTypes = {
|
|
|
553
555
|
}).isRequired,
|
|
554
556
|
connected: _propTypes.default.bool.isRequired,
|
|
555
557
|
progress: _propTypes.default.any.isRequired,
|
|
558
|
+
refreshSpaceGateways: _propTypes.default.func.isRequired,
|
|
556
559
|
onDelete: _propTypes.default.func,
|
|
557
560
|
onBackupNow: _propTypes.default.func
|
|
558
561
|
};
|
|
@@ -18,7 +18,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
18
18
|
* nodeApi: import('@abtnode/client'),
|
|
19
19
|
* blockletDid: string,
|
|
20
20
|
* spaceGateways: import('../blocklet/storage/connected').SpaceGateway[],
|
|
21
|
-
* }} {
|
|
21
|
+
* }} { nodeApi, blockletDid, spaceGateways }
|
|
22
22
|
* @return {Promise<import('../blocklet/storage/connected').SpaceGateway[]>}
|
|
23
23
|
*/
|
|
24
24
|
async function updateSpaceGatewaysFromDIDSpaces(_ref) {
|
|
@@ -33,7 +33,7 @@ async function updateSpaceGatewaysFromDIDSpaces(_ref) {
|
|
|
33
33
|
name
|
|
34
34
|
} = x;
|
|
35
35
|
const newName = await (0, _spaces.getSpaceNameByEndpoint)(x.endpoint);
|
|
36
|
-
if (!(0, _lodash.isEmpty)(newName)) {
|
|
36
|
+
if (!(0, _lodash.isEmpty)(newName) && newName !== name) {
|
|
37
37
|
name = newName;
|
|
38
38
|
shouldUpdate = true;
|
|
39
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/ux",
|
|
3
|
-
"version": "1.16.11-beta-
|
|
3
|
+
"version": "1.16.11-beta-3c2391e3",
|
|
4
4
|
"description": "UX components shared across abtnode packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
|
|
24
24
|
"license": "Apache-2.0",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@abtnode/auth": "1.16.11-beta-
|
|
27
|
-
"@abtnode/constant": "1.16.11-beta-
|
|
28
|
-
"@abtnode/util": "1.16.11-beta-
|
|
26
|
+
"@abtnode/auth": "1.16.11-beta-3c2391e3",
|
|
27
|
+
"@abtnode/constant": "1.16.11-beta-3c2391e3",
|
|
28
|
+
"@abtnode/util": "1.16.11-beta-3c2391e3",
|
|
29
29
|
"@ahooksjs/use-url-state": "^3.5.1",
|
|
30
30
|
"@arcblock/did": "^1.18.84",
|
|
31
31
|
"@arcblock/did-connect": "^2.5.49",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"@arcblock/react-hooks": "^2.5.49",
|
|
35
35
|
"@arcblock/terminal": "^2.5.49",
|
|
36
36
|
"@arcblock/ux": "^2.5.49",
|
|
37
|
-
"@blocklet/constant": "1.16.11-beta-
|
|
38
|
-
"@blocklet/launcher-layout": "2.1.
|
|
37
|
+
"@blocklet/constant": "1.16.11-beta-3c2391e3",
|
|
38
|
+
"@blocklet/launcher-layout": "2.1.18",
|
|
39
39
|
"@blocklet/list": "^0.11.28",
|
|
40
|
-
"@blocklet/meta": "1.16.11-beta-
|
|
40
|
+
"@blocklet/meta": "1.16.11-beta-3c2391e3",
|
|
41
41
|
"@blocklet/ui-react": "^2.5.49",
|
|
42
42
|
"@emotion/react": "^11.10.4",
|
|
43
43
|
"@emotion/styled": "^11.10.4",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"@babel/preset-react": "^7.18.6",
|
|
94
94
|
"babel-plugin-inline-react-svg": "^1.1.2"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "6197b092534ca25e84eae78b8bbbdb92dec72692"
|
|
97
97
|
}
|