@strapi/admin 4.6.0-beta.2 → 4.6.1
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/components/AuthenticatedApp/utils/api.js +5 -4
- package/admin/src/components/ConfigurationsProvider/index.js +21 -18
- package/admin/src/components/ConfigurationsProvider/reducer.js +1 -0
- package/admin/src/components/LeftMenu/index.js +62 -53
- package/admin/src/components/UnauthenticatedLogo/index.js +1 -1
- package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +20 -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/Hint/index.js +4 -17
- package/admin/src/content-manager/components/InputUID/index.js +7 -18
- package/admin/src/content-manager/components/Inputs/index.js +0 -2
- package/admin/src/content-manager/components/PreviewWysiwyg/Wrapper.js +22 -27
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +35 -14
- package/admin/src/content-manager/components/Wysiwyg/EditorLayout.js +19 -28
- package/admin/src/content-manager/components/Wysiwyg/index.js +4 -8
- 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/LeftMenu/index.js +3 -8
- package/admin/src/content-manager/pages/App/LeftMenu/utils/index.js +1 -0
- package/admin/src/content-manager/pages/App/LeftMenu/utils/matchByTitle.js +24 -0
- 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/EditView/{Informations → Information}/index.js +55 -39
- package/admin/src/content-manager/pages/EditView/{Informations → Information}/utils/getUnits.js +0 -0
- package/admin/src/content-manager/pages/EditView/index.js +3 -3
- 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/store/configureStore.js +22 -4
- 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 +3 -3
- package/admin/src/hooks/useRolesList/index.js +5 -3
- package/admin/src/hooks/useSettingsMenu/init.js +2 -25
- package/admin/src/hooks/useSettingsMenu/utils/adminLinks.js +4 -0
- package/admin/src/hooks/useSettingsMenu/utils/customAdminLinks.js +1 -0
- package/admin/src/hooks/useSettingsMenu/utils/defaultAdminLinks.js +21 -0
- package/admin/src/index.js +5 -4
- package/admin/src/pages/App/index.js +6 -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/index.js +6 -5
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +4 -3
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/CustomizationInfos/index.js +142 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/{Form → CustomizationInfos}/init.js +3 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/{Form → CustomizationInfos}/reducer.js +20 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js +21 -17
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +68 -42
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +9 -3
- 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/components/EventInput/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js +3 -2
- package/admin/src/pages/SettingsPage/utils/defaultRoutes.js +0 -11
- package/admin/src/permissions/defaultPermissions.js +4 -0
- package/admin/src/translations/en.json +29 -21
- 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/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/4318.f96a9d4d.chunk.js +30 -0
- package/build/{3557.e7115160.chunk.js → 4855.bd092921.chunk.js} +131 -91
- package/build/{5015.f5e15fdb.chunk.js → 5015.8e3fe50b.chunk.js} +1 -1
- package/build/8633.00ccd382.chunk.js +1 -0
- package/build/9707.7290fd92.chunk.js +96 -0
- package/build/Admin-authenticatedApp.ce646f66.chunk.js +75 -0
- package/build/Admin_homePage.b1730882.chunk.js +77 -0
- package/build/Admin_marketplace.ea0316c2.chunk.js +26 -0
- package/build/Admin_pluginsPage.5c24f963.chunk.js +6 -0
- package/build/Admin_profilePage.59af1978.chunk.js +15 -0
- package/build/Admin_settingsPage.d1493824.chunk.js +178 -0
- package/build/{Upload_ConfigureTheView.9bdf41b5.chunk.js → Upload_ConfigureTheView.3f2b6e6a.chunk.js} +1 -1
- package/build/admin-app.25934eaa.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.d248362d.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.d6c7487b.chunk.js → api-tokens-edit-page.8516fa20.chunk.js} +1 -1
- package/build/api-tokens-list-page.44a79fda.chunk.js +16 -0
- package/build/audit-logs-settings-page.c3dce30d.chunk.js +1 -0
- package/build/content-manager.35ff9726.chunk.js +1139 -0
- package/build/content-type-builder-list-view.79e84b36.chunk.js +193 -0
- package/build/{content-type-builder-translation-de-json.29df67b8.chunk.js → content-type-builder-translation-de-json.0979cccb.chunk.js} +1 -1
- package/build/{content-type-builder-translation-dk-json.e22d2527.chunk.js → content-type-builder-translation-dk-json.e05583e9.chunk.js} +1 -1
- package/build/content-type-builder-translation-en-json.e577d595.chunk.js +1 -0
- package/build/{content-type-builder-translation-es-json.1044b252.chunk.js → content-type-builder-translation-es-json.fe4daad8.chunk.js} +1 -1
- package/build/{content-type-builder-translation-fr-json.2183e6b3.chunk.js → content-type-builder-translation-fr-json.b1eb52f6.chunk.js} +1 -1
- package/build/{content-type-builder-translation-id-json.ba3e8891.chunk.js → content-type-builder-translation-id-json.ee3b36bb.chunk.js} +1 -1
- package/build/{content-type-builder-translation-it-json.d4661201.chunk.js → content-type-builder-translation-it-json.13b3c26a.chunk.js} +1 -1
- package/build/{content-type-builder-translation-ko-json.57ff7f51.chunk.js → content-type-builder-translation-ko-json.8a274be5.chunk.js} +1 -1
- package/build/{content-type-builder-translation-pl-json.a057b51e.chunk.js → content-type-builder-translation-pl-json.24a34349.chunk.js} +1 -1
- package/build/{content-type-builder-translation-pt-BR-json.446df9da.chunk.js → content-type-builder-translation-pt-BR-json.97f71a9d.chunk.js} +1 -1
- package/build/{content-type-builder-translation-ru-json.8c51843e.chunk.js → content-type-builder-translation-ru-json.54d11230.chunk.js} +1 -1
- package/build/{content-type-builder-translation-sv-json.af6ecca1.chunk.js → content-type-builder-translation-sv-json.59f5e1e5.chunk.js} +1 -1
- package/build/{content-type-builder-translation-tr-json.da83a07e.chunk.js → content-type-builder-translation-tr-json.cea4d226.chunk.js} +1 -1
- package/build/{content-type-builder-translation-zh-json.42f94cb3.chunk.js → content-type-builder-translation-zh-json.faedd610.chunk.js} +1 -1
- package/build/content-type-builder.855db321.chunk.js +126 -0
- package/build/email-settings-page.d1fcc7a3.chunk.js +10 -0
- package/build/en-json.1f137a90.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/{i18n-translation-de-json.dc876c08.chunk.js → i18n-translation-de-json.362384a6.chunk.js} +1 -1
- package/build/{i18n-translation-dk-json.49aaf933.chunk.js → i18n-translation-dk-json.89401417.chunk.js} +1 -1
- package/build/{i18n-translation-en-json.ac9ebc1b.chunk.js → i18n-translation-en-json.60af6722.chunk.js} +1 -1
- package/build/{i18n-translation-es-json.57072ed3.chunk.js → i18n-translation-es-json.87b494d1.chunk.js} +1 -1
- package/build/{i18n-translation-fr-json.84733f34.chunk.js → i18n-translation-fr-json.57ddc77e.chunk.js} +1 -1
- package/build/{i18n-translation-ko-json.fc73fe20.chunk.js → i18n-translation-ko-json.ef4f9471.chunk.js} +1 -1
- package/build/{i18n-translation-pl-json.16e5df90.chunk.js → i18n-translation-pl-json.dfac513d.chunk.js} +1 -1
- package/build/{i18n-translation-tr-json.cb39c048.chunk.js → i18n-translation-tr-json.10f0600d.chunk.js} +1 -1
- package/build/{i18n-translation-zh-Hans-json.2cf82d2d.chunk.js → i18n-translation-zh-Hans-json.757ce62d.chunk.js} +1 -1
- package/build/{i18n-translation-zh-json.ed1d272e.chunk.js → i18n-translation-zh-json.bef2dc07.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/main.7b151630.js +4377 -0
- package/build/ru-json.aa5cd123.chunk.js +1 -0
- package/build/runtime~main.a20d633b.js +2 -0
- package/build/sso-settings-page.b85ad080.chunk.js +41 -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.1134f130.chunk.js +42 -0
- package/ee/admin/hooks/useSettingsMenu/utils/customAdminLinks.js +17 -0
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/ComboboxFilter/index.js +41 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/ActionBody.js +1 -3
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/ActionItem.js +0 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/Modal/index.js +5 -1
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/PaginationFooter/index.js +0 -0
- package/{admin/src → 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/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useFormatTimeStamp.js +0 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/index.js +35 -36
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/utils/getActionTypesDefaultMessages.js +10 -9
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getDisplayedFilters.js +88 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ListView/utils/tableHeaders.js +0 -0
- package/{admin/src → ee/admin}/pages/SettingsPage/pages/AuditLogs/ProtectedListPage/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js +4 -2
- package/ee/admin/pages/SettingsPage/{SingleSignOn → pages/SingleSignOn}/index.js +3 -3
- package/ee/admin/pages/SettingsPage/{SingleSignOn → pages/SingleSignOn}/utils/schema.js +0 -0
- package/ee/admin/pages/SettingsPage/utils/customRoutes.js +28 -16
- package/ee/server/bootstrap.js +2 -0
- package/ee/server/migrations/audit-logs-table.js +45 -0
- package/ee/server/register.js +2 -0
- package/ee/server/routes/index.js +94 -10
- package/ee/server/services/audit-logs.js +30 -2
- package/ee/server/services/passport/sso.js +13 -1
- package/ee/server/services/passport.js +1 -4
- package/package.json +27 -32
- package/server/controllers/admin.js +19 -2
- package/server/register.js +7 -7
- package/server/services/project-settings.js +10 -6
- package/server/services/user.js +3 -1
- package/server/validation/project-settings.js +19 -10
- package/strapi-server.js +1 -1
- 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/store/createReducer.js +0 -5
- package/admin/src/core/utils/axiosInstance.js +0 -38
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/index.js +0 -85
- package/build/2235.746d3cf7.chunk.js +0 -106
- package/build/2598.01c96bd5.chunk.js +0 -159
- package/build/2743.692b1f21.chunk.js +0 -42
- package/build/4318.87affaf2.chunk.js +0 -30
- package/build/4958.1979bbf5.chunk.js +0 -276
- package/build/5052.c2eacff2.chunk.js +0 -65
- package/build/7295.4e2dfbbb.chunk.js +0 -114
- package/build/805.da20168c.chunk.js +0 -138
- package/build/8633.6f546066.chunk.js +0 -1
- package/build/874.be41e4b3.chunk.js +0 -104
- package/build/9707.a07db355.chunk.js +0 -101
- package/build/Admin-authenticatedApp.9933974c.chunk.js +0 -75
- package/build/Admin_homePage.045bb0c8.chunk.js +0 -77
- package/build/Admin_marketplace.bf3ac090.chunk.js +0 -26
- package/build/Admin_pluginsPage.d2a9a619.chunk.js +0 -6
- package/build/Admin_profilePage.5e830ceb.chunk.js +0 -15
- package/build/Admin_settingsPage.53fa00a4.chunk.js +0 -178
- package/build/admin-app.8ed108ca.chunk.js +0 -112
- package/build/admin-audit-logs.68f833bf.chunk.js +0 -1
- package/build/admin-edit-roles-page.32bfe5ea.chunk.js +0 -1
- package/build/admin-edit-users.795f155c.chunk.js +0 -10
- package/build/admin-users.cbd9bcf7.chunk.js +0 -11
- package/build/api-tokens-list-page.a55e427c.chunk.js +0 -16
- 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.ad929a94.chunk.js +0 -1174
- package/build/content-type-builder-list-view.3048854d.chunk.js +0 -198
- package/build/content-type-builder-translation-en-json.08e28f4e.chunk.js +0 -1
- package/build/content-type-builder.4edd1c22.chunk.js +0 -127
- package/build/email-settings-page.7c9e6c5e.chunk.js +0 -15
- package/build/en-json.d65a13ef.chunk.js +0 -1
- package/build/i18n-settings-page.fbccdf12.chunk.js +0 -1
- package/build/main.6bbf9950.js +0 -4417
- package/build/ru-json.3b411a39.chunk.js +0 -1
- package/build/runtime~main.c2bf62af.js +0 -2
- package/build/sso-settings-page.4031de9e.chunk.js +0 -41
- package/build/upload-settings.657790fd.chunk.js +0 -89
- package/build/upload.608a9856.chunk.js +0 -38
- package/build/users-advanced-settings-page.e3ab865f.chunk.js +0 -13
- package/build/users-email-settings-page.57adf9b7.chunk.js +0 -28
- package/build/users-providers-settings-page.7d1fb45c.chunk.js +0 -1
- package/build/users-roles-settings-page.ad28ab42.chunk.js +0 -30
- package/build/webhook-edit-page.1dd6d040.chunk.js +0 -75
- package/build/webhook-list-page.98afa3ea.chunk.js +0 -42
- package/ee/server/routes/features-routes.js +0 -66
|
@@ -9,9 +9,8 @@ const Wrapper = styled.div`
|
|
|
9
9
|
padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};
|
|
10
10
|
font-size: ${14 / 16}rem;
|
|
11
11
|
background-color: ${({ theme }) => theme.colors.neutral0};
|
|
12
|
-
z-index: 2;
|
|
13
|
-
cursor: not-allowed;
|
|
14
12
|
color: ${({ theme }) => theme.colors.neutral800};
|
|
13
|
+
line-height: ${({ theme }) => theme.lineHeights[6]};
|
|
15
14
|
|
|
16
15
|
h1,
|
|
17
16
|
h2,
|
|
@@ -19,12 +18,12 @@ const Wrapper = styled.div`
|
|
|
19
18
|
h4,
|
|
20
19
|
h5,
|
|
21
20
|
h6 {
|
|
22
|
-
margin-block-start:
|
|
23
|
-
margin-block-end:
|
|
21
|
+
margin-block-start: ${({ theme }) => theme.spaces[2]};
|
|
22
|
+
margin-block-end: ${({ theme }) => theme.spaces[2]};
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
p {
|
|
27
|
-
margin-bottom:
|
|
26
|
+
margin-bottom: ${({ theme }) => theme.spaces[2]};
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
h1 {
|
|
@@ -56,13 +55,13 @@ const Wrapper = styled.div`
|
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
blockquote {
|
|
59
|
-
margin-top:
|
|
60
|
-
margin-bottom:
|
|
58
|
+
margin-top: ${({ theme }) => theme.spaces[8]};
|
|
59
|
+
margin-bottom: ${({ theme }) => theme.spaces[7]};
|
|
61
60
|
font-size: ${14 / 16}rem;
|
|
62
61
|
font-weight: 400;
|
|
63
|
-
border-left:
|
|
62
|
+
border-left: 4px solid ${({ theme }) => theme.colors.neutral150};
|
|
64
63
|
font-style: italic;
|
|
65
|
-
padding:
|
|
64
|
+
padding: ${({ theme }) => theme.spaces[2]} ${({ theme }) => theme.spaces[5]};
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
img {
|
|
@@ -91,9 +90,18 @@ const Wrapper = styled.div`
|
|
|
91
90
|
|
|
92
91
|
pre,
|
|
93
92
|
code {
|
|
94
|
-
font-size:
|
|
95
|
-
border-radius:
|
|
96
|
-
|
|
93
|
+
font-size: ${14 / 16}rem;
|
|
94
|
+
border-radius: 4px;
|
|
95
|
+
/*
|
|
96
|
+
Hard coded since the color is the same between themes,
|
|
97
|
+
theme.colors.neutral800 changes between themes.
|
|
98
|
+
|
|
99
|
+
Matches the color of the JSON Input component.
|
|
100
|
+
*/
|
|
101
|
+
background-color: #32324d;
|
|
102
|
+
max-width: 100%;
|
|
103
|
+
overflow: auto;
|
|
104
|
+
padding: ${({ theme }) => theme.spaces[2]};
|
|
97
105
|
}
|
|
98
106
|
|
|
99
107
|
/* Inline code */
|
|
@@ -105,21 +113,6 @@ const Wrapper = styled.div`
|
|
|
105
113
|
}
|
|
106
114
|
}
|
|
107
115
|
|
|
108
|
-
.warning {
|
|
109
|
-
background-color: #faa684;
|
|
110
|
-
padding: 30px;
|
|
111
|
-
border-radius: 3px;
|
|
112
|
-
}
|
|
113
|
-
.tip {
|
|
114
|
-
padding: 30px;
|
|
115
|
-
border-radius: 3px;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.footnote-ref,
|
|
119
|
-
.footnote-backref {
|
|
120
|
-
color: #007bff;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
116
|
ol {
|
|
124
117
|
list-style-type: decimal;
|
|
125
118
|
margin-block-start: ${({ theme }) => theme.spaces[4]};
|
|
@@ -127,6 +120,7 @@ const Wrapper = styled.div`
|
|
|
127
120
|
margin-inline-start: 0px;
|
|
128
121
|
margin-inline-end: 0px;
|
|
129
122
|
padding-inline-start: ${({ theme }) => theme.spaces[4]};
|
|
123
|
+
|
|
130
124
|
ol,
|
|
131
125
|
ul {
|
|
132
126
|
margin-block-start: 0px;
|
|
@@ -141,6 +135,7 @@ const Wrapper = styled.div`
|
|
|
141
135
|
margin-inline-start: 0px;
|
|
142
136
|
margin-inline-end: 0px;
|
|
143
137
|
padding-inline-start: ${({ theme }) => theme.spaces[4]};
|
|
138
|
+
|
|
144
139
|
ul,
|
|
145
140
|
ol {
|
|
146
141
|
margin-block-start: 0px;
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
useQueryParams,
|
|
9
9
|
useNotification,
|
|
10
10
|
useGuidedTour,
|
|
11
|
+
useFetchClient,
|
|
11
12
|
} from '@strapi/helper-plugin';
|
|
12
13
|
import { useSelector, useDispatch } from 'react-redux';
|
|
13
14
|
import PropTypes from 'prop-types';
|
|
14
15
|
import axios from 'axios';
|
|
15
|
-
import { axiosInstance } from '../../../core/utils';
|
|
16
16
|
import { createDefaultForm, getTrad, removePasswordFieldsFromData } from '../../utils';
|
|
17
17
|
import {
|
|
18
18
|
getData,
|
|
@@ -39,6 +39,8 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
39
39
|
const searchToSend = buildQueryString(query);
|
|
40
40
|
const toggleNotification = useNotification();
|
|
41
41
|
const dispatch = useDispatch();
|
|
42
|
+
const fetchClient = useFetchClient();
|
|
43
|
+
const { post, put, del } = fetchClient;
|
|
42
44
|
|
|
43
45
|
const { componentsDataStructure, contentTypeDataStructure, data, isLoading, status } =
|
|
44
46
|
useSelector(selectCrudReducer);
|
|
@@ -103,7 +105,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
103
105
|
setIsCreatingEntry(true);
|
|
104
106
|
|
|
105
107
|
try {
|
|
106
|
-
const { data } = await
|
|
108
|
+
const { data } = await fetchClient.get(getRequestUrl(`${slug}${searchToSend}`), {
|
|
107
109
|
cancelToken: source.token,
|
|
108
110
|
});
|
|
109
111
|
|
|
@@ -136,7 +138,16 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
136
138
|
fetchData(source);
|
|
137
139
|
|
|
138
140
|
return () => source.cancel('Operation canceled by the user.');
|
|
139
|
-
}, [
|
|
141
|
+
}, [
|
|
142
|
+
fetchClient,
|
|
143
|
+
cleanReceivedData,
|
|
144
|
+
push,
|
|
145
|
+
slug,
|
|
146
|
+
dispatch,
|
|
147
|
+
searchToSend,
|
|
148
|
+
rawQuery,
|
|
149
|
+
toggleNotification,
|
|
150
|
+
]);
|
|
140
151
|
|
|
141
152
|
const displayErrors = useCallback(
|
|
142
153
|
(err) => {
|
|
@@ -160,7 +171,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
160
171
|
try {
|
|
161
172
|
trackUsageRef.current('willDeleteEntry', trackerProperty);
|
|
162
173
|
|
|
163
|
-
const { data } = await
|
|
174
|
+
const { data } = await del(getRequestUrl(`${slug}${searchToSend}`));
|
|
164
175
|
|
|
165
176
|
toggleNotification({
|
|
166
177
|
type: 'success',
|
|
@@ -178,7 +189,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
178
189
|
return Promise.reject(err);
|
|
179
190
|
}
|
|
180
191
|
},
|
|
181
|
-
[slug, displayErrors, toggleNotification, searchToSend]
|
|
192
|
+
[del, slug, displayErrors, toggleNotification, searchToSend]
|
|
182
193
|
);
|
|
183
194
|
|
|
184
195
|
const onDeleteSucceeded = useCallback(() => {
|
|
@@ -194,7 +205,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
194
205
|
try {
|
|
195
206
|
dispatch(setStatus('submit-pending'));
|
|
196
207
|
|
|
197
|
-
const { data } = await
|
|
208
|
+
const { data } = await put(endPoint, body);
|
|
198
209
|
|
|
199
210
|
trackUsageRef.current('didCreateEntry', trackerProperty);
|
|
200
211
|
toggleNotification({
|
|
@@ -224,6 +235,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
224
235
|
}
|
|
225
236
|
},
|
|
226
237
|
[
|
|
238
|
+
put,
|
|
227
239
|
cleanReceivedData,
|
|
228
240
|
displayErrors,
|
|
229
241
|
slug,
|
|
@@ -242,7 +254,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
242
254
|
const endPoint = getRequestUrl(`${slug}/actions/numberOfDraftRelations`);
|
|
243
255
|
dispatch(setStatus('draft-relation-check-pending'));
|
|
244
256
|
|
|
245
|
-
const numberOfDraftRelations = await
|
|
257
|
+
const numberOfDraftRelations = await fetchClient.get(endPoint);
|
|
246
258
|
trackUsageRef.current('didCheckDraftRelations');
|
|
247
259
|
|
|
248
260
|
dispatch(setStatus('resolved'));
|
|
@@ -254,7 +266,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
254
266
|
|
|
255
267
|
return Promise.reject(err);
|
|
256
268
|
}
|
|
257
|
-
}, [displayErrors, slug, dispatch]);
|
|
269
|
+
}, [fetchClient, displayErrors, slug, dispatch]);
|
|
258
270
|
|
|
259
271
|
const onPublish = useCallback(async () => {
|
|
260
272
|
try {
|
|
@@ -263,7 +275,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
263
275
|
|
|
264
276
|
dispatch(setStatus('publish-pending'));
|
|
265
277
|
|
|
266
|
-
const { data } = await
|
|
278
|
+
const { data } = await post(endPoint);
|
|
267
279
|
|
|
268
280
|
trackUsageRef.current('didPublishEntry');
|
|
269
281
|
toggleNotification({
|
|
@@ -283,7 +295,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
283
295
|
|
|
284
296
|
return Promise.reject(err);
|
|
285
297
|
}
|
|
286
|
-
}, [cleanReceivedData, displayErrors, slug, searchToSend, dispatch, toggleNotification]);
|
|
298
|
+
}, [post, cleanReceivedData, displayErrors, slug, searchToSend, dispatch, toggleNotification]);
|
|
287
299
|
|
|
288
300
|
const onPut = useCallback(
|
|
289
301
|
async (body, trackerProperty) => {
|
|
@@ -294,7 +306,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
294
306
|
|
|
295
307
|
dispatch(setStatus('submit-pending'));
|
|
296
308
|
|
|
297
|
-
const { data } = await
|
|
309
|
+
const { data } = await put(endPoint, body);
|
|
298
310
|
|
|
299
311
|
toggleNotification({
|
|
300
312
|
type: 'success',
|
|
@@ -321,7 +333,16 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
321
333
|
return Promise.reject(err);
|
|
322
334
|
}
|
|
323
335
|
},
|
|
324
|
-
[
|
|
336
|
+
[
|
|
337
|
+
put,
|
|
338
|
+
cleanReceivedData,
|
|
339
|
+
displayErrors,
|
|
340
|
+
slug,
|
|
341
|
+
dispatch,
|
|
342
|
+
rawQuery,
|
|
343
|
+
toggleNotification,
|
|
344
|
+
queryClient,
|
|
345
|
+
]
|
|
325
346
|
);
|
|
326
347
|
|
|
327
348
|
// The publish and unpublish method could be refactored but let's leave the duplication for now
|
|
@@ -333,7 +354,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
333
354
|
try {
|
|
334
355
|
trackUsageRef.current('willUnpublishEntry');
|
|
335
356
|
|
|
336
|
-
const { data } = await
|
|
357
|
+
const { data } = await post(endPoint);
|
|
337
358
|
|
|
338
359
|
trackUsageRef.current('didUnpublishEntry');
|
|
339
360
|
toggleNotification({
|
|
@@ -348,7 +369,7 @@ const SingleTypeFormWrapper = ({ allLayoutData, children, slug }) => {
|
|
|
348
369
|
dispatch(setStatus('resolved'));
|
|
349
370
|
displayErrors(err);
|
|
350
371
|
}
|
|
351
|
-
}, [cleanReceivedData, toggleNotification, displayErrors, slug, dispatch, searchToSend]);
|
|
372
|
+
}, [post, cleanReceivedData, toggleNotification, displayErrors, slug, dispatch, searchToSend]);
|
|
352
373
|
|
|
353
374
|
return children({
|
|
354
375
|
componentsDataStructure,
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import styled from 'styled-components';
|
|
4
|
-
import { Flex } from '@strapi/design-system
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { BaseButton } from '@strapi/design-system/BaseButton';
|
|
9
|
-
import { Typography } from '@strapi/design-system/Typography';
|
|
10
|
-
import { pxToRem } from '@strapi/helper-plugin';
|
|
11
|
-
import Collapse from '@strapi/icons/Collapse';
|
|
12
|
-
import { useIntl } from 'react-intl';
|
|
5
|
+
import { BaseButton, Box, Flex, FocusTrap, Portal, Typography } from '@strapi/design-system';
|
|
6
|
+
import { Collapse } from '@strapi/icons';
|
|
7
|
+
import { pxToRem, useLockScroll } from '@strapi/helper-plugin';
|
|
8
|
+
|
|
13
9
|
import PreviewWysiwyg from '../PreviewWysiwyg';
|
|
14
10
|
|
|
15
11
|
const setOpacity = (hex, alpha) =>
|
|
@@ -32,6 +28,7 @@ export const ExpandButton = styled(BaseButton)`
|
|
|
32
28
|
|
|
33
29
|
svg {
|
|
34
30
|
margin-left: ${({ theme }) => `${theme.spaces[2]}`};
|
|
31
|
+
|
|
35
32
|
path {
|
|
36
33
|
fill: ${({ theme }) => theme.colors.neutral700};
|
|
37
34
|
width: ${12 / 16}rem;
|
|
@@ -42,19 +39,8 @@ export const ExpandButton = styled(BaseButton)`
|
|
|
42
39
|
|
|
43
40
|
export const EditorLayout = ({ children, isExpandMode, error, previewContent, onCollapse }) => {
|
|
44
41
|
const { formatMessage } = useIntl();
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
const body = document.body;
|
|
47
|
-
|
|
48
|
-
if (isExpandMode) {
|
|
49
|
-
body.classList.add('lock-body-scroll');
|
|
50
|
-
}
|
|
51
42
|
|
|
52
|
-
|
|
53
|
-
if (isExpandMode) {
|
|
54
|
-
body.classList.remove('lock-body-scroll');
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}, [isExpandMode]);
|
|
43
|
+
useLockScroll(isExpandMode);
|
|
58
44
|
|
|
59
45
|
if (isExpandMode) {
|
|
60
46
|
return (
|
|
@@ -71,7 +57,6 @@ export const EditorLayout = ({ children, isExpandMode, error, previewContent, on
|
|
|
71
57
|
onClick={onCollapse}
|
|
72
58
|
>
|
|
73
59
|
<Box
|
|
74
|
-
id="wysiwyg-expand"
|
|
75
60
|
background="neutral0"
|
|
76
61
|
hasRadius
|
|
77
62
|
shadow="popupShadow"
|
|
@@ -84,9 +69,15 @@ export const EditorLayout = ({ children, isExpandMode, error, previewContent, on
|
|
|
84
69
|
<BoxWithBorder flex="1" height="100%">
|
|
85
70
|
{children}
|
|
86
71
|
</BoxWithBorder>
|
|
87
|
-
<
|
|
88
|
-
<Flex
|
|
89
|
-
|
|
72
|
+
<Flex alignItems="start" direction="column" flex={1} height="100%" width="100%">
|
|
73
|
+
<Flex
|
|
74
|
+
height={pxToRem(48)}
|
|
75
|
+
background="neutral100"
|
|
76
|
+
justifyContent="flex-end"
|
|
77
|
+
shrink={0}
|
|
78
|
+
width="100%"
|
|
79
|
+
>
|
|
80
|
+
<ExpandButton onClick={onCollapse}>
|
|
90
81
|
<Typography>
|
|
91
82
|
{formatMessage({
|
|
92
83
|
id: 'components.Wysiwyg.collapse',
|
|
@@ -97,10 +88,10 @@ export const EditorLayout = ({ children, isExpandMode, error, previewContent, on
|
|
|
97
88
|
</ExpandButton>
|
|
98
89
|
</Flex>
|
|
99
90
|
|
|
100
|
-
<Box position="relative" height="100%">
|
|
91
|
+
<Box position="relative" height="100%" width="100%">
|
|
101
92
|
<PreviewWysiwyg data={previewContent} />
|
|
102
93
|
</Box>
|
|
103
|
-
</
|
|
94
|
+
</Flex>
|
|
104
95
|
</Flex>
|
|
105
96
|
</Box>
|
|
106
97
|
</ExpandWrapper>
|
|
@@ -31,7 +31,7 @@ const TypographyAsterisk = styled(Typography)`
|
|
|
31
31
|
`;
|
|
32
32
|
|
|
33
33
|
const Wysiwyg = ({
|
|
34
|
-
|
|
34
|
+
hint,
|
|
35
35
|
disabled,
|
|
36
36
|
error,
|
|
37
37
|
intlLabel,
|
|
@@ -167,7 +167,7 @@ const Wysiwyg = ({
|
|
|
167
167
|
|
|
168
168
|
{!isExpandMode && <WysiwygFooter onToggleExpand={handleToggleExpand} />}
|
|
169
169
|
</EditorLayout>
|
|
170
|
-
<Hint
|
|
170
|
+
<Hint hint={hint} name={name} error={error} />
|
|
171
171
|
</Stack>
|
|
172
172
|
|
|
173
173
|
{error && (
|
|
@@ -186,21 +186,17 @@ const Wysiwyg = ({
|
|
|
186
186
|
};
|
|
187
187
|
|
|
188
188
|
Wysiwyg.defaultProps = {
|
|
189
|
-
description: null,
|
|
190
189
|
disabled: false,
|
|
191
190
|
error: '',
|
|
192
191
|
labelAction: undefined,
|
|
193
192
|
placeholder: null,
|
|
194
193
|
required: false,
|
|
195
194
|
value: '',
|
|
195
|
+
hint: '',
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
Wysiwyg.propTypes = {
|
|
199
|
-
|
|
200
|
-
id: PropTypes.string.isRequired,
|
|
201
|
-
defaultMessage: PropTypes.string.isRequired,
|
|
202
|
-
values: PropTypes.object,
|
|
203
|
-
}),
|
|
199
|
+
hint: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
204
200
|
disabled: PropTypes.bool,
|
|
205
201
|
error: PropTypes.string,
|
|
206
202
|
intlLabel: PropTypes.shape({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useReducer, useRef } from 'react';
|
|
2
2
|
import { useSelector, shallowEqual } from 'react-redux';
|
|
3
3
|
import axios from 'axios';
|
|
4
|
-
import {
|
|
4
|
+
import { useFetchClient } from '@strapi/helper-plugin';
|
|
5
5
|
import formatLayouts from './utils/formatLayouts';
|
|
6
6
|
import reducer, { initialState } from './reducer';
|
|
7
7
|
import { makeSelectModelAndComponentSchemas } from '../../pages/App/selectors';
|
|
@@ -12,6 +12,7 @@ const useFetchContentTypeLayout = (contentTypeUID) => {
|
|
|
12
12
|
const schemasSelector = useMemo(makeSelectModelAndComponentSchemas, []);
|
|
13
13
|
const { schemas } = useSelector((state) => schemasSelector(state), shallowEqual);
|
|
14
14
|
const isMounted = useRef(true);
|
|
15
|
+
const { get } = useFetchClient();
|
|
15
16
|
|
|
16
17
|
const getData = useCallback(
|
|
17
18
|
async (uid, source) => {
|
|
@@ -27,7 +28,7 @@ const useFetchContentTypeLayout = (contentTypeUID) => {
|
|
|
27
28
|
|
|
28
29
|
const {
|
|
29
30
|
data: { data },
|
|
30
|
-
} = await
|
|
31
|
+
} = await get(endPoint, { cancelToken: source.token });
|
|
31
32
|
|
|
32
33
|
dispatch({
|
|
33
34
|
type: 'GET_DATA_SUCCEEDED',
|
|
@@ -47,7 +48,7 @@ const useFetchContentTypeLayout = (contentTypeUID) => {
|
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
},
|
|
50
|
-
[layouts, schemas]
|
|
51
|
+
[layouts, schemas, get]
|
|
51
52
|
);
|
|
52
53
|
|
|
53
54
|
useEffect(() => {
|
|
@@ -11,13 +11,12 @@ const componentStore = new Map();
|
|
|
11
11
|
*/
|
|
12
12
|
const useLazyComponents = (componentUids = []) => {
|
|
13
13
|
const [lazyComponentStore, setLazyComponentStore] = useState(Object.fromEntries(componentStore));
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
14
|
+
/**
|
|
15
|
+
* Start loading only if there are any components passed in
|
|
16
|
+
* and there are some new to load
|
|
17
|
+
*/
|
|
18
|
+
const newUids = componentUids.filter((uid) => !componentStore.get(uid));
|
|
19
|
+
const [loading, setLoading] = useState(() => !!newUids.length);
|
|
21
20
|
const customFieldsRegistry = useCustomFields();
|
|
22
21
|
|
|
23
22
|
useEffect(() => {
|
|
@@ -36,11 +35,8 @@ const useLazyComponents = (componentUids = []) => {
|
|
|
36
35
|
setStore(Object.fromEntries(componentStore));
|
|
37
36
|
};
|
|
38
37
|
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
* These uids are not in the component store therefore we need to get the components
|
|
42
|
-
*/
|
|
43
|
-
const newUids = componentUids.filter((uid) => !componentStore.get(uid));
|
|
38
|
+
if (newUids.length > 0) {
|
|
39
|
+
setLoading(true);
|
|
44
40
|
|
|
45
41
|
const componentPromises = newUids.map((uid) => {
|
|
46
42
|
const customField = customFieldsRegistry.get(uid);
|
|
@@ -52,7 +48,7 @@ const useLazyComponents = (componentUids = []) => {
|
|
|
52
48
|
lazyLoadComponents(newUids, componentPromises);
|
|
53
49
|
}
|
|
54
50
|
}
|
|
55
|
-
}, [
|
|
51
|
+
}, [newUids, customFieldsRegistry]);
|
|
56
52
|
|
|
57
53
|
/**
|
|
58
54
|
* Wrap this in a callback so it can be used in
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react';
|
|
2
2
|
import { useInfiniteQuery } from 'react-query';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { useFetchClient } from '@strapi/helper-plugin';
|
|
5
5
|
|
|
6
6
|
import { normalizeRelations } from '../../components/RelationInputDataManager/utils';
|
|
7
7
|
|
|
@@ -10,13 +10,13 @@ import { useCallbackRef } from '../useCallbackRef';
|
|
|
10
10
|
export const useRelation = (cacheKey, { relation, search }) => {
|
|
11
11
|
const [searchParams, setSearchParams] = useState({});
|
|
12
12
|
const [currentPage, setCurrentPage] = useState(0);
|
|
13
|
-
|
|
13
|
+
const { get } = useFetchClient();
|
|
14
14
|
/**
|
|
15
15
|
* This runs in `useInfiniteQuery` to actually fetch the data
|
|
16
16
|
*/
|
|
17
17
|
const fetchRelations = async ({ pageParam = 1 }) => {
|
|
18
18
|
try {
|
|
19
|
-
const { data } = await
|
|
19
|
+
const { data } = await get(relation?.endpoint, {
|
|
20
20
|
params: {
|
|
21
21
|
...(relation.pageParams ?? {}),
|
|
22
22
|
page: pageParam,
|
|
@@ -33,7 +33,7 @@ export const useRelation = (cacheKey, { relation, search }) => {
|
|
|
33
33
|
|
|
34
34
|
const fetchSearch = async ({ pageParam = 1 }) => {
|
|
35
35
|
try {
|
|
36
|
-
const { data } = await
|
|
36
|
+
const { data } = await get(search.endpoint, {
|
|
37
37
|
params: {
|
|
38
38
|
...(search.pageParams ?? {}),
|
|
39
39
|
...searchParams,
|
|
@@ -7,10 +7,8 @@
|
|
|
7
7
|
import React, { useMemo, useState } from 'react';
|
|
8
8
|
import { useSelector, shallowEqual } from 'react-redux';
|
|
9
9
|
import { useIntl } from 'react-intl';
|
|
10
|
-
import matchSorter from 'match-sorter';
|
|
11
|
-
import sortBy from 'lodash/sortBy';
|
|
12
|
-
import toLower from 'lodash/toLower';
|
|
13
10
|
import { NavLink } from 'react-router-dom';
|
|
11
|
+
|
|
14
12
|
import {
|
|
15
13
|
SubNav,
|
|
16
14
|
SubNavHeader,
|
|
@@ -18,14 +16,11 @@ import {
|
|
|
18
16
|
SubNavSections,
|
|
19
17
|
SubNavLink,
|
|
20
18
|
} from '@strapi/design-system/v2/SubNav';
|
|
19
|
+
|
|
20
|
+
import { matchByTitle } from './utils';
|
|
21
21
|
import getTrad from '../../../utils/getTrad';
|
|
22
22
|
import { makeSelectModelLinks } from '../selectors';
|
|
23
23
|
|
|
24
|
-
const matchByTitle = (links, search) =>
|
|
25
|
-
search
|
|
26
|
-
? matchSorter(links, toLower(search), { keys: [(item) => toLower(item.title)] })
|
|
27
|
-
: sortBy(links, (object) => object.title.toLowerCase());
|
|
28
|
-
|
|
29
24
|
const LeftMenu = () => {
|
|
30
25
|
const [search, setSearch] = useState('');
|
|
31
26
|
const { formatMessage } = useIntl();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as matchByTitle } from './matchByTitle';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import matchSorter from 'match-sorter';
|
|
2
|
+
import camelCase from 'lodash/camelCase';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @type {(links: array, search? : string) => array }
|
|
6
|
+
*/
|
|
7
|
+
const matchByTitle = (links, search) =>
|
|
8
|
+
search
|
|
9
|
+
? matchSorter(links, search.toLowerCase(), { keys: [(item) => item.title.toLowerCase()] })
|
|
10
|
+
: links.sort((link, nextLink) => {
|
|
11
|
+
const title = camelCase(link.title);
|
|
12
|
+
const nextTitle = camelCase(nextLink.title);
|
|
13
|
+
|
|
14
|
+
if (title < nextTitle) {
|
|
15
|
+
return -1;
|
|
16
|
+
}
|
|
17
|
+
if (title > nextTitle) {
|
|
18
|
+
return 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return 0;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export default matchByTitle;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
useNotification,
|
|
3
|
+
useRBACProvider,
|
|
4
|
+
useStrapiApp,
|
|
5
|
+
useFetchClient,
|
|
6
|
+
} from '@strapi/helper-plugin';
|
|
2
7
|
import { useEffect, useRef } from 'react';
|
|
3
8
|
import { useDispatch, useSelector } from 'react-redux';
|
|
4
9
|
import { useNotifyAT } from '@strapi/design-system/LiveRegions';
|
|
5
10
|
import axios from 'axios';
|
|
6
11
|
import { useIntl } from 'react-intl';
|
|
7
|
-
import { axiosInstance } from '../../../core/utils';
|
|
8
12
|
import { MUTATE_COLLECTION_TYPES_LINKS, MUTATE_SINGLE_TYPES_LINKS } from '../../../exposedHooks';
|
|
9
13
|
import { getRequestUrl, getTrad } from '../../utils';
|
|
10
14
|
import { getData, resetProps, setContentTypeLinks } from './actions';
|
|
@@ -22,6 +26,7 @@ const useModels = () => {
|
|
|
22
26
|
const source = CancelToken.source();
|
|
23
27
|
const { notifyStatus } = useNotifyAT();
|
|
24
28
|
const { formatMessage } = useIntl();
|
|
29
|
+
const { get } = useFetchClient();
|
|
25
30
|
|
|
26
31
|
const fetchData = async () => {
|
|
27
32
|
dispatch(getData());
|
|
@@ -36,7 +41,7 @@ const useModels = () => {
|
|
|
36
41
|
},
|
|
37
42
|
] = await Promise.all(
|
|
38
43
|
['components', 'content-types'].map((endPoint) =>
|
|
39
|
-
|
|
44
|
+
get(getRequestUrl(endPoint), { cancelToken: source.token })
|
|
40
45
|
)
|
|
41
46
|
);
|
|
42
47
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getFetchClient } from '@strapi/helper-plugin';
|
|
2
2
|
import generateModelsLinks from './generateModelsLinks';
|
|
3
3
|
import checkPermissions from './checkPermissions';
|
|
4
4
|
import { getRequestUrl } from '../../../utils';
|
|
5
5
|
|
|
6
6
|
const getContentTypeLinks = async (models, userPermissions, toggleNotification) => {
|
|
7
|
+
const { get } = getFetchClient();
|
|
7
8
|
try {
|
|
8
9
|
const {
|
|
9
10
|
data: { data: contentTypeConfigurations },
|
|
10
|
-
} = await
|
|
11
|
+
} = await get(getRequestUrl('content-types-settings'));
|
|
11
12
|
|
|
12
13
|
const { collectionTypesSectionLinks, singleTypesSectionLinks } = generateModelsLinks(
|
|
13
14
|
models,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { memo, useEffect, useMemo, useReducer } from 'react';
|
|
2
2
|
import { useParams } from 'react-router-dom';
|
|
3
|
-
import { CheckPagePermissions, LoadingIndicatorPage } from '@strapi/helper-plugin';
|
|
3
|
+
import { CheckPagePermissions, LoadingIndicatorPage, useFetchClient } from '@strapi/helper-plugin';
|
|
4
4
|
import { useSelector, shallowEqual } from 'react-redux';
|
|
5
5
|
import axios from 'axios';
|
|
6
|
-
import { axiosInstance } from '../../../core/utils';
|
|
7
6
|
import { getRequestUrl, mergeMetasWithSchema } from '../../utils';
|
|
8
7
|
import { makeSelectModelAndComponentSchemas } from '../App/selectors';
|
|
9
8
|
import permissions from '../../../permissions';
|
|
@@ -18,6 +17,7 @@ const ComponentSettingsView = () => {
|
|
|
18
17
|
const schemasSelector = useMemo(makeSelectModelAndComponentSchemas, []);
|
|
19
18
|
const { schemas } = useSelector((state) => schemasSelector(state), shallowEqual);
|
|
20
19
|
const { uid } = useParams();
|
|
20
|
+
const { get } = useFetchClient();
|
|
21
21
|
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
const CancelToken = axios.CancelToken;
|
|
@@ -29,7 +29,7 @@ const ComponentSettingsView = () => {
|
|
|
29
29
|
|
|
30
30
|
const {
|
|
31
31
|
data: { data },
|
|
32
|
-
} = await
|
|
32
|
+
} = await get(getRequestUrl(`components/${uid}/configuration`), {
|
|
33
33
|
cancelToken: source.token,
|
|
34
34
|
});
|
|
35
35
|
|
|
@@ -48,7 +48,7 @@ const ComponentSettingsView = () => {
|
|
|
48
48
|
return () => {
|
|
49
49
|
source.cancel('Operation canceled by the user.');
|
|
50
50
|
};
|
|
51
|
-
}, [uid, schemas]);
|
|
51
|
+
}, [uid, schemas, get]);
|
|
52
52
|
|
|
53
53
|
if (isLoading) {
|
|
54
54
|
return <LoadingIndicatorPage />;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getFetchClient } from '@strapi/helper-plugin';
|
|
2
2
|
import { getRequestUrl } from '../../../utils';
|
|
3
3
|
|
|
4
4
|
const putCMSettingsEV = (body, slug, isContentTypeView) => {
|
|
5
|
-
|
|
5
|
+
const { put } = getFetchClient();
|
|
6
|
+
|
|
7
|
+
return put(
|
|
6
8
|
getRequestUrl(
|
|
7
9
|
isContentTypeView ? `content-types/${slug}/configuration` : `components/${slug}/configuration`
|
|
8
10
|
),
|