mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 10:23:34 +00:00
Fix conflicts
This commit is contained in:
commit
d60b5c5b34
@ -106,4 +106,4 @@
|
||||
"webpack-hot-middleware": "^2.18.2",
|
||||
"whatwg-fetch": "^2.0.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
* SettingsPage
|
||||
*/
|
||||
|
||||
@ -8,7 +8,7 @@ import { connect } from 'react-redux';
|
||||
import { bindActionCreators, compose } from 'redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import cn from 'classnames';
|
||||
import { get, isObject, sortBy } from 'lodash';
|
||||
import { get, sortBy } from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
import { onChange, onSubmit, onReset } from 'containers/App/actions';
|
||||
import { makeSelectModifiedSchema, makeSelectSubmitSuccess } from 'containers/App/selectors';
|
||||
@ -36,23 +36,23 @@ class SettingsPage extends React.PureComponent {
|
||||
componentWillUnmount() {
|
||||
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) => {
|
||||
if (curr !== 'plugins') {
|
||||
|
||||
if (!data[curr].fields && isObject(data[curr])) {
|
||||
return this.getModels(data[curr], `${destination}${curr}/`, acc);
|
||||
|
||||
if (!data[curr].fields && _.isObject(data[curr])) {
|
||||
return acc.concat(this.getModels(data[curr], `${destination}${curr}/`));
|
||||
}
|
||||
|
||||
|
||||
return acc.concat([{ name: curr, destination: `${destination}${curr}` }]);
|
||||
}
|
||||
|
||||
return this.getModels(data[curr], `${destination}${curr}/`, acc);
|
||||
}, init);
|
||||
}
|
||||
|
||||
return acc.concat(this.getModels(data[curr], `${destination}${curr}/`));
|
||||
}, []);
|
||||
|
||||
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'],
|
||||
);
|
||||
}
|
||||
|
||||
@ -51,12 +51,12 @@ module.exports = async cb => {
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
// Reference all current models
|
||||
const appModels = Object.keys(pluginsModel).reduce((acc, curr) => {
|
||||
const models = Object.keys(_.get(pluginsModel, [curr, 'models'], {}));
|
||||
|
||||
return acc.concat(models);
|
||||
}, Object.keys(strapi.models).filter(m => m !== 'core_store'));
|
||||
|
||||
// Init schema
|
||||
const schema = {
|
||||
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
|
||||
_.unset(fields, fieldsToRemove);
|
||||
fieldsToRemove.forEach(field => {
|
||||
_.unset(fields, field);
|
||||
});
|
||||
schemaModel.attributes = _.omit(schemaModel.attributes, fieldsToRemove);
|
||||
|
||||
schemaModel.fields = fields;
|
||||
@ -231,7 +233,7 @@ module.exports = async cb => {
|
||||
try {
|
||||
// Retrieve the previous schema from the db
|
||||
const prevSchema = await pluginStore.get({ key: 'schema' });
|
||||
|
||||
|
||||
// If no schema stored
|
||||
if (!prevSchema) {
|
||||
_.set(schema, 'layout', tempLayout);
|
||||
@ -240,9 +242,11 @@ module.exports = async cb => {
|
||||
|
||||
return cb();
|
||||
} 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)) {
|
||||
_.unset(prevSchema, ['layout', model]);
|
||||
}
|
||||
@ -383,4 +387,4 @@ module.exports = async cb => {
|
||||
}
|
||||
|
||||
cb();
|
||||
};
|
||||
};
|
||||
@ -23,8 +23,8 @@ import {
|
||||
size,
|
||||
split,
|
||||
take,
|
||||
toNumber,
|
||||
toLower,
|
||||
toNumber,
|
||||
replace,
|
||||
} from 'lodash';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
@ -26,7 +26,8 @@ module.exports = async cb => {
|
||||
fs.readdir(path.join(basePath, 'node_modules'), async (err, node_modules) => {
|
||||
// get all email providers
|
||||
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
|
||||
|
||||
@ -26,7 +26,8 @@ module.exports = async cb => {
|
||||
fs.readdir(path.join(basePath, 'node_modules'), async (err, node_modules) => {
|
||||
// get all upload provider
|
||||
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
|
||||
|
||||
@ -12,9 +12,9 @@ module.exports = {
|
||||
|
||||
const result = this.aggregate(aggregateStages);
|
||||
|
||||
if (_.has(filters, 'start')) result.skip(filters.start);
|
||||
if (_.has(filters, 'limit')) result.limit(filters.limit);
|
||||
if (_.has(filters, 'sort')) result.sort(filters.sort);
|
||||
if (_.has(filters, 'start') && filters.start) result.skip(filters.start);
|
||||
if (_.has(filters, 'limit') && filters.limit) result.limit(filters.limit);
|
||||
if (_.has(filters, 'sort') && filters.sort) result.sort(filters.sort);
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
@ -56,4 +56,4 @@
|
||||
"npm": ">= 5.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
@ -584,7 +584,7 @@ module.exports = {
|
||||
};
|
||||
} else if (model.attributes[key]) {
|
||||
field = model.attributes[key];
|
||||
} else {
|
||||
} else if (typeof key === 'string') {
|
||||
// Remove the filter keyword at the end
|
||||
let splitKey = key.split('_').slice(0, -1);
|
||||
splitKey = splitKey.join('_');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user