@abtnode/ux 1.16.15-beta-a635f48d → 1.16.15-beta-89b542d3
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/es/actions.js +6 -3
- package/es/blocklet/component/domain-list.js +274 -0
- package/es/blocklet/configuration.js +18 -119
- package/es/blocklet/overview.js +6 -147
- package/es/blocklet/router/action/add-domain-alias.js +23 -11
- package/es/blocklet/router/dns-tip.js +101 -0
- package/es/blocklet/router/domain-actions.js +1 -0
- package/es/blocklet/storage/backups.js +20 -6
- package/es/blocklet/storage/item.js +4 -8
- package/es/clear-cache.js +78 -0
- package/es/confirm.js +3 -1
- package/es/contexts/blocklet-storage.js +9 -3
- package/es/locales/en.js +15 -1
- package/es/locales/zh.js +15 -1
- package/es/subscription.js +22 -10
- package/es/util/index.js +13 -12
- package/lib/actions.js +8 -5
- package/lib/blocklet/component/domain-list.js +289 -0
- package/lib/blocklet/configuration.js +16 -123
- package/lib/blocklet/overview.js +7 -140
- package/lib/blocklet/router/action/add-domain-alias.js +23 -11
- package/lib/blocklet/router/dns-tip.js +117 -0
- package/lib/blocklet/router/domain-actions.js +1 -0
- package/lib/blocklet/storage/backups.js +26 -13
- package/lib/blocklet/storage/item.js +4 -8
- package/lib/clear-cache.js +93 -0
- package/lib/confirm.js +24 -14
- package/lib/contexts/blocklet-storage.js +9 -3
- package/lib/locales/en.js +15 -1
- package/lib/locales/zh.js +15 -1
- package/lib/subscription.js +22 -10
- package/lib/util/index.js +14 -12
- package/package.json +7 -7
|
@@ -4,17 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = AddDomainAlias;
|
|
7
|
-
var _react = require("react");
|
|
8
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _urlEvaluation = require("@abtnode/util/lib/url-evaluation");
|
|
10
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
9
11
|
var _CallMerge = _interopRequireDefault(require("@mui/icons-material/CallMerge"));
|
|
10
12
|
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
11
|
-
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
12
|
-
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
13
13
|
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
14
|
-
var
|
|
14
|
+
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
15
|
+
var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
|
|
15
16
|
var _confirm = _interopRequireDefault(require("../../../confirm"));
|
|
16
|
-
var _util = require("../../../util");
|
|
17
17
|
var _node = require("../../../contexts/node");
|
|
18
|
+
var _util = require("../../../util");
|
|
19
|
+
var _dnsTip = _interopRequireDefault(require("../dns-tip"));
|
|
18
20
|
var _util2 = require("../util");
|
|
19
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -28,7 +30,8 @@ function AddDomainAlias(_ref) {
|
|
|
28
30
|
id,
|
|
29
31
|
children,
|
|
30
32
|
title,
|
|
31
|
-
teamDid
|
|
33
|
+
teamDid,
|
|
34
|
+
systemDomains
|
|
32
35
|
} = _ref;
|
|
33
36
|
const {
|
|
34
37
|
t
|
|
@@ -38,6 +41,10 @@ function AddDomainAlias(_ref) {
|
|
|
38
41
|
} = (0, _node.useNodeContext)();
|
|
39
42
|
const [loading, setLoading] = (0, _react.useState)(false);
|
|
40
43
|
const [confirmSetting, setConfirmSetting] = (0, _react.useState)(null);
|
|
44
|
+
let cnameDomain = systemDomains.find(item => (0, _urlEvaluation.isSlpDomain)(item));
|
|
45
|
+
if (!cnameDomain) {
|
|
46
|
+
cnameDomain = systemDomains.find(item => (0, _urlEvaluation.isDidDomain)(item));
|
|
47
|
+
}
|
|
41
48
|
const onCancel = () => {
|
|
42
49
|
setLoading(false);
|
|
43
50
|
setConfirmSetting(null);
|
|
@@ -73,9 +80,9 @@ function AddDomainAlias(_ref) {
|
|
|
73
80
|
const setting = {
|
|
74
81
|
title: title || t('router.domainAlias.add.title'),
|
|
75
82
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
76
|
-
description: (params, setParams, setError) => /*#__PURE__*/(0, _jsxRuntime.
|
|
83
|
+
description: (params, setParams, setError) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Typography.default, {
|
|
77
84
|
component: "div",
|
|
78
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
85
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
|
|
79
86
|
label: t('router.domainAlias.add.domainDescription'),
|
|
80
87
|
helperText: t('router.domainAlias.add.helperText'),
|
|
81
88
|
autoComplete: "off",
|
|
@@ -117,7 +124,10 @@ function AddDomainAlias(_ref) {
|
|
|
117
124
|
}
|
|
118
125
|
}
|
|
119
126
|
}
|
|
120
|
-
})
|
|
127
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_dnsTip.default, {
|
|
128
|
+
domain: params.domain,
|
|
129
|
+
resolvedTarget: cnameDomain
|
|
130
|
+
})]
|
|
121
131
|
}),
|
|
122
132
|
confirm: t('common.confirm'),
|
|
123
133
|
cancel: t('common.cancel'),
|
|
@@ -158,7 +168,8 @@ function AddDomainAlias(_ref) {
|
|
|
158
168
|
onConfirm: confirmSetting.onConfirm,
|
|
159
169
|
onCancel: confirmSetting.onCancel,
|
|
160
170
|
color: "primary",
|
|
161
|
-
loading: loading
|
|
171
|
+
loading: loading,
|
|
172
|
+
maxWidth: "lg"
|
|
162
173
|
})]
|
|
163
174
|
});
|
|
164
175
|
}
|
|
@@ -166,7 +177,8 @@ AddDomainAlias.propTypes = {
|
|
|
166
177
|
id: _propTypes.default.string.isRequired,
|
|
167
178
|
children: _propTypes.default.any,
|
|
168
179
|
title: _propTypes.default.string,
|
|
169
|
-
teamDid: _propTypes.default.string
|
|
180
|
+
teamDid: _propTypes.default.string,
|
|
181
|
+
systemDomains: _propTypes.default.arrayOf(_propTypes.default.string).isRequired
|
|
170
182
|
};
|
|
171
183
|
AddDomainAlias.defaultProps = {
|
|
172
184
|
children: null,
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = DNSTip;
|
|
7
|
+
var _ClickToCopy = require("@arcblock/ux/lib/ClickToCopy");
|
|
8
|
+
var _InfoRow = _interopRequireDefault(require("@arcblock/ux/lib/InfoRow"));
|
|
9
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
10
|
+
var _material = require("@mui/material");
|
|
11
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
12
|
+
var _useTheme = _interopRequireDefault(require("@mui/material/styles/useTheme"));
|
|
13
|
+
var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
const _excluded = ["domain", "resolvedTarget"];
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
22
|
+
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); }
|
|
23
|
+
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; }
|
|
24
|
+
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; }
|
|
25
|
+
function DNSTip(_ref) {
|
|
26
|
+
let {
|
|
27
|
+
domain,
|
|
28
|
+
resolvedTarget
|
|
29
|
+
} = _ref,
|
|
30
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
31
|
+
const {
|
|
32
|
+
t,
|
|
33
|
+
locale
|
|
34
|
+
} = (0, _context.useLocaleContext)();
|
|
35
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, _objectSpread(_objectSpread({
|
|
36
|
+
sx: {
|
|
37
|
+
backgroundColor: 'rgb(236, 251, 253)',
|
|
38
|
+
borderColor: 'rgb(236, 251, 253)',
|
|
39
|
+
borderRadius: '8px',
|
|
40
|
+
padding: '12px'
|
|
41
|
+
}
|
|
42
|
+
}, rest), {}, {
|
|
43
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
44
|
+
display: "flex",
|
|
45
|
+
children: [t('router.domain.setup.tipStart'), domain && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
46
|
+
mx: 0.5,
|
|
47
|
+
color: "primary.main",
|
|
48
|
+
fontWeight: "fontWeightBold",
|
|
49
|
+
children: domain
|
|
50
|
+
}), t('router.domain.setup.tipEnd'), ":"]
|
|
51
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
52
|
+
sx: {
|
|
53
|
+
'&>div': {
|
|
54
|
+
mb: 0
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Tip, {
|
|
58
|
+
label: t('router.domain.setup.recordType'),
|
|
59
|
+
value: "CNAME",
|
|
60
|
+
locale: locale
|
|
61
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Tip, {
|
|
62
|
+
label: t('router.domain.setup.recordValue'),
|
|
63
|
+
value: resolvedTarget,
|
|
64
|
+
locale: locale
|
|
65
|
+
})]
|
|
66
|
+
})]
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
DNSTip.propTypes = {
|
|
70
|
+
domain: _propTypes.default.string,
|
|
71
|
+
resolvedTarget: _propTypes.default.string.isRequired
|
|
72
|
+
};
|
|
73
|
+
DNSTip.defaultProps = {
|
|
74
|
+
domain: ''
|
|
75
|
+
};
|
|
76
|
+
function Tip(_ref2) {
|
|
77
|
+
let {
|
|
78
|
+
locale,
|
|
79
|
+
label,
|
|
80
|
+
value
|
|
81
|
+
} = _ref2;
|
|
82
|
+
const isMobile = (0, _useMediaQuery.default)(theme => theme.breakpoints.down('md'));
|
|
83
|
+
const theme = (0, _useTheme.default)();
|
|
84
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InfoRow.default, {
|
|
85
|
+
name: label,
|
|
86
|
+
nameWidth: 120,
|
|
87
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
88
|
+
sx: {
|
|
89
|
+
display: 'flex',
|
|
90
|
+
alignItems: 'center',
|
|
91
|
+
lineHeight: 1
|
|
92
|
+
},
|
|
93
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
94
|
+
component: "span",
|
|
95
|
+
color: "primary.main",
|
|
96
|
+
wordWrap: "break-word",
|
|
97
|
+
overflow: "auto",
|
|
98
|
+
sx: isMobile ? {
|
|
99
|
+
maxWidth: '95%'
|
|
100
|
+
} : {},
|
|
101
|
+
children: value
|
|
102
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickToCopy.CopyButton, {
|
|
103
|
+
content: value,
|
|
104
|
+
locale: locale,
|
|
105
|
+
style: {
|
|
106
|
+
marginLeft: '4px',
|
|
107
|
+
color: theme.palette.text.secondary
|
|
108
|
+
}
|
|
109
|
+
})]
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
Tip.propTypes = {
|
|
114
|
+
locale: _propTypes.default.string.isRequired,
|
|
115
|
+
label: _propTypes.default.string.isRequired,
|
|
116
|
+
value: _propTypes.default.string.isRequired
|
|
117
|
+
};
|
|
@@ -27,6 +27,7 @@ function DomainActions(_ref) {
|
|
|
27
27
|
const isCurrentDomain = domain.value === window.location.hostname;
|
|
28
28
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_actions.default, {
|
|
29
29
|
"data-cy": "domain-actions",
|
|
30
|
+
size: "large",
|
|
30
31
|
actions: [
|
|
31
32
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
32
33
|
_ref2 => {
|
|
@@ -12,7 +12,9 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
12
12
|
var _lodash = require("lodash");
|
|
13
13
|
var _dayjs = _interopRequireDefault(require("@abtnode/util/lib/dayjs"));
|
|
14
14
|
var _HelpOutline = _interopRequireDefault(require("@mui/icons-material/HelpOutline"));
|
|
15
|
+
var _constant = require("@abtnode/constant");
|
|
15
16
|
var _blockletStorage = require("../../contexts/blocklet-storage");
|
|
17
|
+
var _spaces = require("../../util/spaces");
|
|
16
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
20
|
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; }
|
|
@@ -20,14 +22,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
20
22
|
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; }
|
|
21
23
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
22
24
|
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); }
|
|
23
|
-
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); } /**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); } /* eslint-disable no-console */ /**
|
|
26
|
+
*
|
|
27
|
+
* @description
|
|
28
|
+
* @param {{
|
|
29
|
+
* progress: any,
|
|
30
|
+
* } & import('@mui/material').BoxProps} { progress, ...rest }
|
|
31
|
+
* @return {React.Component}
|
|
32
|
+
*/
|
|
31
33
|
function SpacesBackupRecords(_ref) {
|
|
32
34
|
let rest = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
33
35
|
const {
|
|
@@ -48,9 +50,20 @@ function SpacesBackupRecords(_ref) {
|
|
|
48
50
|
// eslint-disable-next-line no-unused-vars
|
|
49
51
|
const {
|
|
50
52
|
targetUrl,
|
|
51
|
-
targetName
|
|
53
|
+
targetName,
|
|
54
|
+
status,
|
|
55
|
+
createdAt
|
|
52
56
|
} = backups[index];
|
|
53
|
-
const
|
|
57
|
+
const timeoutError = status === _constant.BACKUPS.STATUS.PROGRESS && (0, _dayjs.default)().diff(createdAt, 'hours') >= _constant.BACKUPS.TIMEOUT_HOURS;
|
|
58
|
+
const success = status === _constant.BACKUPS.STATUS.SUCCEEDED && !timeoutError;
|
|
59
|
+
const spaceName = targetName || ((_spaceGateways$find = spaceGateways.find(spaceGateway => targetUrl === null || targetUrl === void 0 ? void 0 : targetUrl.includes((0, _spaces.getDIDSpaceDidFromEndpoint)(spaceGateway === null || spaceGateway === void 0 ? void 0 : spaceGateway.endpoint)))) === null || _spaceGateways$find === void 0 ? void 0 : _spaceGateways$find.name) || 'Unknown DID Space';
|
|
60
|
+
if (!success) {
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
62
|
+
variant: "body1",
|
|
63
|
+
fontSize: "16px",
|
|
64
|
+
children: spaceName
|
|
65
|
+
});
|
|
66
|
+
}
|
|
54
67
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Link, {
|
|
55
68
|
fontSize: "16px",
|
|
56
69
|
href: targetUrl,
|
|
@@ -120,10 +133,10 @@ function SpacesBackupRecords(_ref) {
|
|
|
120
133
|
message,
|
|
121
134
|
createdAt
|
|
122
135
|
} = (_backups$index = backups === null || backups === void 0 ? void 0 : backups[index]) !== null && _backups$index !== void 0 ? _backups$index : {};
|
|
123
|
-
const timeoutError =
|
|
136
|
+
const timeoutError = status === _constant.BACKUPS.STATUS.PROGRESS && (0, _dayjs.default)().diff(createdAt, 'hours') >= _constant.BACKUPS.TIMEOUT_HOURS;
|
|
124
137
|
const timeoutErrorMessage = timeoutError && t('common.timeoutError');
|
|
125
|
-
const pending =
|
|
126
|
-
const success = status ===
|
|
138
|
+
const pending = status === _constant.BACKUPS.STATUS.PROGRESS && !timeoutError;
|
|
139
|
+
const success = status === _constant.BACKUPS.STATUS.SUCCEEDED && !timeoutError;
|
|
127
140
|
if (pending) {
|
|
128
141
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
129
142
|
display: "inline-flex",
|
|
@@ -81,10 +81,9 @@ SpaceDisconnected.defaultProps = {
|
|
|
81
81
|
* @param {{
|
|
82
82
|
* spaceGateway: import('./connected').SpaceGateway
|
|
83
83
|
* connected: boolean,
|
|
84
|
-
* progress: any,
|
|
85
84
|
* onDelete: (spaceGateway: import('./connected').SpaceGateway) => Promise<void>,
|
|
86
85
|
* onBackupNow: () => Promise<void>,
|
|
87
|
-
* }} { spaceGateway }
|
|
86
|
+
* }} { spaceGateway, connected,, onDelete, onBackupNow }
|
|
88
87
|
*/
|
|
89
88
|
function SpaceItem(_ref) {
|
|
90
89
|
let {
|
|
@@ -122,14 +121,10 @@ function SpaceItem(_ref) {
|
|
|
122
121
|
const {
|
|
123
122
|
updateSpaceGateway,
|
|
124
123
|
backupEndpoint,
|
|
125
|
-
backupProgress
|
|
124
|
+
backupProgress,
|
|
125
|
+
refreshBackupEndpoint
|
|
126
126
|
} = (0, _blockletStorage.useBlockletStorageContext)();
|
|
127
|
-
|
|
128
|
-
// TEST:
|
|
129
127
|
const [loading, setLoading] = (0, _react.useState)(false);
|
|
130
|
-
// backupProgress.message = '(12/99)备份到备份到备份到备份到备';
|
|
131
|
-
// backupProgress.progress = 99;
|
|
132
|
-
|
|
133
128
|
const [authorizeConnect, setAuthorizeConnect] = (0, _react.useState)({
|
|
134
129
|
open: false,
|
|
135
130
|
action: 'one-click-authorization',
|
|
@@ -190,6 +185,7 @@ function SpaceItem(_ref) {
|
|
|
190
185
|
}]
|
|
191
186
|
}
|
|
192
187
|
});
|
|
188
|
+
refreshBackupEndpoint();
|
|
193
189
|
_Toast.default.success(t('storage.spaces.connect.switchToSpaceSucceeded', {
|
|
194
190
|
name: spaceGateway.name ? "(".concat(spaceGateway.name, ")") : ''
|
|
195
191
|
}));
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = ClearCache;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
9
|
+
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
10
|
+
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
11
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
12
|
+
var _util = require("../lib/util");
|
|
13
|
+
var _node = require("./contexts/node");
|
|
14
|
+
var _confirm = _interopRequireDefault(require("./confirm"));
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
const _excluded = ["teamDid", "size"]; // eslint-disable-next-line react/prop-types
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
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); }
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
24
|
+
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); }
|
|
25
|
+
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; }
|
|
26
|
+
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; }
|
|
27
|
+
function ClearCache(_ref) {
|
|
28
|
+
let {
|
|
29
|
+
teamDid,
|
|
30
|
+
size = 'small'
|
|
31
|
+
} = _ref,
|
|
32
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
33
|
+
const {
|
|
34
|
+
t
|
|
35
|
+
} = (0, _context.useLocaleContext)();
|
|
36
|
+
const {
|
|
37
|
+
api
|
|
38
|
+
} = (0, _node.useNodeContext)();
|
|
39
|
+
const [loading, setLoading] = (0, _react.useState)(false);
|
|
40
|
+
const [confirmSetting, setConfirmSetting] = (0, _react.useState)(null);
|
|
41
|
+
const onCancel = () => {
|
|
42
|
+
setLoading(false);
|
|
43
|
+
setConfirmSetting(null);
|
|
44
|
+
};
|
|
45
|
+
const onConfirm = async () => {
|
|
46
|
+
try {
|
|
47
|
+
var _result$removed;
|
|
48
|
+
setLoading(true);
|
|
49
|
+
const result = await api.clearCache({
|
|
50
|
+
input: {
|
|
51
|
+
teamDid
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
_Toast.default.success(t('blocklet.config.clearCache.success', {
|
|
55
|
+
count: ((_result$removed = result.removed) === null || _result$removed === void 0 ? void 0 : _result$removed.length) || 0
|
|
56
|
+
}));
|
|
57
|
+
} catch (err) {
|
|
58
|
+
_Toast.default.error((0, _util.formatError)(err));
|
|
59
|
+
} finally {
|
|
60
|
+
setLoading(false);
|
|
61
|
+
setConfirmSetting(null);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const setting = {
|
|
65
|
+
title: t('blocklet.config.clearCache.title'),
|
|
66
|
+
description: t('blocklet.config.clearCache.description'),
|
|
67
|
+
confirm: t('common.confirm'),
|
|
68
|
+
cancel: t('common.cancel'),
|
|
69
|
+
onConfirm,
|
|
70
|
+
onCancel
|
|
71
|
+
};
|
|
72
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, rest), {}, {
|
|
73
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
74
|
+
onClick: () => setConfirmSetting(setting),
|
|
75
|
+
color: "error",
|
|
76
|
+
variant: "outlined",
|
|
77
|
+
size: size,
|
|
78
|
+
children: [loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
|
|
79
|
+
size: 16,
|
|
80
|
+
style: {
|
|
81
|
+
marginRight: 5
|
|
82
|
+
}
|
|
83
|
+
}) : null, t('blocklet.config.clearCache.action')]
|
|
84
|
+
}), confirmSetting && /*#__PURE__*/(0, _jsxRuntime.jsx)(_confirm.default, {
|
|
85
|
+
title: confirmSetting.title,
|
|
86
|
+
description: confirmSetting.description,
|
|
87
|
+
confirm: confirmSetting.confirm,
|
|
88
|
+
cancel: confirmSetting.cancel,
|
|
89
|
+
onConfirm: confirmSetting.onConfirm,
|
|
90
|
+
onCancel: confirmSetting.onCancel
|
|
91
|
+
})]
|
|
92
|
+
}));
|
|
93
|
+
}
|
package/lib/confirm.js
CHANGED
|
@@ -22,21 +22,30 @@ var _util = require("./util");
|
|
|
22
22
|
var _mobileWidth = _interopRequireDefault(require("./hooks/mobile-width"));
|
|
23
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
24
|
var _templateObject;
|
|
25
|
+
const _excluded = ["title", "description", "showCancel", "cancel", "confirm", "color", "params", "onCancel", "onConfirm", "loading"];
|
|
25
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
27
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
28
|
+
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; }
|
|
29
|
+
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; }
|
|
30
|
+
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; }
|
|
31
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
32
|
+
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); }
|
|
33
|
+
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; }
|
|
34
|
+
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; }
|
|
27
35
|
function ConfirmDialog(_ref) {
|
|
28
36
|
let {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
title,
|
|
38
|
+
description,
|
|
39
|
+
showCancel,
|
|
40
|
+
cancel,
|
|
41
|
+
confirm,
|
|
42
|
+
color,
|
|
43
|
+
params: initialParams,
|
|
44
|
+
onCancel,
|
|
45
|
+
onConfirm,
|
|
46
|
+
loading: inputLoading
|
|
47
|
+
} = _ref,
|
|
48
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
40
49
|
const [params, setParams] = (0, _react.useState)(initialParams);
|
|
41
50
|
const [open, setOpen] = (0, _react.useState)(true);
|
|
42
51
|
const [loading, setLoading] = (0, _react.useState)(false);
|
|
@@ -70,13 +79,14 @@ function ConfirmDialog(_ref) {
|
|
|
70
79
|
const {
|
|
71
80
|
minWidth
|
|
72
81
|
} = (0, _mobileWidth.default)();
|
|
73
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledDialog, {
|
|
82
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledDialog, _objectSpread(_objectSpread({
|
|
74
83
|
onClick: handleClick,
|
|
75
84
|
fullScreen: isBreakpointsDownSm,
|
|
76
85
|
open: open,
|
|
77
86
|
style: {
|
|
78
87
|
minWidth
|
|
79
|
-
}
|
|
88
|
+
}
|
|
89
|
+
}, rest), {}, {
|
|
80
90
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_DialogTitle.default, {
|
|
81
91
|
children: t
|
|
82
92
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_DialogContent.default, {
|
|
@@ -124,7 +134,7 @@ function ConfirmDialog(_ref) {
|
|
|
124
134
|
}), confirm]
|
|
125
135
|
})]
|
|
126
136
|
})]
|
|
127
|
-
});
|
|
137
|
+
}));
|
|
128
138
|
}
|
|
129
139
|
ConfirmDialog.propTypes = {
|
|
130
140
|
title: _propTypes.default.any.isRequired,
|
|
@@ -41,6 +41,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
41
41
|
* backupProgress: any,
|
|
42
42
|
* backups: Backup[],
|
|
43
43
|
* backupsLoading: boolean,
|
|
44
|
+
* refreshBackupEndpoint: () => void,
|
|
44
45
|
* }} BlockletStorageContextType
|
|
45
46
|
*/ /** @type {import('react').Context<BlockletStorageContextType>} */
|
|
46
47
|
const BlockletStorageContext = /*#__PURE__*/(0, _react.createContext)({});
|
|
@@ -76,9 +77,10 @@ function BlockletStorageProvider(_ref) {
|
|
|
76
77
|
const backupProgress = (0, _useBackupProgress.default)({
|
|
77
78
|
appDid: blocklet === null || blocklet === void 0 ? void 0 : blocklet.appDid
|
|
78
79
|
});
|
|
80
|
+
const [backupEndpointRefresh, setBackupEndpointRefresh] = (0, _react.useState)(false);
|
|
79
81
|
const backupEndpoint = (0, _react.useMemo)(() => (0, _spaces.getSpaceBackupEndpoint)(blocklet === null || blocklet === void 0 ? void 0 : blocklet.environments),
|
|
80
82
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
81
|
-
[blocklet, spaceGatewaysRefresh]);
|
|
83
|
+
[blocklet, spaceGatewaysRefresh, backupEndpointRefresh]);
|
|
82
84
|
const [backupsLoading, setBackupsLoading] = (0, _react.useState)(false);
|
|
83
85
|
const {
|
|
84
86
|
backups
|
|
@@ -151,7 +153,7 @@ function BlockletStorageProvider(_ref) {
|
|
|
151
153
|
input: {
|
|
152
154
|
did: blocklet.meta.did,
|
|
153
155
|
where: {
|
|
154
|
-
|
|
156
|
+
did: spaceGateway.did
|
|
155
157
|
},
|
|
156
158
|
spaceGateway
|
|
157
159
|
}
|
|
@@ -181,6 +183,9 @@ function BlockletStorageProvider(_ref) {
|
|
|
181
183
|
* @param {SpaceGateway} spaceGateway
|
|
182
184
|
*/
|
|
183
185
|
const spaceGatewayIsSelected = spaceGateway => (spaceGateway === null || spaceGateway === void 0 ? void 0 : spaceGateway.endpoint) === backupEndpoint;
|
|
186
|
+
const refreshBackupEndpoint = () => {
|
|
187
|
+
setBackupEndpointRefresh(p => !p);
|
|
188
|
+
};
|
|
184
189
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Provider, {
|
|
185
190
|
value: {
|
|
186
191
|
spaceGateways,
|
|
@@ -194,7 +199,8 @@ function BlockletStorageProvider(_ref) {
|
|
|
194
199
|
backupEndpoint,
|
|
195
200
|
backupProgress,
|
|
196
201
|
backups,
|
|
197
|
-
backupsLoading
|
|
202
|
+
backupsLoading,
|
|
203
|
+
refreshBackupEndpoint
|
|
198
204
|
},
|
|
199
205
|
children: children
|
|
200
206
|
});
|
package/lib/locales/en.js
CHANGED
|
@@ -232,7 +232,7 @@ module.exports = {
|
|
|
232
232
|
protocol: 'Protocol',
|
|
233
233
|
published: 'published',
|
|
234
234
|
purchase: 'Purchase',
|
|
235
|
-
readMore: '
|
|
235
|
+
readMore: 'More',
|
|
236
236
|
redirect: 'Redirect',
|
|
237
237
|
redirectCode: 'Redirect Code',
|
|
238
238
|
redirectPermanently: 'Permanent Redirect',
|
|
@@ -451,6 +451,14 @@ module.exports = {
|
|
|
451
451
|
ttl: 'Login session validity period (user will be asked to login again if they have no activity on this site for {day} days)',
|
|
452
452
|
day: '{day} day',
|
|
453
453
|
days: '{day} days'
|
|
454
|
+
},
|
|
455
|
+
clearCache: {
|
|
456
|
+
name: 'Cache Management',
|
|
457
|
+
purpose: 'Manage files cached in router and blocklet services',
|
|
458
|
+
title: 'Confirm Cache Clear?',
|
|
459
|
+
action: 'Clear Cache',
|
|
460
|
+
success: 'Successfully cleared {count} cache entries',
|
|
461
|
+
description: 'Are you sure you want to clear cached files in router and blocklet service? this operation may cause slight performance downgrade in the short term'
|
|
454
462
|
}
|
|
455
463
|
},
|
|
456
464
|
overview: {
|
|
@@ -851,6 +859,12 @@ module.exports = {
|
|
|
851
859
|
label: 'Site Domain',
|
|
852
860
|
description: 'Please provide a valid site domain'
|
|
853
861
|
},
|
|
862
|
+
setup: {
|
|
863
|
+
tipStart: 'Please ensure that the domain name',
|
|
864
|
+
tipEnd: 'has been correctly resolved',
|
|
865
|
+
recordType: 'Record Type',
|
|
866
|
+
recordValue: 'Record Value'
|
|
867
|
+
},
|
|
854
868
|
verify: {
|
|
855
869
|
ok: 'This site is resolved',
|
|
856
870
|
notResolved: 'This site neither resolved nor accessible, please check your DNS configuration'
|
package/lib/locales/zh.js
CHANGED
|
@@ -237,7 +237,7 @@ module.exports = {
|
|
|
237
237
|
protocol: '协议',
|
|
238
238
|
published: '发布于',
|
|
239
239
|
purchase: '购买',
|
|
240
|
-
readMore: '
|
|
240
|
+
readMore: '更多',
|
|
241
241
|
redirect: '重定向',
|
|
242
242
|
redirectCode: '重定向状态码',
|
|
243
243
|
redirectPermanently: '永久重定向',
|
|
@@ -456,6 +456,14 @@ module.exports = {
|
|
|
456
456
|
ttl: '登录会话有效期(如果用户 {day} 天内在此站点没有任何活动,将被要求重新登录)',
|
|
457
457
|
day: '{day} 天',
|
|
458
458
|
days: '{day} 天'
|
|
459
|
+
},
|
|
460
|
+
clearCache: {
|
|
461
|
+
name: '缓存管理',
|
|
462
|
+
purpose: '管理缓存在网关和服务中的文件',
|
|
463
|
+
title: '确认清除缓存?',
|
|
464
|
+
action: '清除缓存',
|
|
465
|
+
success: '成功清除了 {count} 个缓存条目',
|
|
466
|
+
description: '您确定要清除缓存在网关和服务中的文件吗?此操作可能会在短期内导致轻微的性能降低。'
|
|
459
467
|
}
|
|
460
468
|
},
|
|
461
469
|
overview: {
|
|
@@ -854,6 +862,12 @@ module.exports = {
|
|
|
854
862
|
label: '站点域名',
|
|
855
863
|
description: '请填写你所拥有的合法的站点域名'
|
|
856
864
|
},
|
|
865
|
+
setup: {
|
|
866
|
+
tipStart: '请确保',
|
|
867
|
+
tipEnd: '域名已经被正确解析',
|
|
868
|
+
recordType: '记录类型',
|
|
869
|
+
recordValue: '记录值'
|
|
870
|
+
},
|
|
857
871
|
verify: {
|
|
858
872
|
ok: '该站点解析正常',
|
|
859
873
|
notResolved: '改站点解析异常,请检查你域名服务商的 DNS 配置'
|