mirror of
https://github.com/strapi/strapi.git
synced 2025-11-09 22:59:14 +00:00
Fix conflicts
This commit is contained in:
commit
d60b5c5b34
@ -8,7 +8,7 @@ import { connect } from 'react-redux';
|
|||||||
import { bindActionCreators, compose } from 'redux';
|
import { bindActionCreators, compose } from 'redux';
|
||||||
import { createStructuredSelector } from 'reselect';
|
import { createStructuredSelector } from 'reselect';
|
||||||
import cn from 'classnames';
|
import cn from 'classnames';
|
||||||
import { get, isObject, sortBy } from 'lodash';
|
import { get, sortBy } from 'lodash';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { onChange, onSubmit, onReset } from 'containers/App/actions';
|
import { onChange, onSubmit, onReset } from 'containers/App/actions';
|
||||||
import { makeSelectModifiedSchema, makeSelectSubmitSuccess } from 'containers/App/selectors';
|
import { makeSelectModifiedSchema, makeSelectSubmitSuccess } from 'containers/App/selectors';
|
||||||
@ -37,22 +37,22 @@ class SettingsPage extends React.PureComponent {
|
|||||||
this.props.onReset();
|
this.props.onReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
getModels = (data = this.props.schema.models, destination = '/', init = []) => {
|
getModels = (data = this.props.schema.models, destination = '/') => {
|
||||||
const models = Object.keys(data).reduce((acc, curr) => {
|
const models = Object.keys(data).reduce((acc, curr) => {
|
||||||
if (curr !== 'plugins') {
|
if (curr !== 'plugins') {
|
||||||
|
|
||||||
if (!data[curr].fields && isObject(data[curr])) {
|
if (!data[curr].fields && _.isObject(data[curr])) {
|
||||||
return this.getModels(data[curr], `${destination}${curr}/`, acc);
|
return acc.concat(this.getModels(data[curr], `${destination}${curr}/`));
|
||||||
}
|
}
|
||||||
|
|
||||||
return acc.concat([{ name: curr, destination: `${destination}${curr}` }]);
|
return acc.concat([{ name: curr, destination: `${destination}${curr}` }]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.getModels(data[curr], `${destination}${curr}/`, acc);
|
return acc.concat(this.getModels(data[curr], `${destination}${curr}/`));
|
||||||
}, init);
|
}, []);
|
||||||
|
|
||||||
return sortBy(
|
return sortBy(
|
||||||
models.filter(obj => obj.name !== 'permission' && obj.name !== 'role' && !(obj.name === 'file' && obj.destination === '/plugins/upload/file')),
|
models.filter(obj => !!this.props.schema.layout[obj.name]),
|
||||||
['name'],
|
['name'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,12 +51,12 @@ module.exports = async cb => {
|
|||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
// Reference all current models
|
||||||
const appModels = Object.keys(pluginsModel).reduce((acc, curr) => {
|
const appModels = Object.keys(pluginsModel).reduce((acc, curr) => {
|
||||||
const models = Object.keys(_.get(pluginsModel, [curr, 'models'], {}));
|
const models = Object.keys(_.get(pluginsModel, [curr, 'models'], {}));
|
||||||
|
|
||||||
return acc.concat(models);
|
return acc.concat(models);
|
||||||
}, Object.keys(strapi.models).filter(m => m !== 'core_store'));
|
}, Object.keys(strapi.models).filter(m => m !== 'core_store'));
|
||||||
|
|
||||||
// Init schema
|
// Init schema
|
||||||
const schema = {
|
const schema = {
|
||||||
generalSettings: {
|
generalSettings: {
|
||||||
@ -110,7 +110,9 @@ module.exports = async cb => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Don't display fields that are hidden by default like the resetPasswordToken for the model user
|
// Don't display fields that are hidden by default like the resetPasswordToken for the model user
|
||||||
_.unset(fields, fieldsToRemove);
|
fieldsToRemove.forEach(field => {
|
||||||
|
_.unset(fields, field);
|
||||||
|
});
|
||||||
schemaModel.attributes = _.omit(schemaModel.attributes, fieldsToRemove);
|
schemaModel.attributes = _.omit(schemaModel.attributes, fieldsToRemove);
|
||||||
|
|
||||||
schemaModel.fields = fields;
|
schemaModel.fields = fields;
|
||||||
@ -240,9 +242,11 @@ module.exports = async cb => {
|
|||||||
|
|
||||||
return cb();
|
return cb();
|
||||||
} else {
|
} else {
|
||||||
const layoutModels = Object.keys(_.get(prevSchema, 'layout'));
|
const modelsLayout = Object.keys(_.get(prevSchema, 'layout', {}));
|
||||||
|
|
||||||
layoutModels.forEach(model => {
|
// Remove previous model from the schema.layout
|
||||||
|
// Usually needed when renaming a model
|
||||||
|
modelsLayout.forEach(model => {
|
||||||
if (!appModels.includes(model)) {
|
if (!appModels.includes(model)) {
|
||||||
_.unset(prevSchema, ['layout', model]);
|
_.unset(prevSchema, ['layout', model]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,8 +23,8 @@ import {
|
|||||||
size,
|
size,
|
||||||
split,
|
split,
|
||||||
take,
|
take,
|
||||||
toNumber,
|
|
||||||
toLower,
|
toLower,
|
||||||
|
toNumber,
|
||||||
replace,
|
replace,
|
||||||
} from 'lodash';
|
} from 'lodash';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|||||||
@ -26,7 +26,8 @@ module.exports = async cb => {
|
|||||||
fs.readdir(path.join(basePath, 'node_modules'), async (err, node_modules) => {
|
fs.readdir(path.join(basePath, 'node_modules'), async (err, node_modules) => {
|
||||||
// get all email providers
|
// get all email providers
|
||||||
const emails = _.filter(node_modules, (node_module) => {
|
const emails = _.filter(node_modules, (node_module) => {
|
||||||
return _.startsWith(node_module, ('strapi-provider-email'));
|
// DEPRECATED strapi-email-* will be remove in next version
|
||||||
|
return _.startsWith(node_module, 'strapi-provider-email') || _.startsWith(node_module, 'strapi-email');
|
||||||
});
|
});
|
||||||
|
|
||||||
// mount all providers to get configs
|
// mount all providers to get configs
|
||||||
|
|||||||
@ -26,7 +26,8 @@ module.exports = async cb => {
|
|||||||
fs.readdir(path.join(basePath, 'node_modules'), async (err, node_modules) => {
|
fs.readdir(path.join(basePath, 'node_modules'), async (err, node_modules) => {
|
||||||
// get all upload provider
|
// get all upload provider
|
||||||
const uploads = _.filter(node_modules, (node_module) => {
|
const uploads = _.filter(node_modules, (node_module) => {
|
||||||
return _.startsWith(node_module, ('strapi-provider-upload'));
|
// DEPRECATED strapi-upload-* will be remove in next version
|
||||||
|
return _.startsWith(node_module, 'strapi-provider-upload') || _.startsWith(node_module, 'strapi-upload');
|
||||||
});
|
});
|
||||||
|
|
||||||
// mount all providers to get configs
|
// mount all providers to get configs
|
||||||
|
|||||||
@ -12,9 +12,9 @@ module.exports = {
|
|||||||
|
|
||||||
const result = this.aggregate(aggregateStages);
|
const result = this.aggregate(aggregateStages);
|
||||||
|
|
||||||
if (_.has(filters, 'start')) result.skip(filters.start);
|
if (_.has(filters, 'start') && filters.start) result.skip(filters.start);
|
||||||
if (_.has(filters, 'limit')) result.limit(filters.limit);
|
if (_.has(filters, 'limit') && filters.limit) result.limit(filters.limit);
|
||||||
if (_.has(filters, 'sort')) result.sort(filters.sort);
|
if (_.has(filters, 'sort') && filters.sort) result.sort(filters.sort);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -584,7 +584,7 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
} else if (model.attributes[key]) {
|
} else if (model.attributes[key]) {
|
||||||
field = model.attributes[key];
|
field = model.attributes[key];
|
||||||
} else {
|
} else if (typeof key === 'string') {
|
||||||
// Remove the filter keyword at the end
|
// Remove the filter keyword at the end
|
||||||
let splitKey = key.split('_').slice(0, -1);
|
let splitKey = key.split('_').slice(0, -1);
|
||||||
splitKey = splitKey.join('_');
|
splitKey = splitKey.join('_');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user