@strapi/admin 4.1.10-beta.0 → 4.1.12
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/assets/images/homepage-logo.png +0 -0
- package/admin/src/components/AutoReloadOverlayBlockerProvider/Blocker.js +2 -6
- package/admin/src/components/GuidedTour/Homepage/index.js +1 -2
- package/admin/src/components/GuidedTour/Modal/components/Stepper.js +1 -2
- package/admin/src/components/LeftMenu/index.js +9 -9
- package/admin/src/components/Notifications/Notification/index.js +2 -2
- package/admin/src/components/Providers/index.js +4 -8
- package/admin/src/components/UnauthenticatedLogo/index.js +2 -4
- package/admin/src/components/UpgradePlanModal/index.js +6 -2
- package/admin/src/content-manager/components/DynamicZone/components/ComponentPicker/Category/ComponentCard/index.js +1 -1
- package/admin/src/content-manager/components/SelectMany/ListItem.js +1 -2
- package/admin/src/content-manager/components/SelectWrapper/index.js +8 -7
- package/admin/src/content-manager/components/SelectWrapper/utils/getSelectStyles.js +1 -1
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +2 -2
- package/admin/src/content-manager/components/Wysiwyg/Editor.js +2 -0
- package/admin/src/content-manager/pages/App/LeftMenu/index.js +8 -7
- package/admin/src/content-manager/pages/EditSettingsView/components/ComponentFieldList.js +1 -1
- package/admin/src/content-manager/pages/EditSettingsView/components/LinkToCTB.js +1 -2
- package/admin/src/content-manager/pages/EditSettingsView/index.js +1 -2
- package/admin/src/content-manager/pages/EditView/Header/index.js +3 -3
- package/admin/src/content-manager/pages/EditView/index.js +1 -4
- package/admin/src/content-manager/pages/ListSettingsView/index.js +1 -2
- package/admin/src/content-manager/pages/ListView/index.js +1 -1
- package/admin/src/content-manager/pages/NoContentType/index.js +1 -2
- package/admin/src/pages/App/index.js +2 -7
- package/admin/src/pages/AuthPage/components/ForgotPassword/index.js +1 -2
- package/admin/src/pages/AuthPage/components/ForgotPasswordSuccess/index.js +1 -1
- package/admin/src/pages/AuthPage/components/Login/BaseLogin.js +1 -2
- package/admin/src/pages/AuthPage/components/Oops/index.js +1 -2
- package/admin/src/pages/AuthPage/components/Register/index.js +12 -12
- package/admin/src/pages/AuthPage/components/ResetPassword/index.js +3 -4
- package/admin/src/pages/HomePage/ContentBlocks.js +15 -2
- package/admin/src/pages/HomePage/HomeHeader.js +2 -2
- package/admin/src/pages/HomePage/SocialLinks.js +4 -3
- package/admin/src/pages/InternalErrorPage/index.js +1 -2
- package/admin/src/pages/MarketplacePage/components/PageHeader/index.js +2 -1
- package/admin/src/pages/MarketplacePage/components/PluginCard/index.js +4 -3
- package/admin/src/pages/NotFoundPage/index.js +1 -2
- package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +5 -4
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/UpdateButton/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +94 -150
- package/admin/src/pages/SettingsPage/pages/Roles/EditPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js +1 -2
- package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +1 -1
- package/admin/src/translations/ca.json +699 -0
- package/admin/src/translations/en.json +0 -25
- package/admin/src/translations/languageNativeNames.js +1 -0
- package/admin/src/translations/ru.json +34 -0
- package/build/1856.6a94980b.chunk.js +172 -0
- package/build/2077.5456ccd1.chunk.js +194 -0
- package/build/2758.9475712b.chunk.js +162 -0
- package/build/2912.dd031292.chunk.js +253 -0
- package/build/4715.4588fdf5.chunk.js +385 -0
- package/build/4982.c57c5675.chunk.js +308 -0
- package/build/6706.7f57cb76.chunk.js +113 -0
- package/build/7589.577cf729.chunk.js +194 -0
- package/build/{5289.0341db2d.chunk.js → 7757.f6eb5e92.chunk.js} +89 -87
- package/build/7841.9e9cf739.chunk.js +253 -0
- package/build/8681.aec05472.chunk.js +163 -0
- package/build/9066.2847fdff.chunk.js +101 -0
- package/build/9115.abdf4e3b.chunk.js +1 -0
- package/build/9158.e48d88af.chunk.js +503 -0
- package/build/{9298.f97fcef0.chunk.js → 9298.cb3b6bc1.chunk.js} +93 -93
- package/build/9420.ba035f29.chunk.js +508 -0
- package/build/Admin-authenticatedApp.98b6e05b.chunk.js +80 -0
- package/build/Admin_homePage.8c00145e.chunk.js +71 -0
- package/build/Admin_marketplace.25133b64.chunk.js +11 -0
- package/build/Admin_settingsPage.e1dfbb1d.chunk.js +172 -0
- package/build/admin-edit-roles-page.e77a2acc.chunk.js +1 -0
- package/build/admin-edit-users.4c49fe98.chunk.js +11 -0
- package/build/api-tokens-create-page.618b3e40.chunk.js +1 -0
- package/build/api-tokens-edit-page.8d19dfe1.chunk.js +1 -0
- package/build/api-tokens-list-page.274e1c80.chunk.js +15 -0
- package/build/ca-json.0097e443.chunk.js +1 -0
- package/build/content-manager.04b93497.chunk.js +1204 -0
- package/build/content-type-builder.b3139cb1.chunk.js +141 -0
- package/build/email-settings-page.4ae595f6.chunk.js +103 -0
- package/build/en-json.3e1a222e.chunk.js +1 -0
- package/build/fb376b132d18bf4522ca.png +0 -0
- package/build/i18n-settings-page.bdac3c7b.chunk.js +101 -0
- package/build/index.html +1 -1
- package/build/main.baf8a3fd.js +8404 -0
- package/build/ru-json.28147733.chunk.js +1 -0
- package/build/runtime~main.7d21ca6f.js +2 -0
- package/build/upload-settings.cadfd452.chunk.js +101 -0
- package/build/upload-translation-ca-json.79159984.chunk.js +1 -0
- package/build/upload.fbc65439.chunk.js +105 -0
- package/build/users-advanced-settings-page.646b6f29.chunk.js +101 -0
- package/build/users-roles-settings-page.28bf6bdc.chunk.js +30 -0
- package/build/{webhook-edit-page.2e6727ab.chunk.js → webhook-edit-page.ca670f8d.chunk.js} +3 -3
- package/build/webhook-list-page.7057f1e8.chunk.js +133 -0
- package/ee/admin/pages/AuthPage/components/Providers/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Roles/CreatePage/index.js +1 -1
- package/ee/server/controllers/user.js +4 -0
- package/package.json +7 -7
- package/server/config/admin-actions.js +0 -14
- package/server/controllers/admin.js +1 -33
- package/server/controllers/user.js +4 -0
- package/server/routes/admin.js +0 -28
- package/server/services/index.js +0 -1
- package/server/services/permission/permissions-manager/sanitize.js +22 -0
- package/server/services/user.js +1 -1
- package/server/utils/index.d.ts +0 -2
- package/admin/src/components/ConfigurationsProvider/index.js +0 -51
- package/admin/src/components/ConfigurationsProvider/reducer.js +0 -28
- package/admin/src/content-manager/components/DynamicComponentCard/index.js +0 -43
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/index.js +0 -85
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/init.js +0 -13
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/reducer.js +0 -43
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js +0 -116
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/reducer.js +0 -28
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/stepper.js +0 -25
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/AddLogoDialog.js +0 -67
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromComputerForm.js +0 -176
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromUrlForm.js +0 -82
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/ImageCardAsset.js +0 -51
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/PendingLogoDialog.js +0 -97
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/index.js +0 -85
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/reducer.js +0 -28
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +0 -16
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/constants.js +0 -3
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/getFormData.js +0 -17
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/parseFileMetadatas.js +0 -76
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/prefixAllUrls.js +0 -17
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/urlToFile.js +0 -21
- package/build/1856.521a99fd.chunk.js +0 -172
- package/build/2481.7ba28142.chunk.js +0 -184
- package/build/2758.927ecb6d.chunk.js +0 -162
- package/build/2912.79c2b3c8.chunk.js +0 -253
- package/build/2a9e9ef5c4c775bb7c7b.png +0 -0
- package/build/372.3720845e.chunk.js +0 -899
- package/build/4715.77e04177.chunk.js +0 -385
- package/build/497.fbd75558.chunk.js +0 -284
- package/build/4982.f53b78a4.chunk.js +0 -308
- package/build/6404.80bf5858.chunk.js +0 -506
- package/build/7197.959bbe97.chunk.js +0 -113
- package/build/7589.f3b26345.chunk.js +0 -194
- package/build/7841.f0e7d629.chunk.js +0 -253
- package/build/9115.318a6841.chunk.js +0 -1
- package/build/9853.d96fbc67.chunk.js +0 -356
- package/build/Admin-authenticatedApp.d8767873.chunk.js +0 -80
- package/build/Admin_homePage.50b6c129.chunk.js +0 -71
- package/build/Admin_marketplace.514ace37.chunk.js +0 -11
- package/build/Admin_settingsPage.0d94a598.chunk.js +0 -180
- package/build/admin-edit-roles-page.06f3d288.chunk.js +0 -1
- package/build/admin-edit-users.6a325cca.chunk.js +0 -11
- package/build/api-tokens-create-page.635e20c8.chunk.js +0 -1
- package/build/api-tokens-edit-page.db07253e.chunk.js +0 -1
- package/build/api-tokens-list-page.346c2149.chunk.js +0 -15
- package/build/content-manager.78e3f35c.chunk.js +0 -1204
- package/build/content-type-builder.0d8729ad.chunk.js +0 -141
- package/build/email-settings-page.fcc7e65d.chunk.js +0 -103
- package/build/en-json.ca572384.chunk.js +0 -1
- package/build/i18n-settings-page.477ffac7.chunk.js +0 -101
- package/build/main.06f66609.js +0 -7909
- package/build/ru-json.4560906c.chunk.js +0 -1
- package/build/runtime~main.dc1c7ef6.js +0 -2
- package/build/upload-settings.1456cd65.chunk.js +0 -101
- package/build/upload.d45af2c9.chunk.js +0 -105
- package/build/users-advanced-settings-page.5aa21b84.chunk.js +0 -101
- package/build/users-roles-settings-page.97d7092d.chunk.js +0 -30
- package/build/webhook-list-page.927257b5.chunk.js +0 -133
- package/server/services/project-settings.js +0 -173
- package/server/validation/project-settings.js +0 -39
|
@@ -146,19 +146,5 @@ module.exports = {
|
|
|
146
146
|
section: 'settings',
|
|
147
147
|
category: 'api tokens',
|
|
148
148
|
},
|
|
149
|
-
{
|
|
150
|
-
uid: 'project-settings.update',
|
|
151
|
-
displayName: 'Update the project level settings',
|
|
152
|
-
pluginName: 'admin',
|
|
153
|
-
section: 'settings',
|
|
154
|
-
category: 'project',
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
uid: 'project-settings.read',
|
|
158
|
-
displayName: 'Read the project level settings',
|
|
159
|
-
pluginName: 'admin',
|
|
160
|
-
section: 'settings',
|
|
161
|
-
category: 'project',
|
|
162
|
-
},
|
|
163
149
|
],
|
|
164
150
|
};
|
|
@@ -8,11 +8,6 @@ const { ValidationError } = require('@strapi/utils').errors;
|
|
|
8
8
|
// eslint-disable-next-line node/no-extraneous-require
|
|
9
9
|
const ee = require('@strapi/strapi/lib/utils/ee');
|
|
10
10
|
|
|
11
|
-
const {
|
|
12
|
-
validateUpdateProjectSettings,
|
|
13
|
-
validateUpdateProjectSettingsFiles,
|
|
14
|
-
validateUpdateProjectSettingsImagesDimensions,
|
|
15
|
-
} = require('../validation/project-settings');
|
|
16
11
|
const { getService } = require('../utils');
|
|
17
12
|
|
|
18
13
|
const PLUGIN_NAME_REGEX = /^[A-Za-z][A-Za-z0-9-_]+$/;
|
|
@@ -44,7 +39,6 @@ module.exports = {
|
|
|
44
39
|
async init() {
|
|
45
40
|
let uuid = strapi.config.get('uuid', false);
|
|
46
41
|
const hasAdmin = await getService('user').exists();
|
|
47
|
-
const { menuLogo } = await getService('project-settings').getProjectSettings();
|
|
48
42
|
// set to null if telemetryDisabled flag not avaialble in package.json
|
|
49
43
|
const telemetryDisabled = strapi.config.get('packageJsonStrapi.telemetryDisabled', null);
|
|
50
44
|
|
|
@@ -52,33 +46,7 @@ module.exports = {
|
|
|
52
46
|
uuid = false;
|
|
53
47
|
}
|
|
54
48
|
|
|
55
|
-
return {
|
|
56
|
-
data: {
|
|
57
|
-
uuid,
|
|
58
|
-
hasAdmin,
|
|
59
|
-
menuLogo: menuLogo ? menuLogo.url : null,
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
async getProjectSettings() {
|
|
65
|
-
return getService('project-settings').getProjectSettings();
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
async updateProjectSettings(ctx) {
|
|
69
|
-
const projectSettingsService = getService('project-settings');
|
|
70
|
-
|
|
71
|
-
const {
|
|
72
|
-
request: { files, body },
|
|
73
|
-
} = ctx;
|
|
74
|
-
|
|
75
|
-
await validateUpdateProjectSettings(body);
|
|
76
|
-
await validateUpdateProjectSettingsFiles(files);
|
|
77
|
-
|
|
78
|
-
const formatedFiles = await projectSettingsService.parseFilesData(files);
|
|
79
|
-
await validateUpdateProjectSettingsImagesDimensions(formatedFiles);
|
|
80
|
-
|
|
81
|
-
return projectSettingsService.updateProjectSettings({ ...body, ...formatedFiles });
|
|
49
|
+
return { data: { uuid, hasAdmin } };
|
|
82
50
|
},
|
|
83
51
|
|
|
84
52
|
async information() {
|
|
@@ -36,6 +36,10 @@ module.exports = {
|
|
|
36
36
|
|
|
37
37
|
const userInfo = getService('user').sanitizeUser(createdUser);
|
|
38
38
|
|
|
39
|
+
// Note: We need to assign manually the registrationToken to the
|
|
40
|
+
// final user payload so that it's not removed in the sanitation process.
|
|
41
|
+
Object.assign(userInfo, { registrationToken: createdUser.registrationToken });
|
|
42
|
+
|
|
39
43
|
// Send 201 created
|
|
40
44
|
ctx.created({ data: userInfo });
|
|
41
45
|
},
|
package/server/routes/admin.js
CHANGED
|
@@ -7,34 +7,6 @@ module.exports = [
|
|
|
7
7
|
handler: 'admin.init',
|
|
8
8
|
config: { auth: false },
|
|
9
9
|
},
|
|
10
|
-
{
|
|
11
|
-
method: 'GET',
|
|
12
|
-
path: '/project-settings',
|
|
13
|
-
handler: 'admin.getProjectSettings',
|
|
14
|
-
config: {
|
|
15
|
-
policies: [
|
|
16
|
-
'admin::isAuthenticatedAdmin',
|
|
17
|
-
{
|
|
18
|
-
name: 'admin::hasPermissions',
|
|
19
|
-
config: { actions: ['admin::project-settings.read'] },
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
method: 'POST',
|
|
26
|
-
path: '/project-settings',
|
|
27
|
-
handler: 'admin.updateProjectSettings',
|
|
28
|
-
config: {
|
|
29
|
-
policies: [
|
|
30
|
-
'admin::isAuthenticatedAdmin',
|
|
31
|
-
{
|
|
32
|
-
name: 'admin::hasPermissions',
|
|
33
|
-
config: { actions: ['admin::project-settings.update'] },
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
10
|
{
|
|
39
11
|
method: 'GET',
|
|
40
12
|
path: '/project-type',
|
package/server/services/index.js
CHANGED
|
@@ -14,6 +14,7 @@ const {
|
|
|
14
14
|
uniq,
|
|
15
15
|
intersection,
|
|
16
16
|
pick,
|
|
17
|
+
getOr,
|
|
17
18
|
} = require('lodash/fp');
|
|
18
19
|
|
|
19
20
|
const { contentTypes, traverseEntity, sanitize, pipeAsync } = require('@strapi/utils');
|
|
@@ -46,6 +47,8 @@ module.exports = ({ action, ability, model }) => {
|
|
|
46
47
|
const permittedFields = fields.shouldIncludeAll ? null : getOutputFields(fields.permitted);
|
|
47
48
|
|
|
48
49
|
return pipeAsync(
|
|
50
|
+
// Remove fields hidden from the admin
|
|
51
|
+
traverseEntity(omitHiddenFields, { schema }),
|
|
49
52
|
// Remove unallowed fields from admin::user relations
|
|
50
53
|
traverseEntity(pickAllowedAdminUserFields, { schema }),
|
|
51
54
|
// Remove not allowed fields (RBAC)
|
|
@@ -61,6 +64,8 @@ module.exports = ({ action, ability, model }) => {
|
|
|
61
64
|
const permittedFields = fields.shouldIncludeAll ? null : getInputFields(fields.permitted);
|
|
62
65
|
|
|
63
66
|
return pipeAsync(
|
|
67
|
+
// Remove fields hidden from the admin
|
|
68
|
+
traverseEntity(omitHiddenFields, { schema }),
|
|
64
69
|
// Remove not allowed fields (RBAC)
|
|
65
70
|
traverseEntity(allowedFields(permittedFields), { schema }),
|
|
66
71
|
// Remove roles from createdBy & updateBy fields
|
|
@@ -107,8 +112,25 @@ module.exports = ({ action, ability, model }) => {
|
|
|
107
112
|
return defaults({ subject: asSubject(model, data), action }, options);
|
|
108
113
|
};
|
|
109
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Omit creator fields' (createdBy & updatedBy) roles from the admin API responses
|
|
117
|
+
*/
|
|
110
118
|
const omitCreatorRoles = omit([`${CREATED_BY_ATTRIBUTE}.roles`, `${UPDATED_BY_ATTRIBUTE}.roles`]);
|
|
111
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Visitor used to remove hidden fields from the admin API responses
|
|
122
|
+
*/
|
|
123
|
+
const omitHiddenFields = ({ key, schema }, { remove }) => {
|
|
124
|
+
const isHidden = getOr(false, ['config', 'attributes', key, 'hidden'], schema);
|
|
125
|
+
|
|
126
|
+
if (isHidden) {
|
|
127
|
+
remove(key);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Visitor used to only select needed fields from the admin users entities & avoid leaking sensitive information
|
|
133
|
+
*/
|
|
112
134
|
const pickAllowedAdminUserFields = ({ attribute, key, value }, { set }) => {
|
|
113
135
|
const pickAllowedFields = pick(['id', 'firstname', 'lastname', 'username']);
|
|
114
136
|
|
package/server/services/user.js
CHANGED
|
@@ -17,7 +17,7 @@ const sanitizeUserRoles = role => _.pick(role, ['id', 'name', 'description', 'co
|
|
|
17
17
|
*/
|
|
18
18
|
const sanitizeUser = user => {
|
|
19
19
|
return {
|
|
20
|
-
..._.omit(user, ['password', 'resetPasswordToken', 'roles']),
|
|
20
|
+
..._.omit(user, ['password', 'resetPasswordToken', 'registrationToken', 'roles']),
|
|
21
21
|
roles: user.roles && user.roles.map(sanitizeUserRoles),
|
|
22
22
|
};
|
|
23
23
|
};
|
package/server/utils/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ import * as metrics from '../services/metrics';
|
|
|
6
6
|
import * as token from '../services/token';
|
|
7
7
|
import * as auth from '../services/auth';
|
|
8
8
|
import * as apiToken from '../services/api-token';
|
|
9
|
-
import * as projectSettings from '../services/project-settings';
|
|
10
9
|
|
|
11
10
|
type S = {
|
|
12
11
|
role: typeof role;
|
|
@@ -17,7 +16,6 @@ type S = {
|
|
|
17
16
|
auth: typeof auth;
|
|
18
17
|
metrics: typeof metrics;
|
|
19
18
|
'api-token': typeof apiToken;
|
|
20
|
-
'project-settings': typeof projectSettings;
|
|
21
19
|
};
|
|
22
20
|
|
|
23
21
|
export function getService<T extends keyof S>(name: T): S[T];
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React, { useReducer, useRef } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { ConfigurationsContext } from '../../contexts';
|
|
4
|
-
import reducer, { initialState } from './reducer';
|
|
5
|
-
|
|
6
|
-
const ConfigurationsProvider = ({
|
|
7
|
-
children,
|
|
8
|
-
authLogo,
|
|
9
|
-
menuLogo: defaultMenuLogo,
|
|
10
|
-
showReleaseNotification,
|
|
11
|
-
showTutorials,
|
|
12
|
-
}) => {
|
|
13
|
-
const [{ menuLogo }, dispatch] = useReducer(reducer, initialState);
|
|
14
|
-
|
|
15
|
-
const updateProjectSettings = ({ menuLogo }) => {
|
|
16
|
-
return dispatch({
|
|
17
|
-
type: 'UPDATE_PROJECT_SETTINGS',
|
|
18
|
-
values: {
|
|
19
|
-
menuLogo: menuLogo || defaultMenuLogo,
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const updateProjectSettingsRef = useRef(updateProjectSettings);
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<ConfigurationsContext.Provider
|
|
28
|
-
value={{
|
|
29
|
-
logos: {
|
|
30
|
-
menu: { custom: menuLogo, default: defaultMenuLogo },
|
|
31
|
-
auth: { custom: null, default: authLogo },
|
|
32
|
-
},
|
|
33
|
-
updateProjectSettings: updateProjectSettingsRef.current,
|
|
34
|
-
showReleaseNotification,
|
|
35
|
-
showTutorials,
|
|
36
|
-
}}
|
|
37
|
-
>
|
|
38
|
-
{children}
|
|
39
|
-
</ConfigurationsContext.Provider>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
ConfigurationsProvider.propTypes = {
|
|
44
|
-
authLogo: PropTypes.string.isRequired,
|
|
45
|
-
children: PropTypes.element.isRequired,
|
|
46
|
-
menuLogo: PropTypes.string.isRequired,
|
|
47
|
-
showReleaseNotification: PropTypes.bool.isRequired,
|
|
48
|
-
showTutorials: PropTypes.bool.isRequired,
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default ConfigurationsProvider;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/* eslint-disable consistent-return */
|
|
2
|
-
/*
|
|
3
|
-
*
|
|
4
|
-
* ConfigurationsProvider reducer
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import produce from 'immer';
|
|
9
|
-
|
|
10
|
-
const initialState = {
|
|
11
|
-
menuLogo: null,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const reducer = (state = initialState, action) =>
|
|
15
|
-
produce(state, draftState => {
|
|
16
|
-
switch (action.type) {
|
|
17
|
-
case 'UPDATE_PROJECT_SETTINGS': {
|
|
18
|
-
Object.assign(draftState, action.values);
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
default: {
|
|
22
|
-
return draftState;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export default reducer;
|
|
28
|
-
export { initialState };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
|
-
import Wrapper from './Wrapper';
|
|
5
|
-
|
|
6
|
-
const DynamicComponentCard = ({ children, componentUid, friendlyName, icon, onClick }) => {
|
|
7
|
-
return (
|
|
8
|
-
<Wrapper
|
|
9
|
-
onClick={e => {
|
|
10
|
-
e.preventDefault();
|
|
11
|
-
e.stopPropagation();
|
|
12
|
-
|
|
13
|
-
onClick(componentUid);
|
|
14
|
-
}}
|
|
15
|
-
>
|
|
16
|
-
<button className="component-icon" type="button">
|
|
17
|
-
<FontAwesomeIcon icon={icon} />
|
|
18
|
-
</button>
|
|
19
|
-
|
|
20
|
-
<div className="component-uid">
|
|
21
|
-
<span>{friendlyName}</span>
|
|
22
|
-
</div>
|
|
23
|
-
{children}
|
|
24
|
-
</Wrapper>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
DynamicComponentCard.defaultProps = {
|
|
29
|
-
children: null,
|
|
30
|
-
friendlyName: '',
|
|
31
|
-
onClick: () => {},
|
|
32
|
-
icon: 'smile',
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
DynamicComponentCard.propTypes = {
|
|
36
|
-
children: PropTypes.node,
|
|
37
|
-
componentUid: PropTypes.string.isRequired,
|
|
38
|
-
friendlyName: PropTypes.string,
|
|
39
|
-
icon: PropTypes.string,
|
|
40
|
-
onClick: PropTypes.func,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export default DynamicComponentCard;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import React, { useReducer, forwardRef, useImperativeHandle } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
4
|
-
import { useTracking } from '@strapi/helper-plugin';
|
|
5
|
-
import { Grid, GridItem } from '@strapi/design-system/Grid';
|
|
6
|
-
import { Box } from '@strapi/design-system/Box';
|
|
7
|
-
import { Typography } from '@strapi/design-system/Typography';
|
|
8
|
-
import LogoInput from '../LogoInput';
|
|
9
|
-
import { useConfigurations } from '../../../../../../hooks';
|
|
10
|
-
import reducer, { initialState } from './reducer';
|
|
11
|
-
import init from './init';
|
|
12
|
-
|
|
13
|
-
const Form = forwardRef(({ projectSettingsStored }, ref) => {
|
|
14
|
-
const { formatMessage } = useIntl();
|
|
15
|
-
const { trackUsage } = useTracking();
|
|
16
|
-
const {
|
|
17
|
-
logos: { menu },
|
|
18
|
-
} = useConfigurations();
|
|
19
|
-
const [{ menuLogo }, dispatch] = useReducer(reducer, initialState, () =>
|
|
20
|
-
init(initialState, projectSettingsStored)
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
const handleChangeMenuLogo = asset => {
|
|
24
|
-
dispatch({
|
|
25
|
-
type: 'SET_CUSTOM_MENU_LOGO',
|
|
26
|
-
value: asset,
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const handleResetMenuLogo = () => {
|
|
31
|
-
trackUsage('didClickResetLogo');
|
|
32
|
-
|
|
33
|
-
dispatch({
|
|
34
|
-
type: 'RESET_CUSTOM_MENU_LOGO',
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
useImperativeHandle(ref, () => ({
|
|
39
|
-
getValues: () => ({ menuLogo: menuLogo.submit }),
|
|
40
|
-
}));
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<Box
|
|
44
|
-
hasRadius
|
|
45
|
-
background="neutral0"
|
|
46
|
-
shadow="tableShadow"
|
|
47
|
-
paddingTop={6}
|
|
48
|
-
paddingBottom={6}
|
|
49
|
-
paddingRight={7}
|
|
50
|
-
paddingLeft={7}
|
|
51
|
-
>
|
|
52
|
-
<Typography variant="delta" as="h3">
|
|
53
|
-
{formatMessage({
|
|
54
|
-
id: 'Settings.application.customization',
|
|
55
|
-
defaultMessage: 'Customization',
|
|
56
|
-
})}
|
|
57
|
-
</Typography>
|
|
58
|
-
<Grid paddingTop={4}>
|
|
59
|
-
<GridItem col={6} s={12}>
|
|
60
|
-
<LogoInput
|
|
61
|
-
onChangeLogo={handleChangeMenuLogo}
|
|
62
|
-
customLogo={menuLogo.display}
|
|
63
|
-
defaultLogo={menu.default}
|
|
64
|
-
onResetMenuLogo={handleResetMenuLogo}
|
|
65
|
-
/>
|
|
66
|
-
</GridItem>
|
|
67
|
-
</Grid>
|
|
68
|
-
</Box>
|
|
69
|
-
);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
Form.defaultProps = {
|
|
73
|
-
projectSettingsStored: null,
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
Form.propTypes = {
|
|
77
|
-
projectSettingsStored: PropTypes.shape({
|
|
78
|
-
menuLogo: PropTypes.shape({
|
|
79
|
-
url: PropTypes.string,
|
|
80
|
-
name: PropTypes.string,
|
|
81
|
-
}),
|
|
82
|
-
}),
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export default Form;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import merge from 'lodash/merge';
|
|
2
|
-
|
|
3
|
-
const init = (initialState, projectSettingsStored) => {
|
|
4
|
-
const copyInitialState = merge(initialState, {
|
|
5
|
-
menuLogo: {
|
|
6
|
-
display: projectSettingsStored.menuLogo,
|
|
7
|
-
},
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
return copyInitialState;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default init;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/* eslint-disable consistent-return */
|
|
2
|
-
/*
|
|
3
|
-
*
|
|
4
|
-
* ApplicationInfosPage Form reducer
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import produce from 'immer';
|
|
9
|
-
|
|
10
|
-
const initialState = {
|
|
11
|
-
menuLogo: {
|
|
12
|
-
display: null,
|
|
13
|
-
submit: {
|
|
14
|
-
rawFile: null,
|
|
15
|
-
isReset: false,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const reducer = (state = initialState, action) =>
|
|
21
|
-
produce(state, draftState => {
|
|
22
|
-
switch (action.type) {
|
|
23
|
-
case 'SET_CUSTOM_MENU_LOGO': {
|
|
24
|
-
draftState.menuLogo.display = action.value;
|
|
25
|
-
draftState.menuLogo.submit.rawFile = action.value.rawFile;
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
case 'RESET_CUSTOM_MENU_LOGO': {
|
|
29
|
-
draftState.menuLogo.display = null;
|
|
30
|
-
draftState.menuLogo.submit = {
|
|
31
|
-
rawFile: null,
|
|
32
|
-
isReset: true,
|
|
33
|
-
};
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
default: {
|
|
37
|
-
return draftState;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
export default reducer;
|
|
43
|
-
export { initialState };
|
package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import React, { useReducer } from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { CarouselInput, CarouselSlide, CarouselActions } from '@strapi/design-system/CarouselInput';
|
|
5
|
-
import { IconButton } from '@strapi/design-system/IconButton';
|
|
6
|
-
import { Box } from '@strapi/design-system/Box';
|
|
7
|
-
import Plus from '@strapi/icons/Plus';
|
|
8
|
-
import Refresh from '@strapi/icons/Refresh';
|
|
9
|
-
import reducer, { initialState } from './reducer';
|
|
10
|
-
import LogoModalStepper from '../LogoModalStepper';
|
|
11
|
-
import { SIZE, DIMENSION } from '../../utils/constants';
|
|
12
|
-
import stepper from './stepper';
|
|
13
|
-
|
|
14
|
-
const LogoInput = ({ customLogo, defaultLogo, onChangeLogo, onResetMenuLogo }) => {
|
|
15
|
-
const [{ currentStep }, dispatch] = useReducer(reducer, initialState);
|
|
16
|
-
const { Component, next, prev, modalTitle } = stepper[currentStep] || {};
|
|
17
|
-
const { formatMessage } = useIntl();
|
|
18
|
-
|
|
19
|
-
const goTo = to => {
|
|
20
|
-
dispatch({
|
|
21
|
-
type: 'GO_TO',
|
|
22
|
-
to,
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<>
|
|
28
|
-
<CarouselInput
|
|
29
|
-
label={formatMessage({
|
|
30
|
-
id: 'Settings.application.customization.carousel.title',
|
|
31
|
-
defaultMessage: 'Logo',
|
|
32
|
-
})}
|
|
33
|
-
selectedSlide={0}
|
|
34
|
-
hint={formatMessage(
|
|
35
|
-
{
|
|
36
|
-
id: 'Settings.application.customization.carousel-hint',
|
|
37
|
-
defaultMessage:
|
|
38
|
-
'Change the admin panel logo (Max dimension: {dimension}x{dimension}, Max file size: {size}KB)',
|
|
39
|
-
},
|
|
40
|
-
{ size: SIZE, dimension: DIMENSION }
|
|
41
|
-
)}
|
|
42
|
-
previousLabel=""
|
|
43
|
-
nextLabel=""
|
|
44
|
-
onNext={() => {}}
|
|
45
|
-
onPrevious={() => {}}
|
|
46
|
-
secondaryLabel={customLogo?.name || 'logo.png'}
|
|
47
|
-
actions={
|
|
48
|
-
<CarouselActions>
|
|
49
|
-
<IconButton
|
|
50
|
-
onClick={() => goTo(customLogo ? 'pending' : 'upload')}
|
|
51
|
-
label={formatMessage({
|
|
52
|
-
id: 'Settings.application.customization.carousel.change-action',
|
|
53
|
-
defaultMessage: 'Change logo',
|
|
54
|
-
})}
|
|
55
|
-
icon={<Plus />}
|
|
56
|
-
/>
|
|
57
|
-
{customLogo && (
|
|
58
|
-
<IconButton
|
|
59
|
-
onClick={onResetMenuLogo}
|
|
60
|
-
label={formatMessage({
|
|
61
|
-
id: 'Settings.application.customization.carousel.reset-action',
|
|
62
|
-
defaultMessage: 'Reset logo',
|
|
63
|
-
})}
|
|
64
|
-
icon={<Refresh />}
|
|
65
|
-
/>
|
|
66
|
-
)}
|
|
67
|
-
</CarouselActions>
|
|
68
|
-
}
|
|
69
|
-
>
|
|
70
|
-
<CarouselSlide
|
|
71
|
-
label={formatMessage({
|
|
72
|
-
id: 'Settings.application.customization.carousel-slide.label',
|
|
73
|
-
defaultMessage: 'Logo slide',
|
|
74
|
-
})}
|
|
75
|
-
>
|
|
76
|
-
<Box
|
|
77
|
-
maxHeight="40%"
|
|
78
|
-
maxWidth="40%"
|
|
79
|
-
as="img"
|
|
80
|
-
src={customLogo?.url || defaultLogo}
|
|
81
|
-
alt={formatMessage({
|
|
82
|
-
id: 'Settings.application.customization.carousel.title',
|
|
83
|
-
defaultMessage: 'Logo',
|
|
84
|
-
})}
|
|
85
|
-
/>
|
|
86
|
-
</CarouselSlide>
|
|
87
|
-
</CarouselInput>
|
|
88
|
-
<LogoModalStepper
|
|
89
|
-
Component={Component}
|
|
90
|
-
currentStep={currentStep}
|
|
91
|
-
onChangeLogo={onChangeLogo}
|
|
92
|
-
customLogo={customLogo}
|
|
93
|
-
goTo={goTo}
|
|
94
|
-
next={next}
|
|
95
|
-
prev={prev}
|
|
96
|
-
modalTitle={modalTitle}
|
|
97
|
-
/>
|
|
98
|
-
</>
|
|
99
|
-
);
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
LogoInput.defaultProps = {
|
|
103
|
-
customLogo: null,
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
LogoInput.propTypes = {
|
|
107
|
-
customLogo: PropTypes.shape({
|
|
108
|
-
url: PropTypes.string,
|
|
109
|
-
name: PropTypes.string,
|
|
110
|
-
}),
|
|
111
|
-
defaultLogo: PropTypes.string.isRequired,
|
|
112
|
-
onChangeLogo: PropTypes.func.isRequired,
|
|
113
|
-
onResetMenuLogo: PropTypes.func.isRequired,
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export default LogoInput;
|
package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/reducer.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/* eslint-disable consistent-return */
|
|
2
|
-
/*
|
|
3
|
-
*
|
|
4
|
-
* LogoInput reducer
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import produce from 'immer';
|
|
9
|
-
|
|
10
|
-
const initialState = {
|
|
11
|
-
currentStep: undefined,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const reducer = (state = initialState, action) =>
|
|
15
|
-
produce(state, draftState => {
|
|
16
|
-
switch (action.type) {
|
|
17
|
-
case 'GO_TO': {
|
|
18
|
-
draftState.currentStep = action.to;
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
default: {
|
|
22
|
-
return draftState;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export default reducer;
|
|
28
|
-
export { initialState };
|
package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/stepper.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import AddLogoDialog from '../LogoModalStepper/AddLogoDialog';
|
|
2
|
-
import PendingLogoDialog from '../LogoModalStepper/PendingLogoDialog';
|
|
3
|
-
|
|
4
|
-
const stepper = {
|
|
5
|
-
upload: {
|
|
6
|
-
Component: AddLogoDialog,
|
|
7
|
-
modalTitle: {
|
|
8
|
-
id: 'Settings.application.customization.modal.upload',
|
|
9
|
-
defaultMessage: 'Upload logo',
|
|
10
|
-
},
|
|
11
|
-
next: 'pending',
|
|
12
|
-
prev: null,
|
|
13
|
-
},
|
|
14
|
-
pending: {
|
|
15
|
-
Component: PendingLogoDialog,
|
|
16
|
-
modalTitle: {
|
|
17
|
-
id: 'Settings.application.customization.modal.pending',
|
|
18
|
-
defaultMessage: 'Pending logo',
|
|
19
|
-
},
|
|
20
|
-
next: null,
|
|
21
|
-
prev: 'upload',
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default stepper;
|