mirror of
https://github.com/strapi/strapi.git
synced 2025-11-11 07:39:16 +00:00
parent
37d6a3464d
commit
d1acb7df39
@ -36,13 +36,7 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
|
|||||||
|
|
||||||
const toggleModalForm = () => setIsModalFormOpen(prevState => !prevState);
|
const toggleModalForm = () => setIsModalFormOpen(prevState => !prevState);
|
||||||
|
|
||||||
const {
|
const { labelForm, labelToEdit, initialData, modifiedData, isLoading } = reducerState.toJS();
|
||||||
labelForm,
|
|
||||||
labelToEdit,
|
|
||||||
initialData,
|
|
||||||
modifiedData,
|
|
||||||
isLoading,
|
|
||||||
} = reducerState.toJS();
|
|
||||||
|
|
||||||
const abortController = new AbortController();
|
const abortController = new AbortController();
|
||||||
const { signal } = abortController;
|
const { signal } = abortController;
|
||||||
@ -82,8 +76,7 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
|
|||||||
return get(modifiedData, ['schema', 'info', 'name'], '');
|
return get(modifiedData, ['schema', 'info', 'name'], '');
|
||||||
}, [modifiedData]);
|
}, [modifiedData]);
|
||||||
|
|
||||||
const getListDisplayedFields = () =>
|
const getListDisplayedFields = () => get(modifiedData, ['layouts', 'list'], []);
|
||||||
get(modifiedData, ['layouts', 'list'], []);
|
|
||||||
|
|
||||||
const getListRemainingFields = () => {
|
const getListRemainingFields = () => {
|
||||||
const metadatas = get(modifiedData, ['metadatas'], {});
|
const metadatas = get(modifiedData, ['metadatas'], {});
|
||||||
@ -93,10 +86,7 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
|
|||||||
.filter(key => {
|
.filter(key => {
|
||||||
const type = get(attributes, [key, 'type'], '');
|
const type = get(attributes, [key, 'type'], '');
|
||||||
|
|
||||||
return (
|
return !['json', 'component', 'richtext', 'relation'].includes(type) && !!type;
|
||||||
!['json', 'component', 'richtext', 'relation'].includes(type) &&
|
|
||||||
!!type
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.filter(field => {
|
.filter(field => {
|
||||||
return !getListDisplayedFields().includes(field);
|
return !getListDisplayedFields().includes(field);
|
||||||
@ -137,6 +127,7 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
|
|||||||
try {
|
try {
|
||||||
const body = cloneDeep(modifiedData);
|
const body = cloneDeep(modifiedData);
|
||||||
|
|
||||||
|
delete body.apiID;
|
||||||
delete body.schema;
|
delete body.schema;
|
||||||
delete body.uid;
|
delete body.uid;
|
||||||
|
|
||||||
@ -171,9 +162,7 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
|
|||||||
<div className="col-6" style={{ marginBottom: 4 }}>
|
<div className="col-6" style={{ marginBottom: 4 }}>
|
||||||
<FormattedMessage id={`${pluginId}.form.Input.label`}>
|
<FormattedMessage id={`${pluginId}.form.Input.label`}>
|
||||||
{label => (
|
{label => (
|
||||||
<FormattedMessage
|
<FormattedMessage id={`${pluginId}.form.Input.label.inputDescription`}>
|
||||||
id={`${pluginId}.form.Input.label.inputDescription`}
|
|
||||||
>
|
|
||||||
{description => (
|
{description => (
|
||||||
<Input
|
<Input
|
||||||
description={description}
|
description={description}
|
||||||
@ -238,11 +227,7 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{getListDisplayedFields().map((item, index) => {
|
{getListDisplayedFields().map((item, index) => {
|
||||||
const label = get(
|
const label = get(modifiedData, ['metadatas', item, 'list', 'label'], '');
|
||||||
modifiedData,
|
|
||||||
['metadatas', item, 'list', 'label'],
|
|
||||||
''
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Label
|
<Label
|
||||||
@ -258,9 +243,7 @@ const ListSettingsView = ({ deleteLayout, slug }) => {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
if (getListDisplayedFields().length === 1) {
|
if (getListDisplayedFields().length === 1) {
|
||||||
strapi.notification.info(
|
strapi.notification.info(`${pluginId}.notification.info.minimumFields`);
|
||||||
`${pluginId}.notification.info.minimumFields`
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'REMOVE_FIELD',
|
type: 'REMOVE_FIELD',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user