@strapi/admin 4.10.0-beta.0 → 4.10.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/.eslintignore +4 -0
- package/.eslintrc.js +14 -0
- package/admin/src/components/LanguageProvider/index.js +1 -1
- package/admin/src/components/LocalesProvider/__mocks__/useLocalesProvider.js +7 -0
- package/admin/src/components/LocalesProvider/index.js +2 -3
- package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +3 -6
- package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn.js +2 -0
- package/admin/src/content-manager/components/DynamicTable/index.js +11 -29
- package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +12 -6
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/findAllAndReplace.js +10 -3
- package/admin/src/content-manager/components/InputUID/endActionStyle.js +4 -13
- package/admin/src/content-manager/components/InputUID/index.js +95 -72
- package/admin/src/content-manager/components/RepeatableComponent/components/Component.js +8 -2
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +4 -8
- package/admin/src/content-manager/pages/App/LeftMenu/index.js +56 -35
- package/admin/src/content-manager/pages/App/actions.js +19 -7
- package/admin/src/content-manager/pages/App/constants.js +3 -3
- package/admin/src/content-manager/pages/App/index.js +5 -4
- package/admin/src/content-manager/pages/App/reducer.js +7 -6
- package/admin/src/content-manager/pages/App/selectors.js +3 -0
- package/admin/src/content-manager/pages/App/{useModels.js → useContentManagerInitData.js} +29 -28
- package/admin/src/content-manager/pages/App/utils/generateModelsLinks.js +2 -2
- package/admin/src/content-manager/pages/App/utils/getContentTypeLinks.js +17 -15
- package/admin/src/content-manager/pages/EditSettingsView/components/ModalForm.js +6 -5
- package/admin/src/content-manager/pages/EditSettingsView/index.js +4 -0
- package/admin/src/content-manager/pages/EditSettingsView/reducer.js +12 -7
- package/admin/src/content-manager/pages/EditSettingsView/utils/layout.js +1 -30
- package/admin/src/content-manager/pages/EditView/DeleteLink/index.js +5 -11
- package/admin/src/content-manager/pages/EditView/index.js +2 -7
- package/admin/src/content-manager/pages/EditViewLayoutManager/reducer.js +4 -4
- package/admin/src/content-manager/pages/ListSettingsView/index.js +1 -0
- package/admin/src/hooks/useConfigurations/__mocks__/index.js +7 -0
- package/admin/src/hooks/useFetchMarketplacePlugins/utils/api.js +7 -8
- package/admin/src/hooks/useFetchMarketplaceProviders/utils/api.js +5 -0
- package/admin/src/hooks/useFetchPermissionsLayout/index.js +24 -15
- package/admin/src/hooks/useFetchRole/index.js +37 -30
- package/admin/src/hooks/useModels/index.js +22 -12
- package/admin/src/hooks/useRegenerate/index.js +12 -7
- package/admin/src/hooks/useSettingsForm/index.js +14 -6
- package/admin/src/pages/App/index.js +19 -24
- package/admin/src/pages/AuthPage/components/Register/index.js +46 -38
- package/admin/src/pages/HomePage/SocialLinks.js +1 -1
- package/admin/src/pages/MarketplacePage/components/EmptyNpmPackageSearch/index.js +3 -3
- package/admin/src/pages/MarketplacePage/components/NpmPackagesGrid/index.js +42 -9
- package/admin/src/pages/MarketplacePage/components/NpmPackagesPagination/index.js +26 -0
- package/admin/src/pages/MarketplacePage/components/OfflineLayout/index.js +45 -0
- package/admin/src/pages/MarketplacePage/index.js +80 -175
- package/admin/src/pages/MarketplacePage/utils/useMarketplaceData.js +85 -0
- package/admin/src/pages/SettingsPage/components/Tokens/FormHead/index.js +4 -0
- package/admin/src/pages/SettingsPage/components/Tokens/Regenerate/index.js +5 -3
- package/admin/src/pages/SettingsPage/components/Tokens/TokenTypeSelect/index.js +7 -5
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/PendingLogoDialog.js +1 -3
- package/admin/src/pages/SettingsPage/pages/Roles/CreatePage/index.js +6 -12
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/index.js +6 -10
- package/admin/src/pages/SettingsPage/pages/Roles/ListPage/components/RoleRow/index.js +12 -4
- package/admin/src/pages/SettingsPage/pages/Roles/ListPage/index.js +21 -2
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/components/FormTransferTokenContainer/index.js +41 -0
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +53 -9
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/schema.js +1 -0
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/index.js +27 -5
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js +18 -33
- package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +41 -41
- package/admin/src/translations/en.json +52 -50
- package/admin/src/translations/fr.json +89 -1
- package/admin/src/translations/ru.json +51 -19
- package/build/1387.84b454d3.chunk.js +1 -0
- package/build/1657.45231968.chunk.js +168 -0
- package/build/3081.bcf9a12f.chunk.js +108 -0
- package/build/462.8fff7f3b.chunk.js +71 -0
- package/build/4628.20631dd1.chunk.js +1 -0
- package/build/5542.b8240e3f.chunk.js +70 -0
- package/build/5563.905daa13.chunk.js +79 -0
- package/build/6404.68405699.chunk.js +100 -0
- package/build/7259.b7d00cea.chunk.js +1 -0
- package/build/8694.6522968d.chunk.js +247 -0
- package/build/Admin-authenticatedApp.b036fe95.chunk.js +79 -0
- package/build/Admin_InternalErrorPage.15c6bf07.chunk.js +1 -0
- package/build/Admin_homePage.f9309c6d.chunk.js +73 -0
- package/build/Admin_marketplace.56bc1008.chunk.js +31 -0
- package/build/Admin_pluginsPage.f6b52ee9.chunk.js +6 -0
- package/build/Admin_profilePage.9112cffc.chunk.js +15 -0
- package/build/Admin_settingsPage.4604a16c.chunk.js +79 -0
- package/build/Upload_ConfigureTheView.eaaec495.chunk.js +1 -0
- package/build/admin-app.014adc27.chunk.js +110 -0
- package/build/admin-edit-roles-page.8a4063f7.chunk.js +280 -0
- package/build/admin-edit-users.7e14d85f.chunk.js +10 -0
- package/build/admin-roles-list.329c1f63.chunk.js +31 -0
- package/build/admin-users.d02de059.chunk.js +34 -0
- package/build/api-tokens-create-page.97595e12.chunk.js +1 -0
- package/build/api-tokens-edit-page.cd36e30e.chunk.js +1 -0
- package/build/api-tokens-list-page.6757c7b9.chunk.js +16 -0
- package/build/audit-logs-settings-page.19d90bda.chunk.js +76 -0
- package/build/content-manager.84f81966.chunk.js +1130 -0
- package/build/content-type-builder-list-view.9c2c020c.chunk.js +214 -0
- package/build/{content-type-builder-translation-de-json.0979cccb.chunk.js → content-type-builder-translation-de-json.393a76c0.chunk.js} +1 -1
- package/build/{content-type-builder-translation-dk-json.e05583e9.chunk.js → content-type-builder-translation-dk-json.fbd39bb7.chunk.js} +1 -1
- package/build/content-type-builder-translation-en-json.446b611d.chunk.js +1 -0
- package/build/{content-type-builder-translation-es-json.fe4daad8.chunk.js → content-type-builder-translation-es-json.9288474b.chunk.js} +1 -1
- package/build/{content-type-builder-translation-fr-json.b1eb52f6.chunk.js → content-type-builder-translation-fr-json.d35e269c.chunk.js} +1 -1
- package/build/{content-type-builder-translation-id-json.ee3b36bb.chunk.js → content-type-builder-translation-id-json.f0513929.chunk.js} +1 -1
- package/build/{content-type-builder-translation-it-json.13b3c26a.chunk.js → content-type-builder-translation-it-json.aaf16753.chunk.js} +1 -1
- package/build/{content-type-builder-translation-ko-json.8a274be5.chunk.js → content-type-builder-translation-ko-json.8fe21a7f.chunk.js} +1 -1
- package/build/{content-type-builder-translation-ms-json.2d29c1e0.chunk.js → content-type-builder-translation-ms-json.3b5d2d3e.chunk.js} +1 -1
- package/build/{content-type-builder-translation-nl-json.40bbc562.chunk.js → content-type-builder-translation-nl-json.225ef5d3.chunk.js} +1 -1
- package/build/{content-type-builder-translation-pl-json.24a34349.chunk.js → content-type-builder-translation-pl-json.92f36be2.chunk.js} +1 -1
- package/build/{content-type-builder-translation-pt-BR-json.97f71a9d.chunk.js → content-type-builder-translation-pt-BR-json.3bd10f89.chunk.js} +1 -1
- package/build/{content-type-builder-translation-ru-json.54d11230.chunk.js → content-type-builder-translation-ru-json.9bfe47ce.chunk.js} +1 -1
- package/build/{content-type-builder-translation-sk-json.626c9493.chunk.js → content-type-builder-translation-sk-json.d03cc18a.chunk.js} +1 -1
- package/build/{content-type-builder-translation-sv-json.59f5e1e5.chunk.js → content-type-builder-translation-sv-json.d23dcd32.chunk.js} +1 -1
- package/build/{content-type-builder-translation-th-json.6fe3ed55.chunk.js → content-type-builder-translation-th-json.7ad256e2.chunk.js} +1 -1
- package/build/{content-type-builder-translation-tr-json.cea4d226.chunk.js → content-type-builder-translation-tr-json.926f6191.chunk.js} +1 -1
- package/build/{content-type-builder-translation-uk-json.c4524247.chunk.js → content-type-builder-translation-uk-json.7bf19546.chunk.js} +1 -1
- package/build/{content-type-builder-translation-zh-json.faedd610.chunk.js → content-type-builder-translation-zh-json.ad24dbeb.chunk.js} +1 -1
- package/build/content-type-builder.68af11d2.chunk.js +126 -0
- package/build/email-settings-page.1095e1ab.chunk.js +10 -0
- package/build/en-json.c7fc79af.chunk.js +1 -0
- package/build/fr-json.5947cf63.chunk.js +1 -0
- package/build/{highlight.js.26ef649f.chunk.js → highlight.js.28a1547e.chunk.js} +2 -2
- package/build/i18n-settings-page.d95b32df.chunk.js +60 -0
- package/build/index.html +1 -1
- package/build/main.841e0dcb.js +2280 -0
- package/build/review-workflows-settings.f7890c40.chunk.js +106 -0
- package/build/ru-json.e0662702.chunk.js +1 -0
- package/build/{runtime~main.5a95bee6.js → runtime~main.965f8af8.js} +1 -1
- package/build/sso-settings-page.1dd4886e.chunk.js +1 -0
- package/build/transfer-tokens-create-page.ec2ca215.chunk.js +1 -0
- package/build/transfer-tokens-edit-page.22bf28e5.chunk.js +1 -0
- package/build/transfer-tokens-list-page.cf8c77f2.chunk.js +16 -0
- package/build/upload-settings.945fdcfa.chunk.js +13 -0
- package/build/{upload-translation-th-json.3847dae0.chunk.js → upload-translation-th-json.98d35574.chunk.js} +1 -1
- package/build/upload.a86b1054.chunk.js +33 -0
- package/build/users-advanced-settings-page.5b5a9baa.chunk.js +8 -0
- package/build/users-email-settings-page.e5506eb4.chunk.js +23 -0
- package/build/users-providers-settings-page.e32089c2.chunk.js +28 -0
- package/build/users-roles-settings-page.20656f92.chunk.js +30 -0
- package/build/webhook-edit-page.a3b62049.chunk.js +75 -0
- package/build/webhook-list-page.ca38eeef.chunk.js +71 -0
- package/{admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/ReviewWorkflowsStage.js → ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/ReviewWorkflowsStageEE.js} +2 -2
- package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn.js +47 -0
- package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/index.js +3 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +64 -18
- package/ee/admin/hooks/useAuthProviders/index.js +28 -29
- package/ee/admin/hooks/useLicenseLimitNotification/index.js +1 -1
- package/ee/admin/pages/AuthResponse/index.js +7 -3
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useAuditLogsData.js +6 -3
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/index.js +15 -5
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getDisplayedFilters.js +52 -45
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +9 -5
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +2 -2
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +2 -2
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/reducer/index.js +2 -1
- package/ee/server/content-types/workflow/index.js +0 -3
- package/ee/server/content-types/workflow-stage/index.js +0 -5
- package/ee/server/controllers/authentication/middlewares.js +2 -1
- package/ee/server/controllers/workflows/stages/index.js +8 -1
- package/ee/server/register.js +3 -1
- package/ee/server/services/audit-logs.js +75 -16
- package/ee/server/services/index.js +1 -0
- package/ee/server/services/review-workflows/entity-service-decorator.js +17 -5
- package/ee/server/services/review-workflows/metrics.js +24 -0
- package/ee/server/services/review-workflows/review-workflows.js +44 -94
- package/ee/server/services/review-workflows/stages.js +136 -17
- package/ee/server/utils/persisted-tables.js +116 -22
- package/ee/server/utils/review-workflows.js +9 -0
- package/jest.config.front.js +1 -6
- package/package.json +25 -23
- package/server/controllers/transfer/runner.js +4 -2
- package/server/middlewares/data-transfer.js +4 -1
- package/server/routes/transfer.js +13 -4
- package/server/services/constants.js +4 -0
- package/server/services/transfer/permission.js +1 -1
- package/server/services/transfer/token.js +33 -31
- package/server/strategies/api-token.js +8 -1
- package/server/validation/transfer/token.js +10 -2
- package/webpack.config.js +6 -2
- package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/index.js +0 -1
- package/admin/src/content-manager/pages/App/LeftMenu/utils/index.js +0 -1
- package/admin/src/content-manager/pages/App/LeftMenu/utils/matchByTitle.js +0 -24
- package/build/2263.4c5916f9.chunk.js +0 -98
- package/build/4049.64715f20.chunk.js +0 -1
- package/build/4649.213b8a3b.chunk.js +0 -30
- package/build/6985.66cca29c.chunk.js +0 -1
- package/build/7259.aefb51e8.chunk.js +0 -1
- package/build/8469.853c822b.chunk.js +0 -1
- package/build/9505.dbe702ab.chunk.js +0 -14
- package/build/9816.01ee964f.chunk.js +0 -2
- package/build/Admin-authenticatedApp.f50ad423.chunk.js +0 -79
- package/build/Admin_InternalErrorPage.4ad8b0df.chunk.js +0 -1
- package/build/Admin_homePage.1411fb7c.chunk.js +0 -68
- package/build/Admin_marketplace.02608d56.chunk.js +0 -22
- package/build/Admin_pluginsPage.15e3b0fd.chunk.js +0 -1
- package/build/Admin_profilePage.76afeca0.chunk.js +0 -15
- package/build/Admin_settingsPage.147755cd.chunk.js +0 -9
- package/build/Upload_ConfigureTheView.34dde278.chunk.js +0 -1
- package/build/admin-app.55dd7921.chunk.js +0 -112
- package/build/admin-edit-roles-page.cf543488.chunk.js +0 -216
- package/build/admin-edit-users.31c20712.chunk.js +0 -10
- package/build/admin-roles-list.489c501f.chunk.js +0 -2
- package/build/admin-users.3e111a7d.chunk.js +0 -11
- package/build/api-tokens-create-page.4328b852.chunk.js +0 -1
- package/build/api-tokens-edit-page.bce5050f.chunk.js +0 -1
- package/build/api-tokens-list-page.93f24348.chunk.js +0 -16
- package/build/audit-logs-settings-page.7be97e82.chunk.js +0 -1
- package/build/content-manager.4480ae88.chunk.js +0 -1137
- package/build/content-type-builder-list-view.cf38fe2f.chunk.js +0 -191
- package/build/content-type-builder-translation-en-json.7961593e.chunk.js +0 -1
- package/build/content-type-builder.af9abf1e.chunk.js +0 -126
- package/build/email-settings-page.4bdbef9a.chunk.js +0 -3
- package/build/en-json.697b4bcf.chunk.js +0 -1
- package/build/fr-json.f66c3211.chunk.js +0 -1
- package/build/i18n-settings-page.2bb5be96.chunk.js +0 -1
- package/build/main.af8c0f31.js +0 -3790
- package/build/review-workflows-settings.7a7dc773.chunk.js +0 -57
- package/build/ru-json.6a01cea6.chunk.js +0 -1
- package/build/sso-settings-page.272b87c8.chunk.js +0 -1
- package/build/transfer-tokens-create-page.a1f14bb1.chunk.js +0 -1
- package/build/transfer-tokens-edit-page.00ee1c74.chunk.js +0 -1
- package/build/transfer-tokens-list-page.ce37354b.chunk.js +0 -16
- package/build/upload-settings.0875e973.chunk.js +0 -1
- package/build/upload.c7da1611.chunk.js +0 -13
- package/build/users-advanced-settings-page.1d3c14c7.chunk.js +0 -1
- package/build/users-email-settings-page.e8db68c4.chunk.js +0 -1
- package/build/users-providers-settings-page.14cac425.chunk.js +0 -1
- package/build/users-roles-settings-page.2ea4de84.chunk.js +0 -30
- package/build/webhook-edit-page.329141a5.chunk.js +0 -23
- package/build/webhook-list-page.029957a4.chunk.js +0 -1
- package/ee/server/migrations/review-workflows.js +0 -39
- package/ee/server/utils/test.js +0 -11
- /package/admin/src/{content-manager/components/InputUID/useDebounce.js → hooks/useDebounce/index.js} +0 -0
|
@@ -4,21 +4,21 @@ import { useIntl } from 'react-intl';
|
|
|
4
4
|
|
|
5
5
|
import { Select, Option } from '@strapi/design-system';
|
|
6
6
|
|
|
7
|
-
const TokenTypeSelect = ({ errors, values, onChange, canEditInputs, options, label }) => {
|
|
7
|
+
const TokenTypeSelect = ({ name, errors, values, onChange, canEditInputs, options, label }) => {
|
|
8
8
|
const { formatMessage } = useIntl();
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
11
|
<Select
|
|
12
|
-
name=
|
|
12
|
+
name={name}
|
|
13
13
|
label={formatMessage({
|
|
14
14
|
id: label.id,
|
|
15
15
|
defaultMessage: label.defaultMessage,
|
|
16
16
|
})}
|
|
17
|
-
value={values
|
|
17
|
+
value={values && values[name]}
|
|
18
18
|
error={
|
|
19
|
-
errors
|
|
19
|
+
errors[name]
|
|
20
20
|
? formatMessage(
|
|
21
|
-
errors
|
|
21
|
+
errors[name]?.id ? errors[name] : { id: errors[name], defaultMessage: errors[name] }
|
|
22
22
|
)
|
|
23
23
|
: null
|
|
24
24
|
}
|
|
@@ -38,6 +38,7 @@ const TokenTypeSelect = ({ errors, values, onChange, canEditInputs, options, lab
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
TokenTypeSelect.propTypes = {
|
|
41
|
+
name: PropTypes.string,
|
|
41
42
|
options: PropTypes.arrayOf(
|
|
42
43
|
PropTypes.shape({
|
|
43
44
|
label: PropTypes.shape({
|
|
@@ -62,6 +63,7 @@ TokenTypeSelect.propTypes = {
|
|
|
62
63
|
};
|
|
63
64
|
|
|
64
65
|
TokenTypeSelect.defaultProps = {
|
|
66
|
+
name: 'type',
|
|
65
67
|
errors: {},
|
|
66
68
|
options: [],
|
|
67
69
|
};
|
|
@@ -43,9 +43,7 @@ const PendingLogoDialog = ({ onClose, asset, prev, next, goTo, setLocalImage, on
|
|
|
43
43
|
})}
|
|
44
44
|
</Button>
|
|
45
45
|
</Flex>
|
|
46
|
-
<Box maxWidth={pxToRem(180)}>
|
|
47
|
-
<ImageCardAsset asset={asset} />
|
|
48
|
-
</Box>
|
|
46
|
+
<Box maxWidth={pxToRem(180)}>{asset.url ? <ImageCardAsset asset={asset} /> : null}</Box>
|
|
49
47
|
</Box>
|
|
50
48
|
<ModalFooter
|
|
51
49
|
startActions={
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
Form,
|
|
6
6
|
LoadingIndicatorPage,
|
|
7
7
|
SettingsPageTitle,
|
|
8
|
-
|
|
8
|
+
useFetchClient,
|
|
9
9
|
useNotification,
|
|
10
10
|
useOverlayBlocker,
|
|
11
11
|
useTracking,
|
|
@@ -59,6 +59,8 @@ const CreatePage = () => {
|
|
|
59
59
|
const { isLoading: isLayoutLoading, data: permissionsLayout } = useFetchPermissionsLayout();
|
|
60
60
|
const { permissions: rolePermissions, isLoading: isRoleLoading } = useFetchRole(id);
|
|
61
61
|
|
|
62
|
+
const { post, put } = useFetchClient();
|
|
63
|
+
|
|
62
64
|
const handleCreateRoleSubmit = (data) => {
|
|
63
65
|
lockApp();
|
|
64
66
|
setIsSubmiting(true);
|
|
@@ -69,13 +71,8 @@ const CreatePage = () => {
|
|
|
69
71
|
trackUsage('willCreateNewRole');
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
Promise.resolve(
|
|
73
|
-
|
|
74
|
-
method: 'POST',
|
|
75
|
-
body: data,
|
|
76
|
-
})
|
|
77
|
-
)
|
|
78
|
-
.then(async (res) => {
|
|
74
|
+
Promise.resolve(post('/admin/roles', data))
|
|
75
|
+
.then(async ({ data: res }) => {
|
|
79
76
|
const { permissionsToSend } = permissionsRef.current.getPermissions();
|
|
80
77
|
|
|
81
78
|
if (id) {
|
|
@@ -85,10 +82,7 @@ const CreatePage = () => {
|
|
|
85
82
|
}
|
|
86
83
|
|
|
87
84
|
if (res.data.id && !isEmpty(permissionsToSend)) {
|
|
88
|
-
await
|
|
89
|
-
method: 'PUT',
|
|
90
|
-
body: { permissions: permissionsToSend },
|
|
91
|
-
});
|
|
85
|
+
await put(`/admin/roles/${res.data.id}/permissions`, { permissions: permissionsToSend });
|
|
92
86
|
}
|
|
93
87
|
|
|
94
88
|
return res;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useState } from 'react';
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
useFetchClient,
|
|
4
4
|
useNotification,
|
|
5
5
|
useOverlayBlocker,
|
|
6
6
|
useTracking,
|
|
@@ -37,6 +37,8 @@ const EditPage = () => {
|
|
|
37
37
|
onSubmitSucceeded,
|
|
38
38
|
} = useFetchRole(id);
|
|
39
39
|
|
|
40
|
+
const { put } = useFetchClient();
|
|
41
|
+
|
|
40
42
|
const handleEditRoleSubmit = async (data) => {
|
|
41
43
|
try {
|
|
42
44
|
lockApp();
|
|
@@ -44,17 +46,11 @@ const EditPage = () => {
|
|
|
44
46
|
|
|
45
47
|
const { permissionsToSend, didUpdateConditions } = permissionsRef.current.getPermissions();
|
|
46
48
|
|
|
47
|
-
await
|
|
48
|
-
method: 'PUT',
|
|
49
|
-
body: data,
|
|
50
|
-
});
|
|
49
|
+
await put(`/admin/roles/${id}`, data);
|
|
51
50
|
|
|
52
51
|
if (role.code !== 'strapi-super-admin') {
|
|
53
|
-
await
|
|
54
|
-
|
|
55
|
-
body: {
|
|
56
|
-
permissions: permissionsToSend,
|
|
57
|
-
},
|
|
52
|
+
await put(`/admin/roles/${id}/permissions`, {
|
|
53
|
+
permissions: permissionsToSend,
|
|
58
54
|
});
|
|
59
55
|
|
|
60
56
|
if (didUpdateConditions) {
|
|
@@ -4,8 +4,9 @@ import { Box, Flex, Td, Tr, Typography, IconButton } from '@strapi/design-system
|
|
|
4
4
|
import { stopPropagation, onRowClick, pxToRem } from '@strapi/helper-plugin';
|
|
5
5
|
import { useIntl } from 'react-intl';
|
|
6
6
|
|
|
7
|
-
const RoleRow = ({ id, name, description, usersCount, icons, rowIndex }) => {
|
|
7
|
+
const RoleRow = ({ id, name, description, usersCount, icons, rowIndex, canUpdate }) => {
|
|
8
8
|
const { formatMessage } = useIntl();
|
|
9
|
+
const [, editObject] = icons;
|
|
9
10
|
|
|
10
11
|
const usersCountText = formatMessage(
|
|
11
12
|
{
|
|
@@ -19,9 +20,11 @@ const RoleRow = ({ id, name, description, usersCount, icons, rowIndex }) => {
|
|
|
19
20
|
<Tr
|
|
20
21
|
aria-rowindex={rowIndex}
|
|
21
22
|
key={id}
|
|
22
|
-
{...
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
{...(canUpdate
|
|
24
|
+
? onRowClick({
|
|
25
|
+
fn: editObject.onClick,
|
|
26
|
+
})
|
|
27
|
+
: {})}
|
|
25
28
|
>
|
|
26
29
|
<Td maxWidth={pxToRem(130)}>
|
|
27
30
|
<Typography ellipsis textColor="neutral800">
|
|
@@ -58,6 +61,11 @@ RoleRow.propTypes = {
|
|
|
58
61
|
usersCount: PropTypes.number.isRequired,
|
|
59
62
|
icons: PropTypes.array.isRequired,
|
|
60
63
|
rowIndex: PropTypes.number.isRequired,
|
|
64
|
+
canUpdate: PropTypes.bool,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
RoleRow.defaultProps = {
|
|
68
|
+
canUpdate: false,
|
|
61
69
|
};
|
|
62
70
|
|
|
63
71
|
export default RoleRow;
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
useQueryParams,
|
|
10
10
|
useRBAC,
|
|
11
11
|
useFocusWhenNavigate,
|
|
12
|
+
useFilter,
|
|
13
|
+
useCollator,
|
|
12
14
|
} from '@strapi/helper-plugin';
|
|
13
15
|
import { Plus, Trash, Duplicate, Pencil } from '@strapi/icons';
|
|
14
16
|
import {
|
|
@@ -27,7 +29,6 @@ import {
|
|
|
27
29
|
VisuallyHidden,
|
|
28
30
|
} from '@strapi/design-system';
|
|
29
31
|
import get from 'lodash/get';
|
|
30
|
-
import matchSorter from 'match-sorter';
|
|
31
32
|
import { useIntl } from 'react-intl';
|
|
32
33
|
import { useHistory } from 'react-router-dom';
|
|
33
34
|
import { useRolesList } from '../../../../../hooks';
|
|
@@ -38,6 +39,7 @@ import reducer, { initialState } from './reducer';
|
|
|
38
39
|
|
|
39
40
|
const useSortedRoles = () => {
|
|
40
41
|
useFocusWhenNavigate();
|
|
42
|
+
const { locale } = useIntl();
|
|
41
43
|
const {
|
|
42
44
|
isLoading: isLoadingForPermissions,
|
|
43
45
|
allowedActions: { canCreate, canDelete, canRead, canUpdate },
|
|
@@ -46,7 +48,23 @@ const useSortedRoles = () => {
|
|
|
46
48
|
const { getData, roles, isLoading } = useRolesList(false);
|
|
47
49
|
const [{ query }] = useQueryParams();
|
|
48
50
|
const _q = query?._q || '';
|
|
49
|
-
|
|
51
|
+
|
|
52
|
+
const { includes } = useFilter(locale, {
|
|
53
|
+
sensitivity: 'base',
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @type {Intl.Collator}
|
|
58
|
+
*/
|
|
59
|
+
const formatter = useCollator(locale, {
|
|
60
|
+
sensitivity: 'base',
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const sortedRoles = (roles || [])
|
|
64
|
+
.filter((role) => includes(role.name, _q) || includes(role.description, _q))
|
|
65
|
+
.sort(
|
|
66
|
+
(a, b) => formatter.compare(a.name, b.name) || formatter.compare(a.description, b.description)
|
|
67
|
+
);
|
|
50
68
|
|
|
51
69
|
useEffect(() => {
|
|
52
70
|
if (!isLoadingForPermissions && canRead) {
|
|
@@ -356,6 +374,7 @@ const RoleListPage = () => {
|
|
|
356
374
|
usersCount={role.usersCount}
|
|
357
375
|
icons={getIcons(role)}
|
|
358
376
|
rowIndex={index + 2}
|
|
377
|
+
canUpdate={canUpdate}
|
|
359
378
|
/>
|
|
360
379
|
))}
|
|
361
380
|
</Tbody>
|
|
@@ -5,6 +5,7 @@ import { Box, Grid, GridItem, Flex, Typography } from '@strapi/design-system';
|
|
|
5
5
|
import LifeSpanInput from '../../../../../components/Tokens/LifeSpanInput';
|
|
6
6
|
import TokenName from '../../../../../components/Tokens/TokenName';
|
|
7
7
|
import TokenDescription from '../../../../../components/Tokens/TokenDescription';
|
|
8
|
+
import TokenTypeSelect from '../../../../../components/Tokens/TokenTypeSelect';
|
|
8
9
|
|
|
9
10
|
const FormTransferTokenContainer = ({
|
|
10
11
|
errors,
|
|
@@ -16,6 +17,30 @@ const FormTransferTokenContainer = ({
|
|
|
16
17
|
}) => {
|
|
17
18
|
const { formatMessage } = useIntl();
|
|
18
19
|
|
|
20
|
+
const typeOptions = [
|
|
21
|
+
{
|
|
22
|
+
value: 'push',
|
|
23
|
+
label: {
|
|
24
|
+
id: 'Settings.transferTokens.types.push',
|
|
25
|
+
defaultMessage: 'Push',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: 'pull',
|
|
30
|
+
label: {
|
|
31
|
+
id: 'Settings.transferTokens.types.pull',
|
|
32
|
+
defaultMessage: 'Pull',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
value: 'push-pull',
|
|
37
|
+
label: {
|
|
38
|
+
id: 'Settings.transferTokens.types.push-pull',
|
|
39
|
+
defaultMessage: 'Full Access',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
|
|
19
44
|
return (
|
|
20
45
|
<Box
|
|
21
46
|
background="neutral0"
|
|
@@ -59,6 +84,22 @@ const FormTransferTokenContainer = ({
|
|
|
59
84
|
token={transferToken}
|
|
60
85
|
/>
|
|
61
86
|
</GridItem>
|
|
87
|
+
<GridItem key="permissions" col={6} xs={12}>
|
|
88
|
+
<TokenTypeSelect
|
|
89
|
+
name="permissions"
|
|
90
|
+
values={values}
|
|
91
|
+
errors={errors}
|
|
92
|
+
label={{
|
|
93
|
+
id: 'Settings.tokens.form.type',
|
|
94
|
+
defaultMessage: 'Token type',
|
|
95
|
+
}}
|
|
96
|
+
onChange={(value) => {
|
|
97
|
+
onChange({ target: { name: 'permissions', value } });
|
|
98
|
+
}}
|
|
99
|
+
options={typeOptions}
|
|
100
|
+
canEditInputs={canEditInputs}
|
|
101
|
+
/>
|
|
102
|
+
</GridItem>
|
|
62
103
|
</Grid>
|
|
63
104
|
</Flex>
|
|
64
105
|
</Box>
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
useGuidedTour,
|
|
14
14
|
useRBAC,
|
|
15
15
|
useFetchClient,
|
|
16
|
+
useAPIErrorHandler,
|
|
16
17
|
} from '@strapi/helper-plugin';
|
|
17
18
|
import { ContentLayout, Main, Flex } from '@strapi/design-system';
|
|
18
19
|
import { formatAPIErrors } from '../../../../../utils';
|
|
@@ -52,6 +53,8 @@ const TransferTokenCreateView = () => {
|
|
|
52
53
|
|
|
53
54
|
const isCreating = id === 'create';
|
|
54
55
|
|
|
56
|
+
const { formatAPIError } = useAPIErrorHandler();
|
|
57
|
+
|
|
55
58
|
useEffect(() => {
|
|
56
59
|
trackUsageRef.current(isCreating ? 'didAddTokenFromList' : 'didEditTokenFromList', {
|
|
57
60
|
tokenType: TRANSFER_TOKEN_TYPE,
|
|
@@ -73,11 +76,22 @@ const TransferTokenCreateView = () => {
|
|
|
73
76
|
},
|
|
74
77
|
{
|
|
75
78
|
enabled: !isCreating && !transferToken,
|
|
76
|
-
onError() {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
onError(err) {
|
|
80
|
+
if (err.response.data.error.details?.code === 'INVALID_TOKEN_SALT') {
|
|
81
|
+
toggleNotification({
|
|
82
|
+
type: 'warning',
|
|
83
|
+
message: {
|
|
84
|
+
id: 'notification.error.invalid.configuration',
|
|
85
|
+
defaultMessage:
|
|
86
|
+
'You have an invalid configuration, check your server log for more information.',
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
} else {
|
|
90
|
+
toggleNotification({
|
|
91
|
+
type: 'warning',
|
|
92
|
+
message: formatAPIError(err),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
81
95
|
},
|
|
82
96
|
}
|
|
83
97
|
);
|
|
@@ -92,6 +106,8 @@ const TransferTokenCreateView = () => {
|
|
|
92
106
|
? parseInt(body.lifespan, 10)
|
|
93
107
|
: null;
|
|
94
108
|
|
|
109
|
+
const permissions = body.permissions.split('-');
|
|
110
|
+
|
|
95
111
|
try {
|
|
96
112
|
const {
|
|
97
113
|
data: { data: response },
|
|
@@ -99,13 +115,12 @@ const TransferTokenCreateView = () => {
|
|
|
99
115
|
? await post(`/admin/transfer/tokens`, {
|
|
100
116
|
...body,
|
|
101
117
|
lifespan: lifespanVal,
|
|
102
|
-
permissions
|
|
118
|
+
permissions,
|
|
103
119
|
})
|
|
104
120
|
: await put(`/admin/transfer/tokens/${id}`, {
|
|
105
121
|
name: body.name,
|
|
106
122
|
description: body.description,
|
|
107
|
-
|
|
108
|
-
permissions: ['push'],
|
|
123
|
+
permissions,
|
|
109
124
|
});
|
|
110
125
|
|
|
111
126
|
unlockApp();
|
|
@@ -132,7 +147,7 @@ const TransferTokenCreateView = () => {
|
|
|
132
147
|
});
|
|
133
148
|
|
|
134
149
|
trackUsageRef.current(isCreating ? 'didCreateToken' : 'didEditToken', {
|
|
135
|
-
type: transferToken?.
|
|
150
|
+
type: transferToken?.permissions,
|
|
136
151
|
tokenType: TRANSFER_TOKEN_TYPE,
|
|
137
152
|
});
|
|
138
153
|
} catch (err) {
|
|
@@ -144,6 +159,15 @@ const TransferTokenCreateView = () => {
|
|
|
144
159
|
type: 'warning',
|
|
145
160
|
message: err.response.data.message || 'notification.error.tokennamenotunique',
|
|
146
161
|
});
|
|
162
|
+
} else if (err?.response?.data?.error?.details?.code === 'INVALID_TOKEN_SALT') {
|
|
163
|
+
toggleNotification({
|
|
164
|
+
type: 'warning',
|
|
165
|
+
message: {
|
|
166
|
+
id: 'notification.error.invalid.configuration',
|
|
167
|
+
defaultMessage:
|
|
168
|
+
'You have an invalid configuration, check your server log for more information.',
|
|
169
|
+
},
|
|
170
|
+
});
|
|
147
171
|
} else {
|
|
148
172
|
toggleNotification({
|
|
149
173
|
type: 'warning',
|
|
@@ -161,6 +185,24 @@ const TransferTokenCreateView = () => {
|
|
|
161
185
|
return <LoadingView transferTokenName={transferToken?.name} />;
|
|
162
186
|
}
|
|
163
187
|
|
|
188
|
+
const handleErrorRegenerate = (err) => {
|
|
189
|
+
if (err?.response?.data?.error?.details?.code === 'INVALID_TOKEN_SALT') {
|
|
190
|
+
toggleNotification({
|
|
191
|
+
type: 'warning',
|
|
192
|
+
message: {
|
|
193
|
+
id: 'notification.error.invalid.configuration',
|
|
194
|
+
defaultMessage:
|
|
195
|
+
'You have an invalid configuration, check your server log for more information.',
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
} else {
|
|
199
|
+
toggleNotification({
|
|
200
|
+
type: 'warning',
|
|
201
|
+
message: formatAPIError(err),
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
164
206
|
return (
|
|
165
207
|
<Main>
|
|
166
208
|
<SettingsPageTitle name="Transfer Tokens" />
|
|
@@ -173,6 +215,7 @@ const TransferTokenCreateView = () => {
|
|
|
173
215
|
lifespan: transferToken?.lifespan
|
|
174
216
|
? transferToken.lifespan.toString()
|
|
175
217
|
: transferToken?.lifespan,
|
|
218
|
+
permissions: transferToken?.permissions.join('-'),
|
|
176
219
|
}}
|
|
177
220
|
enableReinitialize
|
|
178
221
|
onSubmit={(body, actions) => handleSubmit(body, actions)}
|
|
@@ -192,6 +235,7 @@ const TransferTokenCreateView = () => {
|
|
|
192
235
|
canRegenerate={canRegenerate}
|
|
193
236
|
isSubmitting={isSubmitting}
|
|
194
237
|
regenerateUrl="/admin/transfer/tokens/"
|
|
238
|
+
onErrorRegenerate={handleErrorRegenerate}
|
|
195
239
|
/>
|
|
196
240
|
<ContentLayout>
|
|
197
241
|
<Flex direction="column" alignItems="stretch" gap={6}>
|
|
@@ -5,6 +5,7 @@ const schema = yup.object().shape({
|
|
|
5
5
|
name: yup.string(translatedErrors.string).max(100).required(translatedErrors.required),
|
|
6
6
|
description: yup.string().nullable(),
|
|
7
7
|
lifespan: yup.number().integer().min(0).nullable().defined(translatedErrors.required),
|
|
8
|
+
permissions: yup.string(translatedErrors.string).required(translatedErrors.required),
|
|
8
9
|
});
|
|
9
10
|
|
|
10
11
|
export default schema;
|
|
@@ -77,11 +77,24 @@ const TransferTokenListView = () => {
|
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
enabled: canRead,
|
|
80
|
-
onError() {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
onError(err) {
|
|
81
|
+
console.log('error', err);
|
|
82
|
+
|
|
83
|
+
if (err?.response?.data?.error?.details?.code === 'INVALID_TOKEN_SALT') {
|
|
84
|
+
toggleNotification({
|
|
85
|
+
type: 'warning',
|
|
86
|
+
message: {
|
|
87
|
+
id: 'notification.error.invalid.configuration',
|
|
88
|
+
defaultMessage:
|
|
89
|
+
'You have an invalid configuration, check your server log for more information.',
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
} else {
|
|
93
|
+
toggleNotification({
|
|
94
|
+
type: 'warning',
|
|
95
|
+
message: { id: 'notification.error', defaultMessage: 'An error occured' },
|
|
96
|
+
});
|
|
97
|
+
}
|
|
85
98
|
},
|
|
86
99
|
}
|
|
87
100
|
);
|
|
@@ -101,6 +114,15 @@ const TransferTokenListView = () => {
|
|
|
101
114
|
onError(err) {
|
|
102
115
|
if (err?.response?.data?.data) {
|
|
103
116
|
toggleNotification({ type: 'warning', message: err.response.data.data });
|
|
117
|
+
} else if (err?.response?.data?.error?.details?.code === 'INVALID_TOKEN_SALT') {
|
|
118
|
+
toggleNotification({
|
|
119
|
+
type: 'warning',
|
|
120
|
+
message: {
|
|
121
|
+
id: 'notification.error.invalid.configuration',
|
|
122
|
+
defaultMessage:
|
|
123
|
+
'You have an invalid configuration, check your server log for more information.',
|
|
124
|
+
},
|
|
125
|
+
});
|
|
104
126
|
} else {
|
|
105
127
|
toggleNotification({
|
|
106
128
|
type: 'warning',
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
* EditView
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
6
|
+
import * as React from 'react';
|
|
7
7
|
import {
|
|
8
8
|
LoadingIndicatorPage,
|
|
9
|
-
request,
|
|
10
9
|
SettingsPageTitle,
|
|
11
|
-
to,
|
|
12
10
|
useNotification,
|
|
13
11
|
useOverlayBlocker,
|
|
14
12
|
useFetchClient,
|
|
@@ -30,19 +28,20 @@ const EditView = () => {
|
|
|
30
28
|
const toggleNotification = useNotification();
|
|
31
29
|
const queryClient = useQueryClient();
|
|
32
30
|
const { isLoading: isLoadingForModels, collectionTypes } = useModels();
|
|
33
|
-
const { post } = useFetchClient();
|
|
31
|
+
const { put, get, post } = useFetchClient();
|
|
34
32
|
|
|
35
33
|
const isCreating = id === 'create';
|
|
36
34
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
const { isLoading, data } = useQuery(
|
|
36
|
+
['get-webhook', id],
|
|
37
|
+
async () => {
|
|
38
|
+
try {
|
|
39
|
+
const {
|
|
40
|
+
data: { data },
|
|
41
|
+
} = await get(`/admin/webhooks/${id}`);
|
|
44
42
|
|
|
45
|
-
|
|
43
|
+
return data;
|
|
44
|
+
} catch (err) {
|
|
46
45
|
toggleNotification({
|
|
47
46
|
type: 'warning',
|
|
48
47
|
message: { id: 'notification.error' },
|
|
@@ -50,16 +49,12 @@ const EditView = () => {
|
|
|
50
49
|
|
|
51
50
|
return null;
|
|
52
51
|
}
|
|
53
|
-
|
|
54
|
-
return data;
|
|
55
52
|
},
|
|
56
|
-
|
|
53
|
+
{
|
|
54
|
+
enabled: !isCreating,
|
|
55
|
+
}
|
|
57
56
|
);
|
|
58
57
|
|
|
59
|
-
const { isLoading, data } = useQuery(['get-webhook', id], () => fetchWebhook(id), {
|
|
60
|
-
enabled: !isCreating,
|
|
61
|
-
});
|
|
62
|
-
|
|
63
58
|
const {
|
|
64
59
|
isLoading: isTriggering,
|
|
65
60
|
data: triggerResponse,
|
|
@@ -77,25 +72,15 @@ const EditView = () => {
|
|
|
77
72
|
},
|
|
78
73
|
});
|
|
79
74
|
|
|
80
|
-
const createWebhookMutation = useMutation((body) =>
|
|
81
|
-
request('/admin/webhooks', {
|
|
82
|
-
method: 'POST',
|
|
83
|
-
body,
|
|
84
|
-
})
|
|
85
|
-
);
|
|
75
|
+
const createWebhookMutation = useMutation((body) => post('/admin/webhooks', body));
|
|
86
76
|
|
|
87
|
-
const updateWebhookMutation = useMutation(({ id, body }) =>
|
|
88
|
-
request(`/admin/webhooks/${id}`, {
|
|
89
|
-
method: 'PUT',
|
|
90
|
-
body,
|
|
91
|
-
})
|
|
92
|
-
);
|
|
77
|
+
const updateWebhookMutation = useMutation(({ id, body }) => put(`/admin/webhooks/${id}`, body));
|
|
93
78
|
|
|
94
79
|
const handleSubmit = async (data) => {
|
|
95
80
|
if (isCreating) {
|
|
96
81
|
lockApp();
|
|
97
82
|
createWebhookMutation.mutate(cleanData(data), {
|
|
98
|
-
onSuccess(result) {
|
|
83
|
+
onSuccess({ data: result }) {
|
|
99
84
|
toggleNotification({
|
|
100
85
|
type: 'success',
|
|
101
86
|
message: { id: 'Settings.webhooks.created' },
|
|
@@ -138,7 +123,7 @@ const EditView = () => {
|
|
|
138
123
|
}
|
|
139
124
|
};
|
|
140
125
|
|
|
141
|
-
const isDraftAndPublishEvents = useMemo(
|
|
126
|
+
const isDraftAndPublishEvents = React.useMemo(
|
|
142
127
|
() => collectionTypes.some((ct) => ct.options.draftAndPublish === true),
|
|
143
128
|
[collectionTypes]
|
|
144
129
|
);
|