@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,108 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import ActionIcon from '@mui/icons-material/Delete';
|
|
4
|
+
import Spinner from '@mui/material/CircularProgress';
|
|
5
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
6
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
7
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
8
|
+
import { useNodeContext } from '../../../contexts/node';
|
|
9
|
+
import { useBlockletContext } from '../../../contexts/blocklet';
|
|
10
|
+
import DelConfirm from '../../../delete-confirm';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
export default function DeleteRule({
|
|
15
|
+
id: ruleId,
|
|
16
|
+
from,
|
|
17
|
+
children
|
|
18
|
+
}) {
|
|
19
|
+
const {
|
|
20
|
+
t
|
|
21
|
+
} = useLocaleContext();
|
|
22
|
+
const {
|
|
23
|
+
api
|
|
24
|
+
} = useNodeContext();
|
|
25
|
+
const {
|
|
26
|
+
blocklet
|
|
27
|
+
} = useBlockletContext();
|
|
28
|
+
const [loading, setLoading] = useState(false);
|
|
29
|
+
const [confirmSetting, setConfirmSetting] = useState(null);
|
|
30
|
+
const teamDid = blocklet.meta.did;
|
|
31
|
+
const siteId = blocklet.site.id;
|
|
32
|
+
const name = from.pathPrefix;
|
|
33
|
+
const onCancel = () => {
|
|
34
|
+
setLoading(false);
|
|
35
|
+
setConfirmSetting(null);
|
|
36
|
+
};
|
|
37
|
+
const onConfirm = async () => {
|
|
38
|
+
setLoading(true);
|
|
39
|
+
try {
|
|
40
|
+
await api.deleteRoutingRule({
|
|
41
|
+
input: {
|
|
42
|
+
id: siteId,
|
|
43
|
+
ruleId,
|
|
44
|
+
teamDid
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
} catch (error) {
|
|
48
|
+
Toast.error(error.message);
|
|
49
|
+
} finally {
|
|
50
|
+
setConfirmSetting(null);
|
|
51
|
+
setLoading(false);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const setting = {
|
|
55
|
+
keyName: name,
|
|
56
|
+
title: t('router.rule.delete.title'),
|
|
57
|
+
description: t('router.rule.delete.description', {
|
|
58
|
+
name: `<b>${name}</b>`
|
|
59
|
+
}),
|
|
60
|
+
confirmPlaceholder: t('router.rule.delete.confirm_desc', {
|
|
61
|
+
name
|
|
62
|
+
}),
|
|
63
|
+
confirm: t('common.delConfirm'),
|
|
64
|
+
cancel: t('router.rule.delete.cancel'),
|
|
65
|
+
onConfirm,
|
|
66
|
+
onCancel
|
|
67
|
+
};
|
|
68
|
+
const onMenuItemClick = e => {
|
|
69
|
+
e.stopPropagation();
|
|
70
|
+
setConfirmSetting(setting);
|
|
71
|
+
};
|
|
72
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
73
|
+
children: [typeof children === 'function' ? children({
|
|
74
|
+
loading,
|
|
75
|
+
open: onMenuItemClick
|
|
76
|
+
}) : /*#__PURE__*/_jsxs(MenuItem, {
|
|
77
|
+
onClick: onMenuItemClick,
|
|
78
|
+
className: "rule-action",
|
|
79
|
+
"data-cy": "action-delete-rule",
|
|
80
|
+
children: [loading ? /*#__PURE__*/_jsx(Spinner, {
|
|
81
|
+
size: 16
|
|
82
|
+
}) : /*#__PURE__*/_jsx(ActionIcon, {
|
|
83
|
+
style: {
|
|
84
|
+
fontSize: 18,
|
|
85
|
+
marginRight: 5
|
|
86
|
+
}
|
|
87
|
+
}), t('router.rule.delete.title')]
|
|
88
|
+
}), confirmSetting && /*#__PURE__*/_jsx(DelConfirm, {
|
|
89
|
+
keyName: confirmSetting.keyName,
|
|
90
|
+
title: confirmSetting.title,
|
|
91
|
+
description: confirmSetting.description,
|
|
92
|
+
confirmPlaceholder: confirmSetting.confirmPlaceholder,
|
|
93
|
+
confirm: confirmSetting.confirm,
|
|
94
|
+
cancel: confirmSetting.cancel,
|
|
95
|
+
params: confirmSetting.params,
|
|
96
|
+
onConfirm: confirmSetting.onConfirm,
|
|
97
|
+
onCancel: confirmSetting.onCancel
|
|
98
|
+
})]
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
DeleteRule.propTypes = {
|
|
102
|
+
id: PropTypes.string.isRequired,
|
|
103
|
+
from: PropTypes.object.isRequired,
|
|
104
|
+
children: PropTypes.any
|
|
105
|
+
};
|
|
106
|
+
DeleteRule.defaultProps = {
|
|
107
|
+
children: null
|
|
108
|
+
};
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import EditIcon from '@mui/icons-material/Edit';
|
|
4
|
+
import Spinner from '@mui/material/CircularProgress';
|
|
5
|
+
import Typography from '@mui/material/Typography';
|
|
6
|
+
import TextField from '@mui/material/TextField';
|
|
7
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
8
|
+
import { ROUTING_RULE_TYPES } from '@abtnode/constant';
|
|
9
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
10
|
+
import urlPathFriendly from '@blocklet/meta/lib/url-path-friendly';
|
|
11
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
12
|
+
import { useNodeContext } from '../../../contexts/node';
|
|
13
|
+
import { useBlockletContext } from '../../../contexts/blocklet';
|
|
14
|
+
import Confirm from '../../../confirm';
|
|
15
|
+
import { validateRule } from '../util';
|
|
16
|
+
import ConfigRoutingRule from './config-routing-rule';
|
|
17
|
+
import { formatMountPoint } from '../../../util';
|
|
18
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
21
|
+
export default function UpdateRule({
|
|
22
|
+
id: ruleId,
|
|
23
|
+
from,
|
|
24
|
+
to,
|
|
25
|
+
children
|
|
26
|
+
}) {
|
|
27
|
+
const {
|
|
28
|
+
t
|
|
29
|
+
} = useLocaleContext();
|
|
30
|
+
const {
|
|
31
|
+
api
|
|
32
|
+
} = useNodeContext();
|
|
33
|
+
const {
|
|
34
|
+
blocklet
|
|
35
|
+
} = useBlockletContext();
|
|
36
|
+
const [loading, setLoading] = useState(false);
|
|
37
|
+
const [confirmSetting, setConfirmSetting] = useState(null);
|
|
38
|
+
const teamDid = blocklet.meta.did;
|
|
39
|
+
const siteId = blocklet.site.id;
|
|
40
|
+
const name = from.pathPrefix;
|
|
41
|
+
const onCancel = () => {
|
|
42
|
+
setLoading(false);
|
|
43
|
+
setConfirmSetting(null);
|
|
44
|
+
};
|
|
45
|
+
const onConfirm = async params => {
|
|
46
|
+
try {
|
|
47
|
+
const err = await validateRule(params, t);
|
|
48
|
+
if (err) {
|
|
49
|
+
throw err;
|
|
50
|
+
}
|
|
51
|
+
setLoading(true);
|
|
52
|
+
const rule = {
|
|
53
|
+
id: ruleId,
|
|
54
|
+
from: {
|
|
55
|
+
pathPrefix: urlPathFriendly(params.pathPrefix)
|
|
56
|
+
},
|
|
57
|
+
to: {
|
|
58
|
+
type: params.type
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
if (params.type === ROUTING_RULE_TYPES.REDIRECT) {
|
|
62
|
+
rule.to.url = params.url;
|
|
63
|
+
rule.to.redirectCode = params.redirectCode;
|
|
64
|
+
}
|
|
65
|
+
if (params.type === ROUTING_RULE_TYPES.COMPONENT) {
|
|
66
|
+
rule.to.did = teamDid;
|
|
67
|
+
rule.to.componentId = params.componentId;
|
|
68
|
+
rule.to.pageGroup = params.pageGroup;
|
|
69
|
+
}
|
|
70
|
+
if (params.type === ROUTING_RULE_TYPES.GENERAL_REWRITE) {
|
|
71
|
+
rule.to.url = urlPathFriendly(params.url);
|
|
72
|
+
}
|
|
73
|
+
await api.updateRoutingRule({
|
|
74
|
+
input: {
|
|
75
|
+
id: siteId,
|
|
76
|
+
rule,
|
|
77
|
+
teamDid
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
} catch (error) {
|
|
81
|
+
Toast.error(error.message);
|
|
82
|
+
} finally {
|
|
83
|
+
setLoading(false);
|
|
84
|
+
setConfirmSetting(null);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const setting = {
|
|
88
|
+
title: t('router.rule.update.title'),
|
|
89
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
90
|
+
description: (params, setParams, setError) => {
|
|
91
|
+
const setValue = value => {
|
|
92
|
+
const validateResult = validateRule(value, t);
|
|
93
|
+
if (validateResult) {
|
|
94
|
+
setParams({
|
|
95
|
+
...value,
|
|
96
|
+
__disableConfirm: true
|
|
97
|
+
});
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
setParams({
|
|
101
|
+
...value
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
return /*#__PURE__*/_jsxs(Typography, {
|
|
105
|
+
component: "div",
|
|
106
|
+
children: [/*#__PURE__*/_jsx(TextField, {
|
|
107
|
+
label: t('router.rule.add.pathPrefix'),
|
|
108
|
+
autoComplete: "off",
|
|
109
|
+
variant: "outlined",
|
|
110
|
+
name: "pathPrefix",
|
|
111
|
+
"data-cy": "path-prefix-input",
|
|
112
|
+
fullWidth: true,
|
|
113
|
+
autoFocus: true,
|
|
114
|
+
helperText: params.helperText || t('router.rule.add.pathPrefixTip'),
|
|
115
|
+
style: {
|
|
116
|
+
marginBottom: 32
|
|
117
|
+
},
|
|
118
|
+
margin: "dense",
|
|
119
|
+
value: params.pathPrefix,
|
|
120
|
+
onChange: e => {
|
|
121
|
+
let disable = false;
|
|
122
|
+
if (params.type === ROUTING_RULE_TYPES.REDIRECT && !params.url) {
|
|
123
|
+
disable = true;
|
|
124
|
+
}
|
|
125
|
+
if (params.type === ROUTING_RULE_TYPES.GENERAL_REWRITE && !params.url) {
|
|
126
|
+
disable = true;
|
|
127
|
+
}
|
|
128
|
+
if (!e.target.value.trim()) {
|
|
129
|
+
disable = true;
|
|
130
|
+
setError(t('router.validation.pathPrefixRequired'));
|
|
131
|
+
}
|
|
132
|
+
if (!disable) {
|
|
133
|
+
setError('');
|
|
134
|
+
}
|
|
135
|
+
const helperText = t('common.slugifyHint', {
|
|
136
|
+
value: formatMountPoint(e.target.value)
|
|
137
|
+
});
|
|
138
|
+
setParams({
|
|
139
|
+
...params,
|
|
140
|
+
pathPrefix: e.target.value,
|
|
141
|
+
helperText,
|
|
142
|
+
__disableConfirm: disable
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}), /*#__PURE__*/_jsx(ConfigRoutingRule, {
|
|
146
|
+
params: params,
|
|
147
|
+
setParams: setValue,
|
|
148
|
+
setError: setError
|
|
149
|
+
})]
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
confirm: t('router.rule.update.confirm'),
|
|
153
|
+
cancel: t('router.rule.update.cancel'),
|
|
154
|
+
color: 'primary',
|
|
155
|
+
params: {
|
|
156
|
+
did: to.did || '',
|
|
157
|
+
pathPrefix: name === '/' ? name : name.replace(/^\/+/, '').replace(/\/+$/, ''),
|
|
158
|
+
type: to.type || ROUTING_RULE_TYPES.BLOCKLET,
|
|
159
|
+
redirectCode: to.redirectCode || 302,
|
|
160
|
+
componentId: to.componentId || '',
|
|
161
|
+
pageGroup: to.pageGroup || '',
|
|
162
|
+
url: to.url || '',
|
|
163
|
+
__disableConfirm: false
|
|
164
|
+
},
|
|
165
|
+
onConfirm,
|
|
166
|
+
onCancel
|
|
167
|
+
};
|
|
168
|
+
const onMenuItemClick = e => {
|
|
169
|
+
e.stopPropagation();
|
|
170
|
+
// eslint-disable-next-line no-unused-expressions
|
|
171
|
+
setConfirmSetting(setting);
|
|
172
|
+
};
|
|
173
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
174
|
+
children: [typeof children === 'function' ? children({
|
|
175
|
+
loading,
|
|
176
|
+
open: onMenuItemClick
|
|
177
|
+
}) : /*#__PURE__*/_jsxs(MenuItem, {
|
|
178
|
+
onClick: onMenuItemClick,
|
|
179
|
+
className: "rule-action",
|
|
180
|
+
"data-cy": "action-update-rule",
|
|
181
|
+
children: [loading ? /*#__PURE__*/_jsx(Spinner, {
|
|
182
|
+
size: 16
|
|
183
|
+
}) : /*#__PURE__*/_jsx(EditIcon, {
|
|
184
|
+
style: {
|
|
185
|
+
fontSize: 18,
|
|
186
|
+
marginRight: 5
|
|
187
|
+
}
|
|
188
|
+
}), t('router.rule.update.title')]
|
|
189
|
+
}), confirmSetting && /*#__PURE__*/_jsx(Confirm, {
|
|
190
|
+
title: confirmSetting.title,
|
|
191
|
+
description: confirmSetting.description,
|
|
192
|
+
confirm: confirmSetting.confirm,
|
|
193
|
+
color: confirmSetting.color,
|
|
194
|
+
cancel: confirmSetting.cancel,
|
|
195
|
+
params: confirmSetting.params,
|
|
196
|
+
onConfirm: confirmSetting.onConfirm,
|
|
197
|
+
onCancel: confirmSetting.onCancel
|
|
198
|
+
})]
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
UpdateRule.propTypes = {
|
|
202
|
+
id: PropTypes.string.isRequired,
|
|
203
|
+
from: PropTypes.object.isRequired,
|
|
204
|
+
to: PropTypes.object.isRequired,
|
|
205
|
+
children: PropTypes.any
|
|
206
|
+
};
|
|
207
|
+
UpdateRule.defaultProps = {
|
|
208
|
+
children: null
|
|
209
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
3
|
+
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
4
|
+
import ListItemText from '@mui/material/ListItemText';
|
|
5
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
6
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
7
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
8
|
+
import Actions from '../../actions';
|
|
9
|
+
import DeleteDomainAlias from './action/delete-domain-alias';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
export default function DomainActions({
|
|
13
|
+
site,
|
|
14
|
+
domain,
|
|
15
|
+
blocklet
|
|
16
|
+
}) {
|
|
17
|
+
const {
|
|
18
|
+
t
|
|
19
|
+
} = useLocaleContext();
|
|
20
|
+
const isCurrentDomain = domain.value === window.location.hostname;
|
|
21
|
+
return /*#__PURE__*/_jsx(Actions, {
|
|
22
|
+
"data-cy": "domain-actions",
|
|
23
|
+
actions: [
|
|
24
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
25
|
+
({
|
|
26
|
+
close
|
|
27
|
+
}) => /*#__PURE__*/_jsx(DeleteDomainAlias, {
|
|
28
|
+
id: site.id,
|
|
29
|
+
domain: domain.value,
|
|
30
|
+
teamDid: blocklet?.meta?.did,
|
|
31
|
+
children: ({
|
|
32
|
+
open
|
|
33
|
+
}) => /*#__PURE__*/_jsx(Tooltip, {
|
|
34
|
+
title: isCurrentDomain ? t('blocklet.router.currentDomainTip') : '',
|
|
35
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
36
|
+
children: /*#__PURE__*/_jsxs(MenuItem, {
|
|
37
|
+
disabled: domain.isProtected || isCurrentDomain,
|
|
38
|
+
dense: true,
|
|
39
|
+
onClick: e => {
|
|
40
|
+
close();
|
|
41
|
+
open(e);
|
|
42
|
+
},
|
|
43
|
+
"data-cy": "action-toggle-block",
|
|
44
|
+
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
45
|
+
style: {
|
|
46
|
+
minWidth: 24,
|
|
47
|
+
marginRight: 8
|
|
48
|
+
},
|
|
49
|
+
children: /*#__PURE__*/_jsx(DeleteIcon, {})
|
|
50
|
+
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
51
|
+
primary: t('common.delete')
|
|
52
|
+
})]
|
|
53
|
+
}, "remove")
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
})]
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
DomainActions.propTypes = {
|
|
60
|
+
site: PropTypes.object.isRequired,
|
|
61
|
+
domain: PropTypes.object.isRequired,
|
|
62
|
+
blocklet: PropTypes.object.isRequired
|
|
63
|
+
};
|
|
64
|
+
DomainActions.defaultProps = {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { createElement, Fragment } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import HttpsIcon from '@mui/icons-material/Https';
|
|
4
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
5
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
6
|
+
import VerifiedDot from '../../dot';
|
|
7
|
+
import { DomainType } from '../types';
|
|
8
|
+
import { shouldCheckDomainStatus, checkIsWildcardDomain } from '../../util';
|
|
9
|
+
import Certificate from '../../certificate';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
export default function DomainStatus({
|
|
12
|
+
domain,
|
|
13
|
+
filters
|
|
14
|
+
}) {
|
|
15
|
+
const {
|
|
16
|
+
t
|
|
17
|
+
} = useLocaleContext();
|
|
18
|
+
const {
|
|
19
|
+
value: name,
|
|
20
|
+
domainStatus
|
|
21
|
+
} = domain;
|
|
22
|
+
if (!shouldCheckDomainStatus(name)) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
let domainIcon = null;
|
|
26
|
+
let httpsIcon = null;
|
|
27
|
+
const {
|
|
28
|
+
isHttps,
|
|
29
|
+
matchedCert
|
|
30
|
+
} = domainStatus;
|
|
31
|
+
if (!checkIsWildcardDomain(name)) {
|
|
32
|
+
const {
|
|
33
|
+
dns: {
|
|
34
|
+
resolved,
|
|
35
|
+
ip
|
|
36
|
+
} = {}
|
|
37
|
+
} = domainStatus;
|
|
38
|
+
if (resolved || ip === '127.0.0.1') {
|
|
39
|
+
domainIcon = /*#__PURE__*/_jsx(Tooltip, {
|
|
40
|
+
title: t('router.domain.verify.ok'),
|
|
41
|
+
children: /*#__PURE__*/_jsx(VerifiedDot, {
|
|
42
|
+
color: "success"
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
} else {
|
|
46
|
+
domainIcon = /*#__PURE__*/_jsx(Tooltip, {
|
|
47
|
+
title: t('router.domain.verify.notResolved'),
|
|
48
|
+
children: /*#__PURE__*/_jsx(VerifiedDot, {
|
|
49
|
+
color: "error"
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (isHttps) {
|
|
55
|
+
httpsIcon = /*#__PURE__*/_jsx(Certificate, {
|
|
56
|
+
certificate: matchedCert
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
httpsIcon = /*#__PURE__*/_jsx(Tooltip, {
|
|
60
|
+
title: t('router.domain.https.bad'),
|
|
61
|
+
children: /*#__PURE__*/_jsx(HttpsIcon, {
|
|
62
|
+
style: {
|
|
63
|
+
color: '#D0021B',
|
|
64
|
+
fontSize: 20,
|
|
65
|
+
marginLeft: 8,
|
|
66
|
+
cursor: 'pointer'
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const items = filters.map(x => {
|
|
72
|
+
if (x === 'domain') {
|
|
73
|
+
return domainIcon;
|
|
74
|
+
}
|
|
75
|
+
if (x === 'http') {
|
|
76
|
+
return httpsIcon;
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
});
|
|
80
|
+
return /*#__PURE__*/createElement(Fragment, null, ...items);
|
|
81
|
+
}
|
|
82
|
+
DomainStatus.propTypes = {
|
|
83
|
+
domain: DomainType.isRequired,
|
|
84
|
+
filters: PropTypes.array
|
|
85
|
+
};
|
|
86
|
+
DomainStatus.defaultProps = {
|
|
87
|
+
filters: ['domain', 'http']
|
|
88
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* eslint-disable react/no-unstable-nested-components */
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
5
|
+
import LaunchIcon from '@mui/icons-material/Launch';
|
|
6
|
+
import IconButton from '@mui/material/IconButton';
|
|
7
|
+
import SettingsOutlinedIcon from '@mui/icons-material/SettingsOutlined';
|
|
8
|
+
import Box from '@mui/material/Box';
|
|
9
|
+
import { useBlockletContext } from '../../contexts/blocklet';
|
|
10
|
+
import DeleteRule from './action/delete-rule';
|
|
11
|
+
import UpdateRule from './action/update-rule';
|
|
12
|
+
import { getBlockletUrlParams, getAccessUrl } from '../../util';
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
export default function RuleActions(rule) {
|
|
16
|
+
const {
|
|
17
|
+
locale
|
|
18
|
+
} = useLocaleContext();
|
|
19
|
+
const {
|
|
20
|
+
blocklet,
|
|
21
|
+
recommendedDomain: domain
|
|
22
|
+
} = useBlockletContext();
|
|
23
|
+
const href = getAccessUrl(domain, rule.from.pathPrefix, getBlockletUrlParams(blocklet, locale));
|
|
24
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
25
|
+
display: "flex",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
children: [/*#__PURE__*/_jsx("a", {
|
|
28
|
+
target: "_blank",
|
|
29
|
+
href: href,
|
|
30
|
+
rel: "noopener noreferrer",
|
|
31
|
+
title: href,
|
|
32
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
33
|
+
size: "small",
|
|
34
|
+
children: /*#__PURE__*/_jsx(LaunchIcon, {})
|
|
35
|
+
})
|
|
36
|
+
}), /*#__PURE__*/_jsx(UpdateRule, {
|
|
37
|
+
...rule,
|
|
38
|
+
children: ({
|
|
39
|
+
open: o
|
|
40
|
+
}) => /*#__PURE__*/_jsx(IconButton, {
|
|
41
|
+
size: "small",
|
|
42
|
+
onClick: o,
|
|
43
|
+
disabled: rule.isProtected,
|
|
44
|
+
"data-cy": "action-update-rule",
|
|
45
|
+
children: /*#__PURE__*/_jsx(SettingsOutlinedIcon, {})
|
|
46
|
+
})
|
|
47
|
+
}), /*#__PURE__*/_jsx(DeleteRule, {
|
|
48
|
+
...rule,
|
|
49
|
+
children: ({
|
|
50
|
+
open
|
|
51
|
+
}) => /*#__PURE__*/_jsx(IconButton, {
|
|
52
|
+
size: "small",
|
|
53
|
+
onClick: open,
|
|
54
|
+
disabled: rule.isProtected,
|
|
55
|
+
"data-cy": "action-delete-rule",
|
|
56
|
+
children: /*#__PURE__*/_jsx(DeleteIcon, {})
|
|
57
|
+
})
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
RuleActions.propTypes = {
|
|
62
|
+
isProtected: PropTypes.bool
|
|
63
|
+
};
|
|
64
|
+
RuleActions.defaultProps = {
|
|
65
|
+
isProtected: false
|
|
66
|
+
};
|