@abtnode/ux 1.16.14-beta-ab7f615e → 1.16.14-beta-cb53c14b
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 +97 -0
- package/es/analytics/card.js +92 -0
- package/es/analytics/chart.js +96 -0
- package/es/analytics/cpu.js +36 -0
- package/es/analytics/disk.js +111 -0
- package/es/analytics/memory.js +72 -0
- package/es/analytics/runtime.js +173 -0
- package/es/analytics/traffic.js +259 -0
- package/es/blocklet/access/config-access.js +307 -0
- package/es/blocklet/access/index.js +216 -0
- package/es/blocklet/actions.js +474 -0
- package/es/blocklet/add-cert.js +177 -0
- package/es/blocklet/agreement-app.js +21 -0
- package/es/blocklet/agreement.js +127 -0
- package/es/blocklet/app-avatar.js +57 -0
- package/es/blocklet/audit-logs.js +259 -0
- package/es/blocklet/blocklet-source.js +48 -0
- package/es/blocklet/bundle-avatar.js +64 -0
- package/es/blocklet/component/add.js +1308 -0
- package/es/blocklet/component/configuration.js +122 -0
- package/es/blocklet/component/delete.js +134 -0
- package/es/blocklet/component/environment.js +370 -0
- package/es/blocklet/component/index.js +975 -0
- package/es/blocklet/component/line.js +20 -0
- package/es/blocklet/component/navigation/locale-tabs.js +225 -0
- package/es/blocklet/component/navigation/navigation-actions.js +112 -0
- package/es/blocklet/component/navigation/navigation-dialog.js +607 -0
- package/es/blocklet/component/navigation/navigation-preview.js +101 -0
- package/es/blocklet/component/navigation/simple-select.js +124 -0
- package/es/blocklet/component/select-store.js +155 -0
- package/es/blocklet/component/setting.js +109 -0
- package/es/blocklet/component/sortable-tree.js +126 -0
- package/es/blocklet/component/space-connector.js +199 -0
- package/es/blocklet/component/space-selector.js +178 -0
- package/es/blocklet/component/start.js +101 -0
- package/es/blocklet/component/store-blocklet-list.js +200 -0
- package/es/blocklet/component/switch-control.js +57 -0
- package/es/blocklet/config-navigation.js +331 -0
- package/es/blocklet/configuration.js +603 -0
- package/es/blocklet/disk-info.js +75 -0
- package/es/blocklet/icons.js +18 -0
- package/es/blocklet/install-from-url.js +337 -0
- package/es/blocklet/log.js +90 -0
- package/es/blocklet/migration.js +149 -0
- package/es/blocklet/mode.js +19 -0
- package/es/blocklet/notification/email.js +257 -0
- package/es/blocklet/notification/index.js +49 -0
- package/es/blocklet/oauth/auth0.js +145 -0
- package/es/blocklet/oauth/common-settings.js +133 -0
- package/es/blocklet/oauth/federated-detail-dialog.js +175 -0
- package/es/blocklet/oauth/federated-invite-dialog.js +83 -0
- package/es/blocklet/oauth/federated-join-dialog.js +111 -0
- package/es/blocklet/oauth/federated-site-list.js +338 -0
- package/es/blocklet/oauth/federated.js +81 -0
- package/es/blocklet/oauth/index.js +69 -0
- package/es/blocklet/overview.js +293 -0
- package/es/blocklet/page-group.js +19 -0
- package/es/blocklet/preferences/app-sk.js +142 -0
- package/es/blocklet/preferences/index.js +305 -0
- package/es/blocklet/purchase/common.js +95 -0
- package/es/blocklet/purchase/component-purchase.js +237 -0
- package/es/blocklet/purchase/index.js +4 -0
- package/es/blocklet/router/action/add-domain-alias.js +167 -0
- package/es/blocklet/router/action/add-rule.js +211 -0
- package/es/blocklet/router/action/config-routing-rule.js +232 -0
- package/es/blocklet/router/action/delete-domain-alias.js +99 -0
- package/es/blocklet/router/action/delete-rule.js +108 -0
- package/es/blocklet/router/action/update-rule.js +209 -0
- package/es/blocklet/router/domain-actions.js +64 -0
- package/es/blocklet/router/domain-status.js +88 -0
- package/es/blocklet/router/rule-actions.js +66 -0
- package/es/blocklet/router/rule-list.js +190 -0
- package/es/blocklet/router/util.js +131 -0
- package/es/blocklet/runtime-info.js +68 -0
- package/es/blocklet/status.js +91 -0
- package/es/blocklet/storage/action.js +134 -0
- package/es/blocklet/storage/backups.js +241 -0
- package/es/blocklet/storage/connect-to.js +373 -0
- package/es/blocklet/storage/connected.js +198 -0
- package/es/blocklet/storage/delete.js +113 -0
- package/es/blocklet/storage/disconnect.js +243 -0
- package/es/blocklet/storage/index.js +19 -0
- package/es/blocklet/storage/item.js +558 -0
- package/es/blocklet/storage/preview-nft.js +286 -0
- package/es/blocklet/transfer-owner.js +198 -0
- package/es/blocklet/types.js +18 -0
- package/es/blocklet/util.js +145 -0
- package/es/blocklet/version.js +141 -0
- package/es/card-selector.js +134 -0
- package/es/certificate.js +105 -0
- package/es/chain.js +13 -0
- package/es/click-to-copy.js +22 -0
- package/es/confirm.js +149 -0
- package/es/contexts/audit-log.js +152 -0
- package/es/contexts/blocklet.js +10 -0
- package/es/contexts/deleting-blocklets.js +70 -0
- package/es/contexts/node.js +17 -0
- package/es/contexts/session.js +8 -0
- package/es/contexts/team.js +10 -0
- package/es/delete-confirm.js +121 -0
- package/es/did-address.js +46 -0
- package/es/dot.js +14 -0
- package/es/exchange-passport.js +102 -0
- package/es/form/form-select-input.js +184 -0
- package/es/form/form-text-input.js +178 -0
- package/es/form/form-wrapper.js +88 -0
- package/es/form/input-triggers.js +98 -0
- package/es/form/required.js +8 -0
- package/es/hooks/blocklet.js +229 -0
- package/es/hooks/confirm.js +90 -0
- package/es/hooks/mobile-width.js +11 -0
- package/es/hooks/url-evaluation.js +155 -0
- package/es/hooks/use-app-logo.js +16 -0
- package/es/hooks/use-backup-progress.js +31 -0
- package/es/hooks/use-blocklet-info-for-connect-did-spaces.js +50 -0
- package/es/hooks/use-bundle-logo.js +27 -0
- package/es/hooks/use-navigation.js +347 -0
- package/es/hooks/use-passport-id.js +14 -0
- package/es/hooks/use-subscription.js +22 -0
- package/es/icons/empty-space-nft.svg +59 -0
- package/es/icons/empty-spaces-nft.svg +58 -0
- package/es/icons/long-arrow.svg +5 -0
- package/es/icons/space-connected.svg +3 -0
- package/es/icons/space-disconnect.svg +3 -0
- package/es/index.js +3 -0
- package/es/invitation/invitation-app.js +58 -0
- package/es/invitation/invitation-login.js +68 -0
- package/es/invitation/invitation-passport.js +144 -0
- package/es/invitation/invitation-receive.js +138 -0
- package/es/invitation/invitation-success.js +93 -0
- package/es/invitation/invitation-user.js +90 -0
- package/es/invitation/invitation.js +90 -0
- package/es/issue-passport.js +142 -0
- package/es/launch-blocklet/content-layout.js +58 -0
- package/es/launch-blocklet/page-header.js +43 -0
- package/es/layout/addon.js +114 -0
- package/es/layout/feedback.js +55 -0
- package/es/locales/en.js +1534 -0
- package/es/locales/index.js +9 -0
- package/es/locales/zh.js +1537 -0
- package/es/logs/clock.js +11 -0
- package/es/logs/download.js +132 -0
- package/es/logs/log-terminal.js +253 -0
- package/es/lost-passport.js +452 -0
- package/es/nav-logo.js +219 -0
- package/es/passport-tag.js +43 -0
- package/es/permission.js +57 -0
- package/es/relative-time.js +53 -0
- package/es/result-message.js +11 -0
- package/es/schema-form/color-input.js +98 -0
- package/es/schema-form/common-prop-types.js +13 -0
- package/es/schema-form/index.js +215 -0
- package/es/schema-form/passport-input.js +54 -0
- package/es/schema-form/text-input.js +57 -0
- package/es/store/add.js +179 -0
- package/es/store/delete.js +96 -0
- package/es/store/item.js +76 -0
- package/es/subscription.js +144 -0
- package/es/table-icons.js +34 -0
- package/es/table.js +52 -0
- package/es/tag.js +21 -0
- package/es/team/members/actions.js +89 -0
- package/es/team/members/index.js +636 -0
- package/es/team/members/invitations.js +188 -0
- package/es/team/members/invite-member.js +208 -0
- package/es/team/members/issue-passport.js +152 -0
- package/es/team/members/member.js +408 -0
- package/es/team/members/passport-issuances.js +155 -0
- package/es/team/members/passports.js +364 -0
- package/es/team/members/toggle-user-approval.js +122 -0
- package/es/team/members/transfer-node.js +256 -0
- package/es/team/members/util.js +14 -0
- package/es/team/passports/color.js +126 -0
- package/es/team/passports/detail.js +312 -0
- package/es/team/passports/index.js +282 -0
- package/es/team/passports/mutate-role.js +198 -0
- package/es/team/passports/trusted-factories.js +221 -0
- package/es/team/passports/trusted-factory.js +343 -0
- package/es/team/passports/trusted-issuer.js +296 -0
- package/es/team/passports/trusted-issuers.js +226 -0
- package/es/team/search-input.js +46 -0
- package/es/team/styles/dialog.js +72 -0
- package/es/team/styles/list-header.js +31 -0
- package/es/util/api.js +6 -0
- package/es/util/constants.js +2 -0
- package/es/util/index.js +598 -0
- package/es/util/mode.js +4 -0
- package/es/util/space-gateway.js +51 -0
- package/es/util/spaces.js +151 -0
- package/es/who-can-access/config.js +38 -0
- package/es/wrap-locale.js +15 -0
- package/lib/blocklet/component/space-connector.js +1 -1
- package/lib/blocklet/component/space-selector.js +1 -1
- package/lib/blocklet/storage/backups.js +1 -1
- package/lib/blocklet/storage/connect-to.js +1 -1
- package/lib/blocklet/storage/connected.js +1 -1
- package/lib/blocklet/storage/disconnect.js +1 -1
- package/lib/blocklet/storage/index.js +1 -1
- package/lib/blocklet/storage/item.js +1 -1
- package/lib/invitation/invitation-receive.js +1 -1
- package/lib/team/passports/trusted-factory.js +1 -1
- package/package.json +81 -18
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/* eslint-disable react/no-unstable-nested-components */
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
+
import { useContext, useRef } from 'react';
|
|
5
|
+
import { useMemoizedFn } from 'ahooks';
|
|
6
|
+
import Button from '@arcblock/ux/lib/Button';
|
|
7
|
+
import { Divider } from '@mui/material';
|
|
8
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
9
|
+
import { useBlockletContext } from '../../contexts/blocklet';
|
|
10
|
+
import FederatedSiteList from './federated-site-list';
|
|
11
|
+
import FederatedJoinDialog from './federated-join-dialog';
|
|
12
|
+
import FederatedInviteDialog from './federated-invite-dialog';
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
16
|
+
export default function FederatedLogin() {
|
|
17
|
+
const federatedInviteRef = useRef(null);
|
|
18
|
+
const federatedJoinRef = useRef(null);
|
|
19
|
+
const {
|
|
20
|
+
t
|
|
21
|
+
} = useContext(LocaleContext);
|
|
22
|
+
const {
|
|
23
|
+
blocklet,
|
|
24
|
+
actions: {
|
|
25
|
+
refreshBlocklet
|
|
26
|
+
}
|
|
27
|
+
} = useBlockletContext();
|
|
28
|
+
const showInvite = useMemoizedFn(() => {
|
|
29
|
+
const link = blocklet.site?.domainAliases?.[0]?.href;
|
|
30
|
+
if (link) {
|
|
31
|
+
try {
|
|
32
|
+
const url = new URL(link);
|
|
33
|
+
federatedInviteRef.current?.open({
|
|
34
|
+
link: url.origin
|
|
35
|
+
});
|
|
36
|
+
} catch {
|
|
37
|
+
Toast.error(t('federated.failedToGetFederatedLoginLink'));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, [blocklet.site?.domainAliases?.[0]?.href]);
|
|
41
|
+
const joinInvite = useMemoizedFn(() => {
|
|
42
|
+
federatedJoinRef.current?.open(() => {
|
|
43
|
+
refreshBlocklet();
|
|
44
|
+
});
|
|
45
|
+
}, [refreshBlocklet]);
|
|
46
|
+
if (blocklet.settings.federated?.sites.length > 0) {
|
|
47
|
+
const isMaster = blocklet.settings.federated?.config.isMaster !== false;
|
|
48
|
+
return /*#__PURE__*/_jsx(FederatedSiteList, {
|
|
49
|
+
mode: isMaster ? 'master' : 'member'
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
53
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
54
|
+
display: "flex",
|
|
55
|
+
flexDirection: "column",
|
|
56
|
+
gap: 2,
|
|
57
|
+
justifyContent: "center",
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
minHeight: "200px",
|
|
60
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
61
|
+
variant: "contained",
|
|
62
|
+
onClick: showInvite,
|
|
63
|
+
children: t('federated.inviteJoinFederatedLogin')
|
|
64
|
+
}), /*#__PURE__*/_jsx(Divider, {
|
|
65
|
+
sx: {
|
|
66
|
+
width: '150px',
|
|
67
|
+
color: 'rgba(0, 0, 0, 0.3)'
|
|
68
|
+
},
|
|
69
|
+
children: "OR"
|
|
70
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
71
|
+
variant: "outlined",
|
|
72
|
+
onClick: joinInvite,
|
|
73
|
+
children: t('federated.joinFederatedLogin')
|
|
74
|
+
})]
|
|
75
|
+
}), /*#__PURE__*/_jsx(FederatedInviteDialog, {
|
|
76
|
+
ref: federatedInviteRef
|
|
77
|
+
}), /*#__PURE__*/_jsx(FederatedJoinDialog, {
|
|
78
|
+
ref: federatedJoinRef
|
|
79
|
+
})]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import Empty from '@arcblock/ux/lib/Empty';
|
|
2
|
+
import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
+
import Tabs from '@arcblock/ux/lib/Tabs';
|
|
4
|
+
import { Box } from '@mui/material';
|
|
5
|
+
import { useCreation } from 'ahooks';
|
|
6
|
+
import { useContext, useState } from 'react';
|
|
7
|
+
import OAuthAuth0 from './auth0';
|
|
8
|
+
import CommonSettings from './common-settings';
|
|
9
|
+
import FederatedLogin from './federated';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
function OAuth() {
|
|
13
|
+
const {
|
|
14
|
+
t
|
|
15
|
+
} = useContext(LocaleContext);
|
|
16
|
+
const tabs = [{
|
|
17
|
+
label: /*#__PURE__*/_jsx(Box, {
|
|
18
|
+
textAlign: "center",
|
|
19
|
+
width: "100%",
|
|
20
|
+
children: t('oauth.commonSettings')
|
|
21
|
+
}),
|
|
22
|
+
value: 'settings'
|
|
23
|
+
}, {
|
|
24
|
+
label: /*#__PURE__*/_jsx(Box, {
|
|
25
|
+
textAlign: "center",
|
|
26
|
+
width: "100%",
|
|
27
|
+
children: t('oauth.federated')
|
|
28
|
+
}),
|
|
29
|
+
value: 'federated'
|
|
30
|
+
}, {
|
|
31
|
+
label: /*#__PURE__*/_jsx(Box, {
|
|
32
|
+
textAlign: "center",
|
|
33
|
+
width: "100%",
|
|
34
|
+
children: "Auth0"
|
|
35
|
+
}),
|
|
36
|
+
value: 'auth0'
|
|
37
|
+
}, {
|
|
38
|
+
label: /*#__PURE__*/_jsx(Box, {
|
|
39
|
+
textAlign: "center",
|
|
40
|
+
width: "100%",
|
|
41
|
+
children: t('oauth.moreLogin')
|
|
42
|
+
}),
|
|
43
|
+
value: 'more'
|
|
44
|
+
}];
|
|
45
|
+
const [currentTab, setCurrentTab] = useState(tabs[0].value);
|
|
46
|
+
const contents = useCreation(() => ({
|
|
47
|
+
auth0: /*#__PURE__*/_jsx(OAuthAuth0, {}),
|
|
48
|
+
federated: /*#__PURE__*/_jsx(FederatedLogin, {}),
|
|
49
|
+
more: /*#__PURE__*/_jsx(Box, {
|
|
50
|
+
children: /*#__PURE__*/_jsx(Empty, {
|
|
51
|
+
children: t('oauth.comingSoon')
|
|
52
|
+
})
|
|
53
|
+
}),
|
|
54
|
+
settings: /*#__PURE__*/_jsx(Box, {
|
|
55
|
+
children: /*#__PURE__*/_jsx(CommonSettings, {})
|
|
56
|
+
})
|
|
57
|
+
}), [t]);
|
|
58
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
59
|
+
children: [/*#__PURE__*/_jsx(Tabs, {
|
|
60
|
+
tabs: tabs,
|
|
61
|
+
current: currentTab,
|
|
62
|
+
onChange: setCurrentTab
|
|
63
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
64
|
+
marginTop: "10px",
|
|
65
|
+
children: contents[currentTab]
|
|
66
|
+
})]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export default OAuth;
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import Button from '@arcblock/ux/lib/Button';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
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
|
+
import ExpandLess from '@mui/icons-material/ExpandLess';
|
|
10
|
+
import { encode as encodeBase32 } from '@abtnode/util/lib/base32';
|
|
11
|
+
import { isDidDomain } from '@abtnode/util/lib/url-evaluation';
|
|
12
|
+
import Empty from '@arcblock/ux/lib/Empty';
|
|
13
|
+
import InfoRow from '@arcblock/ux/lib/InfoRow';
|
|
14
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
15
|
+
import Tag from '@arcblock/ux/lib/Tag';
|
|
16
|
+
import { getDisplayName, getWhoCanAccess } from '@blocklet/meta/lib/util';
|
|
17
|
+
import Spinner from '@mui/material/CircularProgress';
|
|
18
|
+
import Typography from '@mui/material/Typography';
|
|
19
|
+
import { useBlockletContext } from '../contexts/blocklet';
|
|
20
|
+
import { useNodeContext } from '../contexts/node';
|
|
21
|
+
import DidAddress from '../did-address';
|
|
22
|
+
import { formatToDatetime, getExplorerLink, sortDomains } from '../util';
|
|
23
|
+
import DomainStatus from './router/domain-status';
|
|
24
|
+
import BlockletStatus from './status';
|
|
25
|
+
import { DomainType } from './types';
|
|
26
|
+
import { isServerless } from './util';
|
|
27
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
|
+
const WalletType = {
|
|
30
|
+
arcblock: 'ArcBlock',
|
|
31
|
+
ethereum: 'Ethereum'
|
|
32
|
+
};
|
|
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
|
+
export default function BlockletOverview() {
|
|
94
|
+
const {
|
|
95
|
+
t,
|
|
96
|
+
locale
|
|
97
|
+
} = useLocaleContext();
|
|
98
|
+
const {
|
|
99
|
+
info: nodeInfo,
|
|
100
|
+
inService
|
|
101
|
+
} = useNodeContext();
|
|
102
|
+
const [showAllDomains, setShowAllDomains] = useState(false);
|
|
103
|
+
const [showAllDIDs, setShowAllDIDs] = useState(false);
|
|
104
|
+
const {
|
|
105
|
+
blocklet,
|
|
106
|
+
loadingRuntimeInfo
|
|
107
|
+
} = useBlockletContext();
|
|
108
|
+
const {
|
|
109
|
+
appDid,
|
|
110
|
+
appPid,
|
|
111
|
+
migratedFrom = []
|
|
112
|
+
} = blocklet;
|
|
113
|
+
const chainType = blocklet.environments.find(x => x.key === 'BLOCKLET_APP_CHAIN_TYPE')?.value;
|
|
114
|
+
const infoRows = [appDid ? {
|
|
115
|
+
name: t('blocklet.appId'),
|
|
116
|
+
value: /*#__PURE__*/_jsx(DidAddress, {
|
|
117
|
+
did: appDid
|
|
118
|
+
})
|
|
119
|
+
} : null, appPid ? {
|
|
120
|
+
name: t('blocklet.appPid'),
|
|
121
|
+
value: /*#__PURE__*/_jsx(DidAddress, {
|
|
122
|
+
did: appPid
|
|
123
|
+
})
|
|
124
|
+
} : null, migratedFrom?.length > 1 ? {
|
|
125
|
+
name: t('blocklet.alsoKnownAs'),
|
|
126
|
+
value: /*#__PURE__*/_jsxs("div", {
|
|
127
|
+
children: [(showAllDIDs ? migratedFrom.slice(1) : migratedFrom.slice(1, 2)).map(x => /*#__PURE__*/_jsx(DidAddress, {
|
|
128
|
+
did: x.appDid
|
|
129
|
+
})), migratedFrom.length > 2 && /*#__PURE__*/_jsx(Button, {
|
|
130
|
+
style: {
|
|
131
|
+
marginLeft: '18px'
|
|
132
|
+
},
|
|
133
|
+
endIcon: showAllDIDs ? /*#__PURE__*/_jsx(ExpandLess, {}) : /*#__PURE__*/_jsx(ExpandMore, {}),
|
|
134
|
+
onClick: () => setShowAllDIDs(!showAllDIDs),
|
|
135
|
+
children: showAllDIDs ? t('common.collapseAll') : t('blocklet.router.showAllDIDs')
|
|
136
|
+
})]
|
|
137
|
+
})
|
|
138
|
+
} : null, {
|
|
139
|
+
name: t('common.name'),
|
|
140
|
+
value: getDisplayName(blocklet, true)
|
|
141
|
+
}, {
|
|
142
|
+
name: t('common.status'),
|
|
143
|
+
value: /*#__PURE__*/_jsx(BlockletStatus, {
|
|
144
|
+
status: blocklet.status,
|
|
145
|
+
source: blocklet.source
|
|
146
|
+
})
|
|
147
|
+
}, isServerless(blocklet) ? {
|
|
148
|
+
name: 'NFT',
|
|
149
|
+
value: /*#__PURE__*/_jsx(DidAddress, {
|
|
150
|
+
external: true,
|
|
151
|
+
href: getExplorerLink(blocklet?.controller?.chainHost, blocklet?.controller?.nftId, 'asset'),
|
|
152
|
+
did: blocklet?.controller?.nftId
|
|
153
|
+
})
|
|
154
|
+
} : null, {
|
|
155
|
+
name: t('blocklet.installedAt'),
|
|
156
|
+
value: formatToDatetime(blocklet.installedAt, locale)
|
|
157
|
+
}, {
|
|
158
|
+
name: t('blocklet.overview.accessControl'),
|
|
159
|
+
value: t(`team.whoCanAccess.${getWhoCanAccess(blocklet)}.title`)
|
|
160
|
+
}, {
|
|
161
|
+
name: t('common.owner'),
|
|
162
|
+
value: blocklet.settings?.owner ? /*#__PURE__*/_jsx(DidAddress, {
|
|
163
|
+
did: blocklet.settings.owner.did
|
|
164
|
+
}) : '--'
|
|
165
|
+
}, {
|
|
166
|
+
name: t('blocklet.config.walletType.name'),
|
|
167
|
+
value: WalletType[chainType || 'arcblock'] || chainType
|
|
168
|
+
}, blocklet.externalSkSource ? {
|
|
169
|
+
name: t('blocklet.skSource'),
|
|
170
|
+
value: blocklet.externalSkSource
|
|
171
|
+
} : null].filter(Boolean);
|
|
172
|
+
if (inService) {
|
|
173
|
+
infoRows.push({
|
|
174
|
+
name: t('common.serverDid'),
|
|
175
|
+
value: /*#__PURE__*/_jsx(DidAddress, {
|
|
176
|
+
did: nodeInfo.did
|
|
177
|
+
})
|
|
178
|
+
}, {
|
|
179
|
+
name: t('common.serverVersion'),
|
|
180
|
+
value: /*#__PURE__*/_jsx(Tag, {
|
|
181
|
+
children: nodeInfo.version
|
|
182
|
+
})
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
const renderRows = rows => rows.map(row => {
|
|
186
|
+
return /*#__PURE__*/_jsx(InfoRow, {
|
|
187
|
+
style: {
|
|
188
|
+
display: 'flex',
|
|
189
|
+
alignItems: 'flex-start'
|
|
190
|
+
},
|
|
191
|
+
valueComponent: "div",
|
|
192
|
+
nameWidth: 120,
|
|
193
|
+
name: row.name,
|
|
194
|
+
nameFormatter: () => row.name,
|
|
195
|
+
children: row.value
|
|
196
|
+
}, row.name);
|
|
197
|
+
});
|
|
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
|
+
return /*#__PURE__*/_jsxs(Div, {
|
|
211
|
+
component: "div",
|
|
212
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
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", {
|
|
272
|
+
className: "title",
|
|
273
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
274
|
+
children: t('common.basicInfo')
|
|
275
|
+
})
|
|
276
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
277
|
+
className: "basicInfo",
|
|
278
|
+
children: renderRows(infoRows)
|
|
279
|
+
})]
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
BlockletOverview.propTypes = {};
|
|
283
|
+
const Div = styled(Typography)`
|
|
284
|
+
.title {
|
|
285
|
+
font-size: 1.2rem;
|
|
286
|
+
font-weight: bold;
|
|
287
|
+
margin-top: ${props => props.theme.spacing(5)};
|
|
288
|
+
margin-bottom: ${props => props.theme.spacing(3)};
|
|
289
|
+
&.first {
|
|
290
|
+
margin-top: 0;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import Tag from '../tag';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export default function BlockletPageGroup({
|
|
5
|
+
group,
|
|
6
|
+
...rest
|
|
7
|
+
}) {
|
|
8
|
+
if (group) {
|
|
9
|
+
return /*#__PURE__*/_jsx(Tag, {
|
|
10
|
+
type: "reverse",
|
|
11
|
+
...rest,
|
|
12
|
+
children: group
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
BlockletPageGroup.propTypes = {
|
|
18
|
+
group: PropTypes.string.isRequired
|
|
19
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import useSetState from 'react-use/lib/useSetState';
|
|
5
|
+
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
6
|
+
import Box from '@mui/material/Box';
|
|
7
|
+
import { APP_STRUCT_VERSION } from '@abtnode/constant';
|
|
8
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
9
|
+
import { isInProgress } from '@blocklet/meta/lib/util';
|
|
10
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
11
|
+
import FormTextInput from '../../form/form-text-input';
|
|
12
|
+
import Confirm from '../../confirm';
|
|
13
|
+
import { useSessionContext } from '../../contexts/session';
|
|
14
|
+
import { useBlockletContext } from '../../contexts/blocklet';
|
|
15
|
+
import { isRunning } from '../../util';
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
export default function AppSk({
|
|
19
|
+
initialValue,
|
|
20
|
+
onChange,
|
|
21
|
+
disabled,
|
|
22
|
+
loading
|
|
23
|
+
}) {
|
|
24
|
+
const {
|
|
25
|
+
t
|
|
26
|
+
} = useLocaleContext();
|
|
27
|
+
const {
|
|
28
|
+
api
|
|
29
|
+
} = useSessionContext();
|
|
30
|
+
const {
|
|
31
|
+
blocklet
|
|
32
|
+
} = useBlockletContext();
|
|
33
|
+
const [state, setState] = useSetState({
|
|
34
|
+
newAppSk: '',
|
|
35
|
+
isConnectOpen: false
|
|
36
|
+
});
|
|
37
|
+
const onAppSkChange = value => {
|
|
38
|
+
setState({
|
|
39
|
+
newAppSk: value
|
|
40
|
+
});
|
|
41
|
+
return false;
|
|
42
|
+
};
|
|
43
|
+
const onConfirm = async v => {
|
|
44
|
+
try {
|
|
45
|
+
await onChange(v);
|
|
46
|
+
} finally {
|
|
47
|
+
setState({
|
|
48
|
+
newAppSk: ''
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const onClose = () => setState({
|
|
53
|
+
isConnectOpen: false
|
|
54
|
+
});
|
|
55
|
+
const triggers = blocklet.structVersion === APP_STRUCT_VERSION ? [{
|
|
56
|
+
key: 'rotate-with-did-wallet',
|
|
57
|
+
title: 'Migrate with DID Wallet',
|
|
58
|
+
handler: () => {
|
|
59
|
+
if (isRunning(blocklet.status)) {
|
|
60
|
+
Toast.error(t('blocklet.error.isRunning'));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (isInProgress(blocklet.status)) {
|
|
64
|
+
Toast.error(t('blocklet.error.isInProgress'));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
setState({
|
|
68
|
+
isConnectOpen: true
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}] : [];
|
|
72
|
+
return [/*#__PURE__*/_jsx(FormTextInput, {
|
|
73
|
+
disabled: disabled,
|
|
74
|
+
loading: loading,
|
|
75
|
+
initialValue: initialValue,
|
|
76
|
+
onSubmit: onAppSkChange,
|
|
77
|
+
triggers: triggers,
|
|
78
|
+
secure: true
|
|
79
|
+
}), state.newAppSk && /*#__PURE__*/_jsx(Confirm, {
|
|
80
|
+
title: t('blocklet.config.appSkTitle'),
|
|
81
|
+
description: /*#__PURE__*/_jsxs(Box, {
|
|
82
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
83
|
+
children: t('blocklet.config.appSkChangeTip')
|
|
84
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
85
|
+
fontWeight: "bold",
|
|
86
|
+
mt: 2,
|
|
87
|
+
children: t('blocklet.config.appDidChangeTip')
|
|
88
|
+
}), /*#__PURE__*/_jsxs(UL, {
|
|
89
|
+
children: [/*#__PURE__*/_jsx("li", {
|
|
90
|
+
children: t('blocklet.config.appDidChangeTipL1')
|
|
91
|
+
}), /*#__PURE__*/_jsx("li", {
|
|
92
|
+
children: t('blocklet.config.appDidChangeTipL2')
|
|
93
|
+
})]
|
|
94
|
+
})]
|
|
95
|
+
}),
|
|
96
|
+
confirm: t('confirm'),
|
|
97
|
+
cancel: t('cancel'),
|
|
98
|
+
onConfirm: () => onConfirm(state.newAppSk),
|
|
99
|
+
onCancel: () => setState({
|
|
100
|
+
newAppSk: ''
|
|
101
|
+
})
|
|
102
|
+
}), /*#__PURE__*/_jsx(DidConnect, {
|
|
103
|
+
popup: true,
|
|
104
|
+
open: state.isConnectOpen,
|
|
105
|
+
forceConnected: false,
|
|
106
|
+
saveConnect: false,
|
|
107
|
+
action: "rotate-key-pair",
|
|
108
|
+
checkFn: api.get,
|
|
109
|
+
checkTimeout: 5 * 60 * 1000,
|
|
110
|
+
onSuccess: onClose,
|
|
111
|
+
extraParams: {
|
|
112
|
+
appDid: blocklet.appDid
|
|
113
|
+
},
|
|
114
|
+
messages: {
|
|
115
|
+
title: t('setup.keyPair.title'),
|
|
116
|
+
scan: t('setup.keyPair.scan'),
|
|
117
|
+
confirm: t('setup.keyPair.confirm'),
|
|
118
|
+
success: t('setup.keyPair.success')
|
|
119
|
+
},
|
|
120
|
+
onClose: onClose
|
|
121
|
+
})];
|
|
122
|
+
}
|
|
123
|
+
AppSk.propTypes = {
|
|
124
|
+
initialValue: PropTypes.string,
|
|
125
|
+
onChange: PropTypes.func,
|
|
126
|
+
disabled: PropTypes.bool,
|
|
127
|
+
loading: PropTypes.bool
|
|
128
|
+
};
|
|
129
|
+
AppSk.defaultProps = {
|
|
130
|
+
initialValue: 'default',
|
|
131
|
+
onChange: () => {},
|
|
132
|
+
disabled: false,
|
|
133
|
+
loading: false
|
|
134
|
+
};
|
|
135
|
+
const UL = styled('ul')`
|
|
136
|
+
padding-left: 16px;
|
|
137
|
+
li {
|
|
138
|
+
margin-top: 8px;
|
|
139
|
+
list-style: disk;
|
|
140
|
+
font-weight: bold;
|
|
141
|
+
}
|
|
142
|
+
`;
|