mirror of
https://github.com/strapi/strapi.git
synced 2025-11-06 21:29:24 +00:00
Fix conflicts
Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
commit
e105592943
@ -2,12 +2,7 @@ import React, { useState } from 'react';
|
|||||||
import { useParams, useRouteMatch } from 'react-router-dom';
|
import { useParams, useRouteMatch } from 'react-router-dom';
|
||||||
import { Header as PluginHeader } from '@buffetjs/custom';
|
import { Header as PluginHeader } from '@buffetjs/custom';
|
||||||
|
|
||||||
import {
|
import { PopUpWarning, request, templateObject, useGlobalContext } from 'strapi-helper-plugin';
|
||||||
PopUpWarning,
|
|
||||||
request,
|
|
||||||
templateObject,
|
|
||||||
useGlobalContext,
|
|
||||||
} from 'strapi-helper-plugin';
|
|
||||||
import { get } from 'lodash';
|
import { get } from 'lodash';
|
||||||
import pluginId from '../../pluginId';
|
import pluginId from '../../pluginId';
|
||||||
import useDataManager from '../../hooks/useDataManager';
|
import useDataManager from '../../hooks/useDataManager';
|
||||||
@ -30,15 +25,13 @@ const Header = () => {
|
|||||||
slug,
|
slug,
|
||||||
clearData,
|
clearData,
|
||||||
} = useDataManager();
|
} = useDataManager();
|
||||||
const isSingleType = useRouteMatch('/plugins/content-manager/singleType');
|
const {
|
||||||
|
params: { contentType },
|
||||||
|
} = useRouteMatch('/plugins/content-manager/:contentType');
|
||||||
|
const isSingleType = contentType === 'singleType';
|
||||||
|
|
||||||
const currentContentTypeMainField = get(
|
const currentContentTypeMainField = get(layout, ['settings', 'mainField'], 'id');
|
||||||
layout,
|
|
||||||
['settings', 'mainField'],
|
|
||||||
'id'
|
|
||||||
);
|
|
||||||
const currentContentTypeName = get(layout, ['schema', 'info', 'name']);
|
const currentContentTypeName = get(layout, ['schema', 'info', 'name']);
|
||||||
const apiId = layout.uid.split('.')[1];
|
|
||||||
const isCreatingEntry = id === 'create';
|
const isCreatingEntry = id === 'create';
|
||||||
|
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
@ -46,8 +39,7 @@ const Header = () => {
|
|||||||
? formatMessage({
|
? formatMessage({
|
||||||
id: `${pluginId}.containers.Edit.pluginHeader.title.new`,
|
id: `${pluginId}.containers.Edit.pluginHeader.title.new`,
|
||||||
})
|
})
|
||||||
: templateObject({ mainField: currentContentTypeMainField }, initialData)
|
: templateObject({ mainField: currentContentTypeMainField }, initialData).mainField;
|
||||||
.mainField;
|
|
||||||
/* eslint-enable indent */
|
/* eslint-enable indent */
|
||||||
const headerTitle = isSingleType ? currentContentTypeName : entryHeaderTitle;
|
const headerTitle = isSingleType ? currentContentTypeName : entryHeaderTitle;
|
||||||
|
|
||||||
@ -106,9 +98,7 @@ const Header = () => {
|
|||||||
title: {
|
title: {
|
||||||
label: headerTitle && headerTitle.toString(),
|
label: headerTitle && headerTitle.toString(),
|
||||||
},
|
},
|
||||||
content: isSingleType
|
content: isSingleType ? `${formatMessage({ id: `${pluginId}.api.id` })} : ${layout.apiID}` : '',
|
||||||
? `${formatMessage({ id: `${pluginId}.api.id` })} : ${apiId}`
|
|
||||||
: '',
|
|
||||||
actions: getHeaderActions(),
|
actions: getHeaderActions(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,4 @@
|
|||||||
import React, {
|
import React, { memo, useCallback, useMemo, useEffect, useReducer, useRef } from 'react';
|
||||||
memo,
|
|
||||||
useCallback,
|
|
||||||
useMemo,
|
|
||||||
useEffect,
|
|
||||||
useReducer,
|
|
||||||
useRef,
|
|
||||||
} from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { get } from 'lodash';
|
import { get } from 'lodash';
|
||||||
import { useHistory, useLocation, useRouteMatch } from 'react-router-dom';
|
import { useHistory, useLocation, useRouteMatch } from 'react-router-dom';
|
||||||
@ -28,31 +21,22 @@ import reducer, { initialState } from './reducer';
|
|||||||
|
|
||||||
/* eslint-disable react/no-array-index-key */
|
/* eslint-disable react/no-array-index-key */
|
||||||
|
|
||||||
const EditView = ({
|
const EditView = ({ components, currentEnvironment, layouts, plugins, slug }) => {
|
||||||
components,
|
|
||||||
currentEnvironment,
|
|
||||||
layouts,
|
|
||||||
plugins,
|
|
||||||
slug,
|
|
||||||
}) => {
|
|
||||||
const formatLayoutRef = useRef();
|
const formatLayoutRef = useRef();
|
||||||
formatLayoutRef.current = createAttributesLayout;
|
formatLayoutRef.current = createAttributesLayout;
|
||||||
// Retrieve push to programmatically navigate between views
|
// Retrieve push to programmatically navigate between views
|
||||||
const { push } = useHistory();
|
const { push } = useHistory();
|
||||||
// Retrieve the search and the pathname
|
// Retrieve the search and the pathname
|
||||||
const { search, pathname } = useLocation();
|
const { search, pathname } = useLocation();
|
||||||
const isSingleType = useRouteMatch('/plugins/content-manager/singleType');
|
const {
|
||||||
const [reducerState, dispatch] = useReducer(reducer, initialState, () =>
|
params: { contentType },
|
||||||
init(initialState)
|
} = useRouteMatch('/plugins/content-manager/:contentType');
|
||||||
);
|
const isSingleType = contentType === 'singleType';
|
||||||
const allLayoutData = useMemo(() => get(layouts, [slug], {}), [
|
const [reducerState, dispatch] = useReducer(reducer, initialState, () => init(initialState));
|
||||||
layouts,
|
const allLayoutData = useMemo(() => get(layouts, [slug], {}), [layouts, slug]);
|
||||||
slug,
|
const currentContentTypeLayoutData = useMemo(() => get(allLayoutData, ['contentType'], {}), [
|
||||||
|
allLayoutData,
|
||||||
]);
|
]);
|
||||||
const currentContentTypeLayoutData = useMemo(
|
|
||||||
() => get(allLayoutData, ['contentType'], {}),
|
|
||||||
[allLayoutData]
|
|
||||||
);
|
|
||||||
const currentContentTypeLayout = useMemo(
|
const currentContentTypeLayout = useMemo(
|
||||||
() => get(currentContentTypeLayoutData, ['layouts', 'edit'], []),
|
() => get(currentContentTypeLayoutData, ['layouts', 'edit'], []),
|
||||||
[currentContentTypeLayoutData]
|
[currentContentTypeLayoutData]
|
||||||
@ -68,11 +52,7 @@ const EditView = ({
|
|||||||
|
|
||||||
const getFieldMetas = useCallback(
|
const getFieldMetas = useCallback(
|
||||||
fieldName => {
|
fieldName => {
|
||||||
return get(
|
return get(currentContentTypeLayoutData, ['metadatas', fieldName, 'edit'], {});
|
||||||
currentContentTypeLayoutData,
|
|
||||||
['metadatas', fieldName, 'edit'],
|
|
||||||
{}
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
[currentContentTypeLayoutData]
|
[currentContentTypeLayoutData]
|
||||||
);
|
);
|
||||||
@ -117,10 +97,7 @@ const EditView = ({
|
|||||||
});
|
});
|
||||||
}, [currentContentTypeLayout, currentContentTypeSchema.attributes]);
|
}, [currentContentTypeLayout, currentContentTypeSchema.attributes]);
|
||||||
|
|
||||||
const {
|
const { formattedContentTypeLayout, isDraggingComponent } = reducerState.toJS();
|
||||||
formattedContentTypeLayout,
|
|
||||||
isDraggingComponent,
|
|
||||||
} = reducerState.toJS();
|
|
||||||
|
|
||||||
// We can't use the getQueryParameters helper here because the search
|
// We can't use the getQueryParameters helper here because the search
|
||||||
// can contain 'redirectUrl' several times since we can navigate between documents
|
// can contain 'redirectUrl' several times since we can navigate between documents
|
||||||
@ -166,14 +143,7 @@ const EditView = ({
|
|||||||
} = block;
|
} = block;
|
||||||
const { max, min } = getField(name);
|
const { max, min } = getField(name);
|
||||||
|
|
||||||
return (
|
return <DynamicZone key={blockIndex} name={name} max={max} min={min} />;
|
||||||
<DynamicZone
|
|
||||||
key={blockIndex}
|
|
||||||
name={name}
|
|
||||||
max={max}
|
|
||||||
min={min}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -182,23 +152,14 @@ const EditView = ({
|
|||||||
return (
|
return (
|
||||||
<div className="row" key={fieldsBlockIndex}>
|
<div className="row" key={fieldsBlockIndex}>
|
||||||
{fieldsBlock.map(({ name, size }, fieldIndex) => {
|
{fieldsBlock.map(({ name, size }, fieldIndex) => {
|
||||||
const isComponent =
|
const isComponent = getFieldType(name) === 'component';
|
||||||
getFieldType(name) === 'component';
|
|
||||||
|
|
||||||
if (isComponent) {
|
if (isComponent) {
|
||||||
const componentUid = getFieldComponentUid(name);
|
const componentUid = getFieldComponentUid(name);
|
||||||
const isRepeatable = get(
|
const isRepeatable = get(getField(name), 'repeatable', false);
|
||||||
getField(name),
|
|
||||||
'repeatable',
|
|
||||||
false
|
|
||||||
);
|
|
||||||
const { max, min } = getField(name);
|
const { max, min } = getField(name);
|
||||||
|
|
||||||
const label = get(
|
const label = get(getFieldMetas(name), 'label', componentUid);
|
||||||
getFieldMetas(name),
|
|
||||||
'label',
|
|
||||||
componentUid
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FieldComponent
|
<FieldComponent
|
||||||
@ -217,9 +178,7 @@ const EditView = ({
|
|||||||
<div className={`col-${size}`} key={name}>
|
<div className={`col-${size}`} key={name}>
|
||||||
<Inputs
|
<Inputs
|
||||||
autoFocus={
|
autoFocus={
|
||||||
blockIndex === 0 &&
|
blockIndex === 0 && fieldsBlockIndex === 0 && fieldIndex === 0
|
||||||
fieldsBlockIndex === 0 &&
|
|
||||||
fieldIndex === 0
|
|
||||||
}
|
}
|
||||||
keys={name}
|
keys={name}
|
||||||
layout={currentContentTypeLayoutData}
|
layout={currentContentTypeLayoutData}
|
||||||
@ -239,9 +198,7 @@ const EditView = ({
|
|||||||
|
|
||||||
<div className="col-md-12 col-lg-3">
|
<div className="col-md-12 col-lg-3">
|
||||||
{currentContentTypeLayoutRelations.length > 0 && (
|
{currentContentTypeLayoutRelations.length > 0 && (
|
||||||
<SubWrapper
|
<SubWrapper style={{ padding: '0 20px 1px', marginBottom: '25px' }}>
|
||||||
style={{ padding: '0 20px 1px', marginBottom: '25px' }}
|
|
||||||
>
|
|
||||||
<div style={{ paddingTop: '22px' }}>
|
<div style={{ paddingTop: '22px' }}>
|
||||||
{currentContentTypeLayoutRelations.map(relationName => {
|
{currentContentTypeLayoutRelations.map(relationName => {
|
||||||
const relation = get(
|
const relation = get(
|
||||||
|
|||||||
@ -2,11 +2,7 @@ import { cloneDeep, get, isEmpty, isEqual, set } from 'lodash';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React, { useEffect, useReducer, useState } from 'react';
|
import React, { useEffect, useReducer, useState } from 'react';
|
||||||
import { Prompt, useParams, useRouteMatch } from 'react-router-dom';
|
import { Prompt, useParams, useRouteMatch } from 'react-router-dom';
|
||||||
import {
|
import { LoadingIndicatorPage, request, useGlobalContext } from 'strapi-helper-plugin';
|
||||||
LoadingIndicatorPage,
|
|
||||||
request,
|
|
||||||
useGlobalContext,
|
|
||||||
} from 'strapi-helper-plugin';
|
|
||||||
import EditViewDataManagerContext from '../../contexts/EditViewDataManager';
|
import EditViewDataManagerContext from '../../contexts/EditViewDataManager';
|
||||||
import pluginId from '../../pluginId';
|
import pluginId from '../../pluginId';
|
||||||
import init from './init';
|
import init from './init';
|
||||||
@ -21,12 +17,7 @@ import {
|
|||||||
|
|
||||||
const getRequestUrl = path => `/${pluginId}/explorer/${path}`;
|
const getRequestUrl = path => `/${pluginId}/explorer/${path}`;
|
||||||
|
|
||||||
const EditViewDataManagerProvider = ({
|
const EditViewDataManagerProvider = ({ allLayoutData, children, redirectToPreviousPage, slug }) => {
|
||||||
allLayoutData,
|
|
||||||
children,
|
|
||||||
redirectToPreviousPage,
|
|
||||||
slug,
|
|
||||||
}) => {
|
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
// Retrieve the search
|
// Retrieve the search
|
||||||
const [reducerState, dispatch] = useReducer(reducer, initialState, init);
|
const [reducerState, dispatch] = useReducer(reducer, initialState, init);
|
||||||
@ -44,7 +35,10 @@ const EditViewDataManagerProvider = ({
|
|||||||
const abortController = new AbortController();
|
const abortController = new AbortController();
|
||||||
const { signal } = abortController;
|
const { signal } = abortController;
|
||||||
const { emitEvent, formatMessage } = useGlobalContext();
|
const { emitEvent, formatMessage } = useGlobalContext();
|
||||||
const isSingleType = useRouteMatch('/plugins/content-manager/singleType');
|
const {
|
||||||
|
params: { contentType },
|
||||||
|
} = useRouteMatch('/plugins/content-manager/:contentType');
|
||||||
|
const isSingleType = contentType === 'singleType';
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isLoading) {
|
if (!isLoading) {
|
||||||
@ -75,9 +69,7 @@ const EditViewDataManagerProvider = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const componentsDataStructure = Object.keys(
|
const componentsDataStructure = Object.keys(allLayoutData.components).reduce((acc, current) => {
|
||||||
allLayoutData.components
|
|
||||||
).reduce((acc, current) => {
|
|
||||||
acc[current] = createDefaultForm(
|
acc[current] = createDefaultForm(
|
||||||
get(allLayoutData, ['components', current, 'schema', 'attributes'], {}),
|
get(allLayoutData, ['components', current, 'schema', 'attributes'], {}),
|
||||||
allLayoutData.components
|
allLayoutData.components
|
||||||
@ -114,11 +106,7 @@ const EditViewDataManagerProvider = ({
|
|||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [id, slug, isCreatingEntry]);
|
}, [id, slug, isCreatingEntry]);
|
||||||
|
|
||||||
const addComponentToDynamicZone = (
|
const addComponentToDynamicZone = (keys, componentUid, shouldCheckErrors = false) => {
|
||||||
keys,
|
|
||||||
componentUid,
|
|
||||||
shouldCheckErrors = false
|
|
||||||
) => {
|
|
||||||
emitEvent('addComponentToDynamicZone');
|
emitEvent('addComponentToDynamicZone');
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'ADD_COMPONENT_TO_DYNAMIC_ZONE',
|
type: 'ADD_COMPONENT_TO_DYNAMIC_ZONE',
|
||||||
@ -144,11 +132,7 @@ const EditViewDataManagerProvider = ({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRepeatableComponentToField = (
|
const addRepeatableComponentToField = (keys, componentUid, shouldCheckErrors = false) => {
|
||||||
keys,
|
|
||||||
componentUid,
|
|
||||||
shouldCheckErrors = false
|
|
||||||
) => {
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'ADD_REPEATABLE_COMPONENT_TO_FIELD',
|
type: 'ADD_REPEATABLE_COMPONENT_TO_FIELD',
|
||||||
keys: keys.split('.'),
|
keys: keys.split('.'),
|
||||||
@ -358,9 +342,7 @@ const EditViewDataManagerProvider = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const shouldCheckDZErrors = dzName => {
|
const shouldCheckDZErrors = dzName => {
|
||||||
const doesDZHaveError = Object.keys(formErrors).some(
|
const doesDZHaveError = Object.keys(formErrors).some(key => key.split('.')[0] === dzName);
|
||||||
key => key.split('.')[0] === dzName
|
|
||||||
);
|
|
||||||
const shouldCheckErrors = !isEmpty(formErrors) && doesDZHaveError;
|
const shouldCheckErrors = !isEmpty(formErrors) && doesDZHaveError;
|
||||||
|
|
||||||
return shouldCheckErrors;
|
return shouldCheckErrors;
|
||||||
|
|||||||
@ -2,12 +2,8 @@ import React, { Suspense, lazy, useEffect, useRef } from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { bindActionCreators, compose } from 'redux';
|
import { bindActionCreators, compose } from 'redux';
|
||||||
import { Switch, Route } from 'react-router-dom';
|
import { Switch, Route, useRouteMatch } from 'react-router-dom';
|
||||||
import {
|
import { LoadingIndicatorPage, useGlobalContext, request } from 'strapi-helper-plugin';
|
||||||
LoadingIndicatorPage,
|
|
||||||
useGlobalContext,
|
|
||||||
request,
|
|
||||||
} from 'strapi-helper-plugin';
|
|
||||||
import { DndProvider } from 'react-dnd';
|
import { DndProvider } from 'react-dnd';
|
||||||
import HTML5Backend from 'react-dnd-html5-backend';
|
import HTML5Backend from 'react-dnd-html5-backend';
|
||||||
import pluginId from '../../pluginId';
|
import pluginId from '../../pluginId';
|
||||||
@ -25,12 +21,8 @@ import reducer from './reducer';
|
|||||||
import makeSelectMain from './selectors';
|
import makeSelectMain from './selectors';
|
||||||
|
|
||||||
const EditSettingsView = lazy(() => import('../EditSettingsView'));
|
const EditSettingsView = lazy(() => import('../EditSettingsView'));
|
||||||
const CollectionTypeRecursivePath = lazy(() =>
|
const CollectionTypeRecursivePath = lazy(() => import('../CollectionTypeRecursivePath'));
|
||||||
import('../CollectionTypeRecursivePath')
|
const SingleTypeRecursivePath = lazy(() => import('../SingleTypeRecursivePath'));
|
||||||
);
|
|
||||||
const SingleTypeRecursivePath = lazy(() =>
|
|
||||||
import('../SingleTypeRecursivePath')
|
|
||||||
);
|
|
||||||
|
|
||||||
function Main({
|
function Main({
|
||||||
deleteLayout,
|
deleteLayout,
|
||||||
@ -50,7 +42,9 @@ function Main({
|
|||||||
strapi.useInjectReducer({ key: 'main', reducer, pluginId });
|
strapi.useInjectReducer({ key: 'main', reducer, pluginId });
|
||||||
|
|
||||||
const { emitEvent } = useGlobalContext();
|
const { emitEvent } = useGlobalContext();
|
||||||
const slug = pathname.split('/')[4];
|
const {
|
||||||
|
params: { slug },
|
||||||
|
} = useRouteMatch('/plugins/content-manager/:contentType/:slug');
|
||||||
const getDataRef = useRef();
|
const getDataRef = useRef();
|
||||||
const getLayoutRef = useRef();
|
const getLayoutRef = useRef();
|
||||||
const resetPropsRef = useRef();
|
const resetPropsRef = useRef();
|
||||||
@ -74,10 +68,9 @@ function Main({
|
|||||||
|
|
||||||
getLayoutRef.current = async uid => {
|
getLayoutRef.current = async uid => {
|
||||||
try {
|
try {
|
||||||
const { data: layout } = await request(
|
const { data: layout } = await request(getRequestUrl(`content-types/${uid}`), {
|
||||||
getRequestUrl(`content-types/${uid}`),
|
method: 'GET',
|
||||||
{ method: 'GET' }
|
});
|
||||||
);
|
|
||||||
|
|
||||||
getLayoutSucceeded(layout, uid);
|
getLayoutSucceeded(layout, uid);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -86,8 +79,7 @@ function Main({
|
|||||||
};
|
};
|
||||||
resetPropsRef.current = resetProps;
|
resetPropsRef.current = resetProps;
|
||||||
|
|
||||||
const shouldShowLoader =
|
const shouldShowLoader = !pathname.includes('ctm-configurations/') && layouts[slug] === undefined;
|
||||||
!pathname.includes('ctm-configurations/') && layouts[slug] === undefined;
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getDataRef.current();
|
getDataRef.current();
|
||||||
@ -114,9 +106,7 @@ function Main({
|
|||||||
deleteLayouts={deleteLayouts}
|
deleteLayouts={deleteLayouts}
|
||||||
emitEvent={emitEvent}
|
emitEvent={emitEvent}
|
||||||
components={components}
|
components={components}
|
||||||
componentsAndModelsMainPossibleMainFields={
|
componentsAndModelsMainPossibleMainFields={componentsAndModelsMainPossibleMainFields}
|
||||||
componentsAndModelsMainPossibleMainFields
|
|
||||||
}
|
|
||||||
layouts={layouts}
|
layouts={layouts}
|
||||||
models={models}
|
models={models}
|
||||||
plugins={plugins}
|
plugins={plugins}
|
||||||
|
|||||||
@ -2,10 +2,7 @@
|
|||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
|
||||||
const {
|
const { createModelConfigurationSchema, validateKind } = require('./validation');
|
||||||
createModelConfigurationSchema,
|
|
||||||
validateKind,
|
|
||||||
} = require('./validation');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
/**
|
/**
|
||||||
@ -27,10 +24,7 @@ module.exports = {
|
|||||||
if (uid.startsWith('strapi::')) return false;
|
if (uid.startsWith('strapi::')) return false;
|
||||||
if (uid === 'plugins::upload.file') return false;
|
if (uid === 'plugins::upload.file') return false;
|
||||||
|
|
||||||
if (
|
if (kind && _.get(strapi.contentTypes[uid], 'kind', 'collectionType') !== kind) {
|
||||||
kind &&
|
|
||||||
_.get(strapi.contentTypes[uid], 'kind', 'collectionType') !== kind
|
|
||||||
) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,14 +57,14 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const service = strapi.plugins['content-manager'].services.contenttypes;
|
const service = strapi.plugins['content-manager'].services.contenttypes;
|
||||||
const componentService =
|
const componentService = strapi.plugins['content-manager'].services.components;
|
||||||
strapi.plugins['content-manager'].services.components;
|
|
||||||
|
|
||||||
const contentTypeConfigurations = await service.getConfiguration(uid);
|
const contentTypeConfigurations = await service.getConfiguration(uid);
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
contentType: {
|
contentType: {
|
||||||
uid,
|
uid,
|
||||||
|
apiID: contentType.modelName,
|
||||||
schema: service.formatContentTypeSchema(contentType),
|
schema: service.formatContentTypeSchema(contentType),
|
||||||
...contentTypeConfigurations,
|
...contentTypeConfigurations,
|
||||||
},
|
},
|
||||||
@ -104,10 +98,7 @@ module.exports = {
|
|||||||
|
|
||||||
let input;
|
let input;
|
||||||
try {
|
try {
|
||||||
input = await createModelConfigurationSchema(
|
input = await createModelConfigurationSchema(contentType, schema).validate(body, {
|
||||||
contentType,
|
|
||||||
schema
|
|
||||||
).validate(body, {
|
|
||||||
abortEarly: false,
|
abortEarly: false,
|
||||||
stripUnknown: true,
|
stripUnknown: true,
|
||||||
strict: true,
|
strict: true,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user