@strapi/admin 4.6.0 → 4.7.0-beta.0
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/.browserslistrc +2 -1
- package/admin/src/assets/images/onboarding-preview.png +0 -0
- package/admin/src/components/AuthenticatedApp/utils/api.js +5 -4
- package/admin/src/components/LeftMenu/index.js +9 -3
- package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +18 -16
- package/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js +5 -5
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/findLeafByPathAndReplace.js +1 -3
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/schema.js +6 -5
- package/admin/src/content-manager/components/InputUID/index.js +4 -4
- package/admin/src/content-manager/components/Inputs/index.js +0 -2
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +35 -14
- package/admin/src/content-manager/hooks/useFetchContentTypeLayout/index.js +4 -3
- package/admin/src/content-manager/hooks/useLazyComponents/index.js +9 -13
- package/admin/src/content-manager/hooks/useRelation/useRelation.js +4 -4
- package/admin/src/content-manager/pages/App/useModels.js +8 -3
- package/admin/src/content-manager/pages/App/utils/getContentTypeLinks.js +3 -2
- package/admin/src/content-manager/pages/ComponentSetttingsView/index.js +4 -4
- package/admin/src/content-manager/pages/EditSettingsView/utils/api.js +4 -2
- package/admin/src/content-manager/pages/ListSettingsView/utils/api.js +4 -2
- package/admin/src/content-manager/pages/ListView/index.js +9 -9
- package/admin/src/core/utils/index.js +0 -1
- package/admin/src/hooks/useFetchEnabledPlugins/utils/api.js +3 -2
- package/admin/src/hooks/useInjectReducer/index.js +1 -0
- package/admin/src/hooks/useInjectReducer/useInjectReducer.js +19 -0
- package/admin/src/hooks/useRegenerate/index.js +4 -4
- package/admin/src/hooks/useRolesList/index.js +5 -3
- package/admin/src/hooks/useSettingsMenu/utils/defaultGlobalLinks.js +7 -0
- package/admin/src/index.js +4 -3
- package/admin/src/pages/Admin/Onboarding/constants.js +46 -0
- package/admin/src/pages/Admin/Onboarding/index.js +161 -89
- package/admin/src/pages/Admin/index.js +5 -2
- package/admin/src/pages/ProfilePage/utils/api.js +5 -3
- package/admin/src/pages/SettingsPage/{pages/Users/ListPage → components}/Filters/index.js +0 -0
- package/admin/src/pages/SettingsPage/{pages/ApiTokens/EditView/components → components/Tokens}/FormHead/index.js +36 -19
- package/admin/src/pages/SettingsPage/components/Tokens/FormiTokenContainer/LifeSpanInput.js +96 -0
- package/admin/src/pages/SettingsPage/components/Tokens/LifeSpanInput/index.js +98 -0
- package/admin/src/pages/SettingsPage/components/Tokens/Regenerate/index.js +73 -0
- package/admin/src/pages/SettingsPage/{pages/ApiTokens/ListView/DynamicTable → components/Tokens/Table}/DefaultButton/index.js +1 -1
- package/admin/src/pages/SettingsPage/{pages/ApiTokens/ListView/DynamicTable → components/Tokens/Table}/DeleteButton/index.js +1 -1
- package/admin/src/pages/SettingsPage/{pages/ApiTokens/ListView/DynamicTable → components/Tokens/Table}/ReadButton/index.js +0 -0
- package/admin/src/pages/SettingsPage/{pages/ApiTokens/ListView/DynamicTable → components/Tokens/Table}/UpdateButton/index.js +0 -0
- package/admin/src/pages/SettingsPage/components/Tokens/Table/index.js +135 -0
- package/admin/src/pages/SettingsPage/{pages/ApiTokens/EditView/components/ContentBox → components/Tokens/TokenBox}/index.js +17 -17
- package/admin/src/pages/SettingsPage/components/Tokens/TokenDescription/index.js +51 -0
- package/admin/src/pages/SettingsPage/components/Tokens/TokenName/index.js +46 -0
- package/admin/src/pages/SettingsPage/components/Tokens/TokenTypeSelect/index.js +69 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/CollapsableContentType/index.js +5 -3
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormApiTokenContainer/index.js +52 -142
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/Regenerate/index.js +5 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +43 -19
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +9 -16
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +5 -3
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/components/FormTransferTokenContainer/index.js +105 -0
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/components/LoadingView/index.js +50 -0
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +201 -0
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/getDateOfExpiration.js +16 -0
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/index.js +4 -0
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/schema.js +10 -0
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/index.js +182 -0
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/utils/tableHeaders.js +48 -0
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedCreateView/index.js +14 -0
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedEditView/index.js +14 -0
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedListView/index.js +12 -0
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/utils/api.js +6 -3
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/index.js +9 -3
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/utils/api.js +6 -3
- package/admin/src/pages/SettingsPage/pages/Users/components/SelectRoles/index.js +3 -2
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js +3 -2
- package/admin/src/pages/SettingsPage/utils/defaultRoutes.js +33 -0
- package/admin/src/permissions/defaultPermissions.js +8 -0
- package/admin/src/translations/en.json +25 -6
- package/admin/src/translations/eu.json +796 -0
- package/admin/src/translations/languageNativeNames.js +1 -0
- package/admin/src/translations/ru.json +9 -9
- package/build/1412.936ed920.chunk.js +159 -0
- package/build/1683.c8aa7b7c.chunk.js +268 -0
- package/build/19eb2dfcf2603eb55733.png +0 -0
- package/build/2607.2e48dbf8.chunk.js +66 -0
- package/build/2743.6d1632f9.chunk.js +45 -0
- package/build/3075.dc3894fe.chunk.js +108 -0
- package/build/3632.0317b618.chunk.js +138 -0
- package/build/4649.15cc0afe.chunk.js +30 -0
- package/build/{5910.a5374848.chunk.js → 4855.bd092921.chunk.js} +65 -65
- package/build/7259.aa68d808.chunk.js +1 -0
- package/build/7407.883fb1f5.chunk.js +1 -0
- package/build/9707.7290fd92.chunk.js +96 -0
- package/build/Admin-authenticatedApp.f29f6021.chunk.js +79 -0
- package/build/{Admin_homePage.79ab880c.chunk.js → Admin_homePage.b1730882.chunk.js} +1 -1
- package/build/{Admin_marketplace.eabf21b2.chunk.js → Admin_marketplace.ea0316c2.chunk.js} +2 -2
- package/build/Admin_pluginsPage.5c24f963.chunk.js +6 -0
- package/build/Admin_profilePage.59af1978.chunk.js +15 -0
- package/build/Admin_settingsPage.178dc6e3.chunk.js +178 -0
- package/build/admin-app.77a50e1f.chunk.js +112 -0
- package/build/admin-edit-roles-page.446b69dc.chunk.js +1 -0
- package/build/admin-edit-users.2ed69bfd.chunk.js +10 -0
- package/build/admin-users.fc003b10.chunk.js +11 -0
- package/build/{api-tokens-create-page.0e686c30.chunk.js → api-tokens-create-page.0db3aec1.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.d6c7487b.chunk.js → api-tokens-edit-page.671e0e26.chunk.js} +1 -1
- package/build/api-tokens-list-page.7387102c.chunk.js +16 -0
- package/build/audit-logs-settings-page.c3dce30d.chunk.js +1 -0
- package/build/content-manager.42b24d46.chunk.js +1139 -0
- package/build/{content-type-builder-list-view.4243b2b1.chunk.js → content-type-builder-list-view.79e84b36.chunk.js} +1 -6
- package/build/{content-type-builder.365b6bf4.chunk.js → content-type-builder.855db321.chunk.js} +16 -15
- package/build/{email-settings-page.379552b1.chunk.js → email-settings-page.d1fcc7a3.chunk.js} +4 -9
- package/build/en-json.b0748970.chunk.js +1 -0
- package/build/eu-json.fceecd8b.chunk.js +1 -0
- package/build/i18n-settings-page.b8d8753e.chunk.js +60 -0
- package/build/index.html +1 -1
- package/build/main.1022ed01.js +4393 -0
- package/build/ru-json.aa5cd123.chunk.js +1 -0
- package/build/runtime~main.84941a97.js +2 -0
- package/build/sso-settings-page.b85ad080.chunk.js +41 -0
- package/build/transfer-tokens-create-page.16e23791.chunk.js +1 -0
- package/build/transfer-tokens-edit-page.3886c973.chunk.js +1 -0
- package/build/transfer-tokens-list-page.e8010a89.chunk.js +16 -0
- package/build/upload-settings.ef64bbf9.chunk.js +84 -0
- package/build/upload.c5730dfa.chunk.js +33 -0
- package/build/users-advanced-settings-page.fce9908e.chunk.js +8 -0
- package/build/users-email-settings-page.343d0ad2.chunk.js +23 -0
- package/build/users-providers-settings-page.e5a9a3f1.chunk.js +99 -0
- package/build/users-roles-settings-page.66312f31.chunk.js +30 -0
- package/build/webhook-edit-page.73e51e64.chunk.js +75 -0
- package/build/{webhook-list-page.f75ba3f2.chunk.js → webhook-list-page.1134f130.chunk.js} +1 -1
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/ComboboxFilter/index.js +41 -0
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/Modal/ActionBody.js +1 -3
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/TableRows/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useAuditLogsData.js +47 -0
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/index.js +30 -31
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getActionTypesDefaultMessages.js +7 -9
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getDisplayedFilters.js +88 -0
- package/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js +4 -2
- package/ee/server/migrations/audit-logs-table.js +45 -0
- package/ee/server/register.js +2 -0
- package/ee/server/services/audit-logs.js +11 -1
- package/package.json +30 -30
- package/server/bootstrap.js +2 -0
- package/server/config/admin-actions.js +48 -0
- package/server/content-types/index.js +2 -0
- package/server/content-types/transfer-token-permission.js +36 -0
- package/server/content-types/transfer-token.js +66 -0
- package/server/controllers/admin.js +16 -0
- package/server/controllers/api-token.js +4 -5
- package/server/controllers/index.js +1 -0
- package/server/controllers/transfer/index.js +13 -0
- package/server/controllers/transfer/runner.js +24 -0
- package/server/controllers/transfer/token.js +131 -0
- package/server/register.js +2 -9
- package/server/routes/index.js +2 -0
- package/server/routes/transfer.js +95 -0
- package/server/services/api-token.js +2 -3
- package/server/services/constants.js +6 -0
- package/server/services/index.js +1 -0
- package/server/services/transfer/index.js +6 -0
- package/server/services/transfer/permission.js +22 -0
- package/server/services/transfer/token.js +409 -0
- package/server/strategies/api-token.js +4 -2
- package/server/strategies/data-transfer.js +107 -0
- package/server/strategies/index.js +1 -0
- package/server/utils/index.d.ts +2 -0
- package/server/validation/api-tokens.js +1 -6
- package/server/validation/transfer/index.js +5 -0
- package/server/validation/transfer/token.js +34 -0
- package/admin/src/content-manager/components/InputJSON/FieldWrapper.js +0 -40
- package/admin/src/content-manager/components/InputJSON/Label.js +0 -35
- package/admin/src/content-manager/components/InputJSON/components.js +0 -36
- package/admin/src/content-manager/components/InputJSON/index.js +0 -223
- package/admin/src/content-manager/components/InputJSON/jsonlint.js +0 -680
- package/admin/src/core/utils/axiosInstance.js +0 -40
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormBody/index.js +0 -78
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/index.js +0 -112
- package/build/2607.ce06608e.chunk.js +0 -66
- package/build/2743.dea372fb.chunk.js +0 -42
- package/build/3075.03ebe93d.chunk.js +0 -115
- package/build/3632.963ac97d.chunk.js +0 -138
- package/build/4318.8cb388a5.chunk.js +0 -30
- package/build/4656.a0d43cca.chunk.js +0 -159
- package/build/8633.4af74a50.chunk.js +0 -1
- package/build/9641.a311b612.chunk.js +0 -276
- package/build/9707.62831b4d.chunk.js +0 -101
- package/build/Admin-authenticatedApp.50dc27f9.chunk.js +0 -75
- package/build/Admin_pluginsPage.953e796b.chunk.js +0 -6
- package/build/Admin_profilePage.5c2efda5.chunk.js +0 -15
- package/build/Admin_settingsPage.19cfb9ca.chunk.js +0 -178
- package/build/admin-app.34295b50.chunk.js +0 -112
- package/build/admin-edit-roles-page.d50d9654.chunk.js +0 -1
- package/build/admin-edit-users.912b856d.chunk.js +0 -10
- package/build/admin-users.e36e7111.chunk.js +0 -11
- package/build/api-tokens-list-page.1cd86136.chunk.js +0 -16
- package/build/audit-logs-settings-page.308a6250.chunk.js +0 -1
- package/build/codemirror-addon-closebrackets.71aa4bbd.chunk.js +0 -2
- package/build/codemirror-addon-lint-js.405f70fb.chunk.js +0 -1
- package/build/codemirror-addon-lint.8487ad3d.chunk.js +0 -1
- package/build/codemirror-addon-mark-selection.1928c849.chunk.js +0 -1
- package/build/codemirror-css.359a2a4b.chunk.js +0 -345
- package/build/codemirror-javacript.af237b68.chunk.js +0 -1
- package/build/codemirror-theme.2fe63a16.chunk.js +0 -33
- package/build/content-manager.851f40ce.chunk.js +0 -1170
- package/build/en-json.38d182e5.chunk.js +0 -1
- package/build/i18n-settings-page.3ab28b1a.chunk.js +0 -65
- package/build/main.9f31732e.js +0 -4454
- package/build/ru-json.3b411a39.chunk.js +0 -1
- package/build/runtime~main.2b8e2318.js +0 -2
- package/build/sso-settings-page.b64a44e8.chunk.js +0 -41
- package/build/upload-settings.6c26ff37.chunk.js +0 -89
- package/build/upload.2c69d238.chunk.js +0 -38
- package/build/users-advanced-settings-page.c4270682.chunk.js +0 -13
- package/build/users-email-settings-page.60422a2f.chunk.js +0 -28
- package/build/users-providers-settings-page.e1834060.chunk.js +0 -104
- package/build/users-roles-settings-page.3ef35132.chunk.js +0 -30
- package/build/webhook-edit-page.c0080dc1.chunk.js +0 -75
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { Box } from '@strapi/design-system/Box';
|
|
5
|
+
import { Grid, GridItem } from '@strapi/design-system/Grid';
|
|
6
|
+
import { Stack } from '@strapi/design-system/Stack';
|
|
7
|
+
|
|
8
|
+
import { Typography } from '@strapi/design-system/Typography';
|
|
9
|
+
import LifeSpanInput from '../../../../../components/Tokens/LifeSpanInput';
|
|
10
|
+
import TokenName from '../../../../../components/Tokens/TokenName';
|
|
11
|
+
import TokenDescription from '../../../../../components/Tokens/TokenDescription';
|
|
12
|
+
|
|
13
|
+
const FormTransferTokenContainer = ({
|
|
14
|
+
errors,
|
|
15
|
+
onChange,
|
|
16
|
+
canEditInputs,
|
|
17
|
+
isCreating,
|
|
18
|
+
values,
|
|
19
|
+
transferToken,
|
|
20
|
+
}) => {
|
|
21
|
+
const { formatMessage } = useIntl();
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Box
|
|
25
|
+
background="neutral0"
|
|
26
|
+
hasRadius
|
|
27
|
+
shadow="filterShadow"
|
|
28
|
+
paddingTop={6}
|
|
29
|
+
paddingBottom={6}
|
|
30
|
+
paddingLeft={7}
|
|
31
|
+
paddingRight={7}
|
|
32
|
+
>
|
|
33
|
+
<Stack spacing={4}>
|
|
34
|
+
<Typography variant="delta" as="h2">
|
|
35
|
+
{formatMessage({
|
|
36
|
+
id: 'global.details',
|
|
37
|
+
defaultMessage: 'Details',
|
|
38
|
+
})}
|
|
39
|
+
</Typography>
|
|
40
|
+
<Grid gap={5}>
|
|
41
|
+
<GridItem key="name" col={6} xs={12}>
|
|
42
|
+
<TokenName
|
|
43
|
+
errors={errors}
|
|
44
|
+
values={values}
|
|
45
|
+
canEditInputs={canEditInputs}
|
|
46
|
+
onChange={onChange}
|
|
47
|
+
/>
|
|
48
|
+
</GridItem>
|
|
49
|
+
<GridItem key="description" col={6} xs={12}>
|
|
50
|
+
<TokenDescription
|
|
51
|
+
errors={errors}
|
|
52
|
+
values={values}
|
|
53
|
+
canEditInputs={canEditInputs}
|
|
54
|
+
onChange={onChange}
|
|
55
|
+
/>
|
|
56
|
+
</GridItem>
|
|
57
|
+
<GridItem key="lifespan" col={6} xs={12}>
|
|
58
|
+
<LifeSpanInput
|
|
59
|
+
isCreating={isCreating}
|
|
60
|
+
errors={errors}
|
|
61
|
+
values={values}
|
|
62
|
+
onChange={onChange}
|
|
63
|
+
token={transferToken}
|
|
64
|
+
/>
|
|
65
|
+
</GridItem>
|
|
66
|
+
</Grid>
|
|
67
|
+
</Stack>
|
|
68
|
+
</Box>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
FormTransferTokenContainer.propTypes = {
|
|
73
|
+
errors: PropTypes.shape({
|
|
74
|
+
name: PropTypes.string,
|
|
75
|
+
description: PropTypes.string,
|
|
76
|
+
lifespan: PropTypes.string,
|
|
77
|
+
type: PropTypes.string,
|
|
78
|
+
}),
|
|
79
|
+
onChange: PropTypes.func.isRequired,
|
|
80
|
+
canEditInputs: PropTypes.bool.isRequired,
|
|
81
|
+
values: PropTypes.shape({
|
|
82
|
+
name: PropTypes.string,
|
|
83
|
+
description: PropTypes.string,
|
|
84
|
+
lifespan: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
85
|
+
type: PropTypes.string,
|
|
86
|
+
}).isRequired,
|
|
87
|
+
isCreating: PropTypes.bool.isRequired,
|
|
88
|
+
transferToken: PropTypes.shape({
|
|
89
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
90
|
+
type: PropTypes.string,
|
|
91
|
+
lifespan: PropTypes.string,
|
|
92
|
+
name: PropTypes.string,
|
|
93
|
+
accessKey: PropTypes.string,
|
|
94
|
+
permissions: PropTypes.array,
|
|
95
|
+
description: PropTypes.string,
|
|
96
|
+
createdAt: PropTypes.string,
|
|
97
|
+
}),
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
FormTransferTokenContainer.defaultProps = {
|
|
101
|
+
errors: {},
|
|
102
|
+
transferToken: {},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export default FormTransferTokenContainer;
|
package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/components/LoadingView/index.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
SettingsPageTitle,
|
|
4
|
+
LoadingIndicatorPage,
|
|
5
|
+
useFocusWhenNavigate,
|
|
6
|
+
} from '@strapi/helper-plugin';
|
|
7
|
+
import { HeaderLayout, ContentLayout } from '@strapi/design-system/Layout';
|
|
8
|
+
import { Main } from '@strapi/design-system/Main';
|
|
9
|
+
import { Button } from '@strapi/design-system/Button';
|
|
10
|
+
import Check from '@strapi/icons/Check';
|
|
11
|
+
import { useIntl } from 'react-intl';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
|
+
|
|
14
|
+
const LoadingView = ({ transferTokenName }) => {
|
|
15
|
+
const { formatMessage } = useIntl();
|
|
16
|
+
useFocusWhenNavigate();
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Main aria-busy="true">
|
|
20
|
+
<SettingsPageTitle name="Transfer Tokens" />
|
|
21
|
+
<HeaderLayout
|
|
22
|
+
primaryAction={
|
|
23
|
+
<Button disabled startIcon={<Check />} type="button" size="L">
|
|
24
|
+
{formatMessage({ id: 'global.save', defaultMessage: 'Save' })}
|
|
25
|
+
</Button>
|
|
26
|
+
}
|
|
27
|
+
title={
|
|
28
|
+
transferTokenName ||
|
|
29
|
+
formatMessage({
|
|
30
|
+
id: 'Settings.transferTokens.createPage.title',
|
|
31
|
+
defaultMessage: 'Create Transfer Token',
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
/>
|
|
35
|
+
<ContentLayout>
|
|
36
|
+
<LoadingIndicatorPage />
|
|
37
|
+
</ContentLayout>
|
|
38
|
+
</Main>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
LoadingView.defaultProps = {
|
|
43
|
+
transferTokenName: null,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
LoadingView.propTypes = {
|
|
47
|
+
transferTokenName: PropTypes.string,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default LoadingView;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { Formik } from 'formik';
|
|
4
|
+
import { useRouteMatch, useHistory } from 'react-router-dom';
|
|
5
|
+
import { useQuery } from 'react-query';
|
|
6
|
+
import {
|
|
7
|
+
SettingsPageTitle,
|
|
8
|
+
useFocusWhenNavigate,
|
|
9
|
+
Form,
|
|
10
|
+
useOverlayBlocker,
|
|
11
|
+
useNotification,
|
|
12
|
+
useGuidedTour,
|
|
13
|
+
useRBAC,
|
|
14
|
+
useFetchClient,
|
|
15
|
+
} from '@strapi/helper-plugin';
|
|
16
|
+
import { Main } from '@strapi/design-system/Main';
|
|
17
|
+
import { Stack } from '@strapi/design-system/Stack';
|
|
18
|
+
import { ContentLayout } from '@strapi/design-system/Layout';
|
|
19
|
+
import { formatAPIErrors } from '../../../../../utils';
|
|
20
|
+
import { schema } from './utils';
|
|
21
|
+
import LoadingView from './components/LoadingView';
|
|
22
|
+
import adminPermissions from '../../../../../permissions';
|
|
23
|
+
import FormTransferTokenContainer from './components/FormTransferTokenContainer';
|
|
24
|
+
import TokenBox from '../../../components/Tokens/TokenBox';
|
|
25
|
+
import FormHead from '../../../components/Tokens/FormHead';
|
|
26
|
+
|
|
27
|
+
const MSG_ERROR_NAME_TAKEN = 'Name already taken';
|
|
28
|
+
|
|
29
|
+
const TransferTokenCreateView = () => {
|
|
30
|
+
useFocusWhenNavigate();
|
|
31
|
+
const { formatMessage } = useIntl();
|
|
32
|
+
const { lockApp, unlockApp } = useOverlayBlocker();
|
|
33
|
+
const toggleNotification = useNotification();
|
|
34
|
+
const history = useHistory();
|
|
35
|
+
const [transferToken, setTransferToken] = useState(
|
|
36
|
+
history.location.state?.transferToken.accessKey
|
|
37
|
+
? {
|
|
38
|
+
...history.location.state.transferToken,
|
|
39
|
+
}
|
|
40
|
+
: null
|
|
41
|
+
);
|
|
42
|
+
const { setCurrentStep } = useGuidedTour();
|
|
43
|
+
const {
|
|
44
|
+
allowedActions: { canCreate, canUpdate, canRegenerate },
|
|
45
|
+
} = useRBAC(adminPermissions.settings['transfer-tokens']);
|
|
46
|
+
const {
|
|
47
|
+
params: { id },
|
|
48
|
+
} = useRouteMatch('/settings/transfer-tokens/:id');
|
|
49
|
+
const { get, post, put } = useFetchClient();
|
|
50
|
+
|
|
51
|
+
const isCreating = id === 'create';
|
|
52
|
+
|
|
53
|
+
const { status } = useQuery(
|
|
54
|
+
['transfer-token', id],
|
|
55
|
+
async () => {
|
|
56
|
+
const {
|
|
57
|
+
data: { data },
|
|
58
|
+
} = await get(`/admin/transfer/tokens/${id}`);
|
|
59
|
+
|
|
60
|
+
setTransferToken({
|
|
61
|
+
...data,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
return data;
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
enabled: !isCreating && !transferToken,
|
|
68
|
+
onError() {
|
|
69
|
+
toggleNotification({
|
|
70
|
+
type: 'warning',
|
|
71
|
+
message: { id: 'notification.error', defaultMessage: 'An error occured' },
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const handleSubmit = async (body, actions) => {
|
|
78
|
+
lockApp();
|
|
79
|
+
const lifespanVal =
|
|
80
|
+
body.lifespan && parseInt(body.lifespan, 10) && body.lifespan !== '0'
|
|
81
|
+
? parseInt(body.lifespan, 10)
|
|
82
|
+
: null;
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
const {
|
|
86
|
+
data: { data: response },
|
|
87
|
+
} = isCreating
|
|
88
|
+
? await post(`/admin/transfer/tokens`, {
|
|
89
|
+
...body,
|
|
90
|
+
lifespan: lifespanVal,
|
|
91
|
+
permissions: ['push'],
|
|
92
|
+
})
|
|
93
|
+
: await put(`/admin/transfer/tokens/${id}`, {
|
|
94
|
+
name: body.name,
|
|
95
|
+
description: body.description,
|
|
96
|
+
type: body.type,
|
|
97
|
+
permissions: ['push'],
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
unlockApp();
|
|
101
|
+
|
|
102
|
+
if (isCreating) {
|
|
103
|
+
history.replace(`/settings/transfer-tokens/${response.id}`, { transferToken: response });
|
|
104
|
+
setCurrentStep('transferTokens.success');
|
|
105
|
+
}
|
|
106
|
+
setTransferToken({
|
|
107
|
+
...response,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
toggleNotification({
|
|
111
|
+
type: 'success',
|
|
112
|
+
message: isCreating
|
|
113
|
+
? formatMessage({
|
|
114
|
+
id: 'notification.success.transfertokencreated',
|
|
115
|
+
defaultMessage: 'Transfer Token successfully created',
|
|
116
|
+
})
|
|
117
|
+
: formatMessage({
|
|
118
|
+
id: 'notification.success.transfertokenedited',
|
|
119
|
+
defaultMessage: 'Transfer Token successfully edited',
|
|
120
|
+
}),
|
|
121
|
+
});
|
|
122
|
+
} catch (err) {
|
|
123
|
+
const errors = formatAPIErrors(err.response.data);
|
|
124
|
+
actions.setErrors(errors);
|
|
125
|
+
|
|
126
|
+
if (err?.response?.data?.error?.message === MSG_ERROR_NAME_TAKEN) {
|
|
127
|
+
toggleNotification({
|
|
128
|
+
type: 'warning',
|
|
129
|
+
message: err.response.data.message || 'notification.error.tokennamenotunique',
|
|
130
|
+
});
|
|
131
|
+
} else {
|
|
132
|
+
toggleNotification({
|
|
133
|
+
type: 'warning',
|
|
134
|
+
message: err?.response?.data?.message || 'notification.error',
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
unlockApp();
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const canEditInputs = (canUpdate && !isCreating) || (canCreate && isCreating);
|
|
142
|
+
const isLoading = !isCreating && !transferToken && status !== 'success';
|
|
143
|
+
|
|
144
|
+
if (isLoading) {
|
|
145
|
+
return <LoadingView transferTokenName={transferToken?.name} />;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<Main>
|
|
150
|
+
<SettingsPageTitle name="Transfer Tokens" />
|
|
151
|
+
<Formik
|
|
152
|
+
validationSchema={schema}
|
|
153
|
+
validateOnChange={false}
|
|
154
|
+
initialValues={{
|
|
155
|
+
name: transferToken?.name || '',
|
|
156
|
+
description: transferToken?.description || '',
|
|
157
|
+
lifespan: transferToken?.lifespan
|
|
158
|
+
? transferToken.lifespan.toString()
|
|
159
|
+
: transferToken?.lifespan,
|
|
160
|
+
}}
|
|
161
|
+
enableReinitialize
|
|
162
|
+
onSubmit={(body, actions) => handleSubmit(body, actions)}
|
|
163
|
+
>
|
|
164
|
+
{({ errors, handleChange, isSubmitting, values }) => {
|
|
165
|
+
return (
|
|
166
|
+
<Form>
|
|
167
|
+
<FormHead
|
|
168
|
+
backUrl="/settings/transfer-tokens"
|
|
169
|
+
title={{
|
|
170
|
+
id: 'Settings.transferTokens.createPage.title',
|
|
171
|
+
defaultMessage: 'Create Transfer Token',
|
|
172
|
+
}}
|
|
173
|
+
token={transferToken}
|
|
174
|
+
setToken={setTransferToken}
|
|
175
|
+
canEditInputs={canEditInputs}
|
|
176
|
+
canRegenerate={canRegenerate}
|
|
177
|
+
isSubmitting={isSubmitting}
|
|
178
|
+
regenerateUrl="/admin/transfer/tokens/"
|
|
179
|
+
/>
|
|
180
|
+
<ContentLayout>
|
|
181
|
+
<Stack spacing={6}>
|
|
182
|
+
{Boolean(transferToken?.name) && <TokenBox token={transferToken?.accessKey} />}
|
|
183
|
+
<FormTransferTokenContainer
|
|
184
|
+
errors={errors}
|
|
185
|
+
onChange={handleChange}
|
|
186
|
+
canEditInputs={canEditInputs}
|
|
187
|
+
isCreating={isCreating}
|
|
188
|
+
values={values}
|
|
189
|
+
transferToken={transferToken}
|
|
190
|
+
/>
|
|
191
|
+
</Stack>
|
|
192
|
+
</ContentLayout>
|
|
193
|
+
</Form>
|
|
194
|
+
);
|
|
195
|
+
}}
|
|
196
|
+
</Formik>
|
|
197
|
+
</Main>
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export default TransferTokenCreateView;
|
package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/getDateOfExpiration.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { addDays, format } from 'date-fns';
|
|
2
|
+
import * as locales from 'date-fns/locale';
|
|
3
|
+
|
|
4
|
+
const getDateOfExpiration = (createdAt, duration, language = 'en') => {
|
|
5
|
+
if (duration && typeof duration === 'number') {
|
|
6
|
+
const durationInDays = duration / 24 / 60 / 60 / 1000;
|
|
7
|
+
|
|
8
|
+
return format(addDays(new Date(createdAt), durationInDays), 'PPP', {
|
|
9
|
+
locale: locales[language],
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return 'Unlimited';
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default getDateOfExpiration;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
import { translatedErrors } from '@strapi/helper-plugin';
|
|
3
|
+
|
|
4
|
+
const schema = yup.object().shape({
|
|
5
|
+
name: yup.string(translatedErrors.string).required(translatedErrors.required),
|
|
6
|
+
description: yup.string().nullable(),
|
|
7
|
+
lifespan: yup.number().integer().min(0).nullable().defined(translatedErrors.required),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export default schema;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { useQuery, useMutation, useQueryClient } from 'react-query';
|
|
4
|
+
import { useHistory } from 'react-router-dom';
|
|
5
|
+
import qs from 'qs';
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
SettingsPageTitle,
|
|
9
|
+
useFocusWhenNavigate,
|
|
10
|
+
useNotification,
|
|
11
|
+
NoPermissions,
|
|
12
|
+
useRBAC,
|
|
13
|
+
NoContent,
|
|
14
|
+
useGuidedTour,
|
|
15
|
+
LinkButton,
|
|
16
|
+
useFetchClient,
|
|
17
|
+
} from '@strapi/helper-plugin';
|
|
18
|
+
import { HeaderLayout, ContentLayout } from '@strapi/design-system/Layout';
|
|
19
|
+
import { Main } from '@strapi/design-system/Main';
|
|
20
|
+
import { Button } from '@strapi/design-system/Button';
|
|
21
|
+
import Plus from '@strapi/icons/Plus';
|
|
22
|
+
|
|
23
|
+
import adminPermissions from '../../../../../permissions';
|
|
24
|
+
import tableHeaders from './utils/tableHeaders';
|
|
25
|
+
import Table from '../../../components/Tokens/Table';
|
|
26
|
+
|
|
27
|
+
const TransferTokenListView = () => {
|
|
28
|
+
useFocusWhenNavigate();
|
|
29
|
+
const queryClient = useQueryClient();
|
|
30
|
+
const { formatMessage } = useIntl();
|
|
31
|
+
const toggleNotification = useNotification();
|
|
32
|
+
const {
|
|
33
|
+
allowedActions: { canCreate, canDelete, canUpdate, canRead },
|
|
34
|
+
} = useRBAC(adminPermissions.settings['transfer-tokens']);
|
|
35
|
+
const { push } = useHistory();
|
|
36
|
+
|
|
37
|
+
const { startSection } = useGuidedTour();
|
|
38
|
+
const startSectionRef = useRef(startSection);
|
|
39
|
+
const { get, del } = useFetchClient();
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (startSectionRef.current) {
|
|
43
|
+
startSectionRef.current('transferTokens');
|
|
44
|
+
}
|
|
45
|
+
}, []);
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
push({ search: qs.stringify({ sort: 'name:ASC' }, { encode: false }) });
|
|
49
|
+
}, [push]);
|
|
50
|
+
|
|
51
|
+
const headers = tableHeaders.map((header) => ({
|
|
52
|
+
...header,
|
|
53
|
+
metadatas: {
|
|
54
|
+
...header.metadatas,
|
|
55
|
+
label: formatMessage(header.metadatas.label),
|
|
56
|
+
},
|
|
57
|
+
}));
|
|
58
|
+
|
|
59
|
+
const {
|
|
60
|
+
data: transferTokens,
|
|
61
|
+
status,
|
|
62
|
+
isFetching,
|
|
63
|
+
} = useQuery(
|
|
64
|
+
['transfer-tokens'],
|
|
65
|
+
async () => {
|
|
66
|
+
const {
|
|
67
|
+
data: { data },
|
|
68
|
+
} = await get(`/admin/transfer/tokens`);
|
|
69
|
+
|
|
70
|
+
return data;
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
enabled: canRead,
|
|
74
|
+
onError() {
|
|
75
|
+
toggleNotification({
|
|
76
|
+
type: 'warning',
|
|
77
|
+
message: { id: 'notification.error', defaultMessage: 'An error occured' },
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const isLoading =
|
|
84
|
+
canRead &&
|
|
85
|
+
((status !== 'success' && status !== 'error') || (status === 'success' && isFetching));
|
|
86
|
+
|
|
87
|
+
const deleteMutation = useMutation(
|
|
88
|
+
async (id) => {
|
|
89
|
+
await del(`/admin/transfer/tokens/${id}`);
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
async onSuccess() {
|
|
93
|
+
await queryClient.invalidateQueries(['transfer-tokens']);
|
|
94
|
+
},
|
|
95
|
+
onError(err) {
|
|
96
|
+
if (err?.response?.data?.data) {
|
|
97
|
+
toggleNotification({ type: 'warning', message: err.response.data.data });
|
|
98
|
+
} else {
|
|
99
|
+
toggleNotification({
|
|
100
|
+
type: 'warning',
|
|
101
|
+
message: { id: 'notification.error', defaultMessage: 'An error occured' },
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
const shouldDisplayDynamicTable = canRead && transferTokens;
|
|
109
|
+
const shouldDisplayNoContent = canRead && !transferTokens && !canCreate;
|
|
110
|
+
const shouldDisplayNoContentWithCreationButton = canRead && !transferTokens && canCreate;
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<Main aria-busy={isLoading}>
|
|
114
|
+
<SettingsPageTitle name="Transfer Tokens" />
|
|
115
|
+
<HeaderLayout
|
|
116
|
+
title={formatMessage({
|
|
117
|
+
id: 'Settings.transferTokens.title',
|
|
118
|
+
defaultMessage: 'Transfer Tokens',
|
|
119
|
+
})}
|
|
120
|
+
subtitle={formatMessage({
|
|
121
|
+
id: 'Settings.transferTokens.description',
|
|
122
|
+
defaultMessage: '"List of generated transfer tokens"', // TODO change this message
|
|
123
|
+
})}
|
|
124
|
+
primaryAction={
|
|
125
|
+
canCreate ? (
|
|
126
|
+
<LinkButton
|
|
127
|
+
data-testid="create-transfer-token-button"
|
|
128
|
+
startIcon={<Plus />}
|
|
129
|
+
size="S"
|
|
130
|
+
to="/settings/transfer-tokens/create"
|
|
131
|
+
>
|
|
132
|
+
{formatMessage({
|
|
133
|
+
id: 'Settings.transferTokens.create',
|
|
134
|
+
defaultMessage: 'Create new Transfer Token',
|
|
135
|
+
})}
|
|
136
|
+
</LinkButton>
|
|
137
|
+
) : undefined
|
|
138
|
+
}
|
|
139
|
+
/>
|
|
140
|
+
<ContentLayout>
|
|
141
|
+
{!canRead && <NoPermissions />}
|
|
142
|
+
{shouldDisplayDynamicTable && (
|
|
143
|
+
<Table
|
|
144
|
+
permissions={{ canRead, canDelete, canUpdate }}
|
|
145
|
+
headers={headers}
|
|
146
|
+
contentType="trasfer-tokens"
|
|
147
|
+
rows={transferTokens}
|
|
148
|
+
isLoading={isLoading}
|
|
149
|
+
onConfirmDelete={(id) => deleteMutation.mutateAsync(id)}
|
|
150
|
+
tokens={transferTokens}
|
|
151
|
+
/>
|
|
152
|
+
)}
|
|
153
|
+
{shouldDisplayNoContentWithCreationButton && (
|
|
154
|
+
<NoContent
|
|
155
|
+
content={{
|
|
156
|
+
id: 'Settings.transferTokens.addFirstToken',
|
|
157
|
+
defaultMessage: 'Add your first Transfer Token',
|
|
158
|
+
}}
|
|
159
|
+
action={
|
|
160
|
+
<Button variant="secondary" startIcon={<Plus />}>
|
|
161
|
+
{formatMessage({
|
|
162
|
+
id: 'Settings.transferTokens.addNewToken',
|
|
163
|
+
defaultMessage: 'Add new Transfer Token',
|
|
164
|
+
})}
|
|
165
|
+
</Button>
|
|
166
|
+
}
|
|
167
|
+
/>
|
|
168
|
+
)}
|
|
169
|
+
{shouldDisplayNoContent && (
|
|
170
|
+
<NoContent
|
|
171
|
+
content={{
|
|
172
|
+
id: 'Settings.transferTokens.emptyStateLayout',
|
|
173
|
+
defaultMessage: 'You don’t have any content yet...',
|
|
174
|
+
}}
|
|
175
|
+
/>
|
|
176
|
+
)}
|
|
177
|
+
</ContentLayout>
|
|
178
|
+
</Main>
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export default TransferTokenListView;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const tableHeaders = [
|
|
2
|
+
{
|
|
3
|
+
name: 'name',
|
|
4
|
+
key: 'name',
|
|
5
|
+
metadatas: {
|
|
6
|
+
label: {
|
|
7
|
+
id: 'Settings.transferTokens.ListView.headers.name',
|
|
8
|
+
defaultMessage: 'Name',
|
|
9
|
+
},
|
|
10
|
+
sortable: true,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'description',
|
|
15
|
+
key: 'description',
|
|
16
|
+
metadatas: {
|
|
17
|
+
label: {
|
|
18
|
+
id: 'Settings.transferTokens.ListView.headers.description',
|
|
19
|
+
defaultMessage: 'Description',
|
|
20
|
+
},
|
|
21
|
+
sortable: false,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'createdAt',
|
|
26
|
+
key: 'createdAt',
|
|
27
|
+
metadatas: {
|
|
28
|
+
label: {
|
|
29
|
+
id: 'Settings.transferTokens.ListView.headers.createdAt',
|
|
30
|
+
defaultMessage: 'Created at',
|
|
31
|
+
},
|
|
32
|
+
sortable: false,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'lastUsedAt',
|
|
37
|
+
key: 'lastUsedAt',
|
|
38
|
+
metadatas: {
|
|
39
|
+
label: {
|
|
40
|
+
id: 'Settings.transferTokens.ListView.headers.lastUsedAt',
|
|
41
|
+
defaultMessage: 'Last used',
|
|
42
|
+
},
|
|
43
|
+
sortable: false,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
export default tableHeaders;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CheckPagePermissions } from '@strapi/helper-plugin';
|
|
3
|
+
import adminPermissions from '../../../../../permissions';
|
|
4
|
+
import EditView from '../EditView';
|
|
5
|
+
|
|
6
|
+
const ProtectedTransferTokenCreateView = () => {
|
|
7
|
+
return (
|
|
8
|
+
<CheckPagePermissions permissions={adminPermissions.settings['transfer-tokens'].create}>
|
|
9
|
+
<EditView />
|
|
10
|
+
</CheckPagePermissions>
|
|
11
|
+
);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default ProtectedTransferTokenCreateView;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CheckPagePermissions } from '@strapi/helper-plugin';
|
|
3
|
+
import adminPermissions from '../../../../../permissions';
|
|
4
|
+
import EditView from '../EditView';
|
|
5
|
+
|
|
6
|
+
const ProtectedTransferTokenCreateView = () => {
|
|
7
|
+
return (
|
|
8
|
+
<CheckPagePermissions permissions={adminPermissions.settings['transfer-tokens'].read}>
|
|
9
|
+
<EditView />
|
|
10
|
+
</CheckPagePermissions>
|
|
11
|
+
);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default ProtectedTransferTokenCreateView;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CheckPagePermissions } from '@strapi/helper-plugin';
|
|
3
|
+
import adminPermissions from '../../../../../permissions';
|
|
4
|
+
import ListView from '../ListView';
|
|
5
|
+
|
|
6
|
+
const ProtectedTransferTokenListView = () => (
|
|
7
|
+
<CheckPagePermissions permissions={adminPermissions.settings['transfer-tokens'].main}>
|
|
8
|
+
<ListView />
|
|
9
|
+
</CheckPagePermissions>
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
export default ProtectedTransferTokenListView;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getFetchClient } from '@strapi/helper-plugin';
|
|
2
2
|
|
|
3
3
|
const fetchUser = async (id) => {
|
|
4
|
-
const {
|
|
4
|
+
const { get } = getFetchClient();
|
|
5
|
+
const { data } = await get(`/admin/users/${id}`);
|
|
5
6
|
|
|
6
7
|
return data.data;
|
|
7
8
|
};
|
|
8
9
|
|
|
9
10
|
const putUser = async (id, body) => {
|
|
10
|
-
const {
|
|
11
|
+
const { put } = getFetchClient();
|
|
12
|
+
|
|
13
|
+
const { data } = await put(`/admin/users/${id}`, body);
|
|
11
14
|
|
|
12
15
|
return data.data;
|
|
13
16
|
};
|