@abtnode/ux 1.16.15-beta-58d50c9a → 1.16.15-beta-e143b1cf
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/clear-cache.js +78 -0
- package/es/confirm.js +3 -1
- 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/clear-cache.js +93 -0
- package/lib/confirm.js +24 -14
- 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
package/es/actions.js
CHANGED
|
@@ -12,6 +12,7 @@ import { createElement as _createElement } from "react";
|
|
|
12
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
export default function Actions({
|
|
14
14
|
actions,
|
|
15
|
+
size,
|
|
15
16
|
...props
|
|
16
17
|
}) {
|
|
17
18
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
@@ -40,7 +41,7 @@ export default function Actions({
|
|
|
40
41
|
"aria-haspopup": "true",
|
|
41
42
|
"data-cy": "actions-menu-icon",
|
|
42
43
|
onClick: onOpen,
|
|
43
|
-
size:
|
|
44
|
+
size: size,
|
|
44
45
|
children: /*#__PURE__*/_jsx(MoreHorizIcon, {})
|
|
45
46
|
}), /*#__PURE__*/_jsx(Menu, {
|
|
46
47
|
id: "actions-menu",
|
|
@@ -89,9 +90,11 @@ export default function Actions({
|
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
92
|
Actions.propTypes = {
|
|
92
|
-
actions: PropTypes.array
|
|
93
|
+
actions: PropTypes.array,
|
|
94
|
+
size: PropTypes.oneOf(['small', 'medium', 'large'])
|
|
93
95
|
};
|
|
94
96
|
Actions.defaultProps = {
|
|
95
|
-
actions: []
|
|
97
|
+
actions: [],
|
|
98
|
+
size: 'small'
|
|
96
99
|
};
|
|
97
100
|
const Div = styled.div``;
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import Button from '@arcblock/ux/lib/Button';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import React, { useMemo, useState } from 'react';
|
|
5
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
6
|
+
import ExpandLess from '@mui/icons-material/ExpandLess';
|
|
7
|
+
import ExpandMore from '@mui/icons-material/ExpandMore';
|
|
8
|
+
import Alert from '@mui/material/Alert';
|
|
9
|
+
import Box from '@mui/material/Box';
|
|
10
|
+
import IconButton from '@mui/material/IconButton';
|
|
11
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
12
|
+
import useTheme from '@mui/material/styles/useTheme';
|
|
13
|
+
import { encode as encodeBase32 } from '@abtnode/util/lib/base32';
|
|
14
|
+
import { isDidDomain } from '@abtnode/util/lib/url-evaluation';
|
|
15
|
+
import LockIcon from '@arcblock/icons/lib/LockIcon';
|
|
16
|
+
import Empty from '@arcblock/ux/lib/Empty';
|
|
17
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
18
|
+
import { isInProgress } from '@blocklet/meta/lib/util';
|
|
19
|
+
import Spinner from '@mui/material/CircularProgress';
|
|
20
|
+
import { useNodeContext } from '../../contexts/node';
|
|
21
|
+
import { withPermission } from '../../permission';
|
|
22
|
+
import { BlockletAdminRoles, getSystemDomains, sortDomains } from '../../util';
|
|
23
|
+
import AddCert from '../add-cert';
|
|
24
|
+
import AddDomainAlias from '../router/action/add-domain-alias';
|
|
25
|
+
import DomainActions from '../router/domain-actions';
|
|
26
|
+
import DomainStatus from '../router/domain-status';
|
|
27
|
+
import { DomainType } from '../types';
|
|
28
|
+
import { isServerless } from '../util';
|
|
29
|
+
import { useBlockletContext } from '../../contexts/blocklet';
|
|
30
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
31
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
32
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
33
|
+
const BlockletComponent = withPermission(DomainList, 'mutate_blocklets');
|
|
34
|
+
const BlockletInServiceComponent = withPermission(DomainList, '', BlockletAdminRoles);
|
|
35
|
+
export default function DomainListWithPermission(props) {
|
|
36
|
+
const {
|
|
37
|
+
inService
|
|
38
|
+
} = useNodeContext();
|
|
39
|
+
const {
|
|
40
|
+
blocklet,
|
|
41
|
+
loadingRuntimeInfo
|
|
42
|
+
} = useBlockletContext();
|
|
43
|
+
let Component = BlockletComponent;
|
|
44
|
+
if (inService) {
|
|
45
|
+
Component = BlockletInServiceComponent;
|
|
46
|
+
}
|
|
47
|
+
return /*#__PURE__*/_jsx(Component, {
|
|
48
|
+
...props,
|
|
49
|
+
blocklet: blocklet,
|
|
50
|
+
inService: inService,
|
|
51
|
+
loadingRuntimeInfo: loadingRuntimeInfo
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function DomainList({
|
|
55
|
+
hasPermission,
|
|
56
|
+
blocklet,
|
|
57
|
+
loadingRuntimeInfo,
|
|
58
|
+
inService
|
|
59
|
+
}) {
|
|
60
|
+
const {
|
|
61
|
+
t
|
|
62
|
+
} = useLocaleContext();
|
|
63
|
+
const [showAllDomains, setShowAllDomains] = useState(false);
|
|
64
|
+
const theme = useTheme();
|
|
65
|
+
const hasMutatePermission = useMemo(() => {
|
|
66
|
+
let res = hasPermission;
|
|
67
|
+
if (isServerless(blocklet)) {
|
|
68
|
+
res = res && inService;
|
|
69
|
+
}
|
|
70
|
+
return res;
|
|
71
|
+
}, [hasPermission, inService, blocklet]);
|
|
72
|
+
const {
|
|
73
|
+
site
|
|
74
|
+
} = blocklet;
|
|
75
|
+
const domains = useMemo(() => sortDomains(blocklet.site?.domainAliases), [blocklet.site?.domainAliases]);
|
|
76
|
+
const displayDomains = [];
|
|
77
|
+
const hiddenDomains = [];
|
|
78
|
+
const pidBase32 = encodeBase32(blocklet.appPid);
|
|
79
|
+
const systemDomains = getSystemDomains(domains);
|
|
80
|
+
domains.forEach(domain => {
|
|
81
|
+
const value = domain.value || '';
|
|
82
|
+
if (isDidDomain(value) && !value.startsWith(pidBase32)) {
|
|
83
|
+
hiddenDomains.push(domain);
|
|
84
|
+
} else {
|
|
85
|
+
displayDomains.push(domain);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
89
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
90
|
+
className: "title first",
|
|
91
|
+
display: "flex",
|
|
92
|
+
justifyContent: "space-between",
|
|
93
|
+
alignItems: "center",
|
|
94
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
95
|
+
children: t('common.domain')
|
|
96
|
+
}), hasMutatePermission && /*#__PURE__*/_jsx(AddDomainAlias, {
|
|
97
|
+
id: site.id,
|
|
98
|
+
title: t('router.domain.add.title'),
|
|
99
|
+
teamDid: blocklet.meta?.did,
|
|
100
|
+
systemDomains: systemDomains?.map(x => x.value),
|
|
101
|
+
children: ({
|
|
102
|
+
open
|
|
103
|
+
}) => /*#__PURE__*/_jsxs(Button, {
|
|
104
|
+
style: {
|
|
105
|
+
marginLeft: 16
|
|
106
|
+
},
|
|
107
|
+
variant: "contained",
|
|
108
|
+
color: "primary",
|
|
109
|
+
"data-cy": "add-domain-alias",
|
|
110
|
+
onClick: open,
|
|
111
|
+
disabled: isInProgress(blocklet.status),
|
|
112
|
+
children: [/*#__PURE__*/_jsx(AddIcon, {
|
|
113
|
+
style: {
|
|
114
|
+
fontSize: '1.3em',
|
|
115
|
+
marginRight: 4
|
|
116
|
+
}
|
|
117
|
+
}), t('common.add')]
|
|
118
|
+
})
|
|
119
|
+
})]
|
|
120
|
+
}), blocklet.status !== 'running' && /*#__PURE__*/_jsx(Box, {
|
|
121
|
+
mt: 1.5,
|
|
122
|
+
mb: 1.5,
|
|
123
|
+
children: /*#__PURE__*/_jsx(Alert, {
|
|
124
|
+
severity: "warning",
|
|
125
|
+
children: t('blocklet.router.noRunning')
|
|
126
|
+
})
|
|
127
|
+
}), (showAllDomains ? domains : displayDomains).map((domain, index) => /*#__PURE__*/_jsxs(Box, {
|
|
128
|
+
display: "flex",
|
|
129
|
+
alignItems: "center",
|
|
130
|
+
justifyContent: "space-between",
|
|
131
|
+
mt: index ? 0 : 1,
|
|
132
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
133
|
+
display: "flex",
|
|
134
|
+
alignItems: "center",
|
|
135
|
+
justifyContent: "flex-start",
|
|
136
|
+
children: [/*#__PURE__*/_jsx(DomainStatus, {
|
|
137
|
+
domain: domain,
|
|
138
|
+
filters: ['domain']
|
|
139
|
+
}, `${domain.value}-domain`), /*#__PURE__*/_jsx(Box, {
|
|
140
|
+
sx: {
|
|
141
|
+
ml: 2,
|
|
142
|
+
mr: 0.5
|
|
143
|
+
},
|
|
144
|
+
children: /*#__PURE__*/_jsx(DomainLink, {
|
|
145
|
+
domain: domain,
|
|
146
|
+
target: "_blank",
|
|
147
|
+
children: domain.value
|
|
148
|
+
})
|
|
149
|
+
}), /*#__PURE__*/_jsx(DomainStatus, {
|
|
150
|
+
domain: domain,
|
|
151
|
+
filters: ['http']
|
|
152
|
+
}, `${domain.value}-http`), hasMutatePermission && /*#__PURE__*/_jsx(AddCert, {
|
|
153
|
+
domain: domain.value,
|
|
154
|
+
domainStatus: domain.domainStatus,
|
|
155
|
+
did: blocklet.meta.did,
|
|
156
|
+
children: ({
|
|
157
|
+
open
|
|
158
|
+
}) => /*#__PURE__*/_jsx(Button, {
|
|
159
|
+
size: "small",
|
|
160
|
+
onClick: e => open(e),
|
|
161
|
+
children: t('router.cert.genLetsEncryptCert.title')
|
|
162
|
+
})
|
|
163
|
+
})]
|
|
164
|
+
}), hasMutatePermission && !domain.isProtected ? /*#__PURE__*/_jsx(DomainActions, {
|
|
165
|
+
site: site,
|
|
166
|
+
domain: domain,
|
|
167
|
+
blocklet: blocklet
|
|
168
|
+
}) : /*#__PURE__*/_jsx(Tooltip, {
|
|
169
|
+
title: t('blocklet.router.domainLockTooltip'),
|
|
170
|
+
placement: "top",
|
|
171
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
172
|
+
disabled: true,
|
|
173
|
+
size: "large",
|
|
174
|
+
style: {
|
|
175
|
+
pointerEvents: 'auto',
|
|
176
|
+
// padding replace to margin, fix the tooltip position
|
|
177
|
+
paddingTop: 0,
|
|
178
|
+
paddingBottom: 0,
|
|
179
|
+
margin: '12px 0'
|
|
180
|
+
},
|
|
181
|
+
children: /*#__PURE__*/_jsx(LockIcon, {
|
|
182
|
+
style: {
|
|
183
|
+
fill: theme.palette.text.disabled
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
})
|
|
187
|
+
})]
|
|
188
|
+
}, domain.value)), hiddenDomains.length > 0 && /*#__PURE__*/_jsx("div", {
|
|
189
|
+
style: {
|
|
190
|
+
marginLeft: '20px',
|
|
191
|
+
marginTop: '12px'
|
|
192
|
+
},
|
|
193
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
194
|
+
endIcon: showAllDomains ? /*#__PURE__*/_jsx(ExpandLess, {}) : /*#__PURE__*/_jsx(ExpandMore, {}),
|
|
195
|
+
onClick: () => setShowAllDomains(!showAllDomains),
|
|
196
|
+
children: showAllDomains ? t('common.collapseAll') : t('blocklet.router.showAllDomains')
|
|
197
|
+
})
|
|
198
|
+
}), !domains.length && (loadingRuntimeInfo ? /*#__PURE__*/_jsx(Spinner, {
|
|
199
|
+
size: 16
|
|
200
|
+
}) : /*#__PURE__*/_jsx(Empty, {
|
|
201
|
+
children: t('common.empty')
|
|
202
|
+
}))]
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
DomainList.propTypes = {
|
|
206
|
+
hasPermission: PropTypes.bool,
|
|
207
|
+
blocklet: PropTypes.object.isRequired,
|
|
208
|
+
loadingRuntimeInfo: PropTypes.bool,
|
|
209
|
+
inService: PropTypes.bool.isRequired
|
|
210
|
+
};
|
|
211
|
+
DomainList.defaultProps = {
|
|
212
|
+
hasPermission: false,
|
|
213
|
+
loadingRuntimeInfo: false
|
|
214
|
+
};
|
|
215
|
+
function DomainLink({
|
|
216
|
+
domain,
|
|
217
|
+
children
|
|
218
|
+
}) {
|
|
219
|
+
const {
|
|
220
|
+
t
|
|
221
|
+
} = useLocaleContext();
|
|
222
|
+
const {
|
|
223
|
+
href,
|
|
224
|
+
accessibility
|
|
225
|
+
} = domain;
|
|
226
|
+
if (!accessibility || accessibility.loading) {
|
|
227
|
+
return /*#__PURE__*/_jsxs(LinkDiv, {
|
|
228
|
+
children: [children, /*#__PURE__*/_jsx(Tooltip, {
|
|
229
|
+
title: t('blocklet.router.checkUrlAccessible'),
|
|
230
|
+
placement: "top-end",
|
|
231
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
232
|
+
className: "status",
|
|
233
|
+
children: /*#__PURE__*/_jsx(Spinner, {
|
|
234
|
+
size: 12
|
|
235
|
+
})
|
|
236
|
+
})
|
|
237
|
+
})]
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
if (!accessibility.accessible) {
|
|
241
|
+
return /*#__PURE__*/_jsx(LinkDiv, {
|
|
242
|
+
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
243
|
+
title: t('blocklet.router.urlInaccessible'),
|
|
244
|
+
placement: "top-end",
|
|
245
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
246
|
+
children: children
|
|
247
|
+
})
|
|
248
|
+
})
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
return /*#__PURE__*/_jsx(LinkDiv, {
|
|
252
|
+
children: /*#__PURE__*/_jsx("a", {
|
|
253
|
+
href: href,
|
|
254
|
+
target: "_blank",
|
|
255
|
+
rel: "noopener noreferrer",
|
|
256
|
+
children: children
|
|
257
|
+
})
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
DomainLink.propTypes = {
|
|
261
|
+
domain: DomainType.isRequired,
|
|
262
|
+
children: PropTypes.any.isRequired
|
|
263
|
+
};
|
|
264
|
+
const LinkDiv = styled.span`
|
|
265
|
+
&,
|
|
266
|
+
& > * {
|
|
267
|
+
color: #222;
|
|
268
|
+
font-size: 18px;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.status {
|
|
272
|
+
margin-left: 8px;
|
|
273
|
+
}
|
|
274
|
+
`;
|
|
@@ -4,32 +4,23 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import get from 'lodash/get';
|
|
5
5
|
import isEqual from 'lodash/isEqual';
|
|
6
6
|
import Box from '@mui/material/Box';
|
|
7
|
-
import useTheme from '@mui/material/styles/useTheme';
|
|
8
7
|
import Switch from '@mui/material/Switch';
|
|
9
8
|
import Divider from '@mui/material/Divider';
|
|
10
|
-
import AddIcon from '@mui/icons-material/Add';
|
|
11
|
-
import IconButton from '@mui/material/IconButton';
|
|
12
|
-
import Tooltip from '@mui/material/Tooltip';
|
|
13
9
|
import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
14
10
|
import Button from '@arcblock/ux/lib/Button';
|
|
15
|
-
import Empty from '@arcblock/ux/lib/Empty';
|
|
16
|
-
import LockIcon from '@arcblock/icons/lib/LockIcon';
|
|
17
11
|
import LoopIcon from '@mui/icons-material/Loop';
|
|
18
12
|
import { EVENTS } from '@abtnode/constant';
|
|
19
13
|
import { BLOCKLET_CONFIGURABLE_KEY, SUPPORTED_LANGUAGES } from '@blocklet/constant';
|
|
20
|
-
import { getWhoCanAccess
|
|
14
|
+
import { getWhoCanAccess } from '@blocklet/meta/lib/util';
|
|
21
15
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
22
16
|
import FormTextInput from '../form/form-text-input';
|
|
23
17
|
import FormSelectInput from '../form/form-select-input';
|
|
24
18
|
import { useNodeContext } from '../contexts/node';
|
|
25
|
-
import { isInstalling, isValidClusterSize, BlockletAdminRoles
|
|
19
|
+
import { isInstalling, isValidClusterSize, BlockletAdminRoles } from '../util';
|
|
26
20
|
import { enableDebug } from '../util/mode';
|
|
27
21
|
import Permission, { withPermission } from '../permission';
|
|
28
|
-
import
|
|
29
|
-
import DomainStatus from './router/domain-status';
|
|
30
|
-
import DomainActions from './router/domain-actions';
|
|
22
|
+
import ClearCache from '../clear-cache';
|
|
31
23
|
import AppSk from './preferences/app-sk';
|
|
32
|
-
import AddCert from './add-cert';
|
|
33
24
|
import TransferOwner from './transfer-owner';
|
|
34
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
35
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -52,7 +43,6 @@ function BlockletEnvironment({
|
|
|
52
43
|
const [showTransferOwner, setShowTransferOwner] = useState(false);
|
|
53
44
|
const whoCanAccess = getWhoCanAccess(blocklet);
|
|
54
45
|
const publicToStore = blocklet?.settings?.publicToStore;
|
|
55
|
-
const theme = useTheme();
|
|
56
46
|
const disabled = loading || !hasPermission;
|
|
57
47
|
const {
|
|
58
48
|
inService,
|
|
@@ -66,7 +56,6 @@ function BlockletEnvironment({
|
|
|
66
56
|
const {
|
|
67
57
|
site
|
|
68
58
|
} = blocklet;
|
|
69
|
-
const domains = sortDomains(site?.domainAliases);
|
|
70
59
|
const clusterMode = get(blocklet.meta, 'capabilities.clusterMode', false);
|
|
71
60
|
useSubscription(EVENTS.NODE_RUNTIME_INFO, res => {
|
|
72
61
|
if (clusterMode) {
|
|
@@ -318,107 +307,6 @@ function BlockletEnvironment({
|
|
|
318
307
|
className: "config-form",
|
|
319
308
|
component: Divider,
|
|
320
309
|
my: 3
|
|
321
|
-
}), /*#__PURE__*/_jsxs(Box, {
|
|
322
|
-
className: "config-form",
|
|
323
|
-
children: [/*#__PURE__*/_jsxs(Box, {
|
|
324
|
-
display: "flex",
|
|
325
|
-
justifyContent: "space-between",
|
|
326
|
-
alignItems: "center",
|
|
327
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
328
|
-
className: "config-label",
|
|
329
|
-
children: t('common.domain')
|
|
330
|
-
}), /*#__PURE__*/_jsx(Box, {
|
|
331
|
-
display: "flex",
|
|
332
|
-
alignItems: "center",
|
|
333
|
-
children: /*#__PURE__*/_jsx(AddDomainAlias, {
|
|
334
|
-
id: site.id,
|
|
335
|
-
title: t('router.domain.add.title'),
|
|
336
|
-
teamDid: did,
|
|
337
|
-
children: ({
|
|
338
|
-
open
|
|
339
|
-
}) => /*#__PURE__*/_jsxs(Button, {
|
|
340
|
-
style: {
|
|
341
|
-
marginLeft: 16
|
|
342
|
-
},
|
|
343
|
-
variant: "contained",
|
|
344
|
-
color: "primary",
|
|
345
|
-
"data-cy": "add-domain-alias",
|
|
346
|
-
onClick: open,
|
|
347
|
-
disabled: isInProgress(blocklet.status),
|
|
348
|
-
children: [/*#__PURE__*/_jsx(AddIcon, {
|
|
349
|
-
style: {
|
|
350
|
-
fontSize: '1.3em',
|
|
351
|
-
marginRight: 4
|
|
352
|
-
}
|
|
353
|
-
}), t('common.add')]
|
|
354
|
-
})
|
|
355
|
-
})
|
|
356
|
-
})]
|
|
357
|
-
}), domains.map((domain, index) => /*#__PURE__*/_jsxs(Box, {
|
|
358
|
-
display: "flex",
|
|
359
|
-
alignItems: "center",
|
|
360
|
-
justifyContent: "space-between",
|
|
361
|
-
mt: index ? 0 : 1,
|
|
362
|
-
children: [/*#__PURE__*/_jsxs(Box, {
|
|
363
|
-
display: "flex",
|
|
364
|
-
alignItems: "center",
|
|
365
|
-
justifyContent: "space-between",
|
|
366
|
-
children: [/*#__PURE__*/_jsx(DomainStatus, {
|
|
367
|
-
domain: domain,
|
|
368
|
-
filters: ['domain']
|
|
369
|
-
}, `${domain.value}-domain`), /*#__PURE__*/_jsx(Box, {
|
|
370
|
-
ml: 2,
|
|
371
|
-
mr: 0.5,
|
|
372
|
-
children: domain.value
|
|
373
|
-
}), /*#__PURE__*/_jsx(DomainStatus, {
|
|
374
|
-
domain: domain,
|
|
375
|
-
filters: ['http']
|
|
376
|
-
}, `${domain.value}-http`), /*#__PURE__*/_jsx("span", {
|
|
377
|
-
style: {
|
|
378
|
-
marginLeft: 12
|
|
379
|
-
}
|
|
380
|
-
}), /*#__PURE__*/_jsx(AddCert, {
|
|
381
|
-
domain: domain.value,
|
|
382
|
-
domainStatus: domain.domainStatus,
|
|
383
|
-
did: blocklet.meta.did,
|
|
384
|
-
children: ({
|
|
385
|
-
open
|
|
386
|
-
}) => /*#__PURE__*/_jsx(Button, {
|
|
387
|
-
size: "small",
|
|
388
|
-
onClick: e => open(e),
|
|
389
|
-
children: t('router.cert.genLetsEncryptCert.title')
|
|
390
|
-
})
|
|
391
|
-
})]
|
|
392
|
-
}), hasPermission && !domain.isProtected ? /*#__PURE__*/_jsx(DomainActions, {
|
|
393
|
-
site: site,
|
|
394
|
-
domain: domain,
|
|
395
|
-
blocklet: blocklet
|
|
396
|
-
}) : /*#__PURE__*/_jsx(Tooltip, {
|
|
397
|
-
title: t('blocklet.router.domainLockTooltip'),
|
|
398
|
-
placement: "top",
|
|
399
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
|
400
|
-
disabled: true,
|
|
401
|
-
size: "large",
|
|
402
|
-
style: {
|
|
403
|
-
pointerEvents: 'auto',
|
|
404
|
-
// padding replace to margin, fix the tooltip position
|
|
405
|
-
paddingTop: 0,
|
|
406
|
-
paddingBottom: 0,
|
|
407
|
-
margin: '12px 0'
|
|
408
|
-
},
|
|
409
|
-
children: /*#__PURE__*/_jsx(LockIcon, {
|
|
410
|
-
style: {
|
|
411
|
-
fill: theme.palette.text.disabled
|
|
412
|
-
}
|
|
413
|
-
})
|
|
414
|
-
})
|
|
415
|
-
})]
|
|
416
|
-
}, domain.value)), !domains.length && /*#__PURE__*/_jsx(Box, {
|
|
417
|
-
mt: 4,
|
|
418
|
-
children: /*#__PURE__*/_jsx(Empty, {
|
|
419
|
-
children: t('common.empty')
|
|
420
|
-
})
|
|
421
|
-
})]
|
|
422
310
|
}), /*#__PURE__*/_jsx(Box, {
|
|
423
311
|
className: "config-form",
|
|
424
312
|
component: Divider,
|
|
@@ -454,10 +342,6 @@ function BlockletEnvironment({
|
|
|
454
342
|
initialValue: (site.corsAllowedOrigins || []).join(', '),
|
|
455
343
|
onSubmit: onUpdateCors
|
|
456
344
|
})]
|
|
457
|
-
}), /*#__PURE__*/_jsx(Box, {
|
|
458
|
-
className: "config-form",
|
|
459
|
-
component: Divider,
|
|
460
|
-
my: 3
|
|
461
345
|
}), /*#__PURE__*/_jsx(Box, {
|
|
462
346
|
mb: 2,
|
|
463
347
|
className: "config-label",
|
|
@@ -538,6 +422,21 @@ function BlockletEnvironment({
|
|
|
538
422
|
onSuccess: () => setShowTransferOwner(false)
|
|
539
423
|
})]
|
|
540
424
|
})
|
|
425
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
426
|
+
className: "config-form",
|
|
427
|
+
mt: 2,
|
|
428
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
429
|
+
className: "config-item",
|
|
430
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
431
|
+
className: "config-label",
|
|
432
|
+
children: [t('blocklet.config.clearCache.name'), /*#__PURE__*/_jsx(Box, {
|
|
433
|
+
className: "config-desc",
|
|
434
|
+
children: t('blocklet.config.clearCache.purpose')
|
|
435
|
+
})]
|
|
436
|
+
}), /*#__PURE__*/_jsx(ClearCache, {
|
|
437
|
+
teamDid: did
|
|
438
|
+
})]
|
|
439
|
+
})
|
|
541
440
|
})]
|
|
542
441
|
})]
|
|
543
442
|
});
|
package/es/blocklet/overview.js
CHANGED
|
@@ -1,95 +1,26 @@
|
|
|
1
1
|
import Button from '@arcblock/ux/lib/Button';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import React, { useState } from 'react';
|
|
5
|
-
import Alert from '@mui/material/Alert';
|
|
6
|
-
import Box from '@mui/material/Box';
|
|
7
|
-
import Tooltip from '@mui/material/Tooltip';
|
|
8
|
-
import ExpandMore from '@mui/icons-material/ExpandMore';
|
|
9
4
|
import ExpandLess from '@mui/icons-material/ExpandLess';
|
|
10
|
-
import
|
|
11
|
-
import { isDidDomain } from '@abtnode/util/lib/url-evaluation';
|
|
12
|
-
import Empty from '@arcblock/ux/lib/Empty';
|
|
5
|
+
import ExpandMore from '@mui/icons-material/ExpandMore';
|
|
13
6
|
import InfoRow from '@arcblock/ux/lib/InfoRow';
|
|
14
7
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
15
8
|
import Tag from '@arcblock/ux/lib/Tag';
|
|
16
9
|
import { getDisplayName, getWhoCanAccess } from '@blocklet/meta/lib/util';
|
|
17
|
-
import Spinner from '@mui/material/CircularProgress';
|
|
18
10
|
import Typography from '@mui/material/Typography';
|
|
19
11
|
import { useBlockletContext } from '../contexts/blocklet';
|
|
20
12
|
import { useNodeContext } from '../contexts/node';
|
|
21
13
|
import DidAddress from '../did-address';
|
|
22
|
-
import { formatToDatetime, getExplorerLink
|
|
23
|
-
import DomainStatus from './router/domain-status';
|
|
14
|
+
import { formatToDatetime, getExplorerLink } from '../util';
|
|
24
15
|
import BlockletStatus from './status';
|
|
25
|
-
import { DomainType } from './types';
|
|
26
16
|
import { isServerless } from './util';
|
|
17
|
+
import DomainListWithPermission from './component/domain-list';
|
|
27
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
20
|
const WalletType = {
|
|
30
21
|
arcblock: 'ArcBlock',
|
|
31
22
|
ethereum: 'Ethereum'
|
|
32
23
|
};
|
|
33
|
-
function DomainLink({
|
|
34
|
-
domain,
|
|
35
|
-
children
|
|
36
|
-
}) {
|
|
37
|
-
const {
|
|
38
|
-
t
|
|
39
|
-
} = useLocaleContext();
|
|
40
|
-
const {
|
|
41
|
-
href,
|
|
42
|
-
accessibility
|
|
43
|
-
} = domain;
|
|
44
|
-
if (!accessibility || accessibility.loading) {
|
|
45
|
-
return /*#__PURE__*/_jsxs(LinkDiv, {
|
|
46
|
-
children: [children, /*#__PURE__*/_jsx(Tooltip, {
|
|
47
|
-
title: t('blocklet.router.checkUrlAccessible'),
|
|
48
|
-
placement: "top-end",
|
|
49
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
50
|
-
className: "status",
|
|
51
|
-
children: /*#__PURE__*/_jsx(Spinner, {
|
|
52
|
-
size: 12
|
|
53
|
-
})
|
|
54
|
-
})
|
|
55
|
-
})]
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
if (!accessibility.accessible) {
|
|
59
|
-
return /*#__PURE__*/_jsx(LinkDiv, {
|
|
60
|
-
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
61
|
-
title: t('blocklet.router.urlInaccessible'),
|
|
62
|
-
placement: "top-end",
|
|
63
|
-
children: /*#__PURE__*/_jsx("span", {
|
|
64
|
-
children: children
|
|
65
|
-
})
|
|
66
|
-
})
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
return /*#__PURE__*/_jsx(LinkDiv, {
|
|
70
|
-
children: /*#__PURE__*/_jsx("a", {
|
|
71
|
-
href: href,
|
|
72
|
-
target: "_blank",
|
|
73
|
-
rel: "noopener noreferrer",
|
|
74
|
-
children: children
|
|
75
|
-
})
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
DomainLink.propTypes = {
|
|
79
|
-
domain: DomainType.isRequired,
|
|
80
|
-
children: PropTypes.any.isRequired
|
|
81
|
-
};
|
|
82
|
-
const LinkDiv = styled.span`
|
|
83
|
-
&,
|
|
84
|
-
& > * {
|
|
85
|
-
color: #222;
|
|
86
|
-
font-size: 18px;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.status {
|
|
90
|
-
margin-left: 8px;
|
|
91
|
-
}
|
|
92
|
-
`;
|
|
93
24
|
export default function BlockletOverview() {
|
|
94
25
|
const {
|
|
95
26
|
t,
|
|
@@ -99,11 +30,9 @@ export default function BlockletOverview() {
|
|
|
99
30
|
info: nodeInfo,
|
|
100
31
|
inService
|
|
101
32
|
} = useNodeContext();
|
|
102
|
-
const [showAllDomains, setShowAllDomains] = useState(false);
|
|
103
33
|
const [showAllDIDs, setShowAllDIDs] = useState(false);
|
|
104
34
|
const {
|
|
105
|
-
blocklet
|
|
106
|
-
loadingRuntimeInfo
|
|
35
|
+
blocklet
|
|
107
36
|
} = useBlockletContext();
|
|
108
37
|
const {
|
|
109
38
|
appDid,
|
|
@@ -195,80 +124,9 @@ export default function BlockletOverview() {
|
|
|
195
124
|
children: row.value
|
|
196
125
|
}, row.name);
|
|
197
126
|
});
|
|
198
|
-
const domains = sortDomains(blocklet.site?.domainAliases);
|
|
199
|
-
const displayDomains = [];
|
|
200
|
-
const hiddenDomains = [];
|
|
201
|
-
const pidBase32 = encodeBase32(blocklet.appPid);
|
|
202
|
-
domains.forEach(domain => {
|
|
203
|
-
const value = domain.value || '';
|
|
204
|
-
if (isDidDomain(value) && !value.startsWith(pidBase32)) {
|
|
205
|
-
hiddenDomains.push(domain);
|
|
206
|
-
} else {
|
|
207
|
-
displayDomains.push(domain);
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
127
|
return /*#__PURE__*/_jsxs(Div, {
|
|
211
128
|
component: "div",
|
|
212
|
-
children: [/*#__PURE__*/_jsx(
|
|
213
|
-
display: "flex",
|
|
214
|
-
justifyContent: "space-between",
|
|
215
|
-
alignItems: "center",
|
|
216
|
-
children: /*#__PURE__*/_jsx(Box, {
|
|
217
|
-
className: "title first",
|
|
218
|
-
mb: 0,
|
|
219
|
-
children: t('common.domain')
|
|
220
|
-
})
|
|
221
|
-
}), blocklet.status !== 'running' && /*#__PURE__*/_jsx(Box, {
|
|
222
|
-
mt: -2,
|
|
223
|
-
mb: 1.5,
|
|
224
|
-
children: /*#__PURE__*/_jsx(Alert, {
|
|
225
|
-
severity: "warning",
|
|
226
|
-
children: t('blocklet.router.noRunning')
|
|
227
|
-
})
|
|
228
|
-
}), (showAllDomains ? domains : displayDomains).map((domain, index) => /*#__PURE__*/_jsx(Box, {
|
|
229
|
-
display: "flex",
|
|
230
|
-
alignItems: "center",
|
|
231
|
-
justifyContent: "space-between",
|
|
232
|
-
mt: index ? 3 : 0,
|
|
233
|
-
children: /*#__PURE__*/_jsxs(Box, {
|
|
234
|
-
display: "flex",
|
|
235
|
-
alignItems: "center",
|
|
236
|
-
justifyContent: "space-between",
|
|
237
|
-
children: [/*#__PURE__*/_jsx(DomainStatus, {
|
|
238
|
-
domain: domain,
|
|
239
|
-
filters: ['domain']
|
|
240
|
-
}, `${domain.value}-domain`), /*#__PURE__*/_jsx(Box, {
|
|
241
|
-
ml: 2,
|
|
242
|
-
mr: 0.5,
|
|
243
|
-
children: /*#__PURE__*/_jsx(DomainLink, {
|
|
244
|
-
domain: domain,
|
|
245
|
-
target: "_blank",
|
|
246
|
-
children: domain.value
|
|
247
|
-
})
|
|
248
|
-
}), /*#__PURE__*/_jsx(DomainStatus, {
|
|
249
|
-
domain: domain,
|
|
250
|
-
filters: ['http']
|
|
251
|
-
}, `${domain.value}-http`), /*#__PURE__*/_jsx("span", {
|
|
252
|
-
style: {
|
|
253
|
-
marginLeft: 12
|
|
254
|
-
}
|
|
255
|
-
})]
|
|
256
|
-
})
|
|
257
|
-
}, domain.value)), hiddenDomains.length > 0 && /*#__PURE__*/_jsx("div", {
|
|
258
|
-
style: {
|
|
259
|
-
marginLeft: '20px',
|
|
260
|
-
marginTop: '12px'
|
|
261
|
-
},
|
|
262
|
-
children: /*#__PURE__*/_jsx(Button, {
|
|
263
|
-
endIcon: showAllDomains ? /*#__PURE__*/_jsx(ExpandLess, {}) : /*#__PURE__*/_jsx(ExpandMore, {}),
|
|
264
|
-
onClick: () => setShowAllDomains(!showAllDomains),
|
|
265
|
-
children: showAllDomains ? t('common.collapseAll') : t('blocklet.router.showAllDomains')
|
|
266
|
-
})
|
|
267
|
-
}), !domains.length && (loadingRuntimeInfo ? /*#__PURE__*/_jsx(Spinner, {
|
|
268
|
-
size: 16
|
|
269
|
-
}) : /*#__PURE__*/_jsx(Empty, {
|
|
270
|
-
children: t('common.empty')
|
|
271
|
-
})), /*#__PURE__*/_jsx("div", {
|
|
129
|
+
children: [/*#__PURE__*/_jsx(DomainListWithPermission, {}), /*#__PURE__*/_jsx("div", {
|
|
272
130
|
className: "title",
|
|
273
131
|
children: /*#__PURE__*/_jsx("span", {
|
|
274
132
|
children: t('common.basicInfo')
|
|
@@ -286,6 +144,7 @@ const Div = styled(Typography)`
|
|
|
286
144
|
font-weight: bold;
|
|
287
145
|
margin-top: ${props => props.theme.spacing(5)};
|
|
288
146
|
margin-bottom: ${props => props.theme.spacing(3)};
|
|
147
|
+
|
|
289
148
|
&.first {
|
|
290
149
|
margin-top: 0;
|
|
291
150
|
}
|