Merge branch 'master' into fix-fetch-user

This commit is contained in:
Jim LAURIE 2018-11-27 16:53:00 +01:00 committed by GitHub
commit a39ec8c3ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
/**
*
*
* SettingsPage
*/
@ -36,23 +36,23 @@ class SettingsPage extends React.PureComponent {
componentWillUnmount() {
this.props.onReset();
}
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}/`);
return acc.concat(this.getModels(data[curr], `${destination}${curr}/`));
}
return acc.concat([{ name: curr, destination: `${destination}${curr}` }]);
}
return this.getModels(data[curr], `${destination}${curr}/`);
}
return acc.concat(this.getModels(data[curr], `${destination}${curr}/`));
}, []);
return sortBy(
models.filter(obj => obj.name !== 'permission' && obj.name !== 'role'),
models.filter(obj => !!this.props.schema.layout[obj.name]),
['name'],
);
}