@strapi/admin 4.7.0-beta.0 → 4.9.0-alpha.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/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +6 -14
- package/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js +1 -1
- package/admin/src/content-manager/components/DynamicZone/components/DynamicComponent.js +2 -0
- package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +39 -9
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +9 -15
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +4 -12
- package/admin/src/content-manager/pages/EditView/DeleteLink/index.js +6 -8
- package/admin/src/content-manager/pages/ListView/index.js +6 -11
- package/admin/src/hooks/useRegenerate/index.js +2 -2
- package/admin/src/hooks/useSettingsMenu/utils/defaultGlobalLinks.js +0 -7
- package/admin/src/index.js +1 -0
- package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +15 -2
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/CollapsableContentType/index.js +3 -5
- package/admin/src/pages/SettingsPage/{components/Tokens/TokenBox → pages/ApiTokens/EditView/components/ContentBox}/index.js +17 -17
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormApiTokenContainer/index.js +142 -52
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/FormBody/index.js +78 -0
- package/admin/src/pages/SettingsPage/{components/Tokens → pages/ApiTokens/EditView/components}/FormHead/index.js +19 -36
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/Regenerate/index.js +1 -5
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +14 -37
- package/admin/src/pages/SettingsPage/{components/Tokens/Table → pages/ApiTokens/ListView/DynamicTable}/DefaultButton/index.js +1 -1
- package/admin/src/pages/SettingsPage/{components/Tokens/Table → pages/ApiTokens/ListView/DynamicTable}/DeleteButton/index.js +1 -1
- package/admin/src/pages/SettingsPage/{components/Tokens/Table → pages/ApiTokens/ListView/DynamicTable}/ReadButton/index.js +0 -0
- package/admin/src/pages/SettingsPage/{components/Tokens/Table → pages/ApiTokens/ListView/DynamicTable}/UpdateButton/index.js +0 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/index.js +112 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +13 -5
- package/admin/src/pages/SettingsPage/pages/Users/components/MagicLink/MagicLinkWrapper.js +3 -20
- package/admin/src/pages/SettingsPage/utils/defaultRoutes.js +0 -33
- package/admin/src/permissions/defaultPermissions.js +2 -23
- package/admin/src/translations/ar.json +4 -4
- package/admin/src/translations/ca.json +4 -4
- package/admin/src/translations/cs.json +4 -4
- package/admin/src/translations/de.json +4 -4
- package/admin/src/translations/dk.json +4 -4
- package/admin/src/translations/en.json +9 -17
- package/admin/src/translations/es.json +4 -4
- package/admin/src/translations/eu.json +4 -4
- package/admin/src/translations/fr.json +4 -4
- package/admin/src/translations/gu.json +4 -4
- package/admin/src/translations/he.json +4 -4
- package/admin/src/translations/hi.json +4 -4
- package/admin/src/translations/hu.json +4 -4
- package/admin/src/translations/id.json +4 -4
- package/admin/src/translations/it.json +4 -4
- package/admin/src/translations/ja.json +4 -4
- package/admin/src/translations/ko.json +4 -4
- package/admin/src/translations/ml.json +4 -4
- package/admin/src/translations/ms.json +4 -4
- package/admin/src/translations/nl.json +4 -4
- package/admin/src/translations/no.json +4 -4
- package/admin/src/translations/pl.json +4 -4
- package/admin/src/translations/pt-BR.json +4 -4
- package/admin/src/translations/pt.json +4 -4
- package/admin/src/translations/ru.json +785 -789
- package/admin/src/translations/sa.json +4 -4
- package/admin/src/translations/sk.json +4 -4
- package/admin/src/translations/sv.json +4 -4
- package/admin/src/translations/th.json +4 -4
- package/admin/src/translations/tr.json +4 -4
- package/admin/src/translations/uk.json +4 -4
- package/admin/src/translations/vi.json +4 -4
- package/admin/src/translations/zh-Hans.json +4 -4
- package/admin/src/translations/zh.json +4 -4
- package/build/1683.d59d0f23.chunk.js +268 -0
- package/build/{4855.bd092921.chunk.js → 2223.1bfea951.chunk.js} +88 -88
- package/build/2743.646a1015.chunk.js +45 -0
- package/build/3075.3ee481f1.chunk.js +108 -0
- package/build/3632.2e378cf8.chunk.js +138 -0
- package/build/4318.cd55ce02.chunk.js +30 -0
- package/build/8633.00ccd382.chunk.js +1 -0
- package/build/9707.b36ed71e.chunk.js +96 -0
- package/build/{Admin-authenticatedApp.f29f6021.chunk.js → Admin-authenticatedApp.a73577e1.chunk.js} +2 -2
- package/build/{Admin_InternalErrorPage.157152a8.chunk.js → Admin_InternalErrorPage.178ddb90.chunk.js} +1 -1
- package/build/{Admin_homePage.b1730882.chunk.js → Admin_homePage.c2f5f27d.chunk.js} +2 -2
- package/build/{Admin_marketplace.ea0316c2.chunk.js → Admin_marketplace.1df49c42.chunk.js} +1 -1
- package/build/{Admin_pluginsPage.5c24f963.chunk.js → Admin_pluginsPage.8d824408.chunk.js} +2 -2
- package/build/{Admin_profilePage.59af1978.chunk.js → Admin_profilePage.cb667bc5.chunk.js} +2 -2
- package/build/Admin_settingsPage.f90615fb.chunk.js +178 -0
- package/build/{Upload_ConfigureTheView.3f2b6e6a.chunk.js → Upload_ConfigureTheView.d306009d.chunk.js} +1 -1
- package/build/admin-app.06f07029.chunk.js +112 -0
- package/build/admin-edit-roles-page.35199b9d.chunk.js +1 -0
- package/build/admin-edit-users.9e48b00d.chunk.js +10 -0
- package/build/admin-users.cf7b4151.chunk.js +11 -0
- package/build/{api-tokens-create-page.0db3aec1.chunk.js → api-tokens-create-page.a31c7fba.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.671e0e26.chunk.js → api-tokens-edit-page.64fef287.chunk.js} +1 -1
- package/build/api-tokens-list-page.e600ad3e.chunk.js +16 -0
- package/build/ar-json.39e54aba.chunk.js +1 -0
- package/build/{audit-logs-settings-page.c3dce30d.chunk.js → audit-logs-settings-page.d4da4579.chunk.js} +1 -1
- package/build/{ca-json.f6a0f472.chunk.js → ca-json.4d999055.chunk.js} +1 -1
- package/build/content-manager.255c3a59.chunk.js +1139 -0
- package/build/{content-type-builder-list-view.79e84b36.chunk.js → content-type-builder-list-view.8d7a3d68.chunk.js} +5 -5
- package/build/content-type-builder.3c8558a5.chunk.js +126 -0
- package/build/cs-json.4b44411c.chunk.js +1 -0
- package/build/{de-json.30e1f35b.chunk.js → de-json.866f8a28.chunk.js} +1 -1
- package/build/{dk-json.e6d9ffa4.chunk.js → dk-json.10f7b1d1.chunk.js} +1 -1
- package/build/email-settings-page.b19f2eb2.chunk.js +10 -0
- package/build/en-json.1997583c.chunk.js +1 -0
- package/build/es-json.ea15c957.chunk.js +1 -0
- package/build/{eu-json.fceecd8b.chunk.js → eu-json.3bc24d60.chunk.js} +1 -1
- package/build/{fr-json.78545ef8.chunk.js → fr-json.e88fbdfd.chunk.js} +1 -1
- package/build/{gu-json.676518f2.chunk.js → gu-json.94f0d242.chunk.js} +1 -1
- package/build/{he-json.ad22e8cc.chunk.js → he-json.f0de8cdb.chunk.js} +1 -1
- package/build/{hi-json.19b51c09.chunk.js → hi-json.df3a7be2.chunk.js} +1 -1
- package/build/{hu-json.f947088f.chunk.js → hu-json.680e6eef.chunk.js} +1 -1
- package/build/{i18n-settings-page.b8d8753e.chunk.js → i18n-settings-page.a6b49eac.chunk.js} +1 -1
- package/build/{id-json.504daa84.chunk.js → id-json.e0d83d41.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/{it-json.2fd90f4d.chunk.js → it-json.8be59205.chunk.js} +1 -1
- package/build/{ja-json.c9f12d0b.chunk.js → ja-json.97ee41ba.chunk.js} +1 -1
- package/build/{ko-json.ef463065.chunk.js → ko-json.4cbbf4f2.chunk.js} +1 -1
- package/build/main.7f308c20.js +4322 -0
- package/build/{ml-json.490f666c.chunk.js → ml-json.e3747091.chunk.js} +1 -1
- package/build/ms-json.0eddffd9.chunk.js +1 -0
- package/build/{nl-json.c416295a.chunk.js → nl-json.371a15ee.chunk.js} +1 -1
- package/build/{no-json.1a2258ba.chunk.js → no-json.9b3cd181.chunk.js} +1 -1
- package/build/{pl-json.8cf0c871.chunk.js → pl-json.e535cbce.chunk.js} +1 -1
- package/build/{pt-BR-json.51fab8d0.chunk.js → pt-BR-json.e5fafa46.chunk.js} +1 -1
- package/build/pt-json.ee554a41.chunk.js +1 -0
- package/build/review-workflows-settings.7b4be1b0.chunk.js +63 -0
- package/build/{ru-json.aa5cd123.chunk.js → ru-json.866f0ff1.chunk.js} +1 -1
- package/build/runtime~main.bf374148.js +2 -0
- package/build/{sa-json.f3fa5407.chunk.js → sa-json.7efeb257.chunk.js} +1 -1
- package/build/{sk-json.9ec60d9f.chunk.js → sk-json.7bbeb0af.chunk.js} +1 -1
- package/build/{sso-settings-page.b85ad080.chunk.js → sso-settings-page.ad2143dd.chunk.js} +1 -1
- package/build/{sv-json.c6b0c237.chunk.js → sv-json.dc40951f.chunk.js} +1 -1
- package/build/{th-json.6e68155c.chunk.js → th-json.f664b96d.chunk.js} +1 -1
- package/build/{tr-json.9f41dc08.chunk.js → tr-json.b79eae31.chunk.js} +1 -1
- package/build/uk-json.b7e38370.chunk.js +1 -0
- package/build/upload-settings.eb1a7908.chunk.js +84 -0
- package/build/upload.700e2c84.chunk.js +33 -0
- package/build/{users-advanced-settings-page.fce9908e.chunk.js → users-advanced-settings-page.aae212f2.chunk.js} +1 -1
- package/build/{users-email-settings-page.343d0ad2.chunk.js → users-email-settings-page.8a9b0da1.chunk.js} +1 -1
- package/build/{users-providers-settings-page.e5a9a3f1.chunk.js → users-providers-settings-page.e6be909d.chunk.js} +10 -10
- package/build/{users-roles-settings-page.66312f31.chunk.js → users-roles-settings-page.97d06a80.chunk.js} +3 -3
- package/build/vi-json.ee4c5537.chunk.js +1 -0
- package/build/webhook-edit-page.9eb0f789.chunk.js +75 -0
- package/build/webhook-list-page.66082323.chunk.js +42 -0
- package/build/{zh-Hans-json.9c0eac99.chunk.js → zh-Hans-json.30a18940.chunk.js} +1 -1
- package/build/{zh-json.f88f563d.chunk.js → zh-json.49d84433.chunk.js} +1 -1
- package/ee/admin/hooks/useSettingsMenu/utils/customAdminLinks.js +12 -12
- package/ee/admin/hooks/useSettingsMenu/utils/customGlobalLinks.js +21 -13
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +137 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/actions/index.js +42 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/AddStage/AddStage.js +87 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/AddStage/index.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +90 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/index.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stages.js +77 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/index.js +1 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/constants.js +6 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +63 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/index.js +3 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/reducer/index.js +102 -0
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/getWorkflowValidationSchema.js +25 -0
- package/ee/admin/pages/SettingsPage/utils/customRoutes.js +16 -2
- package/ee/admin/permissions/customPermissions.js +7 -0
- package/ee/server/bootstrap.js +7 -1
- package/ee/server/config/admin-actions.js +10 -0
- package/ee/server/constants/default-stages.json +14 -0
- package/ee/server/constants/default-workflow.json +1 -0
- package/ee/server/constants/workflows.js +7 -0
- package/ee/server/content-types/index.js +9 -0
- package/ee/server/content-types/workflow/index.js +34 -0
- package/ee/server/content-types/workflow-stage/index.js +36 -0
- package/ee/server/controllers/index.js +2 -0
- package/ee/server/controllers/workflows/index.js +36 -0
- package/ee/server/controllers/workflows/stages/index.js +57 -0
- package/ee/server/index.js +1 -0
- package/ee/server/routes/index.js +87 -0
- package/ee/server/services/index.js +3 -0
- package/ee/server/services/review-workflows/review-workflows.js +54 -0
- package/ee/server/services/review-workflows/stages.js +133 -0
- package/ee/server/services/review-workflows/workflows.js +25 -0
- package/ee/server/utils/index.js +8 -0
- package/ee/server/utils/test.js +11 -0
- package/ee/server/validation/review-workflows.js +17 -0
- package/package.json +13 -13
- package/server/bootstrap.js +0 -2
- package/server/config/admin-actions.js +0 -64
- package/server/content-types/index.js +0 -2
- package/server/controllers/admin.js +0 -55
- package/server/controllers/api-token.js +5 -4
- package/server/controllers/index.js +0 -1
- package/server/register.js +9 -2
- package/server/routes/admin.js +0 -28
- package/server/routes/index.js +0 -2
- package/server/services/api-token.js +3 -2
- package/server/services/constants.js +0 -6
- package/server/services/index.js +0 -1
- package/server/strategies/api-token.js +2 -4
- package/server/strategies/index.js +0 -1
- package/server/utils/index.d.ts +0 -2
- package/server/validation/api-tokens.js +6 -1
- package/webpack.config.js +0 -3
- package/admin/src/pages/SettingsPage/components/Tokens/FormiTokenContainer/LifeSpanInput.js +0 -96
- package/admin/src/pages/SettingsPage/components/Tokens/LifeSpanInput/index.js +0 -98
- package/admin/src/pages/SettingsPage/components/Tokens/Regenerate/index.js +0 -73
- package/admin/src/pages/SettingsPage/components/Tokens/Table/index.js +0 -135
- package/admin/src/pages/SettingsPage/components/Tokens/TokenDescription/index.js +0 -51
- package/admin/src/pages/SettingsPage/components/Tokens/TokenName/index.js +0 -46
- package/admin/src/pages/SettingsPage/components/Tokens/TokenTypeSelect/index.js +0 -69
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/components/FormTransferTokenContainer/index.js +0 -105
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/components/LoadingView/index.js +0 -50
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +0 -201
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/getDateOfExpiration.js +0 -16
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/index.js +0 -4
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/schema.js +0 -10
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/index.js +0 -182
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/utils/tableHeaders.js +0 -48
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedCreateView/index.js +0 -14
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedEditView/index.js +0 -14
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ProtectedListView/index.js +0 -12
- package/build/1683.c8aa7b7c.chunk.js +0 -268
- package/build/2743.6d1632f9.chunk.js +0 -45
- package/build/3075.dc3894fe.chunk.js +0 -108
- package/build/3632.0317b618.chunk.js +0 -138
- package/build/4649.15cc0afe.chunk.js +0 -30
- package/build/7259.aa68d808.chunk.js +0 -1
- package/build/7407.883fb1f5.chunk.js +0 -1
- package/build/9707.7290fd92.chunk.js +0 -96
- package/build/Admin_settingsPage.178dc6e3.chunk.js +0 -178
- package/build/admin-app.77a50e1f.chunk.js +0 -112
- package/build/admin-edit-roles-page.446b69dc.chunk.js +0 -1
- package/build/admin-edit-users.2ed69bfd.chunk.js +0 -10
- package/build/admin-users.fc003b10.chunk.js +0 -11
- package/build/api-tokens-list-page.7387102c.chunk.js +0 -16
- package/build/ar-json.932794f7.chunk.js +0 -1
- package/build/content-manager.42b24d46.chunk.js +0 -1139
- package/build/content-type-builder.855db321.chunk.js +0 -126
- package/build/cs-json.79879fb6.chunk.js +0 -1
- package/build/email-settings-page.d1fcc7a3.chunk.js +0 -10
- package/build/en-json.b0748970.chunk.js +0 -1
- package/build/es-json.e275481d.chunk.js +0 -1
- package/build/main.1022ed01.js +0 -4393
- package/build/ms-json.db87d8d3.chunk.js +0 -1
- package/build/pt-json.62927d1e.chunk.js +0 -1
- package/build/runtime~main.84941a97.js +0 -2
- package/build/transfer-tokens-create-page.16e23791.chunk.js +0 -1
- package/build/transfer-tokens-edit-page.3886c973.chunk.js +0 -1
- package/build/transfer-tokens-list-page.e8010a89.chunk.js +0 -16
- package/build/uk-json.b2fcd567.chunk.js +0 -1
- package/build/upload-settings.ef64bbf9.chunk.js +0 -84
- package/build/upload.c5730dfa.chunk.js +0 -33
- package/build/vi-json.f08d7d03.chunk.js +0 -1
- package/build/webhook-edit-page.73e51e64.chunk.js +0 -75
- package/build/webhook-list-page.1134f130.chunk.js +0 -42
- package/server/content-types/transfer-token-permission.js +0 -36
- package/server/content-types/transfer-token.js +0 -66
- package/server/controllers/transfer/index.js +0 -13
- package/server/controllers/transfer/runner.js +0 -24
- package/server/controllers/transfer/token.js +0 -131
- package/server/routes/transfer.js +0 -95
- package/server/services/transfer/index.js +0 -6
- package/server/services/transfer/permission.js +0 -22
- package/server/services/transfer/token.js +0 -409
- package/server/strategies/data-transfer.js +0 -107
- package/server/validation/transfer/index.js +0 -5
- package/server/validation/transfer/token.js +0 -34
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useHistory } from 'react-router-dom';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { Typography } from '@strapi/design-system/Typography';
|
|
5
|
-
import { Tbody, Tr, Td } from '@strapi/design-system/Table';
|
|
6
|
-
import { Flex } from '@strapi/design-system/Flex';
|
|
7
|
-
import {
|
|
8
|
-
RelativeTime,
|
|
9
|
-
onRowClick,
|
|
10
|
-
pxToRem,
|
|
11
|
-
DynamicTable,
|
|
12
|
-
useQueryParams,
|
|
13
|
-
useTracking,
|
|
14
|
-
} from '@strapi/helper-plugin';
|
|
15
|
-
import DeleteButton from './DeleteButton';
|
|
16
|
-
import UpdateButton from './UpdateButton';
|
|
17
|
-
import ReadButton from './ReadButton';
|
|
18
|
-
|
|
19
|
-
const Table = ({ permissions, headers, contentType, isLoading, tokens, onConfirmDelete }) => {
|
|
20
|
-
const { canDelete, canUpdate, canRead } = permissions;
|
|
21
|
-
const withBulkActions = canDelete || canUpdate || canRead;
|
|
22
|
-
const [{ query }] = useQueryParams();
|
|
23
|
-
const [, sortOrder] = query ? query.sort.split(':') : 'ASC';
|
|
24
|
-
const {
|
|
25
|
-
push,
|
|
26
|
-
location: { pathname },
|
|
27
|
-
} = useHistory();
|
|
28
|
-
const { trackUsage } = useTracking(); // TODO: Track different types of tokens
|
|
29
|
-
|
|
30
|
-
const sortedTokens = tokens.sort((a, b) => {
|
|
31
|
-
const comparison = a.name.localeCompare(b.name);
|
|
32
|
-
|
|
33
|
-
return sortOrder === 'DESC' ? -comparison : comparison;
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<DynamicTable
|
|
38
|
-
headers={headers}
|
|
39
|
-
contentType={contentType}
|
|
40
|
-
rows={tokens}
|
|
41
|
-
withBulkActions={withBulkActions}
|
|
42
|
-
isLoading={isLoading}
|
|
43
|
-
onConfirmDelete={onConfirmDelete}
|
|
44
|
-
>
|
|
45
|
-
<Tbody>
|
|
46
|
-
{sortedTokens.map((token) => {
|
|
47
|
-
return (
|
|
48
|
-
<Tr
|
|
49
|
-
key={token.id}
|
|
50
|
-
{...onRowClick({
|
|
51
|
-
fn() {
|
|
52
|
-
trackUsage('willEditTokenFromList');
|
|
53
|
-
push(`${pathname}/${token.id}`);
|
|
54
|
-
},
|
|
55
|
-
condition: canUpdate,
|
|
56
|
-
})}
|
|
57
|
-
>
|
|
58
|
-
<Td>
|
|
59
|
-
<Typography textColor="neutral800" fontWeight="bold">
|
|
60
|
-
{token.name}
|
|
61
|
-
</Typography>
|
|
62
|
-
</Td>
|
|
63
|
-
<Td maxWidth={pxToRem(250)}>
|
|
64
|
-
<Typography textColor="neutral800" ellipsis>
|
|
65
|
-
{token.description}
|
|
66
|
-
</Typography>
|
|
67
|
-
</Td>
|
|
68
|
-
<Td>
|
|
69
|
-
<Typography textColor="neutral800">
|
|
70
|
-
<RelativeTime timestamp={new Date(token.createdAt)} />
|
|
71
|
-
</Typography>
|
|
72
|
-
</Td>
|
|
73
|
-
<Td>
|
|
74
|
-
{token.lastUsedAt && (
|
|
75
|
-
<Typography textColor="neutral800">
|
|
76
|
-
<RelativeTime timestamp={new Date(token.lastUsedAt)} />
|
|
77
|
-
</Typography>
|
|
78
|
-
)}
|
|
79
|
-
</Td>
|
|
80
|
-
|
|
81
|
-
{withBulkActions && (
|
|
82
|
-
<Td>
|
|
83
|
-
<Flex justifyContent="end">
|
|
84
|
-
{canUpdate && <UpdateButton tokenName={token.name} tokenId={token.id} />}
|
|
85
|
-
{!canUpdate && canRead && (
|
|
86
|
-
<ReadButton tokenName={token.name} tokenId={token.id} />
|
|
87
|
-
)}
|
|
88
|
-
{canDelete && (
|
|
89
|
-
<DeleteButton
|
|
90
|
-
tokenName={token.name}
|
|
91
|
-
onClickDelete={() => onConfirmDelete(token.id)}
|
|
92
|
-
/>
|
|
93
|
-
)}
|
|
94
|
-
</Flex>
|
|
95
|
-
</Td>
|
|
96
|
-
)}
|
|
97
|
-
</Tr>
|
|
98
|
-
);
|
|
99
|
-
})}
|
|
100
|
-
</Tbody>
|
|
101
|
-
</DynamicTable>
|
|
102
|
-
);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
Table.propTypes = {
|
|
106
|
-
tokens: PropTypes.array,
|
|
107
|
-
permissions: PropTypes.shape({
|
|
108
|
-
canRead: PropTypes.bool,
|
|
109
|
-
canDelete: PropTypes.bool,
|
|
110
|
-
canUpdate: PropTypes.bool,
|
|
111
|
-
}).isRequired,
|
|
112
|
-
headers: PropTypes.arrayOf(
|
|
113
|
-
PropTypes.shape({
|
|
114
|
-
cellFormatter: PropTypes.func,
|
|
115
|
-
key: PropTypes.string.isRequired,
|
|
116
|
-
metadatas: PropTypes.shape({
|
|
117
|
-
label: PropTypes.string.isRequired,
|
|
118
|
-
sortable: PropTypes.bool,
|
|
119
|
-
}).isRequired,
|
|
120
|
-
name: PropTypes.string.isRequired,
|
|
121
|
-
})
|
|
122
|
-
),
|
|
123
|
-
contentType: PropTypes.string.isRequired,
|
|
124
|
-
isLoading: PropTypes.bool,
|
|
125
|
-
onConfirmDelete: PropTypes.func,
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
Table.defaultProps = {
|
|
129
|
-
tokens: [],
|
|
130
|
-
headers: [],
|
|
131
|
-
isLoading: false,
|
|
132
|
-
onConfirmDelete() {},
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
export default Table;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
4
|
-
import { Textarea } from '@strapi/design-system/Textarea';
|
|
5
|
-
|
|
6
|
-
const TokenDescription = ({ errors, values, onChange, canEditInputs }) => {
|
|
7
|
-
const { formatMessage } = useIntl();
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<Textarea
|
|
11
|
-
label={formatMessage({
|
|
12
|
-
id: 'Settings.tokens.form.description',
|
|
13
|
-
defaultMessage: 'Description',
|
|
14
|
-
})}
|
|
15
|
-
name="description"
|
|
16
|
-
error={
|
|
17
|
-
errors.description
|
|
18
|
-
? formatMessage(
|
|
19
|
-
errors.description?.id
|
|
20
|
-
? errors.description
|
|
21
|
-
: {
|
|
22
|
-
id: errors.description,
|
|
23
|
-
defaultMessage: errors.description,
|
|
24
|
-
}
|
|
25
|
-
)
|
|
26
|
-
: null
|
|
27
|
-
}
|
|
28
|
-
onChange={onChange}
|
|
29
|
-
disabled={!canEditInputs}
|
|
30
|
-
>
|
|
31
|
-
{values.description}
|
|
32
|
-
</Textarea>
|
|
33
|
-
);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
TokenDescription.propTypes = {
|
|
37
|
-
errors: PropTypes.shape({
|
|
38
|
-
description: PropTypes.string,
|
|
39
|
-
}),
|
|
40
|
-
onChange: PropTypes.func.isRequired,
|
|
41
|
-
canEditInputs: PropTypes.bool.isRequired,
|
|
42
|
-
values: PropTypes.shape({
|
|
43
|
-
description: PropTypes.string,
|
|
44
|
-
}).isRequired,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
TokenDescription.defaultProps = {
|
|
48
|
-
errors: {},
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default TokenDescription;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
4
|
-
import { TextInput } from '@strapi/design-system/TextInput';
|
|
5
|
-
|
|
6
|
-
const TokenName = ({ errors, values, onChange, canEditInputs }) => {
|
|
7
|
-
const { formatMessage } = useIntl();
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<TextInput
|
|
11
|
-
name="name"
|
|
12
|
-
error={
|
|
13
|
-
errors.name
|
|
14
|
-
? formatMessage(
|
|
15
|
-
errors.name?.id ? errors.name : { id: errors.name, defaultMessage: errors.name }
|
|
16
|
-
)
|
|
17
|
-
: null
|
|
18
|
-
}
|
|
19
|
-
label={formatMessage({
|
|
20
|
-
id: 'Settings.tokens.form.name',
|
|
21
|
-
defaultMessage: 'Name',
|
|
22
|
-
})}
|
|
23
|
-
onChange={onChange}
|
|
24
|
-
value={values.name}
|
|
25
|
-
disabled={!canEditInputs}
|
|
26
|
-
required
|
|
27
|
-
/>
|
|
28
|
-
);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
TokenName.propTypes = {
|
|
32
|
-
errors: PropTypes.shape({
|
|
33
|
-
name: PropTypes.string,
|
|
34
|
-
}),
|
|
35
|
-
onChange: PropTypes.func.isRequired,
|
|
36
|
-
canEditInputs: PropTypes.bool.isRequired,
|
|
37
|
-
values: PropTypes.shape({
|
|
38
|
-
name: PropTypes.string,
|
|
39
|
-
}).isRequired,
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
TokenName.defaultProps = {
|
|
43
|
-
errors: {},
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export default TokenName;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
4
|
-
|
|
5
|
-
import { Select, Option } from '@strapi/design-system/Select';
|
|
6
|
-
|
|
7
|
-
const TokenTypeSelect = ({ errors, values, onChange, canEditInputs, options, label }) => {
|
|
8
|
-
const { formatMessage } = useIntl();
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<Select
|
|
12
|
-
name="type"
|
|
13
|
-
label={formatMessage({
|
|
14
|
-
id: label.id,
|
|
15
|
-
defaultMessage: label.defaultMessage,
|
|
16
|
-
})}
|
|
17
|
-
value={values?.type}
|
|
18
|
-
error={
|
|
19
|
-
errors.type
|
|
20
|
-
? formatMessage(
|
|
21
|
-
errors.type?.id ? errors.type : { id: errors.type, defaultMessage: errors.type }
|
|
22
|
-
)
|
|
23
|
-
: null
|
|
24
|
-
}
|
|
25
|
-
onChange={onChange}
|
|
26
|
-
placeholder="Select"
|
|
27
|
-
required
|
|
28
|
-
disabled={!canEditInputs}
|
|
29
|
-
>
|
|
30
|
-
{options &&
|
|
31
|
-
options.map(({ value, label }) => (
|
|
32
|
-
<Option key={value} value={value}>
|
|
33
|
-
{formatMessage(label)}
|
|
34
|
-
</Option>
|
|
35
|
-
))}
|
|
36
|
-
</Select>
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
TokenTypeSelect.propTypes = {
|
|
41
|
-
options: PropTypes.arrayOf(
|
|
42
|
-
PropTypes.shape({
|
|
43
|
-
label: PropTypes.shape({
|
|
44
|
-
id: PropTypes.string,
|
|
45
|
-
defaultMessage: PropTypes.string,
|
|
46
|
-
}),
|
|
47
|
-
value: PropTypes.string,
|
|
48
|
-
})
|
|
49
|
-
),
|
|
50
|
-
errors: PropTypes.shape({
|
|
51
|
-
type: PropTypes.string,
|
|
52
|
-
}),
|
|
53
|
-
onChange: PropTypes.func.isRequired,
|
|
54
|
-
canEditInputs: PropTypes.bool.isRequired,
|
|
55
|
-
values: PropTypes.shape({
|
|
56
|
-
type: PropTypes.string,
|
|
57
|
-
}).isRequired,
|
|
58
|
-
label: PropTypes.shape({
|
|
59
|
-
id: PropTypes.string,
|
|
60
|
-
defaultMessage: PropTypes.string,
|
|
61
|
-
}).isRequired,
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
TokenTypeSelect.defaultProps = {
|
|
65
|
-
errors: {},
|
|
66
|
-
options: [],
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export default TokenTypeSelect;
|
|
@@ -1,105 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
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;
|
|
@@ -1,201 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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;
|
|
@@ -1,10 +0,0 @@
|
|
|
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;
|