@strapi/admin 4.2.0-beta.3 → 4.2.1-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/app.js +4 -7
- package/admin/src/components/ConfigurationsProvider/index.js +51 -0
- package/admin/src/components/ConfigurationsProvider/reducer.js +28 -0
- package/admin/src/components/LeftMenu/index.js +12 -2
- package/admin/src/components/Providers/index.js +8 -4
- package/admin/src/components/UnauthenticatedLogo/index.js +4 -2
- package/admin/src/hooks/useFetchMarketplaceProviders/index.js +23 -0
- package/admin/src/hooks/useFetchMarketplaceProviders/utils/api.js +11 -0
- package/admin/src/pages/Admin/index.js +5 -15
- package/admin/src/pages/App/index.js +9 -18
- package/admin/src/pages/MarketplacePage/components/{EmptyPluginSearch/EmptyPluginGrid.js → EmptyNpmPackageSearch/EmptyNpmPackageGrid.js} +1 -1
- package/admin/src/pages/MarketplacePage/components/{EmptyPluginSearch → EmptyNpmPackageSearch}/index.js +6 -4
- package/admin/src/pages/MarketplacePage/components/{PluginCard → NpmPackageCard}/InstallPluginButton.js +0 -0
- package/admin/src/pages/MarketplacePage/components/{PluginCard → NpmPackageCard}/index.js +22 -10
- package/admin/src/pages/MarketplacePage/components/NpmPackagesGrid/index.js +42 -0
- package/admin/src/pages/MarketplacePage/components/PageHeader/index.js +12 -5
- package/admin/src/pages/MarketplacePage/index.js +99 -37
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/index.js +85 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/init.js +13 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/Form/reducer.js +43 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/index.js +118 -0
- package/admin/src/pages/{App → SettingsPage/pages/ApplicationInfosPage/components/LogoInput}/reducer.js +13 -7
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoInput/stepper.js +25 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/AddLogoDialog.js +67 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromComputerForm.js +176 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromUrlForm.js +82 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/ImageCardAsset.js +51 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/PendingLogoDialog.js +97 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/index.js +85 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/reducer.js +28 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +153 -91
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +16 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/constants.js +3 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/getFormData.js +17 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/parseFileMetadatas.js +76 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/prefixAllUrls.js +17 -0
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/urlToFile.js +21 -0
- package/admin/src/reducers.js +2 -4
- package/admin/src/translations/en.json +33 -3
- package/admin/src/translations/pl.json +264 -12
- package/admin/src/translations/vi.json +17 -17
- 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/4800.d3ebc81d.chunk.js +1 -0
- package/build/4982.c57c5675.chunk.js +308 -0
- package/build/7197.47565569.chunk.js +113 -0
- package/build/{6229.a5cca9f2.chunk.js → 7589.77ef4fbf.chunk.js} +2 -2
- package/build/{210.014495c1.chunk.js → 7757.f6eb5e92.chunk.js} +58 -58
- 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/{4073.41ac1235.chunk.js → 9115.623dc4f7.chunk.js} +1 -1
- package/build/9158.e48d88af.chunk.js +503 -0
- package/build/{7191.3bde3cbf.chunk.js → 9298.cb3b6bc1.chunk.js} +112 -113
- package/build/9420.ba035f29.chunk.js +508 -0
- package/build/948.d64fb515.chunk.js +2 -0
- package/build/Admin-authenticatedApp.63a5061a.chunk.js +80 -0
- package/build/{Admin_homePage.f157e33e.chunk.js → Admin_homePage.447df176.chunk.js} +2 -2
- package/build/Admin_marketplace.8a503eec.chunk.js +11 -0
- package/build/Admin_pluginsPage.91a96fa5.chunk.js +1 -0
- package/build/{Admin_profilePage.62c203ad.chunk.js → Admin_profilePage.249cbfc9.chunk.js} +2 -2
- package/build/Admin_settingsPage.0d138832.chunk.js +180 -0
- package/build/{admin-edit-roles-page.94e1403b.chunk.js → admin-edit-roles-page.7c2c9752.chunk.js} +1 -1
- package/build/admin-edit-users.b835bc48.chunk.js +11 -0
- package/build/admin-users.19900b75.chunk.js +12 -0
- package/build/api-tokens-create-page.8d299dde.chunk.js +1 -0
- package/build/api-tokens-edit-page.3e453fc1.chunk.js +1 -0
- package/build/{api-tokens-list-page.340750a6.chunk.js → api-tokens-list-page.872c3800.chunk.js} +1 -1
- package/build/{codemirror-css.b467b1de.chunk.js → codemirror-css.98490df3.chunk.js} +2 -2
- package/build/{codemirror-javacript.41bdefda.chunk.js → codemirror-javacript.cafbda9c.chunk.js} +1 -1
- package/build/codemirror-theme.b3c64617.chunk.js +34 -0
- package/build/{content-manager.6cdcfb6e.chunk.js → content-manager.002bfd99.chunk.js} +16 -16
- package/build/content-type-builder.a0450dfe.chunk.js +141 -0
- package/build/{cropper-css.ecc0d670.chunk.js → cropper-css.0055cd53.chunk.js} +2 -2
- package/build/email-settings-page.1f235173.chunk.js +103 -0
- package/build/en-json.0a5ba154.chunk.js +1 -0
- package/build/{fontawesome-css-all.04f33619.chunk.js → fontawesome-css-all.b88d464e.chunk.js} +3 -3
- package/build/{fontawesome-css.477ba714.chunk.js → fontawesome-css.a92a7b6c.chunk.js} +2 -2
- package/build/highlight.js.9d8ef460.chunk.js +86 -0
- package/build/i18n-settings-page.06e88cf2.chunk.js +101 -0
- package/build/index.html +1 -1
- package/build/main.e3a13431.js +8404 -0
- package/build/pl-json.f65302c2.chunk.js +1 -0
- package/build/{runtime~main.e7611418.js → runtime~main.dacf1aff.js} +2 -2
- package/build/sso-settings-page.a7c2e854.chunk.js +1 -0
- package/build/upload-settings.4ee2f135.chunk.js +101 -0
- package/build/upload.0d4153e8.chunk.js +105 -0
- package/build/users-advanced-settings-page.747b2ec1.chunk.js +101 -0
- package/build/users-email-settings-page.8b9a266d.chunk.js +1 -0
- package/build/users-providers-settings-page.fc9d8f9d.chunk.js +1 -0
- package/build/{users-roles-settings-page.988ebc3b.chunk.js → users-roles-settings-page.1bf4ffc5.chunk.js} +2 -2
- package/build/vi-json.bf3424be.chunk.js +1 -0
- package/build/webhook-edit-page.142b23ac.chunk.js +23 -0
- package/build/webhook-list-page.671582a0.chunk.js +133 -0
- package/index.js +239 -53
- package/package.json +8 -12
- package/scripts/build.js +3 -17
- package/server/config/admin-actions.js +14 -0
- package/server/controllers/admin.js +29 -12
- package/server/policies/index.js +0 -1
- package/server/routes/admin.js +28 -9
- package/server/routes/serve-admin-panel.js +1 -1
- package/server/services/index.js +1 -0
- package/server/services/project-settings.js +173 -0
- package/server/utils/index.d.ts +2 -0
- package/server/validation/project-settings.js +39 -0
- package/webpack.alias.js +30 -19
- package/webpack.config.js +5 -28
- package/admin/src/pages/App/constants.js +0 -1
- package/admin/src/tsconfig.json +0 -10
- package/build/1709.ceed0e18.chunk.js +0 -503
- package/build/1856.521a99fd.chunk.js +0 -172
- package/build/20.cf744c35.chunk.js +0 -308
- package/build/2077.51485bfb.chunk.js +0 -194
- package/build/2135.95ee6de1.chunk.js +0 -162
- package/build/2524.688d0355.chunk.js +0 -1
- package/build/2912.79c2b3c8.chunk.js +0 -253
- package/build/4715.77e04177.chunk.js +0 -385
- package/build/4761.3eabdf46.chunk.js +0 -101
- package/build/6281.f10a7e3a.chunk.js +0 -1
- package/build/7009.79fce86d.chunk.js +0 -164
- package/build/7841.f0e7d629.chunk.js +0 -253
- package/build/7863.bc7a8f3a.chunk.js +0 -112
- package/build/9420.cb0b75e8.chunk.js +0 -508
- package/build/Admin-authenticatedApp.4ce8d292.chunk.js +0 -80
- package/build/Admin_marketplace.1e3393c9.chunk.js +0 -11
- package/build/Admin_pluginsPage.788fb2f6.chunk.js +0 -1
- package/build/Admin_settingsPage.924a7816.chunk.js +0 -170
- package/build/admin-edit-users.6c2bf718.chunk.js +0 -10
- package/build/admin-users.e03db115.chunk.js +0 -11
- package/build/api-tokens-create-page.787ab302.chunk.js +0 -1
- package/build/api-tokens-edit-page.e4010c0c.chunk.js +0 -1
- package/build/codemirror-theme.cf9f9eb6.chunk.js +0 -34
- package/build/content-type-builder.e73879b9.chunk.js +0 -141
- package/build/email-settings-page.f67d13b2.chunk.js +0 -103
- package/build/en-json.3e1a222e.chunk.js +0 -1
- package/build/highlight.js.3381ffc3.chunk.js +0 -86
- package/build/i18n-settings-page.6b67cb75.chunk.js +0 -101
- package/build/main.45472ea9.js +0 -8404
- package/build/pl-json.94f05d2c.chunk.js +0 -1
- package/build/sso-settings-page.e9034e22.chunk.js +0 -1
- package/build/upload-settings.3db55de0.chunk.js +0 -101
- package/build/upload.070c189b.chunk.js +0 -105
- package/build/users-advanced-settings-page.a23cda17.chunk.js +0 -101
- package/build/users-email-settings-page.0a096388.chunk.js +0 -1
- package/build/users-providers-settings-page.bfe7755a.chunk.js +0 -1
- package/build/vi-json.3d14e91e.chunk.js +0 -1
- package/build/webhook-edit-page.2fa94db3.chunk.js +0 -23
- package/build/webhook-list-page.b594db49.chunk.js +0 -133
- package/server/policies/isTelemetryEnabled.js +0 -16
- package/utils/create-cache-dir.js +0 -161
- package/utils/get-custom-app-config-file.js +0 -23
- package/utils/get-custom-webpack-config.js +0 -38
- package/utils/get-plugins-path.js +0 -26
- package/utils/index.js +0 -13
- package/utils/should-build-admin.js +0 -52
- package/utils/watch-admin-files.js +0 -59
|
@@ -1,26 +1,76 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { useQuery, useMutation, useQueryClient } from 'react-query';
|
|
2
3
|
import { useIntl } from 'react-intl';
|
|
3
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
useAppInfos,
|
|
6
|
+
SettingsPageTitle,
|
|
7
|
+
useFocusWhenNavigate,
|
|
8
|
+
CheckPermissions,
|
|
9
|
+
useNotification,
|
|
10
|
+
useTracking,
|
|
11
|
+
} from '@strapi/helper-plugin';
|
|
4
12
|
import { HeaderLayout, Layout, ContentLayout } from '@strapi/design-system/Layout';
|
|
5
13
|
import { Main } from '@strapi/design-system/Main';
|
|
6
14
|
import { Box } from '@strapi/design-system/Box';
|
|
7
15
|
import { Grid, GridItem } from '@strapi/design-system/Grid';
|
|
8
16
|
import { Typography } from '@strapi/design-system/Typography';
|
|
9
|
-
|
|
10
17
|
import { Stack } from '@strapi/design-system/Stack';
|
|
18
|
+
import { Button } from '@strapi/design-system/Button';
|
|
11
19
|
import { Link } from '@strapi/design-system/v2/Link';
|
|
12
20
|
import ExternalLink from '@strapi/icons/ExternalLink';
|
|
21
|
+
import Check from '@strapi/icons/Check';
|
|
22
|
+
import { useConfigurations } from '../../../../hooks';
|
|
23
|
+
import Form from './components/Form';
|
|
24
|
+
import { fetchProjectSettings, postProjectSettings } from './utils/api';
|
|
25
|
+
import getFormData from './utils/getFormData';
|
|
26
|
+
|
|
27
|
+
const permissions = [{ action: 'admin::project-settings.update', subject: null }];
|
|
13
28
|
|
|
14
29
|
const ApplicationInfosPage = () => {
|
|
30
|
+
const inputsRef = useRef();
|
|
31
|
+
const toggleNotification = useNotification();
|
|
32
|
+
const { trackUsage } = useTracking();
|
|
15
33
|
const { formatMessage } = useIntl();
|
|
34
|
+
const queryClient = useQueryClient();
|
|
16
35
|
useFocusWhenNavigate();
|
|
17
36
|
const appInfos = useAppInfos();
|
|
18
37
|
const { shouldUpdateStrapi, latestStrapiReleaseTag, strapiVersion } = appInfos;
|
|
38
|
+
const { updateProjectSettings } = useConfigurations();
|
|
39
|
+
|
|
40
|
+
const { data } = useQuery('project-settings', fetchProjectSettings);
|
|
19
41
|
|
|
20
42
|
const currentPlan = appInfos.communityEdition
|
|
21
43
|
? 'app.components.UpgradePlanModal.text-ce'
|
|
22
44
|
: 'app.components.UpgradePlanModal.text-ee';
|
|
23
45
|
|
|
46
|
+
const submitMutation = useMutation(body => postProjectSettings(body), {
|
|
47
|
+
onSuccess: async ({ menuLogo }) => {
|
|
48
|
+
await queryClient.invalidateQueries('project-settings', { refetchActive: true });
|
|
49
|
+
updateProjectSettings({ menuLogo: menuLogo?.url });
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const handleSubmit = () => {
|
|
54
|
+
const inputValues = inputsRef.current.getValues();
|
|
55
|
+
const formData = getFormData(inputValues);
|
|
56
|
+
|
|
57
|
+
submitMutation.mutate(formData, {
|
|
58
|
+
onSuccess: () => {
|
|
59
|
+
const { menuLogo } = inputValues;
|
|
60
|
+
|
|
61
|
+
if (menuLogo.rawFile) {
|
|
62
|
+
trackUsage('didChangeLogo');
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
onError: () => {
|
|
66
|
+
toggleNotification({
|
|
67
|
+
type: 'warning',
|
|
68
|
+
message: { id: 'notification.error', defaultMessage: 'An error occurred' },
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
24
74
|
return (
|
|
25
75
|
<Layout>
|
|
26
76
|
<SettingsPageTitle name="Application" />
|
|
@@ -31,107 +81,119 @@ const ApplicationInfosPage = () => {
|
|
|
31
81
|
id: 'Settings.application.description',
|
|
32
82
|
defaultMessage: 'Administration panel’s global information',
|
|
33
83
|
})}
|
|
84
|
+
primaryAction={
|
|
85
|
+
<Button onClick={handleSubmit} startIcon={<Check />}>
|
|
86
|
+
{formatMessage({ id: 'global.save', defaultMessage: 'Save' })}
|
|
87
|
+
</Button>
|
|
88
|
+
}
|
|
34
89
|
/>
|
|
35
90
|
<ContentLayout>
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
91
|
+
<Stack spacing={6}>
|
|
92
|
+
<Box
|
|
93
|
+
hasRadius
|
|
94
|
+
background="neutral0"
|
|
95
|
+
shadow="tableShadow"
|
|
96
|
+
paddingTop={6}
|
|
97
|
+
paddingBottom={6}
|
|
98
|
+
paddingRight={7}
|
|
99
|
+
paddingLeft={7}
|
|
100
|
+
>
|
|
101
|
+
<Stack spacing={5}>
|
|
102
|
+
<Typography variant="delta" as="h3">
|
|
103
|
+
{formatMessage({
|
|
104
|
+
id: 'global.details',
|
|
105
|
+
defaultMessage: 'Details',
|
|
106
|
+
})}
|
|
107
|
+
</Typography>
|
|
52
108
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
109
|
+
<Grid paddingTop={1}>
|
|
110
|
+
<GridItem col={6} s={12}>
|
|
111
|
+
<Typography variant="sigma" textColor="neutral600">
|
|
112
|
+
{formatMessage({
|
|
113
|
+
id: 'Settings.application.strapiVersion',
|
|
114
|
+
defaultMessage: 'strapi version',
|
|
115
|
+
})}
|
|
116
|
+
</Typography>
|
|
117
|
+
<Typography as="p">v{strapiVersion}</Typography>
|
|
118
|
+
<Link
|
|
119
|
+
href={
|
|
120
|
+
appInfos.communityEdition
|
|
121
|
+
? 'https://discord.strapi.io'
|
|
122
|
+
: 'https://support.strapi.io/support/home'
|
|
123
|
+
}
|
|
124
|
+
isExternal
|
|
125
|
+
endIcon={<ExternalLink />}
|
|
126
|
+
>
|
|
127
|
+
{formatMessage({
|
|
128
|
+
id: 'Settings.application.get-help',
|
|
129
|
+
defaultMessage: 'Get help',
|
|
130
|
+
})}
|
|
131
|
+
</Link>
|
|
132
|
+
</GridItem>
|
|
133
|
+
<GridItem col={6} s={12}>
|
|
134
|
+
<Typography variant="sigma" textColor="neutral600">
|
|
135
|
+
{formatMessage({
|
|
136
|
+
id: 'Settings.application.edition-title',
|
|
137
|
+
defaultMessage: 'current plan',
|
|
138
|
+
})}
|
|
139
|
+
</Typography>
|
|
140
|
+
<Typography as="p">
|
|
141
|
+
{formatMessage({
|
|
142
|
+
id: currentPlan,
|
|
143
|
+
defaultMessage: `${
|
|
144
|
+
appInfos.communityEdition ? 'Community Edition' : 'Enterprise Edition'
|
|
145
|
+
}`,
|
|
146
|
+
})}
|
|
147
|
+
</Typography>
|
|
148
|
+
</GridItem>
|
|
149
|
+
</Grid>
|
|
94
150
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
151
|
+
<Grid paddingTop={1}>
|
|
152
|
+
<GridItem col={6} s={12}>
|
|
153
|
+
{shouldUpdateStrapi && (
|
|
154
|
+
<Link
|
|
155
|
+
href={`https://github.com/strapi/strapi/releases/tag/${latestStrapiReleaseTag}`}
|
|
156
|
+
isExternal
|
|
157
|
+
endIcon={<ExternalLink />}
|
|
158
|
+
>
|
|
159
|
+
{formatMessage({
|
|
160
|
+
id: 'Settings.application.link-upgrade',
|
|
161
|
+
defaultMessage: 'Upgrade your admin panel',
|
|
162
|
+
})}
|
|
163
|
+
</Link>
|
|
164
|
+
)}
|
|
165
|
+
</GridItem>
|
|
166
|
+
<GridItem col={6} s={12}>
|
|
98
167
|
<Link
|
|
99
|
-
href=
|
|
168
|
+
href="https://strapi.io/pricing-self-hosted"
|
|
100
169
|
isExternal
|
|
101
170
|
endIcon={<ExternalLink />}
|
|
102
171
|
>
|
|
103
172
|
{formatMessage({
|
|
104
|
-
id: 'Settings.application.link-
|
|
105
|
-
defaultMessage: '
|
|
173
|
+
id: 'Settings.application.link-pricing',
|
|
174
|
+
defaultMessage: 'See all pricing plans',
|
|
106
175
|
})}
|
|
107
176
|
</Link>
|
|
108
|
-
|
|
109
|
-
</
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
isExternal
|
|
114
|
-
endIcon={<ExternalLink />}
|
|
115
|
-
>
|
|
177
|
+
</GridItem>
|
|
178
|
+
</Grid>
|
|
179
|
+
|
|
180
|
+
<Box paddingTop={1}>
|
|
181
|
+
<Typography variant="sigma" textColor="neutral600">
|
|
116
182
|
{formatMessage({
|
|
117
|
-
id: 'Settings.application.
|
|
118
|
-
defaultMessage: '
|
|
183
|
+
id: 'Settings.application.node-version',
|
|
184
|
+
defaultMessage: 'node version',
|
|
119
185
|
})}
|
|
120
|
-
</
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
<Typography as="p">{appInfos.nodeVersion}</Typography>
|
|
132
|
-
</Box>
|
|
133
|
-
</Stack>
|
|
134
|
-
</Box>
|
|
186
|
+
</Typography>
|
|
187
|
+
<Typography as="p">{appInfos.nodeVersion}</Typography>
|
|
188
|
+
</Box>
|
|
189
|
+
</Stack>
|
|
190
|
+
</Box>
|
|
191
|
+
{data && (
|
|
192
|
+
<CheckPermissions permissions={permissions}>
|
|
193
|
+
<Form ref={inputsRef} projectSettingsStored={data} />
|
|
194
|
+
</CheckPermissions>
|
|
195
|
+
)}
|
|
196
|
+
</Stack>
|
|
135
197
|
</ContentLayout>
|
|
136
198
|
</Main>
|
|
137
199
|
</Layout>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { axiosInstance } from '../../../../../core/utils';
|
|
2
|
+
import prefixAllUrls from './prefixAllUrls';
|
|
3
|
+
|
|
4
|
+
const fetchProjectSettings = async () => {
|
|
5
|
+
const { data } = await axiosInstance.get('/admin/project-settings');
|
|
6
|
+
|
|
7
|
+
return prefixAllUrls(data);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const postProjectSettings = async body => {
|
|
11
|
+
const { data } = await axiosInstance.post('/admin/project-settings', body);
|
|
12
|
+
|
|
13
|
+
return prefixAllUrls(data);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { fetchProjectSettings, postProjectSettings };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const getFormData = data => {
|
|
2
|
+
const formData = new FormData();
|
|
3
|
+
|
|
4
|
+
Object.entries(data).forEach(([key, value]) => {
|
|
5
|
+
if (value && value.rawFile instanceof File) {
|
|
6
|
+
formData.append(key, value.rawFile);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if (value && value.isReset) {
|
|
10
|
+
formData.append(key, null);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
return formData;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default getFormData;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { DIMENSION, SIZE, ACCEPTED_FORMAT } from './constants';
|
|
2
|
+
|
|
3
|
+
const FILE_FORMAT_ERROR_MESSAGE = {
|
|
4
|
+
id: 'Settings.application.customization.modal.upload.error-format',
|
|
5
|
+
defaultMessage: 'Wrong format uploaded (accepted formats only: jpeg, jpg, png, svg).',
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const FILE_SIZING_ERROR_MESSAGE = {
|
|
9
|
+
id: 'Settings.application.customization.modal.upload.error-size',
|
|
10
|
+
defaultMessage:
|
|
11
|
+
'The file uploaded is too large (max dimension: {dimension}x{dimension}, max file size: {size}KB)',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const getFileDimensions = file => {
|
|
15
|
+
return new Promise(resolve => {
|
|
16
|
+
const reader = new FileReader();
|
|
17
|
+
reader.onload = () => {
|
|
18
|
+
const img = new Image();
|
|
19
|
+
img.onload = function() {
|
|
20
|
+
resolve({ width: img.width, height: img.height });
|
|
21
|
+
};
|
|
22
|
+
img.src = reader.result;
|
|
23
|
+
};
|
|
24
|
+
reader.readAsDataURL(file);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const rawFileToAsset = (rawFile, fileDimensions) => {
|
|
29
|
+
return {
|
|
30
|
+
ext: rawFile.name.split('.').pop(),
|
|
31
|
+
size: rawFile.size / 1000,
|
|
32
|
+
name: rawFile.name,
|
|
33
|
+
url: URL.createObjectURL(rawFile),
|
|
34
|
+
rawFile,
|
|
35
|
+
width: fileDimensions.width,
|
|
36
|
+
height: fileDimensions.height,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const parseFileMetadatas = async file => {
|
|
41
|
+
let error;
|
|
42
|
+
|
|
43
|
+
const isFormatAuthorized = ACCEPTED_FORMAT.includes(file.type);
|
|
44
|
+
|
|
45
|
+
if (!isFormatAuthorized) {
|
|
46
|
+
error = new Error('File format');
|
|
47
|
+
error.displayMessage = FILE_FORMAT_ERROR_MESSAGE;
|
|
48
|
+
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const fileDimensions = await getFileDimensions(file);
|
|
53
|
+
|
|
54
|
+
const areDimensionsAuthorized =
|
|
55
|
+
fileDimensions.width <= DIMENSION && fileDimensions.height <= DIMENSION;
|
|
56
|
+
|
|
57
|
+
if (!areDimensionsAuthorized) {
|
|
58
|
+
error = new Error('File sizing');
|
|
59
|
+
error.displayMessage = FILE_SIZING_ERROR_MESSAGE;
|
|
60
|
+
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const asset = rawFileToAsset(file, fileDimensions);
|
|
65
|
+
|
|
66
|
+
const isSizeAuthorized = asset.size <= SIZE;
|
|
67
|
+
|
|
68
|
+
if (!isSizeAuthorized) {
|
|
69
|
+
error = new Error('File sizing');
|
|
70
|
+
error.displayMessage = FILE_SIZING_ERROR_MESSAGE;
|
|
71
|
+
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return asset;
|
|
76
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import transform from 'lodash/transform';
|
|
2
|
+
import { prefixFileUrlWithBackendUrl } from '@strapi/helper-plugin';
|
|
3
|
+
|
|
4
|
+
const prefixAllUrls = data =>
|
|
5
|
+
transform(
|
|
6
|
+
data,
|
|
7
|
+
(result, value, key) => {
|
|
8
|
+
if (value && value.url) {
|
|
9
|
+
result[key] = { ...value, url: prefixFileUrlWithBackendUrl(value.url) };
|
|
10
|
+
} else {
|
|
11
|
+
result[key] = value;
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
{}
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export default prefixAllUrls;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
|
|
3
|
+
const urlToFile = async url => {
|
|
4
|
+
try {
|
|
5
|
+
const res = await axios.get(url, { responseType: 'blob', timeout: 8000 });
|
|
6
|
+
const loadedFile = new File([res.data], res.config.url, {
|
|
7
|
+
type: res.headers['content-type'],
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
return loadedFile;
|
|
11
|
+
} catch (err) {
|
|
12
|
+
err.displayMessage = {
|
|
13
|
+
id: 'Settings.application.customization.modal.upload.error-network',
|
|
14
|
+
defaultMessage: 'Network error',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
throw err;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default urlToFile;
|
package/admin/src/reducers.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import appReducer from './pages/App/reducer';
|
|
2
1
|
import rbacProviderReducer from './components/RBACProvider/reducer';
|
|
3
|
-
import
|
|
2
|
+
import appReducer from './content-manager/pages/App/reducer';
|
|
4
3
|
import editViewLayoutManagerReducer from './content-manager/pages/EditViewLayoutManager/reducer';
|
|
5
4
|
import listViewReducer from './content-manager/pages/ListView/reducer';
|
|
6
5
|
import rbacManagerReducer from './content-manager/hooks/useSyncRbac/reducer';
|
|
7
6
|
import editViewCrudReducer from './content-manager/sharedReducers/crudReducer/reducer';
|
|
8
7
|
|
|
9
8
|
const contentManagerReducers = {
|
|
10
|
-
'content-manager_app':
|
|
9
|
+
'content-manager_app': appReducer,
|
|
11
10
|
'content-manager_listView': listViewReducer,
|
|
12
11
|
'content-manager_rbacManager': rbacManagerReducer,
|
|
13
12
|
'content-manager_editViewLayoutManager': editViewLayoutManagerReducer,
|
|
@@ -15,7 +14,6 @@ const contentManagerReducers = {
|
|
|
15
14
|
};
|
|
16
15
|
|
|
17
16
|
const reducers = {
|
|
18
|
-
admin_app: appReducer,
|
|
19
17
|
rbacProvider: rbacProviderReducer,
|
|
20
18
|
...contentManagerReducers,
|
|
21
19
|
};
|
|
@@ -99,6 +99,31 @@
|
|
|
99
99
|
"Settings.application.strapi-version": "strapi version",
|
|
100
100
|
"Settings.application.strapiVersion": "strapi version",
|
|
101
101
|
"Settings.application.title": "Overview",
|
|
102
|
+
"Settings.application.customization": "Customization",
|
|
103
|
+
"Settings.application.customization.carousel.title": "Logo",
|
|
104
|
+
"Settings.application.customization.carousel.change-action": "Change logo",
|
|
105
|
+
"Settings.application.customization.carousel.reset-action": "Reset logo",
|
|
106
|
+
"Settings.application.customization.carousel-slide.label": "Logo slide",
|
|
107
|
+
"Settings.application.customization.carousel-hint": "Change the admin panel logo (Max dimension: {dimension}x{dimension}, Max file size: {size}KB)",
|
|
108
|
+
"Settings.application.customization.modal.cancel": "Cancel",
|
|
109
|
+
"Settings.application.customization.modal.upload": "Upload logo",
|
|
110
|
+
"Settings.application.customization.modal.tab.label": "How do you want to upload your assets?",
|
|
111
|
+
"Settings.application.customization.modal.upload.from-computer": "From computer",
|
|
112
|
+
"Settings.application.customization.modal.upload.file-validation": "Max dimension: {dimension}x{dimension}, Max size: {size}KB",
|
|
113
|
+
"Settings.application.customization.modal.upload.error-format": "Wrong format uploaded (accepted formats only: jpeg, jpg, png, svg).",
|
|
114
|
+
"Settings.application.customization.modal.upload.error-size": "The file uploaded is too large (max dimension: {dimension}x{dimension}, max file size: {size}KB)",
|
|
115
|
+
"Settings.application.customization.modal.upload.error-network": "Network error",
|
|
116
|
+
"Settings.application.customization.modal.upload.cta.browse": "Browse files",
|
|
117
|
+
"Settings.application.customization.modal.upload.drag-drop": "Drag and Drop here or",
|
|
118
|
+
"Settings.application.customization.modal.upload.from-url": "From url",
|
|
119
|
+
"Settings.application.customization.modal.upload.from-url.input-label": "URL",
|
|
120
|
+
"Settings.application.customization.modal.upload.next": "Next",
|
|
121
|
+
"Settings.application.customization.modal.pending": "Pending logo",
|
|
122
|
+
"Settings.application.customization.modal.pending.choose-another": "Choose another logo",
|
|
123
|
+
"Settings.application.customization.modal.pending.title": "Logo ready to upload",
|
|
124
|
+
"Settings.application.customization.modal.pending.subtitle": "Manage the chosen logo before uploading it",
|
|
125
|
+
"Settings.application.customization.modal.pending.upload": "Upload logo",
|
|
126
|
+
"Settings.application.customization.modal.pending.card-badge": "image",
|
|
102
127
|
"Settings.error": "Error",
|
|
103
128
|
"Settings.global": "Global Settings",
|
|
104
129
|
"Settings.permissions": "Administration panel",
|
|
@@ -207,6 +232,7 @@
|
|
|
207
232
|
"admin.pages.MarketPlacePage.helmet": "Marketplace - Plugins",
|
|
208
233
|
"admin.pages.MarketPlacePage.offline.title": "You are offline",
|
|
209
234
|
"admin.pages.MarketPlacePage.offline.subtitle": "You need to be connected to the Internet to access Strapi Market.",
|
|
235
|
+
"admin.pages.MarketPlacePage.plugins": "Plugins",
|
|
210
236
|
"admin.pages.MarketPlacePage.plugin.copy": "Copy install command",
|
|
211
237
|
"admin.pages.MarketPlacePage.plugin.copy.success": "Install command ready to be pasted in your terminal",
|
|
212
238
|
"admin.pages.MarketPlacePage.plugin.info": "Learn more",
|
|
@@ -215,11 +241,14 @@
|
|
|
215
241
|
"admin.pages.MarketPlacePage.plugin.installed": "Installed",
|
|
216
242
|
"admin.pages.MarketPlacePage.plugin.tooltip.madeByStrapi": "Made by Strapi",
|
|
217
243
|
"admin.pages.MarketPlacePage.plugin.tooltip.verified": "Plugin verified by Strapi",
|
|
218
|
-
"admin.pages.MarketPlacePage.
|
|
244
|
+
"admin.pages.MarketPlacePage.providers": "Providers",
|
|
245
|
+
"admin.pages.MarketPlacePage.search.clear": "Clear the search",
|
|
219
246
|
"admin.pages.MarketPlacePage.search.empty": "No result for \"{target}\"",
|
|
220
|
-
"admin.pages.MarketPlacePage.search.placeholder": "Search
|
|
221
|
-
"admin.pages.MarketPlacePage.submit.plugin.link": "Submit
|
|
247
|
+
"admin.pages.MarketPlacePage.search.placeholder": "Search",
|
|
248
|
+
"admin.pages.MarketPlacePage.submit.plugin.link": "Submit plugin",
|
|
249
|
+
"admin.pages.MarketPlacePage.submit.provider.link": "Submit provider",
|
|
222
250
|
"admin.pages.MarketPlacePage.subtitle": "Get more out of Strapi",
|
|
251
|
+
"admin.pages.MarketPlacePage.tab-group.label": "Plugins and Providers for Strapi",
|
|
223
252
|
"admin.pages.MarketPlacePage.missingPlugin.title": "Missing a plugin?",
|
|
224
253
|
"admin.pages.MarketPlacePage.missingPlugin.description": "Tell us what plugin you are looking for and we'll let our community plugin developers know in case they are in search for inspiration!",
|
|
225
254
|
"anErrorOccurred": "Woops! Something went wrong. Please, try again.",
|
|
@@ -292,6 +321,7 @@
|
|
|
292
321
|
"app.components.LeftMenu.collapse": "Collapse the navbar",
|
|
293
322
|
"app.components.LeftMenu.expand": "Expand the navbar",
|
|
294
323
|
"app.components.LeftMenu.logout": "Logout",
|
|
324
|
+
"app.components.LeftMenu.logo.alt": "Application logo",
|
|
295
325
|
"app.components.LeftMenu.navbrand.title": "Strapi Dashboard",
|
|
296
326
|
"app.components.LeftMenu.navbrand.workplace": "Workplace",
|
|
297
327
|
"app.components.LeftMenuFooter.help": "Help",
|