@strapi/admin 4.12.6 → 4.13.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/src/StrapiApp.js +1 -1
- package/admin/src/components/AuthenticatedApp/index.js +118 -0
- package/admin/src/components/AuthenticatedApp/utils/api.js +85 -0
- package/admin/src/components/AuthenticatedApp/utils/checkLatestStrapiVersion.js +11 -0
- package/admin/src/components/GuidedTour/Modal/index.js +3 -1
- package/admin/src/components/NpsSurvey/hooks/useNpsSurveySettings.js +17 -0
- package/admin/src/components/NpsSurvey/index.js +365 -0
- package/admin/src/components/PluginsInitializer/index.js +68 -0
- package/admin/src/components/PluginsInitializer/init.js +11 -0
- package/admin/src/components/PluginsInitializer/reducer.js +22 -0
- package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumns.js +2 -0
- package/admin/src/content-manager/components/DynamicZone/components/DynamicZoneLabel.js +1 -1
- package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +8 -1
- package/admin/src/content-manager/components/Filter/CustomInputs/AdminUsersFilter.js +42 -0
- package/admin/src/content-manager/components/Filter/Filter.js +54 -0
- package/admin/src/content-manager/components/Filter/index.js +1 -0
- package/admin/src/content-manager/components/InputUID/index.js +222 -216
- package/admin/src/content-manager/components/RelationInput/RelationInput.js +4 -0
- package/admin/src/content-manager/components/RepeatableComponent/index.js +32 -2
- package/admin/src/content-manager/components/Wysiwyg/Editor.js +432 -68
- package/admin/src/content-manager/components/Wysiwyg/WysiwygStyles.js +0 -7
- package/admin/src/content-manager/components/Wysiwyg/index.js +147 -152
- package/admin/src/content-manager/hooks/useAllowedAttributes.js +47 -0
- package/admin/src/content-manager/pages/App/index.js +16 -5
- package/admin/src/content-manager/pages/EditView/Information/index.js +9 -8
- package/admin/src/content-manager/pages/ListSettingsView/components/Settings.js +40 -7
- package/admin/src/content-manager/pages/ListSettingsView/index.js +6 -2
- package/admin/src/content-manager/pages/ListView/components/BulkActionButtons/SelectedEntriesModal/index.js +2 -2
- package/admin/src/content-manager/pages/ListView/components/FieldPicker/index.js +67 -69
- package/admin/src/content-manager/pages/ListView/components/TableRows/index.js +1 -1
- package/admin/src/content-manager/pages/ListView/components/ViewSettingsMenu/index.js +80 -0
- package/admin/src/content-manager/pages/ListView/index.js +236 -67
- package/admin/src/content-manager/utils/getDisplayName.js +33 -0
- package/admin/src/content-manager/utils/index.js +1 -0
- package/admin/src/hooks/useSettingsForm/index.js +3 -14
- package/admin/src/hooks/useSettingsMenu/index.js +2 -2
- package/admin/src/hooks/useSettingsMenu/utils/formatLinks.js +3 -1
- package/admin/src/hooks/useSettingsMenu/utils/sortLinks.js +3 -1
- package/admin/src/index.js +1 -1
- package/admin/src/layouts/AppLayout/index.js +33 -0
- package/admin/src/pages/Admin/Onboarding/index.js +3 -1
- package/admin/src/pages/Admin/index.js +73 -77
- package/admin/src/pages/App/constants.js +1 -1
- package/admin/src/pages/App/index.js +122 -160
- package/admin/src/pages/AuthPage/components/Register/index.js +5 -0
- package/admin/src/pages/AuthPage/index.js +4 -2
- package/admin/src/pages/HomePage/index.js +3 -1
- package/admin/src/pages/InstalledPluginsPage/index.js +3 -1
- package/admin/src/pages/{InternalErrorPage.js → InternalErrorPage/index.js} +4 -3
- package/admin/src/pages/{NotFoundPage.js → NotFoundPage/index.js} +3 -1
- package/admin/src/pages/ProfilePage/index.js +4 -2
- package/admin/src/pages/SettingsPage/constants.js +132 -67
- package/admin/src/pages/SettingsPage/index.js +18 -23
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +1 -2
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/DynamicTable/TableRows/index.js +1 -1
- package/admin/src/pages/UseCasePage/index.js +175 -0
- package/admin/src/plugins.js +7 -8
- package/admin/src/translations/en.json +10 -1
- package/admin/src/utils/checkFormValidity.js +15 -0
- package/admin/src/utils/createRoute.js +7 -5
- package/admin/src/utils/formatAPIErrors.js +3 -1
- package/admin/src/utils/getAttributesToDisplay.js +19 -0
- package/admin/src/utils/getExistingActions.js +32 -0
- package/admin/src/utils/getFullName.js +1 -1
- package/admin/src/utils/index.js +9 -0
- package/admin/src/utils/makeUniqueRoutes.js +6 -0
- package/admin/src/utils/sortLinks.js +3 -1
- package/admin/src/utils/uniqueAdminHash.js +9 -2
- package/build/{1049.9d69d231.chunk.js → 1049.ec69f5e0.chunk.js} +1 -1
- package/build/1227.9f37e1dc.chunk.js +1 -0
- package/build/1386.ea73b677.chunk.js +7 -0
- package/build/{2225.33287e1b.chunk.js → 2225.649fb7bc.chunk.js} +2 -2
- package/build/{2237.03792b63.chunk.js → 2237.b832ae6e.chunk.js} +4 -4
- package/build/{2379.401f56f3.chunk.js → 2379.1f98a31a.chunk.js} +1 -1
- package/build/{2395.e6a79fbb.chunk.js → 2395.0e5e8ded.chunk.js} +1 -1
- package/build/{2801.31393ffe.chunk.js → 2801.8e1aa82a.chunk.js} +1 -1
- package/build/3483.19381b40.chunk.js +1 -0
- package/build/3739.63e352f1.chunk.js +103 -0
- package/build/4174.f1f39e40.chunk.js +1 -0
- package/build/448.829e1344.chunk.js +1 -0
- package/build/4546.a5946d22.chunk.js +1 -0
- package/build/4724.aea5c8c1.chunk.js +6 -0
- package/build/{502.8dd074ff.chunk.js → 502.7bba43b1.chunk.js} +1 -1
- package/build/6158.c3c13c20.chunk.js +1 -0
- package/build/6691.4985ef22.chunk.js +105 -0
- package/build/{7464.592a9295.chunk.js → 7464.eb057bec.chunk.js} +1 -1
- package/build/78.dcc6df5c.chunk.js +1 -0
- package/build/{8276.e519a707.chunk.js → 8276.be3ed581.chunk.js} +2 -2
- package/build/{2747.d1442a90.chunk.js → 9806.5d5a0e8d.chunk.js} +64 -72
- package/build/9944.7af075a5.chunk.js +26 -0
- package/build/Admin-authenticatedApp.43b6ec9a.chunk.js +79 -0
- package/build/Admin_InternalErrorPage.38155af3.chunk.js +1 -0
- package/build/Admin_homePage.6f128523.chunk.js +81 -0
- package/build/Admin_marketplace.061a6e5a.chunk.js +55 -0
- package/build/Admin_pluginsPage.16f837b8.chunk.js +6 -0
- package/build/Admin_profilePage.678bce24.chunk.js +13 -0
- package/build/Admin_settingsPage.af7309e4.chunk.js +111 -0
- package/build/{Upload_ConfigureTheView.345ac1e0.chunk.js → Upload_ConfigureTheView.3fc1c100.chunk.js} +1 -1
- package/build/admin-app.d63bd229.chunk.js +36 -0
- package/build/{admin-edit-roles-page.24bdf746.chunk.js → admin-edit-roles-page.38a6c863.chunk.js} +3 -3
- package/build/admin-edit-users.545fc882.chunk.js +10 -0
- package/build/{admin-roles-list.23ddff26.chunk.js → admin-roles-list.1e2e814d.chunk.js} +1 -1
- package/build/admin-users.b8ea5677.chunk.js +11 -0
- package/build/{api-tokens-create-page.46c2ea84.chunk.js → api-tokens-create-page.e0c15627.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.58139df9.chunk.js → api-tokens-edit-page.9f2dce47.chunk.js} +1 -1
- package/build/{api-tokens-list-page.0af7d431.chunk.js → api-tokens-list-page.d747051c.chunk.js} +2 -2
- package/build/{audit-logs-settings-page.0f73ccf8.chunk.js → audit-logs-settings-page.96f9d608.chunk.js} +1 -1
- package/build/content-manager.ccff1078.chunk.js +1097 -0
- package/build/{content-type-builder-list-view.bf9be456.chunk.js → content-type-builder-list-view.b71cf240.chunk.js} +1 -1
- package/build/{content-type-builder.66066281.chunk.js → content-type-builder.e5669749.chunk.js} +18 -18
- package/build/{email-settings-page.2f7e35c0.chunk.js → email-settings-page.2809f0bf.chunk.js} +1 -1
- package/build/en-json.e12fd5fc.chunk.js +1 -0
- package/build/{i18n-settings-page.47f78016.chunk.js → i18n-settings-page.5f716172.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/main.c6c9e04c.js +2859 -0
- package/build/{review-workflows-settings-create-view.d24a32b9.chunk.js → review-workflows-settings-create-view.4a156a19.chunk.js} +1 -1
- package/build/{review-workflows-settings-edit-view.6044b022.chunk.js → review-workflows-settings-edit-view.ce984d1f.chunk.js} +1 -1
- package/build/{review-workflows-settings-list-view.3f0ef4bc.chunk.js → review-workflows-settings-list-view.419b8deb.chunk.js} +2 -2
- package/build/runtime~main.dcf1cb45.js +2 -0
- package/build/{sso-settings-page.4dba0670.chunk.js → sso-settings-page.45153df5.chunk.js} +1 -1
- package/build/{transfer-tokens-create-page.1597e6ab.chunk.js → transfer-tokens-create-page.ebba16d8.chunk.js} +1 -1
- package/build/{transfer-tokens-edit-page.8741529f.chunk.js → transfer-tokens-edit-page.d7bb2b3e.chunk.js} +1 -1
- package/build/{transfer-tokens-list-page.d6986b03.chunk.js → transfer-tokens-list-page.cfe1736c.chunk.js} +2 -2
- package/build/{upload-settings.7f93d4c0.chunk.js → upload-settings.cc5ad813.chunk.js} +1 -1
- package/build/{upload.37488080.chunk.js → upload.756efc28.chunk.js} +1 -1
- package/build/{users-advanced-settings-page.17052d72.chunk.js → users-advanced-settings-page.818d84eb.chunk.js} +1 -1
- package/build/{users-email-settings-page.3de8ea50.chunk.js → users-email-settings-page.c1967c09.chunk.js} +1 -1
- package/build/{users-providers-settings-page.0eaa916d.chunk.js → users-providers-settings-page.11893e08.chunk.js} +1 -1
- package/build/{users-roles-settings-page.957ad48b.chunk.js → users-roles-settings-page.2b051e6a.chunk.js} +1 -1
- package/build/webhook-edit-page.de45c635.chunk.js +33 -0
- package/build/{webhook-list-page.65e1b5bb.chunk.js → webhook-list-page.ca91df8b.chunk.js} +1 -1
- package/ee/admin/content-manager/components/Filter/CustomInputs/ReviewWorkflows/AssigneeFilter.js +42 -0
- package/ee/admin/content-manager/components/Filter/CustomInputs/ReviewWorkflows/StageFilter.js +70 -0
- package/ee/admin/content-manager/components/Filter/CustomInputs/ReviewWorkflows/constants.js +71 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +9 -217
- package/ee/admin/content-manager/pages/EditView/InformationBox/components/AssigneeSelect/AssigneeSelect.js +147 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/components/AssigneeSelect/index.js +1 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/components/StageSelect/StageSelect.js +243 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/components/StageSelect/index.js +1 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/constants.js +2 -0
- package/ee/admin/content-manager/pages/ListSettingsView/constants.js +7 -0
- package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/ReviewWorkflowsAssigneeEE.js +21 -0
- package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/constants.js +44 -17
- package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/index.js +1 -0
- package/ee/admin/pages/App/constants.js +5 -6
- package/ee/admin/pages/SettingsPage/constants.js +42 -27
- package/ee/server/constants/workflows.js +1 -0
- package/ee/server/controllers/index.js +1 -0
- package/ee/server/controllers/workflows/assignees/index.js +44 -0
- package/ee/server/routes/review-workflows.js +17 -0
- package/ee/server/services/index.js +1 -0
- package/ee/server/services/review-workflows/assignees.js +54 -0
- package/ee/server/services/review-workflows/metrics/index.js +5 -0
- package/ee/server/services/review-workflows/review-workflows.js +20 -11
- package/ee/server/validation/review-workflows.js +8 -0
- package/index.js +2 -6
- package/package.json +9 -9
- package/scripts/build.js +15 -15
- package/scripts/create-dev-plugins-file.js +5 -38
- package/server/controllers/role.js +2 -0
- package/server/controllers/user.js +2 -0
- package/server/services/permission/permissions-manager/index.js +3 -1
- package/server/services/permission/permissions-manager/sanitize.js +19 -7
- package/server/services/permission/permissions-manager/validate.js +218 -0
- package/utils/create-cache-dir.js +62 -16
- package/utils/create-plugins-exclude-path.js +3 -23
- package/utils/get-plugins.js +110 -0
- package/utils/index.js +1 -1
- package/webpack.config.js +10 -13
- package/admin/src/components/AuthenticatedApp.js +0 -229
- package/admin/src/content-manager/components/AttributeFilter/Filters.js +0 -58
- package/admin/src/content-manager/components/AttributeFilter/hooks/useAllowedAttributes.js +0 -42
- package/admin/src/content-manager/components/AttributeFilter/index.js +0 -40
- package/admin/src/content-manager/components/Wysiwyg/EditorStylesContainer.js +0 -344
- package/admin/src/pages/UseCasePage.js +0 -174
- package/build/2166.c837469a.chunk.js +0 -1
- package/build/3483.8517171f.chunk.js +0 -1
- package/build/3984.dda474f7.chunk.js +0 -1
- package/build/4546.7a3c0d03.chunk.js +0 -1
- package/build/5483.5bfbb00d.chunk.js +0 -6
- package/build/6158.c974fd83.chunk.js +0 -1
- package/build/748.fd2e5afd.chunk.js +0 -105
- package/build/773.6381d62d.chunk.js +0 -18
- package/build/7826.399afe81.chunk.js +0 -103
- package/build/8261.2525d35c.chunk.js +0 -7
- package/build/8299.62b67c72.chunk.js +0 -1
- package/build/Admin-AuthPage.90d64342.chunk.js +0 -35
- package/build/Admin-AuthenticatedApp.379ac945.chunk.js +0 -24
- package/build/Admin-UseCasePage.1f757db5.chunk.js +0 -13
- package/build/Admin_GuidedTourModal.8ccf1fbc.chunk.js +0 -12
- package/build/Admin_InternalErrorPage.9de92c6d.chunk.js +0 -9
- package/build/Admin_NotFoundPage.21620424.chunk.js +0 -9
- package/build/Admin_Onboarding.dbfa32f6.chunk.js +0 -43
- package/build/Admin_homePage.2000cbe9.chunk.js +0 -86
- package/build/Admin_marketplace.ec80e29b.chunk.js +0 -63
- package/build/Admin_pluginsPage.0c6851f8.chunk.js +0 -14
- package/build/Admin_profilePage.78cd8495.chunk.js +0 -21
- package/build/Admin_settingsPage.1760c3ce.chunk.js +0 -119
- package/build/StrapiApp.221fac30.chunk.js +0 -5
- package/build/admin-edit-users.5d10d444.chunk.js +0 -10
- package/build/admin-users.2b3e4305.chunk.js +0 -11
- package/build/content-manager.fb0833bd.chunk.js +0 -1099
- package/build/en-json.08c05fcf.chunk.js +0 -1
- package/build/main.ee3c1938.js +0 -2859
- package/build/runtime~main.397ee447.js +0 -2
- package/build/webhook-edit-page.665210af.chunk.js +0 -33
- package/scripts/create-plugins-file.js +0 -92
- package/utils/get-plugins-path.js +0 -41
- /package/server/services/permission/permissions-manager/{query-builers.js → query-builders.js} +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the display name of an admin panel user
|
|
3
|
+
* @typedef AdminUserNamesAttributes
|
|
4
|
+
* @property {string} firstname
|
|
5
|
+
* @property {string} lastname
|
|
6
|
+
* @property {string} username
|
|
7
|
+
* @property {string} email
|
|
8
|
+
*
|
|
9
|
+
* @type {(user: AdminUserNamesAttributes, formatMessage: import('react-intl').formatMessage) => string}
|
|
10
|
+
*/
|
|
11
|
+
const getDisplayName = ({ firstname, lastname, username, email }, formatMessage) => {
|
|
12
|
+
if (username) {
|
|
13
|
+
return username;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// firstname is not required if the user is created with a username
|
|
17
|
+
if (firstname) {
|
|
18
|
+
return formatMessage(
|
|
19
|
+
{
|
|
20
|
+
id: 'global.fullname',
|
|
21
|
+
defaultMessage: '{firstname} {lastname}',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
firstname,
|
|
25
|
+
lastname,
|
|
26
|
+
}
|
|
27
|
+
).trim();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return email;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { getDisplayName };
|
|
@@ -12,3 +12,4 @@ export { default as mergeMetasWithSchema } from './mergeMetasWithSchema';
|
|
|
12
12
|
export { default as removeKeyInObject } from './removeKeyInObject';
|
|
13
13
|
export { default as removePasswordFieldsFromData } from './removePasswordFieldsFromData';
|
|
14
14
|
export { default as createYupSchema } from './schema';
|
|
15
|
+
export { getDisplayName } from './getDisplayName';
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { useEffect, useReducer } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
getYupInnerErrors,
|
|
5
|
-
useFetchClient,
|
|
6
|
-
useNotification,
|
|
7
|
-
useOverlayBlocker,
|
|
8
|
-
} from '@strapi/helper-plugin';
|
|
3
|
+
import { useFetchClient, useNotification, useOverlayBlocker } from '@strapi/helper-plugin';
|
|
9
4
|
import omit from 'lodash/omit';
|
|
10
5
|
|
|
11
|
-
import { formatAPIErrors } from '../../utils
|
|
6
|
+
import { checkFormValidity, formatAPIErrors } from '../../utils';
|
|
12
7
|
|
|
13
8
|
import init from './init';
|
|
14
9
|
import { initialState, reducer } from './reducer';
|
|
@@ -81,13 +76,7 @@ const useSettingsForm = (endPoint, schema, cbSuccess, fieldsToPick) => {
|
|
|
81
76
|
const handleSubmit = async (e) => {
|
|
82
77
|
e.preventDefault();
|
|
83
78
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
try {
|
|
87
|
-
await schema.validate(modifiedData, { abortEarly: false });
|
|
88
|
-
} catch (err) {
|
|
89
|
-
errors = getYupInnerErrors(err);
|
|
90
|
-
}
|
|
79
|
+
const errors = await checkFormValidity(modifiedData, schema);
|
|
91
80
|
|
|
92
81
|
dispatch({
|
|
93
82
|
type: 'SET_ERRORS',
|
|
@@ -7,8 +7,8 @@ import { selectAdminPermissions } from '../../pages/App/selectors';
|
|
|
7
7
|
import { useEnterprise } from '../useEnterprise';
|
|
8
8
|
|
|
9
9
|
import { LINKS_CE } from './constants';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
10
|
+
import formatLinks from './utils/formatLinks';
|
|
11
|
+
import sortLinks from './utils/sortLinks';
|
|
12
12
|
|
|
13
13
|
const useSettingsMenu = () => {
|
|
14
14
|
const [{ isLoading, menu }, setData] = useState({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const formatLinks = (menu) => {
|
|
2
2
|
return menu.map((menuSection) => {
|
|
3
3
|
const formattedLinks = menuSection.links.map((link) => ({
|
|
4
4
|
...link,
|
|
@@ -8,3 +8,5 @@ export const formatLinks = (menu) => {
|
|
|
8
8
|
return { ...menuSection, links: formattedLinks };
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
|
|
12
|
+
export default formatLinks;
|
package/admin/src/index.js
CHANGED
|
@@ -52,7 +52,7 @@ const run = async () => {
|
|
|
52
52
|
|
|
53
53
|
// We need to make sure to fetch the project type before importing the StrapiApp
|
|
54
54
|
// otherwise the strapi-babel-plugin does not work correctly
|
|
55
|
-
const StrapiApp = await import(/* webpackChunkName: "
|
|
55
|
+
const StrapiApp = await import(/* webpackChunkName: "admin-app" */ './StrapiApp');
|
|
56
56
|
|
|
57
57
|
const app = StrapiApp.default({
|
|
58
58
|
appPlugins: plugins,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Box, Flex, SkipToContent } from '@strapi/design-system';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { useIntl } from 'react-intl';
|
|
6
|
+
import styled from 'styled-components';
|
|
7
|
+
|
|
8
|
+
const FlexBox = styled(Box)`
|
|
9
|
+
flex: 1;
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
const AppLayout = ({ children, sideNav }) => {
|
|
13
|
+
const { formatMessage } = useIntl();
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Box background="neutral100">
|
|
17
|
+
<SkipToContent>
|
|
18
|
+
{formatMessage({ id: 'skipToContent', defaultMessage: 'Skip to content' })}
|
|
19
|
+
</SkipToContent>
|
|
20
|
+
<Flex alignItems="flex-start">
|
|
21
|
+
{sideNav}
|
|
22
|
+
<FlexBox>{children}</FlexBox>
|
|
23
|
+
</Flex>
|
|
24
|
+
</Box>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
AppLayout.propTypes = {
|
|
29
|
+
children: PropTypes.node.isRequired,
|
|
30
|
+
sideNav: PropTypes.node.isRequired,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default AppLayout;
|
|
@@ -75,7 +75,7 @@ const TextLink = styled(TypographyLineHeight)`
|
|
|
75
75
|
}
|
|
76
76
|
`;
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
const Onboarding = () => {
|
|
79
79
|
const triggerRef = useRef();
|
|
80
80
|
const [isOpen, setIsOpen] = useState(false);
|
|
81
81
|
const { formatMessage } = useIntl();
|
|
@@ -222,3 +222,5 @@ export const Onboarding = () => {
|
|
|
222
222
|
</Box>
|
|
223
223
|
);
|
|
224
224
|
};
|
|
225
|
+
|
|
226
|
+
export default Onboarding;
|
|
@@ -4,92 +4,82 @@
|
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import React, { lazy, Suspense, useEffect, useMemo } from 'react';
|
|
8
8
|
|
|
9
|
-
import { Box, Flex } from '@strapi/design-system';
|
|
10
9
|
import { LoadingIndicatorPage, useStrapiApp, useTracking } from '@strapi/helper-plugin';
|
|
11
10
|
import { DndProvider } from 'react-dnd';
|
|
12
11
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
|
13
12
|
import { useDispatch, useSelector } from 'react-redux';
|
|
14
13
|
import { Route, Switch } from 'react-router-dom';
|
|
15
14
|
|
|
15
|
+
import GuidedTourModal from '../../components/GuidedTour/Modal';
|
|
16
16
|
import LeftMenu from '../../components/LeftMenu';
|
|
17
|
-
import useConfigurations from '../../hooks
|
|
18
|
-
import
|
|
19
|
-
import { createRoute } from '../../utils
|
|
17
|
+
import { useConfigurations, useMenu } from '../../hooks';
|
|
18
|
+
import AppLayout from '../../layouts/AppLayout';
|
|
19
|
+
import { createRoute } from '../../utils';
|
|
20
20
|
import { SET_APP_RUNTIME_STATUS } from '../App/constants';
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
)
|
|
26
|
-
);
|
|
27
|
-
const GuidedTourModal = React.lazy(() =>
|
|
28
|
-
import(/* webpackChunkName: "Admin_GuidedTourModal" */ '../../components/GuidedTour/Modal').then(
|
|
29
|
-
(module) => ({ default: module.GuidedTourModal })
|
|
30
|
-
)
|
|
31
|
-
);
|
|
32
|
-
const HomePage = React.lazy(() =>
|
|
33
|
-
import(/* webpackChunkName: "Admin_homePage" */ '../HomePage').then((module) => ({
|
|
34
|
-
default: module.HomePage,
|
|
35
|
-
}))
|
|
22
|
+
import Onboarding from './Onboarding';
|
|
23
|
+
|
|
24
|
+
const CM = lazy(() =>
|
|
25
|
+
import(/* webpackChunkName: "content-manager" */ '../../content-manager/pages/App')
|
|
36
26
|
);
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}))
|
|
27
|
+
const HomePage = lazy(() => import(/* webpackChunkName: "Admin_homePage" */ '../HomePage'));
|
|
28
|
+
const InstalledPluginsPage = lazy(() =>
|
|
29
|
+
import(/* webpackChunkName: "Admin_pluginsPage" */ '../InstalledPluginsPage')
|
|
41
30
|
);
|
|
42
|
-
const MarketplacePage =
|
|
31
|
+
const MarketplacePage = lazy(() =>
|
|
43
32
|
import(/* webpackChunkName: "Admin_marketplace" */ '../MarketplacePage')
|
|
44
33
|
);
|
|
45
|
-
const
|
|
46
|
-
import(/* webpackChunkName: "
|
|
47
|
-
default: module.Onboarding,
|
|
48
|
-
}))
|
|
34
|
+
const NotFoundPage = lazy(() =>
|
|
35
|
+
import(/* webpackChunkName: "Admin_NotFoundPage" */ '../NotFoundPage')
|
|
49
36
|
);
|
|
50
|
-
const
|
|
51
|
-
import(/* webpackChunkName: "
|
|
52
|
-
|
|
53
|
-
|
|
37
|
+
const InternalErrorPage = lazy(() =>
|
|
38
|
+
import(/* webpackChunkName: "Admin_InternalErrorPage" */ '../InternalErrorPage')
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const ProfilePage = lazy(() =>
|
|
42
|
+
import(/* webpackChunkName: "Admin_profilePage" */ '../ProfilePage')
|
|
54
43
|
);
|
|
55
|
-
const SettingsPage =
|
|
44
|
+
const SettingsPage = lazy(() =>
|
|
56
45
|
import(/* webpackChunkName: "Admin_settingsPage" */ '../SettingsPage').then((module) => ({
|
|
57
46
|
default: module.SettingsPage,
|
|
58
47
|
}))
|
|
59
48
|
);
|
|
60
49
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
50
|
+
// Simple hook easier for testing
|
|
51
|
+
/**
|
|
52
|
+
* TODO: remove this, it's bad.
|
|
53
|
+
*/
|
|
54
|
+
const useTrackUsage = () => {
|
|
65
55
|
const { trackUsage } = useTracking();
|
|
66
56
|
const dispatch = useDispatch();
|
|
67
57
|
const appStatus = useSelector((state) => state.admin_app.status);
|
|
68
58
|
|
|
69
|
-
|
|
59
|
+
useEffect(() => {
|
|
70
60
|
// Make sure the event is only send once after accessing the admin panel
|
|
71
61
|
// and not at runtime for example when regenerating the permissions with the ctb
|
|
72
62
|
// or with i18n
|
|
73
63
|
if (appStatus === 'init') {
|
|
74
64
|
trackUsage('didAccessAuthenticatedAdministration');
|
|
65
|
+
|
|
75
66
|
dispatch({ type: SET_APP_RUNTIME_STATUS });
|
|
76
67
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
.filter((link) => link.Component)
|
|
68
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
|
+
}, [appStatus]);
|
|
70
|
+
};
|
|
81
71
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
* but have to await the function.
|
|
88
|
-
*
|
|
89
|
-
* This isn't a good React pattern and should be reconsidered.
|
|
90
|
-
*/
|
|
72
|
+
const Admin = () => {
|
|
73
|
+
useTrackUsage();
|
|
74
|
+
const { isLoading, generalSectionLinks, pluginsSectionLinks } = useMenu();
|
|
75
|
+
const { menu } = useStrapiApp();
|
|
76
|
+
const { showTutorials } = useConfigurations();
|
|
91
77
|
|
|
92
|
-
|
|
78
|
+
const routes = useMemo(() => {
|
|
79
|
+
return menu
|
|
80
|
+
.filter((link) => link.Component)
|
|
81
|
+
.map(({ to, Component, exact }) => createRoute(Component, to, exact));
|
|
82
|
+
}, [menu]);
|
|
93
83
|
|
|
94
84
|
if (isLoading) {
|
|
95
85
|
return <LoadingIndicatorPage />;
|
|
@@ -97,34 +87,40 @@ export const Admin = () => {
|
|
|
97
87
|
|
|
98
88
|
return (
|
|
99
89
|
<DndProvider backend={HTML5Backend}>
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
90
|
+
<AppLayout
|
|
91
|
+
sideNav={
|
|
92
|
+
<LeftMenu
|
|
93
|
+
generalSectionLinks={generalSectionLinks}
|
|
94
|
+
pluginsSectionLinks={pluginsSectionLinks}
|
|
95
|
+
/>
|
|
96
|
+
}
|
|
97
|
+
>
|
|
98
|
+
<Suspense fallback={<LoadingIndicatorPage />}>
|
|
99
|
+
<Switch>
|
|
100
|
+
<Route path="/" component={HomePage} exact />
|
|
101
|
+
<Route path="/me" component={ProfilePage} exact />
|
|
102
|
+
<Route path="/content-manager" component={CM} />
|
|
103
|
+
{routes}
|
|
104
|
+
<Route path="/settings/:settingId" component={SettingsPage} />
|
|
105
|
+
<Route path="/settings" component={SettingsPage} exact />
|
|
106
|
+
<Route path="/marketplace">
|
|
107
|
+
<MarketplacePage />
|
|
108
|
+
</Route>
|
|
109
|
+
<Route path="/list-plugins" exact>
|
|
110
|
+
<InstalledPluginsPage />
|
|
111
|
+
</Route>
|
|
112
|
+
<Route path="/404" component={NotFoundPage} />
|
|
113
|
+
<Route path="/500" component={InternalErrorPage} />
|
|
114
|
+
<Route path="" component={NotFoundPage} />
|
|
115
|
+
</Switch>
|
|
116
|
+
</Suspense>
|
|
124
117
|
<GuidedTourModal />
|
|
125
118
|
|
|
126
119
|
{showTutorials && <Onboarding />}
|
|
127
|
-
</
|
|
120
|
+
</AppLayout>
|
|
128
121
|
</DndProvider>
|
|
129
122
|
);
|
|
130
123
|
};
|
|
124
|
+
|
|
125
|
+
export default Admin;
|
|
126
|
+
export { useTrackUsage };
|