@abtnode/ux 1.16.14-beta-c308dc3b → 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,177 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import useAsyncRetry from 'react-use/lib/useAsyncRetry';
|
|
4
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
5
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
6
|
+
import Alert from '@arcblock/ux/lib/Alert';
|
|
7
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
8
|
+
import { BlockletEvents } from '@blocklet/constant';
|
|
9
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
10
|
+
import Confirm from '../confirm';
|
|
11
|
+
import { useNodeContext } from '../contexts/node';
|
|
12
|
+
import { useBlockletContext } from '../contexts/blocklet';
|
|
13
|
+
import { shouldCheckDomainStatus } from '../util';
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
17
|
+
const isCertInProgress = status => ['waiting', 'creating', 'renewaling'].includes(status);
|
|
18
|
+
function Add(props) {
|
|
19
|
+
const {
|
|
20
|
+
t
|
|
21
|
+
} = useLocaleContext();
|
|
22
|
+
const [loading, setLoading] = useState(false);
|
|
23
|
+
const [confirmSetting, setConfirmSetting] = useState(null);
|
|
24
|
+
const {
|
|
25
|
+
domain,
|
|
26
|
+
onAdd,
|
|
27
|
+
children,
|
|
28
|
+
did
|
|
29
|
+
} = props;
|
|
30
|
+
const {
|
|
31
|
+
api,
|
|
32
|
+
ws: {
|
|
33
|
+
useSubscription
|
|
34
|
+
}
|
|
35
|
+
} = useNodeContext();
|
|
36
|
+
const [issuing, setIssuing] = useState(false);
|
|
37
|
+
const {
|
|
38
|
+
actions: {
|
|
39
|
+
refreshDomainStatus
|
|
40
|
+
}
|
|
41
|
+
} = useBlockletContext();
|
|
42
|
+
const certState = useAsyncRetry(async () => {
|
|
43
|
+
const {
|
|
44
|
+
cert
|
|
45
|
+
} = await api.findCertificateByDomain({
|
|
46
|
+
input: {
|
|
47
|
+
domain,
|
|
48
|
+
did
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return cert;
|
|
52
|
+
});
|
|
53
|
+
const handleIssueComplete = (cert, type) => {
|
|
54
|
+
if (cert.domain === domain) {
|
|
55
|
+
setIssuing(false);
|
|
56
|
+
if (type === 'success') {
|
|
57
|
+
Toast.success(`The ${cert.domain} certificate is issued successfully`);
|
|
58
|
+
} else if (type === 'error') {
|
|
59
|
+
Toast.error(`Failed to issue certificate for ${cert.domain}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (!certState.loading && isCertInProgress(certState.value?.status)) {
|
|
65
|
+
setIssuing(true);
|
|
66
|
+
}
|
|
67
|
+
}, [certState]);
|
|
68
|
+
useSubscription(BlockletEvents.certError, cert => handleIssueComplete(cert, 'error'));
|
|
69
|
+
useSubscription(BlockletEvents.certIssued, cert => {
|
|
70
|
+
certState.retry();
|
|
71
|
+
refreshDomainStatus(cert.domain);
|
|
72
|
+
handleIssueComplete(cert, 'success');
|
|
73
|
+
});
|
|
74
|
+
if (certState.loading) {
|
|
75
|
+
return ''; // 如果正在加载证书的状态,则不渲染任何元素
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (certState.value?.status === 'normal') {
|
|
79
|
+
return ''; // 如果证书已经生成,则不渲染任何元素
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const onCancel = () => {
|
|
83
|
+
setLoading(false);
|
|
84
|
+
setConfirmSetting(null);
|
|
85
|
+
};
|
|
86
|
+
const onConfirm = async () => {
|
|
87
|
+
setLoading(true);
|
|
88
|
+
try {
|
|
89
|
+
await api.issueLetsEncryptCert({
|
|
90
|
+
input: {
|
|
91
|
+
domain,
|
|
92
|
+
did
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
onAdd();
|
|
96
|
+
setIssuing(true);
|
|
97
|
+
} catch (error) {
|
|
98
|
+
console.error(error);
|
|
99
|
+
setIssuing(false);
|
|
100
|
+
} finally {
|
|
101
|
+
setLoading(false);
|
|
102
|
+
setConfirmSetting(null);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const setting = {
|
|
106
|
+
title: t('router.cert.genLetsEncryptCert.title'),
|
|
107
|
+
description: /*#__PURE__*/_jsxs("div", {
|
|
108
|
+
children: [/*#__PURE__*/_jsx(Alert, {
|
|
109
|
+
type: "success",
|
|
110
|
+
children: t('router.cert.genLetsEncryptCert.dnsTip')
|
|
111
|
+
}), t('router.cert.genLetsEncryptCert.description')]
|
|
112
|
+
}),
|
|
113
|
+
confirm: t('common.confirm'),
|
|
114
|
+
onConfirm,
|
|
115
|
+
onCancel
|
|
116
|
+
};
|
|
117
|
+
const onClick = e => {
|
|
118
|
+
e.stopPropagation();
|
|
119
|
+
setConfirmSetting(setting);
|
|
120
|
+
};
|
|
121
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
122
|
+
children: [issuing ? /*#__PURE__*/_jsx(Tooltip, {
|
|
123
|
+
title: t('router.cert.issuing'),
|
|
124
|
+
children: /*#__PURE__*/_jsx(CircularProgress, {
|
|
125
|
+
size: 12
|
|
126
|
+
})
|
|
127
|
+
}) : children({
|
|
128
|
+
loading,
|
|
129
|
+
open: onClick
|
|
130
|
+
}), confirmSetting && /*#__PURE__*/_jsx(Confirm, {
|
|
131
|
+
color: "primary",
|
|
132
|
+
title: confirmSetting.title,
|
|
133
|
+
description: confirmSetting.description,
|
|
134
|
+
confirm: confirmSetting.confirm,
|
|
135
|
+
params: confirmSetting.params,
|
|
136
|
+
onConfirm: confirmSetting.onConfirm,
|
|
137
|
+
onCancel: confirmSetting.onCancel
|
|
138
|
+
})]
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
Add.propTypes = {
|
|
142
|
+
domain: PropTypes.string.isRequired,
|
|
143
|
+
did: PropTypes.string.isRequired,
|
|
144
|
+
onAdd: PropTypes.func,
|
|
145
|
+
children: PropTypes.any
|
|
146
|
+
};
|
|
147
|
+
Add.defaultProps = {
|
|
148
|
+
onAdd: () => {},
|
|
149
|
+
children: null
|
|
150
|
+
};
|
|
151
|
+
export default function AddCert(props) {
|
|
152
|
+
const {
|
|
153
|
+
domain,
|
|
154
|
+
domainStatus,
|
|
155
|
+
...others
|
|
156
|
+
} = props;
|
|
157
|
+
if (!shouldCheckDomainStatus(domain) || domainStatus?.isHttps) {
|
|
158
|
+
return '';
|
|
159
|
+
}
|
|
160
|
+
return /*#__PURE__*/_jsx(Add, {
|
|
161
|
+
domain,
|
|
162
|
+
...others
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
AddCert.propTypes = {
|
|
166
|
+
domain: PropTypes.string.isRequired,
|
|
167
|
+
domainStatus: PropTypes.shape({
|
|
168
|
+
isHttps: PropTypes.bool
|
|
169
|
+
}).isRequired,
|
|
170
|
+
did: PropTypes.string.isRequired,
|
|
171
|
+
onAdd: PropTypes.func,
|
|
172
|
+
children: PropTypes.any
|
|
173
|
+
};
|
|
174
|
+
AddCert.defaultProps = {
|
|
175
|
+
onAdd: () => {},
|
|
176
|
+
children: null
|
|
177
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
export default function AgreementApp({
|
|
4
|
+
...props
|
|
5
|
+
}) {
|
|
6
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
7
|
+
...props,
|
|
8
|
+
style: {
|
|
9
|
+
width: '100%'
|
|
10
|
+
},
|
|
11
|
+
children: [/*#__PURE__*/_jsx("h3", {
|
|
12
|
+
children: "End User License Agreement for Application"
|
|
13
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
14
|
+
children: "Blocklet Server License Agreement ArcBlock, Inc. version 2020-08-28"
|
|
15
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
16
|
+
children: "BLOCKLET SERVER LICENSE AGREEMENT"
|
|
17
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
18
|
+
children: "\u6682\u65E0"
|
|
19
|
+
})]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
5
|
+
import ServerEula from '@blocklet/launcher-layout/lib/wizard/server-eula';
|
|
6
|
+
import WizardDesc from '@blocklet/launcher-layout/lib/wizard/wizard-desc';
|
|
7
|
+
import AgreementApp from './agreement-app';
|
|
8
|
+
|
|
9
|
+
// TODO: 加载 Blocklet 定义的 Agreement
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
export default function Agreement({
|
|
13
|
+
meta,
|
|
14
|
+
onClickNext,
|
|
15
|
+
handleDescEle
|
|
16
|
+
}) {
|
|
17
|
+
const navigate = useNavigate();
|
|
18
|
+
const {
|
|
19
|
+
t,
|
|
20
|
+
locale
|
|
21
|
+
} = useLocaleContext();
|
|
22
|
+
const clickNext = onClickNext || (() => {
|
|
23
|
+
navigate(`/launch-blocklet/install${window.location.search}`);
|
|
24
|
+
});
|
|
25
|
+
return /*#__PURE__*/_jsxs(Container, {
|
|
26
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
27
|
+
className: "app-content",
|
|
28
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
29
|
+
className: "agreement",
|
|
30
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
31
|
+
className: "agreement-content",
|
|
32
|
+
children: /*#__PURE__*/_jsx(WizardDesc, {
|
|
33
|
+
blockletMeta: {
|
|
34
|
+
data: meta
|
|
35
|
+
},
|
|
36
|
+
locale: locale,
|
|
37
|
+
handleDescEle: handleDescEle
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
42
|
+
className: "button-container",
|
|
43
|
+
"data-cy": "agree-all",
|
|
44
|
+
children: /*#__PURE__*/_jsx(ServerEula, {
|
|
45
|
+
onContinue: clickNext,
|
|
46
|
+
description: /*#__PURE__*/_jsx(AgreementApp, {}),
|
|
47
|
+
texts: {
|
|
48
|
+
listenName: t('launchBlocklet.license'),
|
|
49
|
+
buttonNext: t('launchBlocklet.next')
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
Agreement.propTypes = {
|
|
56
|
+
meta: PropTypes.object.isRequired,
|
|
57
|
+
onClickNext: PropTypes.func,
|
|
58
|
+
handleDescEle: PropTypes.node
|
|
59
|
+
};
|
|
60
|
+
Agreement.defaultProps = {
|
|
61
|
+
onClickNext: null,
|
|
62
|
+
handleDescEle: ''
|
|
63
|
+
};
|
|
64
|
+
const Container = styled.div`
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
align-items: center;
|
|
68
|
+
width: 100%;
|
|
69
|
+
height: 100%;
|
|
70
|
+
flex: 1;
|
|
71
|
+
.app-content {
|
|
72
|
+
padding: 2px 24px 24px;
|
|
73
|
+
${props => props.theme.breakpoints.down('md')} {
|
|
74
|
+
padding-top: 10px;
|
|
75
|
+
}
|
|
76
|
+
width: 100%;
|
|
77
|
+
flex: 1;
|
|
78
|
+
letter-spacing: normal;
|
|
79
|
+
}
|
|
80
|
+
.agreement {
|
|
81
|
+
position: relative;
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
width: 100%;
|
|
85
|
+
height: 100%;
|
|
86
|
+
border: 1px solid ${props => props.theme.palette.grey['100']};
|
|
87
|
+
border-radius: 12px;
|
|
88
|
+
${props => props.theme.breakpoints.up('md')} {
|
|
89
|
+
margin-top: 24px;
|
|
90
|
+
}
|
|
91
|
+
${props => props.theme.breakpoints.down('md')} {
|
|
92
|
+
margin-top: 16px;
|
|
93
|
+
}
|
|
94
|
+
.agreement-content {
|
|
95
|
+
position: absolute;
|
|
96
|
+
left: 0;
|
|
97
|
+
top: 0;
|
|
98
|
+
width: 100%;
|
|
99
|
+
height: 100%;
|
|
100
|
+
font-size: 14px;
|
|
101
|
+
overflow-y: auto;
|
|
102
|
+
${props => props.theme.breakpoints.up('md')} {
|
|
103
|
+
padding: 0 24px;
|
|
104
|
+
}
|
|
105
|
+
${props => props.theme.breakpoints.down('md')} {
|
|
106
|
+
padding: 0 16px;
|
|
107
|
+
}
|
|
108
|
+
&:after {
|
|
109
|
+
display: block;
|
|
110
|
+
content: '';
|
|
111
|
+
height: 24px;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
.button-container {
|
|
116
|
+
padding-top: 24px;
|
|
117
|
+
padding-bottom: 34px;
|
|
118
|
+
${props => props.theme.breakpoints.up('md')} {
|
|
119
|
+
padding-right: 24px;
|
|
120
|
+
margin-left: auto;
|
|
121
|
+
}
|
|
122
|
+
${props => props.theme.breakpoints.down('md')} {
|
|
123
|
+
padding-top: 0;
|
|
124
|
+
padding-bottom: 16px;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
`;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import Avatar from '@mui/material/Avatar';
|
|
3
|
+
import DiDAvatar from '@arcblock/did-connect/lib/Avatar';
|
|
4
|
+
import { BLOCKLET_CONFIGURABLE_KEY } from '@blocklet/constant';
|
|
5
|
+
import useAppLogo from '../hooks/use-app-logo';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export default function BlockletAppAvatar({
|
|
8
|
+
blocklet,
|
|
9
|
+
style,
|
|
10
|
+
size,
|
|
11
|
+
...rest
|
|
12
|
+
}) {
|
|
13
|
+
const {
|
|
14
|
+
logoUrl
|
|
15
|
+
} = useAppLogo({
|
|
16
|
+
blocklet
|
|
17
|
+
});
|
|
18
|
+
const {
|
|
19
|
+
variant
|
|
20
|
+
} = rest;
|
|
21
|
+
let imgEle = /*#__PURE__*/_jsx("img", {
|
|
22
|
+
src: logoUrl,
|
|
23
|
+
alt: "",
|
|
24
|
+
style: {
|
|
25
|
+
width: size
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
if (!blocklet.meta.logo) {
|
|
29
|
+
const exist = (blocklet.configs || []).find(x => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_LOGO_SQUARE)?.value;
|
|
30
|
+
if (!exist) {
|
|
31
|
+
imgEle = /*#__PURE__*/_jsx(DiDAvatar, {
|
|
32
|
+
did: blocklet.meta.did || '',
|
|
33
|
+
responsive: true
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return /*#__PURE__*/_jsx(Avatar, {
|
|
38
|
+
variant: variant || 'square',
|
|
39
|
+
style: Object.assign({
|
|
40
|
+
backgroundColor: 'transparent',
|
|
41
|
+
width: size,
|
|
42
|
+
height: size,
|
|
43
|
+
borderRadius: 10
|
|
44
|
+
}, style),
|
|
45
|
+
...rest,
|
|
46
|
+
children: imgEle
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
BlockletAppAvatar.propTypes = {
|
|
50
|
+
blocklet: PropTypes.object.isRequired,
|
|
51
|
+
style: PropTypes.object,
|
|
52
|
+
size: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
53
|
+
};
|
|
54
|
+
BlockletAppAvatar.defaultProps = {
|
|
55
|
+
style: {},
|
|
56
|
+
size: 40
|
|
57
|
+
};
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { Link } from 'react-router-dom';
|
|
4
|
+
import MarkdownPreview from '@uiw/react-markdown-preview';
|
|
5
|
+
import DidAvatar from '@arcblock/did-connect/lib/Avatar';
|
|
6
|
+
import Spinner from '@mui/material/CircularProgress';
|
|
7
|
+
import Empty from '@arcblock/ux/lib/Empty';
|
|
8
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
9
|
+
import { WELLKNOWN_BLOCKLET_ADMIN_PATH } from '@abtnode/constant';
|
|
10
|
+
import Box from '@mui/material/Box';
|
|
11
|
+
import Typography from '@mui/material/Typography';
|
|
12
|
+
import Pagination from '@mui/lab/Pagination';
|
|
13
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
14
|
+
import Select from '@mui/material/Select';
|
|
15
|
+
import InputLabel from '@mui/material/InputLabel';
|
|
16
|
+
import FormControl from '@mui/material/FormControl';
|
|
17
|
+
import Tag from '@arcblock/ux/lib/Tag';
|
|
18
|
+
import { useAuditLogContext, AuditLogProvider } from '../contexts/audit-log';
|
|
19
|
+
import { useNodeContext } from '../contexts/node';
|
|
20
|
+
import RelativeTime from '../relative-time';
|
|
21
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
+
const getUserLink = ({
|
|
24
|
+
log,
|
|
25
|
+
info,
|
|
26
|
+
inService
|
|
27
|
+
}) => {
|
|
28
|
+
if (inService) {
|
|
29
|
+
// TODO
|
|
30
|
+
return `${WELLKNOWN_BLOCKLET_ADMIN_PATH}/members?did=${log.actor.did}`;
|
|
31
|
+
}
|
|
32
|
+
if (log.scope === info.did) {
|
|
33
|
+
return `/team/members?did=${log.actor.did}`;
|
|
34
|
+
}
|
|
35
|
+
return `/blocklets/${log.scope}/members?did=${log.actor.did}`;
|
|
36
|
+
};
|
|
37
|
+
function AuditLog({
|
|
38
|
+
log
|
|
39
|
+
}) {
|
|
40
|
+
const {
|
|
41
|
+
inService,
|
|
42
|
+
info
|
|
43
|
+
} = useNodeContext();
|
|
44
|
+
const {
|
|
45
|
+
showScope,
|
|
46
|
+
scopeFormatter = x => x
|
|
47
|
+
} = useAuditLogContext();
|
|
48
|
+
if (!log.actor.did) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
52
|
+
className: "log-entry",
|
|
53
|
+
"data-cy": "log-entry",
|
|
54
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
55
|
+
className: "log-author",
|
|
56
|
+
children: /*#__PURE__*/_jsx(DidAvatar, {
|
|
57
|
+
did: log.actor.did,
|
|
58
|
+
size: 36,
|
|
59
|
+
shape: "circle"
|
|
60
|
+
})
|
|
61
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
62
|
+
className: "log-body",
|
|
63
|
+
children: [/*#__PURE__*/_jsxs(Typography, {
|
|
64
|
+
className: "log-header",
|
|
65
|
+
color: "textSecondary",
|
|
66
|
+
component: "p",
|
|
67
|
+
gutterBottom: true,
|
|
68
|
+
display: "flex",
|
|
69
|
+
alignItems: "center",
|
|
70
|
+
children: [showScope && /*#__PURE__*/_jsx(Link, {
|
|
71
|
+
to: log.link,
|
|
72
|
+
children: /*#__PURE__*/_jsx(Tag, {
|
|
73
|
+
style: {
|
|
74
|
+
marginRight: 8
|
|
75
|
+
},
|
|
76
|
+
children: scopeFormatter(log.scope)
|
|
77
|
+
})
|
|
78
|
+
}), /*#__PURE__*/_jsxs(Link, {
|
|
79
|
+
to: getUserLink({
|
|
80
|
+
log,
|
|
81
|
+
inService,
|
|
82
|
+
info
|
|
83
|
+
}),
|
|
84
|
+
target: "_blank",
|
|
85
|
+
children: [log.actor.fullName, log.actor.role ? `(${log.actor.role})` : '']
|
|
86
|
+
}), ' ', "- ", log.action]
|
|
87
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
88
|
+
className: "log-content",
|
|
89
|
+
maxWidth: "lg",
|
|
90
|
+
color: "textPrimary",
|
|
91
|
+
component: "div",
|
|
92
|
+
"data-color-mode": "light",
|
|
93
|
+
gutterBottom: true,
|
|
94
|
+
children: /*#__PURE__*/_jsx(MarkdownPreview, {
|
|
95
|
+
source: log.content,
|
|
96
|
+
linkTarget: "_blank"
|
|
97
|
+
})
|
|
98
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
99
|
+
className: "log-meta",
|
|
100
|
+
variant: "body2",
|
|
101
|
+
children: [!!log.ip && /*#__PURE__*/_jsx(Typography, {
|
|
102
|
+
component: "span",
|
|
103
|
+
color: "textSecondary",
|
|
104
|
+
children: `IP: ${log.ip}`
|
|
105
|
+
}), !!log.env.os?.name && /*#__PURE__*/_jsxs(Typography, {
|
|
106
|
+
component: "span",
|
|
107
|
+
color: "textSecondary",
|
|
108
|
+
children: [log.env.os.name, "(", log.env.os.version, ")"]
|
|
109
|
+
}), !!log.env.browser?.name && /*#__PURE__*/_jsxs(Typography, {
|
|
110
|
+
component: "span",
|
|
111
|
+
color: "textSecondary",
|
|
112
|
+
children: [log.env.browser.name, "(", log.env.browser.version, ")"]
|
|
113
|
+
}), /*#__PURE__*/_jsx(Typography, {
|
|
114
|
+
component: "span",
|
|
115
|
+
color: "textSecondary",
|
|
116
|
+
children: /*#__PURE__*/_jsx(RelativeTime, {
|
|
117
|
+
value: log.createdAt
|
|
118
|
+
})
|
|
119
|
+
})]
|
|
120
|
+
})]
|
|
121
|
+
})]
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function AuditLogs() {
|
|
125
|
+
const {
|
|
126
|
+
t
|
|
127
|
+
} = useLocaleContext();
|
|
128
|
+
const {
|
|
129
|
+
data,
|
|
130
|
+
loading,
|
|
131
|
+
paging,
|
|
132
|
+
filter,
|
|
133
|
+
categories,
|
|
134
|
+
setCategory,
|
|
135
|
+
fetch
|
|
136
|
+
} = useAuditLogContext();
|
|
137
|
+
if (loading) {
|
|
138
|
+
return /*#__PURE__*/_jsx("div", {
|
|
139
|
+
style: {
|
|
140
|
+
textAlign: 'center',
|
|
141
|
+
marginTop: '50px'
|
|
142
|
+
},
|
|
143
|
+
children: /*#__PURE__*/_jsx(Spinner, {})
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return /*#__PURE__*/_jsxs(Div, {
|
|
147
|
+
"data-cy": "audit-logs",
|
|
148
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
149
|
+
className: "log-controls",
|
|
150
|
+
children: /*#__PURE__*/_jsxs(FormControl, {
|
|
151
|
+
style: {
|
|
152
|
+
width: '240px'
|
|
153
|
+
},
|
|
154
|
+
variant: "outlined",
|
|
155
|
+
children: [/*#__PURE__*/_jsx(InputLabel, {
|
|
156
|
+
children: t('common.filter')
|
|
157
|
+
}), /*#__PURE__*/_jsx(Select, {
|
|
158
|
+
"data-cy": "filter-by-category-trigger",
|
|
159
|
+
value: filter.category,
|
|
160
|
+
onChange: e => setCategory(e.target.value),
|
|
161
|
+
fullWidth: true,
|
|
162
|
+
label: t('common.category'),
|
|
163
|
+
disabled: loading,
|
|
164
|
+
children: categories.map(x => /*#__PURE__*/_jsx(MenuItem, {
|
|
165
|
+
value: x.value,
|
|
166
|
+
"data-cy": `filter-by-category-${x.value}`,
|
|
167
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
168
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
169
|
+
children: x.label
|
|
170
|
+
})
|
|
171
|
+
})
|
|
172
|
+
}, x.label))
|
|
173
|
+
})]
|
|
174
|
+
})
|
|
175
|
+
}), data.length === 0 && /*#__PURE__*/_jsx(Empty, {
|
|
176
|
+
children: t('common.empty')
|
|
177
|
+
}), data.length > 0 && data.map(x => /*#__PURE__*/_jsx(AuditLog, {
|
|
178
|
+
log: x
|
|
179
|
+
}, x.id)), paging.pageCount > 1 && /*#__PURE__*/_jsx(Pagination, {
|
|
180
|
+
page: paging.page,
|
|
181
|
+
count: paging.pageCount,
|
|
182
|
+
onChange: (e, page) => fetch({
|
|
183
|
+
page
|
|
184
|
+
}),
|
|
185
|
+
showFirstButton: true,
|
|
186
|
+
showLastButton: true
|
|
187
|
+
})]
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
export default function WrappedAuditLogs({
|
|
191
|
+
scope,
|
|
192
|
+
categories,
|
|
193
|
+
showScope,
|
|
194
|
+
scopeFormatter
|
|
195
|
+
}) {
|
|
196
|
+
return /*#__PURE__*/_jsx(AuditLogProvider, {
|
|
197
|
+
scope: scope,
|
|
198
|
+
categories: categories,
|
|
199
|
+
showScope: showScope,
|
|
200
|
+
scopeFormatter: scopeFormatter,
|
|
201
|
+
children: /*#__PURE__*/_jsx(AuditLogs, {})
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
const Div = styled.div`
|
|
205
|
+
.log-controls {
|
|
206
|
+
display: flex;
|
|
207
|
+
justify-content: space-between;
|
|
208
|
+
}
|
|
209
|
+
.log-entry {
|
|
210
|
+
display: flex;
|
|
211
|
+
margin: 16px 0;
|
|
212
|
+
|
|
213
|
+
.log-author {
|
|
214
|
+
margin-right: 8px;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.log-body {
|
|
218
|
+
flex: 1;
|
|
219
|
+
|
|
220
|
+
a {
|
|
221
|
+
color: ${({
|
|
222
|
+
theme
|
|
223
|
+
}) => theme.palette.primary.main};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.log-header {
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.log-content {
|
|
230
|
+
p {
|
|
231
|
+
margin-bottom: 4px;
|
|
232
|
+
}
|
|
233
|
+
ul,
|
|
234
|
+
ol {
|
|
235
|
+
padding-left: 2rem;
|
|
236
|
+
}
|
|
237
|
+
li {
|
|
238
|
+
list-style-type: disc;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.log-meta {
|
|
243
|
+
margin-top: 4px;
|
|
244
|
+
|
|
245
|
+
span {
|
|
246
|
+
font-size: 0.8rem;
|
|
247
|
+
display: inline-block;
|
|
248
|
+
margin-right: 8px;
|
|
249
|
+
padding-right: 8px;
|
|
250
|
+
border-right: 1px solid #ccc;
|
|
251
|
+
|
|
252
|
+
&:last-of-type {
|
|
253
|
+
border-right: none;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
`;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import joinUrl from 'url-join';
|
|
4
|
+
import toUpper from 'lodash/toUpper';
|
|
5
|
+
import Tag from '@arcblock/ux/lib/Tag';
|
|
6
|
+
import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
7
|
+
import ExternalLink from '@mui/material/Link';
|
|
8
|
+
import Box from '@mui/material/Box';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
export default function BlockletSource({
|
|
12
|
+
sourceInfo,
|
|
13
|
+
blocklet
|
|
14
|
+
}) {
|
|
15
|
+
const {
|
|
16
|
+
t
|
|
17
|
+
} = useContext(LocaleContext);
|
|
18
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
19
|
+
display: "flex",
|
|
20
|
+
alignItems: "center",
|
|
21
|
+
children: [/*#__PURE__*/_jsx(Tag, {
|
|
22
|
+
type: "success",
|
|
23
|
+
children: toUpper(sourceInfo.source)
|
|
24
|
+
}, "source"), sourceInfo.source === 'registry' && /*#__PURE__*/_jsx(ExternalLink, {
|
|
25
|
+
href: joinUrl(sourceInfo.deployedFrom, 'blocklets', blocklet?.meta?.bundleDid || ''),
|
|
26
|
+
target: "_blank",
|
|
27
|
+
className: "page-link",
|
|
28
|
+
underline: "hover",
|
|
29
|
+
style: {
|
|
30
|
+
display: 'flex',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
marginLeft: 8
|
|
33
|
+
},
|
|
34
|
+
children: t('blocklet.overview.viewInStore')
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
BlockletSource.propTypes = {
|
|
39
|
+
sourceInfo: PropTypes.shape({
|
|
40
|
+
source: PropTypes.string,
|
|
41
|
+
deployedFrom: PropTypes.string
|
|
42
|
+
}),
|
|
43
|
+
blocklet: PropTypes.object
|
|
44
|
+
};
|
|
45
|
+
BlockletSource.defaultProps = {
|
|
46
|
+
sourceInfo: {},
|
|
47
|
+
blocklet: {}
|
|
48
|
+
};
|