@strapi/admin 4.12.5 → 4.12.6
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/StrapiApp.js +1 -1
- package/admin/src/components/AuthenticatedApp.js +229 -0
- package/admin/src/components/GuidedTour/Modal/index.js +1 -3
- package/admin/src/content-manager/pages/App/index.js +5 -16
- package/admin/src/content-manager/pages/EditView/Information/index.js +1 -1
- package/admin/src/content-manager/pages/ListView/components/BulkActionButtons/SelectedEntriesModal/index.js +2 -2
- package/admin/src/content-manager/pages/ListView/components/TableRows/index.js +1 -1
- package/admin/src/hooks/useSettingsForm/index.js +14 -3
- package/admin/src/hooks/useSettingsMenu/index.js +2 -2
- package/admin/src/hooks/useSettingsMenu/utils/formatLinks.js +1 -3
- package/admin/src/hooks/useSettingsMenu/utils/sortLinks.js +1 -3
- package/admin/src/index.js +1 -1
- package/admin/src/pages/Admin/Onboarding/index.js +1 -3
- package/admin/src/pages/Admin/index.js +80 -74
- package/admin/src/pages/App/constants.js +1 -1
- package/admin/src/pages/App/index.js +160 -122
- package/admin/src/pages/AuthPage/index.js +2 -4
- package/admin/src/pages/HomePage/index.js +1 -3
- package/admin/src/pages/InstalledPluginsPage/index.js +1 -3
- package/admin/src/pages/{InternalErrorPage/index.js → InternalErrorPage.js} +3 -4
- package/admin/src/pages/{NotFoundPage/index.js → NotFoundPage.js} +1 -3
- package/admin/src/pages/ProfilePage/index.js +2 -4
- package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +3 -3
- package/admin/src/pages/SettingsPage/constants.js +67 -132
- package/admin/src/pages/SettingsPage/index.js +31 -36
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +69 -35
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +2 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/DynamicTable/TableRows/index.js +1 -1
- package/admin/src/pages/UseCasePage.js +174 -0
- package/admin/src/utils/createRoute.js +5 -7
- package/admin/src/utils/formatAPIErrors.js +1 -3
- package/admin/src/utils/getFullName.js +1 -1
- package/admin/src/utils/sortLinks.js +1 -3
- package/admin/src/utils/uniqueAdminHash.js +2 -9
- package/build/{1049.f76cb14b.chunk.js → 1049.9d69d231.chunk.js} +1 -1
- package/build/1504.eff012f7.chunk.js +95 -0
- package/build/2166.c837469a.chunk.js +1 -0
- package/build/2225.33287e1b.chunk.js +79 -0
- package/build/2237.03792b63.chunk.js +114 -0
- package/build/2379.401f56f3.chunk.js +1 -0
- package/build/2395.e6a79fbb.chunk.js +26 -0
- package/build/{9806.5d5a0e8d.chunk.js → 2747.d1442a90.chunk.js} +72 -64
- package/build/2801.31393ffe.chunk.js +1 -0
- package/build/3483.8517171f.chunk.js +1 -0
- package/build/502.8dd074ff.chunk.js +1 -0
- package/build/5483.5bfbb00d.chunk.js +6 -0
- package/build/7464.592a9295.chunk.js +1 -0
- package/build/748.fd2e5afd.chunk.js +105 -0
- package/build/773.6381d62d.chunk.js +18 -0
- package/build/7826.399afe81.chunk.js +103 -0
- package/build/8261.2525d35c.chunk.js +7 -0
- package/build/8276.e519a707.chunk.js +26 -0
- package/build/8299.62b67c72.chunk.js +1 -0
- package/build/Admin-AuthPage.90d64342.chunk.js +35 -0
- package/build/Admin-AuthenticatedApp.379ac945.chunk.js +24 -0
- package/build/Admin-UseCasePage.1f757db5.chunk.js +13 -0
- package/build/Admin_GuidedTourModal.8ccf1fbc.chunk.js +12 -0
- package/build/Admin_InternalErrorPage.9de92c6d.chunk.js +9 -0
- package/build/Admin_NotFoundPage.21620424.chunk.js +9 -0
- package/build/Admin_Onboarding.dbfa32f6.chunk.js +43 -0
- package/build/Admin_homePage.2000cbe9.chunk.js +86 -0
- package/build/Admin_marketplace.ec80e29b.chunk.js +63 -0
- package/build/Admin_pluginsPage.0c6851f8.chunk.js +14 -0
- package/build/Admin_profilePage.78cd8495.chunk.js +21 -0
- package/build/Admin_settingsPage.1760c3ce.chunk.js +119 -0
- package/build/StrapiApp.221fac30.chunk.js +5 -0
- package/build/{admin-edit-roles-page.6d567273.chunk.js → admin-edit-roles-page.24bdf746.chunk.js} +1 -1
- package/build/admin-edit-users.5d10d444.chunk.js +10 -0
- package/build/{admin-users.00e20017.chunk.js → admin-users.2b3e4305.chunk.js} +2 -2
- package/build/{content-manager.b40f79c0.chunk.js → content-manager.fb0833bd.chunk.js} +78 -78
- package/build/{content-type-builder.cd999f6e.chunk.js → content-type-builder.66066281.chunk.js} +18 -18
- package/build/email-settings-page.2f7e35c0.chunk.js +11 -0
- package/build/index.html +1 -1
- package/build/main.ee3c1938.js +2859 -0
- package/build/review-workflows-settings-create-view.d24a32b9.chunk.js +1 -0
- package/build/review-workflows-settings-edit-view.6044b022.chunk.js +1 -0
- package/build/review-workflows-settings-list-view.3f0ef4bc.chunk.js +56 -0
- package/build/runtime~main.397ee447.js +2 -0
- package/build/{sso-settings-page.12b6d8ae.chunk.js → sso-settings-page.4dba0670.chunk.js} +1 -1
- package/build/users-advanced-settings-page.17052d72.chunk.js +9 -0
- package/build/users-email-settings-page.3de8ea50.chunk.js +9 -0
- package/build/users-providers-settings-page.0eaa916d.chunk.js +14 -0
- package/build/users-roles-settings-page.957ad48b.chunk.js +55 -0
- package/build/webhook-edit-page.665210af.chunk.js +33 -0
- package/ee/admin/hooks/useAuthProviders.js +25 -0
- package/ee/admin/hooks/{useLicenseLimitNotification/index.js → useLicenseLimitNotification.js} +2 -4
- package/ee/admin/hooks/{useLicenseLimits/useLicenseLimits.js → useLicenseLimits.js} +4 -1
- package/ee/admin/pages/App/constants.js +6 -5
- package/ee/admin/pages/AuthPage/components/Login/index.js +8 -4
- package/ee/admin/pages/AuthPage/components/Providers/index.js +8 -5
- package/ee/admin/pages/HomePage/index.js +1 -1
- package/ee/admin/pages/SettingsPage/constants.js +27 -42
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/ListView/ListView.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Users/ListPage/CreateAction/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Users/ListPage/index.js +1 -1
- package/package.json +8 -8
- package/admin/src/components/AuthenticatedApp/index.js +0 -118
- package/admin/src/components/AuthenticatedApp/utils/api.js +0 -85
- package/admin/src/components/AuthenticatedApp/utils/checkLatestStrapiVersion.js +0 -11
- package/admin/src/components/PluginsInitializer/index.js +0 -68
- package/admin/src/components/PluginsInitializer/init.js +0 -11
- package/admin/src/components/PluginsInitializer/reducer.js +0 -22
- package/admin/src/layouts/AppLayout/index.js +0 -33
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +0 -23
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/prefixAllUrls.js +0 -17
- package/admin/src/pages/SettingsPage/utils/createSectionsRoutes.js +0 -11
- package/admin/src/pages/SettingsPage/utils/getSectionsToDisplay.js +0 -5
- package/admin/src/pages/SettingsPage/utils/index.js +0 -2
- package/admin/src/pages/UseCasePage/index.js +0 -175
- package/admin/src/utils/checkFormValidity.js +0 -15
- package/admin/src/utils/getAttributesToDisplay.js +0 -19
- package/admin/src/utils/getExistingActions.js +0 -32
- package/admin/src/utils/index.js +0 -9
- package/admin/src/utils/makeUniqueRoutes.js +0 -6
- package/build/1386.879bcd90.chunk.js +0 -7
- package/build/2225.c6244756.chunk.js +0 -79
- package/build/2379.f1641312.chunk.js +0 -1
- package/build/2395.46f8d0c1.chunk.js +0 -26
- package/build/2801.5cef5ec8.chunk.js +0 -1
- package/build/3483.03c24f96.chunk.js +0 -1
- package/build/3739.63e352f1.chunk.js +0 -103
- package/build/3929.5632f24d.chunk.js +0 -114
- package/build/448.829e1344.chunk.js +0 -1
- package/build/502.8ae8ef60.chunk.js +0 -1
- package/build/5483.6dd2e776.chunk.js +0 -6
- package/build/5542.2415a393.chunk.js +0 -63
- package/build/6691.4985ef22.chunk.js +0 -105
- package/build/7464.3e64a1d5.chunk.js +0 -1
- package/build/8276.10a3f883.chunk.js +0 -26
- package/build/9944.7af075a5.chunk.js +0 -26
- package/build/Admin-authenticatedApp.01fc56de.chunk.js +0 -79
- package/build/Admin_InternalErrorPage.f45f2462.chunk.js +0 -1
- package/build/Admin_homePage.ac9dfb86.chunk.js +0 -81
- package/build/Admin_marketplace.c94239f6.chunk.js +0 -55
- package/build/Admin_pluginsPage.bbe79434.chunk.js +0 -6
- package/build/Admin_profilePage.192edc52.chunk.js +0 -13
- package/build/Admin_settingsPage.97cb9d41.chunk.js +0 -111
- package/build/admin-app.91898385.chunk.js +0 -36
- package/build/admin-edit-users.acfd4128.chunk.js +0 -10
- package/build/email-settings-page.d494d1eb.chunk.js +0 -11
- package/build/main.9dbe4579.js +0 -2859
- package/build/review-workflows-settings-create-view.cb08cfa2.chunk.js +0 -1
- package/build/review-workflows-settings-edit-view.3c7cbe63.chunk.js +0 -1
- package/build/review-workflows-settings-list-view.1611dc1f.chunk.js +0 -56
- package/build/runtime~main.46a609e9.js +0 -2
- package/build/users-advanced-settings-page.f0760eb8.chunk.js +0 -9
- package/build/users-email-settings-page.ff4b32f3.chunk.js +0 -9
- package/build/users-providers-settings-page.48de0306.chunk.js +0 -14
- package/build/users-roles-settings-page.9d9a1eff.chunk.js +0 -30
- package/build/webhook-edit-page.6cb479ff.chunk.js +0 -33
- package/ee/admin/hooks/index.js +0 -4
- package/ee/admin/hooks/useAuthProviders/index.js +0 -50
- package/ee/admin/hooks/useAuthProviders/reducer.js +0 -26
- package/ee/admin/hooks/useLicenseLimits/index.js +0 -1
- /package/ee/admin/hooks/{useLicenseLimits/__mocks__/index.js → __mocks__/useLicenseLimits.js} +0 -0
|
@@ -1,167 +1,102 @@
|
|
|
1
|
-
|
|
2
|
-
{
|
|
3
|
-
async Component() {
|
|
4
|
-
const component = await import(
|
|
5
|
-
/* webpackChunkName: "admin-roles-list" */ './pages/Roles/ProtectedListPage'
|
|
6
|
-
);
|
|
1
|
+
import * as React from 'react';
|
|
7
2
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
export const SETTINGS_ROUTES_CE = [
|
|
4
|
+
{
|
|
5
|
+
component: React.lazy(() =>
|
|
6
|
+
import(/* webpackChunkName: "admin-roles-list" */ './pages/Roles/ProtectedListPage')
|
|
7
|
+
),
|
|
8
|
+
path: '/settings/roles',
|
|
12
9
|
},
|
|
13
10
|
{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return component;
|
|
20
|
-
},
|
|
21
|
-
to: '/settings/roles/duplicate/:id',
|
|
22
|
-
exact: true,
|
|
11
|
+
component: React.lazy(() =>
|
|
12
|
+
import(/* webpackChunkName: "admin-edit-roles-page" */ './pages/Roles/CreatePage')
|
|
13
|
+
),
|
|
14
|
+
path: '/settings/roles/duplicate/:id',
|
|
23
15
|
},
|
|
24
16
|
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return component;
|
|
31
|
-
},
|
|
32
|
-
to: '/settings/roles/new',
|
|
33
|
-
exact: true,
|
|
17
|
+
component: React.lazy(() =>
|
|
18
|
+
import(/* webpackChunkName: "admin-edit-roles-page" */ './pages/Roles/CreatePage')
|
|
19
|
+
),
|
|
20
|
+
path: '/settings/roles/new',
|
|
34
21
|
},
|
|
35
22
|
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return component;
|
|
42
|
-
},
|
|
43
|
-
to: '/settings/roles/:id',
|
|
44
|
-
exact: true,
|
|
23
|
+
component: React.lazy(() =>
|
|
24
|
+
import(/* webpackChunkName: "admin-edit-roles-page" */ './pages/Roles/ProtectedEditPage')
|
|
25
|
+
),
|
|
26
|
+
path: '/settings/roles/:id',
|
|
45
27
|
},
|
|
46
28
|
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return component;
|
|
53
|
-
},
|
|
54
|
-
to: '/settings/users',
|
|
55
|
-
exact: true,
|
|
29
|
+
component: React.lazy(() =>
|
|
30
|
+
import(/* webpackChunkName: "admin-users" */ './pages/Users/ProtectedListPage')
|
|
31
|
+
),
|
|
32
|
+
path: '/settings/users',
|
|
56
33
|
},
|
|
57
34
|
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return component;
|
|
64
|
-
},
|
|
65
|
-
to: '/settings/users/:id',
|
|
66
|
-
exact: true,
|
|
35
|
+
component: React.lazy(() =>
|
|
36
|
+
import(/* webpackChunkName: "admin-edit-users" */ './pages/Users/ProtectedEditPage')
|
|
37
|
+
),
|
|
38
|
+
path: '/settings/users/:id',
|
|
67
39
|
},
|
|
68
40
|
{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return component;
|
|
75
|
-
},
|
|
76
|
-
to: '/settings/webhooks/create',
|
|
77
|
-
exact: true,
|
|
41
|
+
component: React.lazy(() =>
|
|
42
|
+
import(/* webpackChunkName: "webhook-edit-page" */ './pages/Webhooks/ProtectedCreateView')
|
|
43
|
+
),
|
|
44
|
+
path: '/settings/webhooks/create',
|
|
78
45
|
},
|
|
79
46
|
{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return component;
|
|
86
|
-
},
|
|
87
|
-
to: '/settings/webhooks/:id',
|
|
88
|
-
exact: true,
|
|
47
|
+
component: React.lazy(() =>
|
|
48
|
+
import(/* webpackChunkName: "webhook-edit-page" */ './pages/Webhooks/ProtectedEditView')
|
|
49
|
+
),
|
|
50
|
+
path: '/settings/webhooks/:id',
|
|
89
51
|
},
|
|
90
52
|
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return component;
|
|
97
|
-
},
|
|
98
|
-
to: '/settings/webhooks',
|
|
99
|
-
exact: true,
|
|
53
|
+
component: React.lazy(() =>
|
|
54
|
+
import(/* webpackChunkName: "webhook-list-page" */ './pages/Webhooks/ProtectedListView')
|
|
55
|
+
),
|
|
56
|
+
path: '/settings/webhooks',
|
|
100
57
|
},
|
|
101
58
|
{
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return component;
|
|
108
|
-
},
|
|
109
|
-
to: '/settings/api-tokens',
|
|
110
|
-
exact: true,
|
|
59
|
+
component: React.lazy(() =>
|
|
60
|
+
import(/* webpackChunkName: "api-tokens-list-page" */ './pages/ApiTokens/ProtectedListView')
|
|
61
|
+
),
|
|
62
|
+
path: '/settings/api-tokens',
|
|
111
63
|
},
|
|
112
64
|
{
|
|
113
|
-
|
|
114
|
-
|
|
65
|
+
component: React.lazy(() =>
|
|
66
|
+
import(
|
|
115
67
|
/* webpackChunkName: "api-tokens-create-page" */ './pages/ApiTokens/ProtectedCreateView'
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
to: '/settings/api-tokens/create',
|
|
121
|
-
exact: true,
|
|
68
|
+
)
|
|
69
|
+
),
|
|
70
|
+
path: '/settings/api-tokens/create',
|
|
122
71
|
},
|
|
123
72
|
{
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return component;
|
|
130
|
-
},
|
|
131
|
-
to: '/settings/api-tokens/:id',
|
|
132
|
-
exact: true,
|
|
73
|
+
component: React.lazy(() =>
|
|
74
|
+
import(/* webpackChunkName: "api-tokens-edit-page" */ './pages/ApiTokens/ProtectedEditView')
|
|
75
|
+
),
|
|
76
|
+
path: '/settings/api-tokens/:id',
|
|
133
77
|
},
|
|
134
78
|
{
|
|
135
|
-
|
|
136
|
-
|
|
79
|
+
component: React.lazy(() =>
|
|
80
|
+
import(
|
|
137
81
|
/* webpackChunkName: "transfer-tokens-create-page" */ './pages/TransferTokens/ProtectedCreateView'
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
},
|
|
142
|
-
to: '/settings/transfer-tokens/create',
|
|
143
|
-
exact: true,
|
|
82
|
+
)
|
|
83
|
+
),
|
|
84
|
+
path: '/settings/transfer-tokens/create',
|
|
144
85
|
},
|
|
145
86
|
{
|
|
146
|
-
|
|
147
|
-
|
|
87
|
+
component: React.lazy(() =>
|
|
88
|
+
import(
|
|
148
89
|
/* webpackChunkName: "transfer-tokens-list-page" */ './pages/TransferTokens/ProtectedListView'
|
|
149
|
-
)
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
to: '/settings/transfer-tokens',
|
|
154
|
-
exact: true,
|
|
90
|
+
)
|
|
91
|
+
),
|
|
92
|
+
path: '/settings/transfer-tokens',
|
|
155
93
|
},
|
|
156
94
|
{
|
|
157
|
-
|
|
158
|
-
|
|
95
|
+
component: React.lazy(() =>
|
|
96
|
+
import(
|
|
159
97
|
/* webpackChunkName: "transfer-tokens-edit-page" */ './pages/TransferTokens/ProtectedEditView'
|
|
160
|
-
)
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
},
|
|
164
|
-
to: '/settings/transfer-tokens/:id',
|
|
165
|
-
exact: true,
|
|
98
|
+
)
|
|
99
|
+
),
|
|
100
|
+
path: '/settings/transfer-tokens/:id',
|
|
166
101
|
},
|
|
167
102
|
];
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
* SettingsPage
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// NOTE TO PLUGINS DEVELOPERS:
|
|
8
|
-
// If you modify this file you also need to update the documentation accordingly
|
|
9
|
-
// Here's the file: strapi/docs/3.0.0-beta.x/plugin-development/frontend-settings-api.md
|
|
10
|
-
// IF THE DOC IS NOT UPDATED THE PULL REQUEST WILL NOT BE MERGED
|
|
11
|
-
|
|
12
|
-
import React, { memo, useMemo } from 'react';
|
|
1
|
+
import * as React from 'react';
|
|
13
2
|
|
|
14
3
|
import { Layout } from '@strapi/design-system';
|
|
15
4
|
import { LoadingIndicatorPage, useStrapiApp } from '@strapi/helper-plugin';
|
|
@@ -19,21 +8,21 @@ import { Redirect, Route, Switch, useParams } from 'react-router-dom';
|
|
|
19
8
|
|
|
20
9
|
import { useSettingsMenu } from '../../hooks';
|
|
21
10
|
import { useEnterprise } from '../../hooks/useEnterprise';
|
|
22
|
-
import { createRoute
|
|
11
|
+
import { createRoute } from '../../utils/createRoute';
|
|
23
12
|
|
|
24
13
|
import SettingsNav from './components/SettingsNav';
|
|
25
|
-
import {
|
|
14
|
+
import { SETTINGS_ROUTES_CE } from './constants';
|
|
26
15
|
import ApplicationInfosPage from './pages/ApplicationInfosPage';
|
|
27
|
-
import { createSectionsRoutes } from './utils';
|
|
28
16
|
|
|
29
|
-
function SettingsPage() {
|
|
17
|
+
export function SettingsPage() {
|
|
30
18
|
const { settingId } = useParams();
|
|
31
19
|
const { settings } = useStrapiApp();
|
|
32
20
|
const { formatMessage } = useIntl();
|
|
33
21
|
const { isLoading, menu } = useSettingsMenu();
|
|
34
22
|
const routes = useEnterprise(
|
|
35
|
-
|
|
36
|
-
async () =>
|
|
23
|
+
SETTINGS_ROUTES_CE,
|
|
24
|
+
async () =>
|
|
25
|
+
(await import('../../../../ee/admin/pages/SettingsPage/constants')).SETTINGS_ROUTES_EE,
|
|
37
26
|
{
|
|
38
27
|
combine(ceRoutes, eeRoutes) {
|
|
39
28
|
return [...ceRoutes, ...eeRoutes];
|
|
@@ -42,14 +31,19 @@ function SettingsPage() {
|
|
|
42
31
|
}
|
|
43
32
|
);
|
|
44
33
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
34
|
+
/**
|
|
35
|
+
* `Component` is an async function, which is passed as property of the
|
|
36
|
+
* addSettingsLink() API during the plugin bootstrap step.
|
|
37
|
+
*
|
|
38
|
+
* Because of that we can't just render <Route component={Component} />,
|
|
39
|
+
* but have to await the function.
|
|
40
|
+
*
|
|
41
|
+
* This isn't a good React pattern and should be reconsidered.
|
|
42
|
+
*/
|
|
51
43
|
|
|
52
|
-
const
|
|
44
|
+
const pluginSettingsRoutes = Object.values(settings).flatMap((section) =>
|
|
45
|
+
section.links.map((link) => createRoute(link.Component, link.to, link.exact || false))
|
|
46
|
+
);
|
|
53
47
|
|
|
54
48
|
// Since the useSettingsMenu hook can make API calls in order to check the links permissions
|
|
55
49
|
// We need to add a loading state to prevent redirecting the user while permissions are being checked
|
|
@@ -61,23 +55,24 @@ function SettingsPage() {
|
|
|
61
55
|
return <Redirect to="/settings/application-infos" />;
|
|
62
56
|
}
|
|
63
57
|
|
|
64
|
-
const settingTitle = formatMessage({
|
|
65
|
-
id: 'global.settings',
|
|
66
|
-
defaultMessage: 'Settings',
|
|
67
|
-
});
|
|
68
|
-
|
|
69
58
|
return (
|
|
70
59
|
<Layout sideNav={<SettingsNav menu={menu} />}>
|
|
71
|
-
<Helmet
|
|
60
|
+
<Helmet
|
|
61
|
+
title={formatMessage({
|
|
62
|
+
id: 'global.settings',
|
|
63
|
+
defaultMessage: 'Settings',
|
|
64
|
+
})}
|
|
65
|
+
/>
|
|
72
66
|
|
|
73
67
|
<Switch>
|
|
74
68
|
<Route path="/settings/application-infos" component={ApplicationInfosPage} exact />
|
|
75
|
-
|
|
76
|
-
{
|
|
69
|
+
|
|
70
|
+
{routes.map(({ path, component }) => (
|
|
71
|
+
<Route key={path} path={path} component={component} exact />
|
|
72
|
+
))}
|
|
73
|
+
|
|
74
|
+
{pluginSettingsRoutes}
|
|
77
75
|
</Switch>
|
|
78
76
|
</Layout>
|
|
79
77
|
);
|
|
80
78
|
}
|
|
81
|
-
|
|
82
|
-
export default memo(SettingsPage);
|
|
83
|
-
export { SettingsPage };
|
|
@@ -19,7 +19,7 @@ import { useSelector } from 'react-redux';
|
|
|
19
19
|
import { useHistory, useRouteMatch } from 'react-router-dom';
|
|
20
20
|
|
|
21
21
|
import { ApiTokenPermissionsContextProvider } from '../../../../../contexts/ApiTokenPermissions';
|
|
22
|
-
import { formatAPIErrors } from '../../../../../utils';
|
|
22
|
+
import { formatAPIErrors } from '../../../../../utils/formatAPIErrors';
|
|
23
23
|
import { selectAdminPermissions } from '../../../../App/selectors';
|
|
24
24
|
import { API_TOKEN_TYPE } from '../../../components/Tokens/constants';
|
|
25
25
|
import FormHead from '../../../components/Tokens/FormHead';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
@@ -14,8 +14,11 @@ import {
|
|
|
14
14
|
Typography,
|
|
15
15
|
} from '@strapi/design-system';
|
|
16
16
|
import {
|
|
17
|
+
prefixFileUrlWithBackendUrl,
|
|
17
18
|
SettingsPageTitle,
|
|
19
|
+
useAPIErrorHandler,
|
|
18
20
|
useAppInfo,
|
|
21
|
+
useFetchClient,
|
|
19
22
|
useFocusWhenNavigate,
|
|
20
23
|
useNotification,
|
|
21
24
|
useRBAC,
|
|
@@ -23,7 +26,7 @@ import {
|
|
|
23
26
|
} from '@strapi/helper-plugin';
|
|
24
27
|
import { Check, ExternalLink } from '@strapi/icons';
|
|
25
28
|
import { useIntl } from 'react-intl';
|
|
26
|
-
import { useMutation, useQuery
|
|
29
|
+
import { useMutation, useQuery } from 'react-query';
|
|
27
30
|
import { useSelector } from 'react-redux';
|
|
28
31
|
|
|
29
32
|
import { useConfigurations } from '../../../../hooks';
|
|
@@ -31,18 +34,20 @@ import { useEnterprise } from '../../../../hooks/useEnterprise';
|
|
|
31
34
|
import { selectAdminPermissions } from '../../../App/selectors';
|
|
32
35
|
|
|
33
36
|
import CustomizationInfos from './components/CustomizationInfos';
|
|
34
|
-
import { fetchProjectSettings, postProjectSettings } from './utils/api';
|
|
35
37
|
import getFormData from './utils/getFormData';
|
|
36
38
|
|
|
37
39
|
const AdminSeatInfoCE = () => null;
|
|
38
40
|
|
|
39
41
|
const ApplicationInfosPage = () => {
|
|
40
|
-
const inputsRef = useRef();
|
|
42
|
+
const inputsRef = React.useRef();
|
|
41
43
|
const toggleNotification = useNotification();
|
|
42
44
|
const { trackUsage } = useTracking();
|
|
43
45
|
const { formatMessage } = useIntl();
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
+
const { get, post } = useFetchClient();
|
|
47
|
+
const { updateProjectSettings } = useConfigurations();
|
|
48
|
+
const permissions = useSelector(selectAdminPermissions);
|
|
49
|
+
const { formatAPIError } = useAPIErrorHandler();
|
|
50
|
+
|
|
46
51
|
const {
|
|
47
52
|
communityEdition,
|
|
48
53
|
latestStrapiReleaseTag,
|
|
@@ -50,8 +55,7 @@ const ApplicationInfosPage = () => {
|
|
|
50
55
|
shouldUpdateStrapi,
|
|
51
56
|
strapiVersion,
|
|
52
57
|
} = useAppInfo();
|
|
53
|
-
|
|
54
|
-
const permissions = useSelector(selectAdminPermissions);
|
|
58
|
+
|
|
55
59
|
const AdminSeatInfo = useEnterprise(
|
|
56
60
|
AdminSeatInfoCE,
|
|
57
61
|
async () =>
|
|
@@ -65,38 +69,68 @@ const ApplicationInfosPage = () => {
|
|
|
65
69
|
const {
|
|
66
70
|
allowedActions: { canRead, canUpdate },
|
|
67
71
|
} = useRBAC(permissions.settings['project-settings']);
|
|
68
|
-
const canSubmit = canRead && canUpdate;
|
|
69
72
|
|
|
70
|
-
|
|
71
|
-
enabled: canRead,
|
|
72
|
-
});
|
|
73
|
+
useFocusWhenNavigate();
|
|
73
74
|
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
const { data, isLoading } = useQuery(
|
|
76
|
+
['project-settings'],
|
|
77
|
+
async () => {
|
|
78
|
+
const { data } = await get('/admin/project-settings');
|
|
79
|
+
|
|
80
|
+
return data;
|
|
78
81
|
},
|
|
79
|
-
|
|
82
|
+
{
|
|
83
|
+
cacheTime: 0,
|
|
84
|
+
enabled: canRead,
|
|
85
|
+
select(data) {
|
|
86
|
+
return {
|
|
87
|
+
...data,
|
|
80
88
|
|
|
81
|
-
|
|
82
|
-
|
|
89
|
+
authLogo: data.authLogo
|
|
90
|
+
? {
|
|
91
|
+
...data.authLogo,
|
|
92
|
+
url: prefixFileUrlWithBackendUrl(data.authLogo.url),
|
|
93
|
+
}
|
|
94
|
+
: data.authLogo,
|
|
83
95
|
|
|
84
|
-
|
|
96
|
+
menuLogo: data.menuLogo
|
|
97
|
+
? {
|
|
98
|
+
...data.menuLogo,
|
|
99
|
+
url: prefixFileUrlWithBackendUrl(data.menuLogo.url),
|
|
100
|
+
}
|
|
101
|
+
: data.menuLogo,
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
);
|
|
85
106
|
|
|
86
|
-
|
|
87
|
-
|
|
107
|
+
const submitMutation = useMutation(
|
|
108
|
+
(body) =>
|
|
109
|
+
post('/admin/project-settings', body, {
|
|
110
|
+
headers: {
|
|
111
|
+
'Content-Type': 'multipart/form-data',
|
|
112
|
+
},
|
|
113
|
+
}),
|
|
114
|
+
{
|
|
115
|
+
onError(error) {
|
|
116
|
+
toggleNotification({
|
|
117
|
+
type: 'warning',
|
|
118
|
+
message: formatAPIError(error),
|
|
119
|
+
});
|
|
120
|
+
},
|
|
88
121
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const { menuLogo, authLogo } = inputValues;
|
|
122
|
+
async onSuccess(data) {
|
|
123
|
+
const { menuLogo, authLogo } = data;
|
|
92
124
|
|
|
93
|
-
|
|
125
|
+
updateProjectSettings({ menuLogo: menuLogo?.url, authLogo: authLogo?.url });
|
|
126
|
+
|
|
127
|
+
if (menuLogo?.rawFile) {
|
|
94
128
|
trackUsage('didChangeLogo', {
|
|
95
129
|
logo: 'menu',
|
|
96
130
|
});
|
|
97
131
|
}
|
|
98
132
|
|
|
99
|
-
if (authLogo
|
|
133
|
+
if (authLogo?.rawFile) {
|
|
100
134
|
trackUsage('didChangeLogo', {
|
|
101
135
|
logo: 'auth',
|
|
102
136
|
});
|
|
@@ -107,13 +141,13 @@ const ApplicationInfosPage = () => {
|
|
|
107
141
|
message: formatMessage({ id: 'app', defaultMessage: 'Saved' }),
|
|
108
142
|
});
|
|
109
143
|
},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
const handleSubmit = (e) => {
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
|
|
150
|
+
submitMutation.mutate(getFormData(inputsRef.current.getValues()));
|
|
117
151
|
};
|
|
118
152
|
|
|
119
153
|
// block rendering until the EE component is fully loaded
|
|
@@ -145,7 +179,7 @@ const ApplicationInfosPage = () => {
|
|
|
145
179
|
defaultMessage: 'Administration panel’s global information',
|
|
146
180
|
})}
|
|
147
181
|
primaryAction={
|
|
148
|
-
|
|
182
|
+
canUpdate && (
|
|
149
183
|
<Button type="submit" startIcon={<Check />}>
|
|
150
184
|
{formatMessage({ id: 'global.save', defaultMessage: 'Save' })}
|
|
151
185
|
</Button>
|
|
@@ -19,7 +19,7 @@ import { useQuery } from 'react-query';
|
|
|
19
19
|
import { useSelector } from 'react-redux';
|
|
20
20
|
import { useHistory, useRouteMatch } from 'react-router-dom';
|
|
21
21
|
|
|
22
|
-
import { formatAPIErrors } from '../../../../../utils';
|
|
22
|
+
import { formatAPIErrors } from '../../../../../utils/formatAPIErrors';
|
|
23
23
|
import { selectAdminPermissions } from '../../../../App/selectors';
|
|
24
24
|
import { TRANSFER_TOKEN_TYPE } from '../../../components/Tokens/constants';
|
|
25
25
|
import FormHead from '../../../components/Tokens/FormHead';
|
|
@@ -34,7 +34,8 @@ import { useHistory, useRouteMatch } from 'react-router-dom';
|
|
|
34
34
|
|
|
35
35
|
import { useAdminUsers } from '../../../../../hooks/useAdminUsers';
|
|
36
36
|
import { useEnterprise } from '../../../../../hooks/useEnterprise';
|
|
37
|
-
import { formatAPIErrors
|
|
37
|
+
import { formatAPIErrors } from '../../../../../utils/formatAPIErrors';
|
|
38
|
+
import { getFullName } from '../../../../../utils/getFullName';
|
|
38
39
|
import { MagicLinkCE } from '../components/MagicLink';
|
|
39
40
|
import SelectRoles from '../components/SelectRoles';
|
|
40
41
|
import { editValidation } from '../utils/validations/users';
|
|
@@ -16,7 +16,7 @@ import PropTypes from 'prop-types';
|
|
|
16
16
|
import { useIntl } from 'react-intl';
|
|
17
17
|
import { useHistory } from 'react-router-dom';
|
|
18
18
|
|
|
19
|
-
import { getFullName } from '../../../../../../../utils';
|
|
19
|
+
import { getFullName } from '../../../../../../../utils/getFullName';
|
|
20
20
|
|
|
21
21
|
const TableRows = ({
|
|
22
22
|
canDelete,
|