@strapi/admin 4.4.0-alpha.0 → 4.4.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/src/StrapiApp.js +12 -4
- package/admin/src/components/Providers/index.js +10 -14
- package/admin/src/content-manager/components/DynamicTable/CellContent/RelationSingle/index.js +1 -1
- package/admin/src/content-manager/components/FieldTypeIcon/index.js +1 -31
- package/admin/src/content-manager/components/Inputs/index.js +10 -30
- package/admin/src/content-manager/components/SelectMany/index.js +3 -0
- package/admin/src/content-manager/components/SelectOne/SingleValue.js +2 -2
- package/admin/src/content-manager/components/SelectOne/index.js +3 -0
- package/admin/src/content-manager/components/SelectWrapper/Option.js +2 -2
- package/admin/src/content-manager/components/SelectWrapper/index.js +6 -0
- package/admin/src/content-manager/pages/EditSettingsView/components/FormModal.js +2 -7
- package/admin/src/content-manager/pages/EditSettingsView/index.js +1 -2
- package/admin/src/content-manager/pages/EditView/index.js +84 -91
- package/admin/src/content-manager/pages/ListSettingsView/index.js +1 -1
- package/admin/src/contexts/ApiTokenPermissions/index.js +24 -0
- package/admin/src/core/apis/index.js +0 -1
- package/admin/src/hooks/index.js +1 -0
- package/admin/src/hooks/useRegenerate/index.js +34 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/ActionBoundRoutes/index.js +56 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/BoundRoute/getMethodColor.js +41 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/BoundRoute/index.js +72 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/CollapsableContentType/CheckBoxWrapper.js +30 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/CollapsableContentType/index.js +150 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/ContenTypesSection/index.js +37 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/Permissions/index.js +40 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/components/Regenerate/index.js +68 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/index.js +452 -180
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/init.js +13 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/reducer.js +55 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/getDateOfExpiration.js +16 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/index.js +5 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/schema.js +2 -1
- package/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/transformPermissionsData.js +36 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/DefaultButton/index.js +63 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/DeleteButton/index.js +1 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/ReadButton/index.js +19 -0
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/UpdateButton/index.js +3 -36
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/DynamicTable/index.js +13 -11
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +4 -3
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/utils/tableHeaders.js +8 -8
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ProtectedEditView/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Roles/ListPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +1 -1
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/EventInput/index.js +10 -10
- package/admin/src/pages/SettingsPage/pages/Webhooks/ListView/index.js +1 -1
- package/admin/src/permissions/defaultPermissions.js +2 -6
- package/admin/src/translations/en.json +18 -0
- package/admin/src/translations/es.json +1 -1
- package/admin/src/translations/fr.json +33 -0
- package/build/1669.d1b29c28.chunk.js +1 -0
- package/build/{1856.d3da2fcd.chunk.js → 1856.47226450.chunk.js} +6 -6
- package/build/{2077.b25a0b57.chunk.js → 2077.61cebc93.chunk.js} +4 -4
- package/build/{2912.da8a70aa.chunk.js → 2912.a015078a.chunk.js} +10 -10
- package/build/4235.982b5799.chunk.js +30 -0
- package/build/{4715.3787be19.chunk.js → 4715.3f6cac0a.chunk.js} +30 -30
- package/build/{4800.d3ebc81d.chunk.js → 4800.d09f1225.chunk.js} +1 -1
- package/build/{4982.a4e36c9a.chunk.js → 4982.c6f88c5d.chunk.js} +8 -8
- package/build/611.a91aff91.chunk.js +158 -0
- package/build/7379.d246dd38.chunk.js +1 -0
- package/build/{7841.922b96eb.chunk.js → 7841.91f793dc.chunk.js} +9 -9
- package/build/{7866.22e3c9f8.chunk.js → 7866.c793a31d.chunk.js} +23 -23
- package/build/{8380.ab3939f3.chunk.js → 8380.8789ff76.chunk.js} +8 -8
- package/build/{8549.0e30f86d.chunk.js → 8549.133c4473.chunk.js} +5 -5
- package/build/{8773.4e36117f.chunk.js → 8773.eccaa5f3.chunk.js} +9 -9
- package/build/{9066.2847fdff.chunk.js → 9066.08049eb1.chunk.js} +4 -4
- package/build/{9166.280c7521.chunk.js → 9166.037339e0.chunk.js} +2 -2
- package/build/{9420.ee1ccff7.chunk.js → 9420.43a86e7c.chunk.js} +30 -30
- package/build/{Admin-authenticatedApp.aaa66872.chunk.js → Admin-authenticatedApp.3a31a087.chunk.js} +3 -3
- package/build/{Admin_homePage.118926e0.chunk.js → Admin_homePage.6d5e3236.chunk.js} +1 -1
- package/build/{Admin_marketplace.2d181ad7.chunk.js → Admin_marketplace.82c0570b.chunk.js} +1 -1
- package/build/{Admin_profilePage.8617313a.chunk.js → Admin_profilePage.83991a6c.chunk.js} +1 -1
- package/build/{Admin_settingsPage.e58753c8.chunk.js → Admin_settingsPage.fc9c607a.chunk.js} +16 -16
- package/build/admin-app.41b6472c.chunk.js +112 -0
- package/build/admin-edit-roles-page.4dd6bcb9.chunk.js +1 -0
- package/build/{admin-users.1d0aa7a0.chunk.js → admin-users.dccd5f4c.chunk.js} +2 -2
- package/build/api-tokens-create-page.29cc87b6.chunk.js +1 -0
- package/build/api-tokens-edit-page.c294a88f.chunk.js +1 -0
- package/build/api-tokens-list-page.bb36535f.chunk.js +16 -0
- package/build/content-manager.fb5ee865.chunk.js +1178 -0
- package/build/content-type-builder-list-view.8cc534e0.chunk.js +194 -0
- package/build/content-type-builder-translation-en-json.201bfb78.chunk.js +1 -0
- package/build/content-type-builder.42cecba9.chunk.js +142 -0
- package/build/{email-settings-page.818761d5.chunk.js → email-settings-page.64037147.chunk.js} +5 -5
- package/build/en-json.a9918c93.chunk.js +1 -0
- package/build/{es-json.bb1fc425.chunk.js → es-json.3a9c7c09.chunk.js} +1 -1
- package/build/fr-json.4ed1fc2c.chunk.js +1 -0
- package/build/{i18n-settings-page.bf1304b0.chunk.js → i18n-settings-page.0b73785d.chunk.js} +5 -5
- package/build/index.html +1 -1
- package/build/{main.7db3414f.js → main.cdfda31e.js} +1235 -1235
- package/build/{runtime~main.c1c5510b.js → runtime~main.fa8f8898.js} +1 -1
- package/build/sso-settings-page.9ceb0140.chunk.js +1 -0
- package/build/{upload-settings.5dfe0fe2.chunk.js → upload-settings.80ff0974.chunk.js} +7 -7
- package/build/upload-translation-ca-json.db8ed7ba.chunk.js +1 -0
- package/build/{users-advanced-settings-page.f11c8af4.chunk.js → users-advanced-settings-page.a02f4806.chunk.js} +5 -5
- package/build/{users-roles-settings-page.cafb4fe5.chunk.js → users-roles-settings-page.b33ec5e5.chunk.js} +1 -1
- package/build/{webhook-edit-page.9aba79b2.chunk.js → webhook-edit-page.9e46fc3f.chunk.js} +3 -3
- package/build/{webhook-list-page.912becb8.chunk.js → webhook-list-page.2775a683.chunk.js} +5 -5
- package/ee/admin/pages/SettingsPage/pages/Roles/ListPage/index.js +1 -1
- package/package.json +14 -13
- package/scripts/build.js +2 -4
- package/server/bootstrap.js +19 -1
- package/server/config/admin-actions.js +20 -0
- package/server/content-types/api-token-permission.js +36 -0
- package/server/content-types/api-token.js +25 -1
- package/server/content-types/index.js +1 -0
- package/server/controllers/api-token.js +24 -1
- package/server/controllers/content-api.js +15 -0
- package/server/controllers/index.js +1 -0
- package/server/routes/api-tokens.js +11 -0
- package/server/routes/content-api.js +20 -0
- package/server/routes/index.js +2 -0
- package/server/services/api-token.js +310 -29
- package/server/services/constants.js +10 -0
- package/server/services/permission/engine.js +36 -226
- package/server/services/permission/permissions-manager/query-builers.js +3 -2
- package/server/services/permission/queries.js +1 -1
- package/server/services/permission.js +4 -1
- package/server/strategies/admin.js +7 -1
- package/server/strategies/api-token.js +71 -11
- package/server/validation/api-tokens.js +12 -2
- package/server/validation/common-functions/check-fields-are-correctly-nested.js +1 -1
- package/admin/src/core/apis/CustomFields.js +0 -80
- package/build/1669.4ce92b2f.chunk.js +0 -1
- package/build/524.2437fb56.chunk.js +0 -644
- package/build/admin-app.1f9e13f8.chunk.js +0 -112
- package/build/admin-edit-roles-page.554ba3fa.chunk.js +0 -1
- package/build/api-tokens-create-page.b4a9987d.chunk.js +0 -1
- package/build/api-tokens-edit-page.6f5b4e26.chunk.js +0 -1
- package/build/api-tokens-list-page.06938769.chunk.js +0 -15
- package/build/content-manager.86f7594d.chunk.js +0 -1178
- package/build/content-type-builder-list-view.9b874fd4.chunk.js +0 -194
- package/build/content-type-builder-translation-en-json.f985c9c4.chunk.js +0 -1
- package/build/content-type-builder.47ab07ad.chunk.js +0 -145
- package/build/en-json.1bf20384.chunk.js +0 -1
- package/build/fr-json.a3cf2e0b.chunk.js +0 -1
- package/build/sso-settings-page.445184e0.chunk.js +0 -1
- package/build/upload-translation-ca-json.00dc1f33.chunk.js +0 -1
- package/server/services/permission/engine-hooks.js +0 -82
package/admin/src/StrapiApp.js
CHANGED
|
@@ -8,7 +8,7 @@ import invariant from 'invariant';
|
|
|
8
8
|
import { Helmet } from 'react-helmet';
|
|
9
9
|
import { basename, createHook } from './core/utils';
|
|
10
10
|
import configureStore from './core/store/configureStore';
|
|
11
|
-
import {
|
|
11
|
+
import { Plugin } from './core/apis';
|
|
12
12
|
import App from './pages/App';
|
|
13
13
|
import AuthLogo from './assets/images/logo_strapi_auth_v4.png';
|
|
14
14
|
import MenuLogo from './assets/images/logo_strapi_menu.png';
|
|
@@ -47,7 +47,6 @@ class StrapiApp {
|
|
|
47
47
|
this.admin = {
|
|
48
48
|
injectionZones,
|
|
49
49
|
};
|
|
50
|
-
this.customFields = customFields;
|
|
51
50
|
|
|
52
51
|
this.menu = [];
|
|
53
52
|
this.settings = {
|
|
@@ -281,7 +280,17 @@ class StrapiApp {
|
|
|
281
280
|
|
|
282
281
|
async initialize() {
|
|
283
282
|
Object.keys(this.appPlugins).forEach((plugin) => {
|
|
284
|
-
this.appPlugins[plugin].register(
|
|
283
|
+
this.appPlugins[plugin].register({
|
|
284
|
+
addComponents: this.addComponents,
|
|
285
|
+
addCorePluginMenuLink: this.addCorePluginMenuLink,
|
|
286
|
+
addFields: this.addFields,
|
|
287
|
+
addMenuLink: this.addMenuLink,
|
|
288
|
+
addMiddlewares: this.addMiddlewares,
|
|
289
|
+
addReducers: this.addReducers,
|
|
290
|
+
createHook: this.createHook,
|
|
291
|
+
createSettingSection: this.createSettingSection,
|
|
292
|
+
registerPlugin: this.registerPlugin,
|
|
293
|
+
});
|
|
285
294
|
});
|
|
286
295
|
}
|
|
287
296
|
|
|
@@ -421,7 +430,6 @@ class StrapiApp {
|
|
|
421
430
|
authLogo={this.configurations.authLogo}
|
|
422
431
|
components={components}
|
|
423
432
|
fields={fields}
|
|
424
|
-
customFields={this.customFields}
|
|
425
433
|
localeNames={localeNames}
|
|
426
434
|
getAdminInjectedComponents={this.getAdminInjectedComponents}
|
|
427
435
|
getPlugin={this.getPlugin}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { QueryClientProvider, QueryClient } from 'react-query';
|
|
4
|
-
import { LibraryProvider,
|
|
4
|
+
import { LibraryProvider, StrapiAppProvider } from '@strapi/helper-plugin';
|
|
5
5
|
import { Provider } from 'react-redux';
|
|
6
6
|
import { AdminContext } from '../../contexts';
|
|
7
7
|
import ConfigurationsProvider from '../ConfigurationsProvider';
|
|
@@ -25,7 +25,6 @@ const Providers = ({
|
|
|
25
25
|
authLogo,
|
|
26
26
|
children,
|
|
27
27
|
components,
|
|
28
|
-
customFields,
|
|
29
28
|
fields,
|
|
30
29
|
getAdminInjectedComponents,
|
|
31
30
|
getPlugin,
|
|
@@ -65,17 +64,15 @@ const Providers = ({
|
|
|
65
64
|
settings={settings}
|
|
66
65
|
>
|
|
67
66
|
<LibraryProvider components={components} fields={fields}>
|
|
68
|
-
<
|
|
69
|
-
<
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
</LanguageProvider>
|
|
78
|
-
</CustomFieldsProvider>
|
|
67
|
+
<LanguageProvider messages={messages} localeNames={localeNames}>
|
|
68
|
+
<AutoReloadOverlayBlockerProvider>
|
|
69
|
+
<OverlayBlocker>
|
|
70
|
+
<GuidedTour>
|
|
71
|
+
<Notifications>{children}</Notifications>
|
|
72
|
+
</GuidedTour>
|
|
73
|
+
</OverlayBlocker>
|
|
74
|
+
</AutoReloadOverlayBlockerProvider>
|
|
75
|
+
</LanguageProvider>
|
|
79
76
|
</LibraryProvider>
|
|
80
77
|
</StrapiAppProvider>
|
|
81
78
|
</ConfigurationsProvider>
|
|
@@ -91,7 +88,6 @@ Providers.propTypes = {
|
|
|
91
88
|
authLogo: PropTypes.oneOfType([PropTypes.string, PropTypes.any]).isRequired,
|
|
92
89
|
children: PropTypes.element.isRequired,
|
|
93
90
|
components: PropTypes.object.isRequired,
|
|
94
|
-
customFields: PropTypes.object.isRequired,
|
|
95
91
|
fields: PropTypes.object.isRequired,
|
|
96
92
|
getAdminInjectedComponents: PropTypes.func.isRequired,
|
|
97
93
|
getPlugin: PropTypes.func.isRequired,
|
package/admin/src/content-manager/components/DynamicTable/CellContent/RelationSingle/index.js
CHANGED
|
@@ -13,7 +13,7 @@ const RelationSingle = ({ metadatas, value }) => {
|
|
|
13
13
|
<TypographyMaxWidth textColor="neutral800" ellipsis>
|
|
14
14
|
<CellValue
|
|
15
15
|
type={metadatas.mainField.schema.type}
|
|
16
|
-
value={value[metadatas.mainField.name]
|
|
16
|
+
value={value[metadatas.mainField.name] ?? value.id}
|
|
17
17
|
/>
|
|
18
18
|
</TypographyMaxWidth>
|
|
19
19
|
);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { Box } from '@strapi/design-system/Box';
|
|
4
|
-
import { useCustomFields } from '@strapi/helper-plugin';
|
|
5
3
|
import Date from '@strapi/icons/Date';
|
|
6
4
|
import Boolean from '@strapi/icons/Boolean';
|
|
7
5
|
import Email from '@strapi/icons/Email';
|
|
@@ -42,38 +40,10 @@ const iconByTypes = {
|
|
|
42
40
|
dynamiczone: <DynamicZone />,
|
|
43
41
|
};
|
|
44
42
|
|
|
45
|
-
const FieldTypeIcon = ({ type
|
|
46
|
-
const customFieldsRegistry = useCustomFields();
|
|
47
|
-
|
|
48
|
-
let Compo = iconByTypes[type];
|
|
49
|
-
|
|
50
|
-
if (customFieldUid) {
|
|
51
|
-
const customField = customFieldsRegistry.get(customFieldUid);
|
|
52
|
-
const CustomFieldIcon = customField.icon;
|
|
53
|
-
|
|
54
|
-
if (CustomFieldIcon) {
|
|
55
|
-
Compo = (
|
|
56
|
-
<Box marginRight={3} width={7} height={6}>
|
|
57
|
-
<CustomFieldIcon />
|
|
58
|
-
</Box>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (!iconByTypes[type]) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return Compo;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
FieldTypeIcon.defaultProps = {
|
|
71
|
-
customFieldUid: null,
|
|
72
|
-
};
|
|
43
|
+
const FieldTypeIcon = ({ type }) => iconByTypes[type] || null;
|
|
73
44
|
|
|
74
45
|
FieldTypeIcon.propTypes = {
|
|
75
46
|
type: PropTypes.string.isRequired,
|
|
76
|
-
customFieldUid: PropTypes.string,
|
|
77
47
|
};
|
|
78
48
|
|
|
79
49
|
export default FieldTypeIcon;
|
|
@@ -5,7 +5,7 @@ import get from 'lodash/get';
|
|
|
5
5
|
import omit from 'lodash/omit';
|
|
6
6
|
import take from 'lodash/take';
|
|
7
7
|
import isEqual from 'react-fast-compare';
|
|
8
|
-
import { GenericInput, NotAllowedInput, useLibrary
|
|
8
|
+
import { GenericInput, NotAllowedInput, useLibrary } from '@strapi/helper-plugin';
|
|
9
9
|
import { useContentTypeLayout } from '../../hooks';
|
|
10
10
|
import { getFieldName } from '../../utils';
|
|
11
11
|
import Wysiwyg from '../Wysiwyg';
|
|
@@ -39,10 +39,9 @@ function Inputs({
|
|
|
39
39
|
const { fields } = useLibrary();
|
|
40
40
|
const { formatMessage } = useIntl();
|
|
41
41
|
const { contentType: currentContentTypeLayout } = useContentTypeLayout();
|
|
42
|
-
const customFieldsRegistry = useCustomFields();
|
|
43
42
|
|
|
44
43
|
const disabled = useMemo(() => !get(metadatas, 'editable', true), [metadatas]);
|
|
45
|
-
const
|
|
44
|
+
const type = fieldSchema.type;
|
|
46
45
|
const error = get(formErrors, [keys], null);
|
|
47
46
|
|
|
48
47
|
const fieldName = useMemo(() => {
|
|
@@ -192,19 +191,6 @@ function Inputs({
|
|
|
192
191
|
return minutes % metadatas.step === 0 ? metadatas.step : step;
|
|
193
192
|
}, [inputType, inputValue, metadatas.step, step]);
|
|
194
193
|
|
|
195
|
-
// Memoize the component to avoid remounting it and losing state
|
|
196
|
-
const CustomFieldInput = useMemo(() => {
|
|
197
|
-
if (customFieldUid) {
|
|
198
|
-
const customField = customFieldsRegistry.get(customFieldUid);
|
|
199
|
-
const CustomFieldInput = React.lazy(customField.components.Input);
|
|
200
|
-
|
|
201
|
-
return CustomFieldInput;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Not a custom field, component won't be used
|
|
205
|
-
return null;
|
|
206
|
-
}, [customFieldUid, customFieldsRegistry]);
|
|
207
|
-
|
|
208
194
|
if (visible === false) {
|
|
209
195
|
return null;
|
|
210
196
|
}
|
|
@@ -258,18 +244,6 @@ function Inputs({
|
|
|
258
244
|
);
|
|
259
245
|
}
|
|
260
246
|
|
|
261
|
-
const customInputs = {
|
|
262
|
-
json: InputJSON,
|
|
263
|
-
uid: InputUID,
|
|
264
|
-
media: fields.media,
|
|
265
|
-
wysiwyg: Wysiwyg,
|
|
266
|
-
...fields,
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
if (customFieldUid) {
|
|
270
|
-
customInputs[customFieldUid] = CustomFieldInput;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
247
|
return (
|
|
274
248
|
<GenericInput
|
|
275
249
|
attribute={fieldSchema}
|
|
@@ -282,7 +256,13 @@ function Inputs({
|
|
|
282
256
|
error={error}
|
|
283
257
|
labelAction={labelAction}
|
|
284
258
|
contentTypeUID={currentContentTypeLayout.uid}
|
|
285
|
-
customInputs={
|
|
259
|
+
customInputs={{
|
|
260
|
+
json: InputJSON,
|
|
261
|
+
uid: InputUID,
|
|
262
|
+
media: fields.media,
|
|
263
|
+
wysiwyg: Wysiwyg,
|
|
264
|
+
...fields,
|
|
265
|
+
}}
|
|
286
266
|
multiple={fieldSchema.multiple || false}
|
|
287
267
|
name={keys}
|
|
288
268
|
onChange={onChange}
|
|
@@ -290,7 +270,7 @@ function Inputs({
|
|
|
290
270
|
placeholder={placeholder ? { id: placeholder, defaultMessage: placeholder } : null}
|
|
291
271
|
required={fieldSchema.required || false}
|
|
292
272
|
step={inputStep}
|
|
293
|
-
type={
|
|
273
|
+
type={inputType}
|
|
294
274
|
// validations={validations}
|
|
295
275
|
value={inputValue}
|
|
296
276
|
withDefaultValue={false}
|
|
@@ -17,6 +17,7 @@ function SelectMany({
|
|
|
17
17
|
name,
|
|
18
18
|
isDisabled,
|
|
19
19
|
isLoading,
|
|
20
|
+
loadingMessage,
|
|
20
21
|
onInputChange,
|
|
21
22
|
onMenuClose,
|
|
22
23
|
onMenuOpen,
|
|
@@ -61,6 +62,7 @@ function SelectMany({
|
|
|
61
62
|
}}
|
|
62
63
|
mainField={mainField}
|
|
63
64
|
isLoading={isLoading}
|
|
65
|
+
loadingMessage={loadingMessage}
|
|
64
66
|
isMulti
|
|
65
67
|
isSearchable
|
|
66
68
|
options={options}
|
|
@@ -119,6 +121,7 @@ SelectMany.propTypes = {
|
|
|
119
121
|
displayNavigationLink: PropTypes.bool.isRequired,
|
|
120
122
|
isDisabled: PropTypes.bool.isRequired,
|
|
121
123
|
isLoading: PropTypes.bool.isRequired,
|
|
124
|
+
loadingMessage: PropTypes.func.isRequired,
|
|
122
125
|
mainField: PropTypes.shape({
|
|
123
126
|
name: PropTypes.string.isRequired,
|
|
124
127
|
schema: PropTypes.shape({
|
|
@@ -43,13 +43,13 @@ const SingleValue = (props) => {
|
|
|
43
43
|
<Component {...props}>
|
|
44
44
|
<Flex>
|
|
45
45
|
<StyledBullet title={title} isDraft={isDraft} />
|
|
46
|
-
<Typography ellipsis>{props.data.label
|
|
46
|
+
<Typography ellipsis>{props.data.label ?? '-'}</Typography>
|
|
47
47
|
</Flex>
|
|
48
48
|
</Component>
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
return <Component {...props}>{props.data.label
|
|
52
|
+
return <Component {...props}>{props.data.label ?? '-'}</Component>;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
SingleValue.propTypes = {
|
|
@@ -14,6 +14,7 @@ function SelectOne({
|
|
|
14
14
|
name,
|
|
15
15
|
isDisabled,
|
|
16
16
|
isLoading,
|
|
17
|
+
loadingMessage,
|
|
17
18
|
onChange,
|
|
18
19
|
onInputChange,
|
|
19
20
|
onMenuClose,
|
|
@@ -37,6 +38,7 @@ function SelectOne({
|
|
|
37
38
|
isClearable
|
|
38
39
|
isDisabled={isDisabled}
|
|
39
40
|
isLoading={isLoading}
|
|
41
|
+
loadingMessage={loadingMessage}
|
|
40
42
|
mainField={mainField}
|
|
41
43
|
options={options}
|
|
42
44
|
onChange={onChange}
|
|
@@ -70,6 +72,7 @@ SelectOne.propTypes = {
|
|
|
70
72
|
components: PropTypes.object,
|
|
71
73
|
isDisabled: PropTypes.bool.isRequired,
|
|
72
74
|
isLoading: PropTypes.bool.isRequired,
|
|
75
|
+
loadingMessage: PropTypes.func.isRequired,
|
|
73
76
|
mainField: PropTypes.shape({
|
|
74
77
|
name: PropTypes.string.isRequired,
|
|
75
78
|
schema: PropTypes.shape({
|
|
@@ -41,13 +41,13 @@ const Option = (props) => {
|
|
|
41
41
|
<Component {...props}>
|
|
42
42
|
<Flex>
|
|
43
43
|
<StyledBullet title={title} isDraft={isDraft} />
|
|
44
|
-
<Typography ellipsis>{props.label
|
|
44
|
+
<Typography ellipsis>{props.label ?? '-'}</Typography>
|
|
45
45
|
</Flex>
|
|
46
46
|
</Component>
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
return <Component {...props}>{props.label
|
|
50
|
+
return <Component {...props}>{props.label ?? '-'}</Component>;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
Option.defaultProps = {
|
|
@@ -282,6 +282,12 @@ function SelectWrapper({
|
|
|
282
282
|
isDisabled={isDisabled}
|
|
283
283
|
isLoading={isLoading}
|
|
284
284
|
isClearable
|
|
285
|
+
loadingMessage={() =>
|
|
286
|
+
formatMessage({
|
|
287
|
+
id: getTrad('DynamicTable.relation-loading'),
|
|
288
|
+
defaultMessage: 'Relations are loading',
|
|
289
|
+
})
|
|
290
|
+
}
|
|
285
291
|
mainField={mainField}
|
|
286
292
|
move={moveRelation}
|
|
287
293
|
name={name}
|
|
@@ -26,7 +26,7 @@ const HeaderContainer = styled(Flex)`
|
|
|
26
26
|
}
|
|
27
27
|
`;
|
|
28
28
|
|
|
29
|
-
const FormModal = ({ onToggle, onMetaChange, onSizeChange, onSubmit, type
|
|
29
|
+
const FormModal = ({ onToggle, onMetaChange, onSizeChange, onSubmit, type }) => {
|
|
30
30
|
const { selectedField } = useLayoutDnd();
|
|
31
31
|
const { formatMessage } = useIntl();
|
|
32
32
|
|
|
@@ -47,7 +47,7 @@ const FormModal = ({ onToggle, onMetaChange, onSizeChange, onSubmit, type, custo
|
|
|
47
47
|
<form onSubmit={onSubmit}>
|
|
48
48
|
<ModalHeader>
|
|
49
49
|
<HeaderContainer>
|
|
50
|
-
<FieldTypeIcon type={getAttrType()}
|
|
50
|
+
<FieldTypeIcon type={getAttrType(type)} />
|
|
51
51
|
<Typography fontWeight="bold" textColor="neutral800" as="h2" id="title">
|
|
52
52
|
{formatMessage(
|
|
53
53
|
{
|
|
@@ -81,12 +81,7 @@ const FormModal = ({ onToggle, onMetaChange, onSizeChange, onSubmit, type, custo
|
|
|
81
81
|
);
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
-
FormModal.defaultProps = {
|
|
85
|
-
customFieldUid: null,
|
|
86
|
-
};
|
|
87
|
-
|
|
88
84
|
FormModal.propTypes = {
|
|
89
|
-
customFieldUid: PropTypes.string,
|
|
90
85
|
onSubmit: PropTypes.func.isRequired,
|
|
91
86
|
onToggle: PropTypes.func.isRequired,
|
|
92
87
|
onMetaChange: PropTypes.func.isRequired,
|
|
@@ -371,10 +371,9 @@ const EditSettingsView = ({ mainLayout, components, isContentTypeView, slug, upd
|
|
|
371
371
|
<ModalForm
|
|
372
372
|
onSubmit={handleMetaSubmit}
|
|
373
373
|
onToggle={handleToggleModal}
|
|
374
|
+
type={get(attributes, [metaToEdit, 'type'], '')}
|
|
374
375
|
onMetaChange={handleMetaChange}
|
|
375
376
|
onSizeChange={handleSizeChange}
|
|
376
|
-
type={get(attributes, [metaToEdit, 'type'], '')}
|
|
377
|
-
customFieldUid={get(attributes, [metaToEdit, 'customField'], '')}
|
|
378
377
|
/>
|
|
379
378
|
)}
|
|
380
379
|
</Main>
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { memo, useCallback, useMemo } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import get from 'lodash/get';
|
|
4
|
-
import {
|
|
5
|
-
CheckPermissions,
|
|
6
|
-
LoadingIndicatorPage,
|
|
7
|
-
useTracking,
|
|
8
|
-
LinkButton,
|
|
9
|
-
} from '@strapi/helper-plugin';
|
|
4
|
+
import { CheckPermissions, useTracking, LinkButton } from '@strapi/helper-plugin';
|
|
10
5
|
import { useIntl } from 'react-intl';
|
|
11
6
|
import { ContentLayout } from '@strapi/design-system/Layout';
|
|
12
7
|
import { Box } from '@strapi/design-system/Box';
|
|
@@ -136,101 +131,99 @@ const EditView = ({
|
|
|
136
131
|
<ContentLayout>
|
|
137
132
|
<Grid gap={4}>
|
|
138
133
|
<GridItem col={9} s={12}>
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
0: {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
} = row;
|
|
148
|
-
|
|
149
|
-
return (
|
|
150
|
-
<Box key={index}>
|
|
151
|
-
<Grid gap={4}>
|
|
152
|
-
<GridItem col={12} s={12} xs={12}>
|
|
153
|
-
<DynamicZone
|
|
154
|
-
name={name}
|
|
155
|
-
fieldSchema={fieldSchema}
|
|
156
|
-
labelAction={labelAction}
|
|
157
|
-
metadatas={metadatas}
|
|
158
|
-
/>
|
|
159
|
-
</GridItem>
|
|
160
|
-
</Grid>
|
|
161
|
-
</Box>
|
|
162
|
-
);
|
|
163
|
-
}
|
|
134
|
+
<Stack spacing={6}>
|
|
135
|
+
{formattedContentTypeLayout.map((row, index) => {
|
|
136
|
+
if (isDynamicZone(row)) {
|
|
137
|
+
const {
|
|
138
|
+
0: {
|
|
139
|
+
0: { name, fieldSchema, metadatas, labelAction },
|
|
140
|
+
},
|
|
141
|
+
} = row;
|
|
164
142
|
|
|
165
143
|
return (
|
|
166
|
-
<Box
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
<Grid gap={4} key={gridIndex}>
|
|
181
|
-
{grid.map(
|
|
182
|
-
({ fieldSchema, labelAction, metadatas, name, size }) => {
|
|
183
|
-
const isComponent = fieldSchema.type === 'component';
|
|
144
|
+
<Box key={index}>
|
|
145
|
+
<Grid gap={4}>
|
|
146
|
+
<GridItem col={12} s={12} xs={12}>
|
|
147
|
+
<DynamicZone
|
|
148
|
+
name={name}
|
|
149
|
+
fieldSchema={fieldSchema}
|
|
150
|
+
labelAction={labelAction}
|
|
151
|
+
metadatas={metadatas}
|
|
152
|
+
/>
|
|
153
|
+
</GridItem>
|
|
154
|
+
</Grid>
|
|
155
|
+
</Box>
|
|
156
|
+
);
|
|
157
|
+
}
|
|
184
158
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
159
|
+
return (
|
|
160
|
+
<Box
|
|
161
|
+
key={index}
|
|
162
|
+
hasRadius
|
|
163
|
+
background="neutral0"
|
|
164
|
+
shadow="tableShadow"
|
|
165
|
+
paddingLeft={6}
|
|
166
|
+
paddingRight={6}
|
|
167
|
+
paddingTop={6}
|
|
168
|
+
paddingBottom={6}
|
|
169
|
+
borderColor="neutral150"
|
|
170
|
+
>
|
|
171
|
+
<Stack spacing={6}>
|
|
172
|
+
{row.map((grid, gridIndex) => {
|
|
173
|
+
return (
|
|
174
|
+
<Grid gap={4} key={gridIndex}>
|
|
175
|
+
{grid.map(
|
|
176
|
+
({ fieldSchema, labelAction, metadatas, name, size }) => {
|
|
177
|
+
const isComponent = fieldSchema.type === 'component';
|
|
193
178
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
defaultMessage: metadatas.label,
|
|
203
|
-
}}
|
|
204
|
-
max={max}
|
|
205
|
-
min={min}
|
|
206
|
-
name={name}
|
|
207
|
-
required={required}
|
|
208
|
-
/>
|
|
209
|
-
</GridItem>
|
|
210
|
-
);
|
|
211
|
-
}
|
|
179
|
+
if (isComponent) {
|
|
180
|
+
const {
|
|
181
|
+
component,
|
|
182
|
+
max,
|
|
183
|
+
min,
|
|
184
|
+
repeatable = false,
|
|
185
|
+
required = false,
|
|
186
|
+
} = fieldSchema;
|
|
212
187
|
|
|
213
188
|
return (
|
|
214
|
-
<GridItem col={size}
|
|
215
|
-
<
|
|
216
|
-
|
|
217
|
-
keys={name}
|
|
189
|
+
<GridItem col={size} s={12} xs={12} key={component}>
|
|
190
|
+
<FieldComponent
|
|
191
|
+
componentUid={component}
|
|
218
192
|
labelAction={labelAction}
|
|
219
|
-
|
|
193
|
+
isRepeatable={repeatable}
|
|
194
|
+
intlLabel={{
|
|
195
|
+
id: metadatas.label,
|
|
196
|
+
defaultMessage: metadatas.label,
|
|
197
|
+
}}
|
|
198
|
+
max={max}
|
|
199
|
+
min={min}
|
|
200
|
+
name={name}
|
|
201
|
+
required={required}
|
|
220
202
|
/>
|
|
221
203
|
</GridItem>
|
|
222
204
|
);
|
|
223
205
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
<GridItem col={size} key={name} s={12} xs={12}>
|
|
209
|
+
<Inputs
|
|
210
|
+
fieldSchema={fieldSchema}
|
|
211
|
+
keys={name}
|
|
212
|
+
labelAction={labelAction}
|
|
213
|
+
metadatas={metadatas}
|
|
214
|
+
/>
|
|
215
|
+
</GridItem>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
)}
|
|
219
|
+
</Grid>
|
|
220
|
+
);
|
|
221
|
+
})}
|
|
222
|
+
</Stack>
|
|
223
|
+
</Box>
|
|
224
|
+
);
|
|
225
|
+
})}
|
|
226
|
+
</Stack>
|
|
234
227
|
</GridItem>
|
|
235
228
|
<GridItem col={3} s={12}>
|
|
236
229
|
<Stack spacing={2}>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { createContext, useContext } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
const ApiTokenPermissionsContext = createContext({});
|
|
5
|
+
|
|
6
|
+
const ApiTokenPermissionsContextProvider = ({ children, ...rest }) => {
|
|
7
|
+
return (
|
|
8
|
+
<ApiTokenPermissionsContext.Provider value={rest}>
|
|
9
|
+
{children}
|
|
10
|
+
</ApiTokenPermissionsContext.Provider>
|
|
11
|
+
);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const useApiTokenPermissionsContext = () => useContext(ApiTokenPermissionsContext);
|
|
15
|
+
|
|
16
|
+
ApiTokenPermissionsContextProvider.propTypes = {
|
|
17
|
+
children: PropTypes.node.isRequired,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
ApiTokenPermissionsContext,
|
|
22
|
+
ApiTokenPermissionsContextProvider,
|
|
23
|
+
useApiTokenPermissionsContext,
|
|
24
|
+
};
|
package/admin/src/hooks/index.js
CHANGED
|
@@ -9,3 +9,4 @@ export { default as useSettingsForm } from './useSettingsForm';
|
|
|
9
9
|
export { default as usePermissionsDataManager } from './usePermissionsDataManager';
|
|
10
10
|
export { default as useReleaseNotification } from './useReleaseNotification';
|
|
11
11
|
export { default as useThemeToggle } from './useThemeToggle';
|
|
12
|
+
export { default as useRegenerate } from './useRegenerate';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { get } from 'lodash';
|
|
3
|
+
import { useNotification } from '@strapi/helper-plugin';
|
|
4
|
+
import { axiosInstance } from '../../core/utils';
|
|
5
|
+
|
|
6
|
+
const useRegenerate = (id, onRegenerate) => {
|
|
7
|
+
const [isLoadingConfirmation, setIsLoadingConfirmation] = useState(false);
|
|
8
|
+
const toggleNotification = useNotification();
|
|
9
|
+
|
|
10
|
+
const regenerateData = async () => {
|
|
11
|
+
try {
|
|
12
|
+
const {
|
|
13
|
+
data: {
|
|
14
|
+
data: { accessKey },
|
|
15
|
+
},
|
|
16
|
+
} = await axiosInstance.post(`/admin/api-tokens/${id}/regenerate`);
|
|
17
|
+
setIsLoadingConfirmation(false);
|
|
18
|
+
onRegenerate(accessKey);
|
|
19
|
+
} catch (error) {
|
|
20
|
+
setIsLoadingConfirmation(false);
|
|
21
|
+
toggleNotification({
|
|
22
|
+
type: 'warning',
|
|
23
|
+
message: get(error, 'response.data.message', 'notification.error'),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
regenerateData,
|
|
30
|
+
isLoadingConfirmation,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default useRegenerate;
|