Store config in core_store

This commit is contained in:
cyril lopez 2018-06-28 09:31:17 +02:00
parent 039d9e5856
commit 4aa46c5d0f
2 changed files with 11 additions and 3 deletions

View File

@ -35,6 +35,11 @@ module.exports = async cb => {
label: _.upperFirst(name), label: _.upperFirst(name),
labelPlural: _.upperFirst(pluralize(name)), labelPlural: _.upperFirst(pluralize(name)),
orm: model.orm || 'mongoose', orm: model.orm || 'mongoose',
search: true,
filters: true,
bulkActions: true,
pageEntries: 20,
defaultSort: 'id'
}; };
// Fields (non relation) // Fields (non relation)
@ -50,10 +55,11 @@ module.exports = async cb => {
// schemaModel.list = _.slice(_.keys(schemaModel.fields), 0, 4); // schemaModel.list = _.slice(_.keys(schemaModel.fields), 0, 4);
schemaModel.listDisplay = Object.keys(schemaModel.fields) schemaModel.listDisplay = Object.keys(schemaModel.fields)
// Construct Array of attr ex { type: 'string', label: 'Foo', name: 'Foo', description: '' } // Construct Array of attr ex { type: 'string', label: 'Foo', name: 'Foo', description: '' }
.map(attr => Object.assign(schemaModel.fields[attr], { name: attr })) // NOTE: Do we allow sort on boolean?
.map(attr => Object.assign(schemaModel.fields[attr], { name: attr, sortable: true, searchable: true }))
// Retrieve only the fourth first items // Retrieve only the fourth first items
.slice(0, 4); .slice(0, 4);
if (model.associations) { if (model.associations) {
// Model relations // Model relations
schemaModel.relations = model.associations.reduce((acc, current) => { schemaModel.relations = model.associations.reduce((acc, current) => {
@ -101,7 +107,6 @@ module.exports = async cb => {
}); });
const buildSchemaKeys = (data) => Object.keys(data).reduce((acc, curr) => { const buildSchemaKeys = (data) => 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])) {

View File

@ -6,6 +6,9 @@
}, },
"json": { "json": {
"appearance": "" "appearance": ""
},
"bool": {
"appearance": ""
} }
} }
} }