2
0
Fork 0

WIP open file for a while

This commit is contained in:
Willem 2017-06-10 16:53:29 +02:00
parent f937019e42
commit d280fb9af3
122 changed files with 5702 additions and 10 deletions

View file

@ -0,0 +1,28 @@
module.exports = (function () {
return function DefaultTEntityPlugin() {
this.configPlugin = function (ctx) {
ctx.key = 'defaultTEntity';
ctx.description = 'Adds the basic data and structure of the tentity.';
ctx.localDir = __dirname;
ctx.localConfigTemplate = 'default-tentity.json';
};
this.fillTEntity = function(ctx) {
if (ctx.tentity === undefined) {
throw new Error('no tentity');
}
if (ctx.tentity.tid === undefined) {
throw new Error('no tentity.tid');
}
if (ctx.tentity.tid === null) {
throw new Error('null tentity.tid');
}
if (ctx.tentity.tid.length === 0) {
throw new Error('empty tentity.tid');
}
};
};
})();

View file

@ -0,0 +1,83 @@
{
"masterTEntityTemplate": {
"tid": null,
"tname": null,
"tplural": null,
"tslug": null,
"tenable": null,
"tcode": null,
"tkeys": [],
"troles": [],
"tparent": null,
"tchilds": [],
"tlist": {
"tenable": null,
"ttext": "Listing of ..",
"troles": [],
"tmethods": ["GET"],
"tplugin": {}
},
"tcreate": {
"tenable": null,
"ttext": null,
"troles": [],
"tmethods": ["POST"],
"tplugin": {}
},
"tedit": {
"tenable": null,
"ttext": null,
"troles": [],
"tmethods": ["PUT","POST"],
"tplugin": {}
},
"tread": {
"tenable": null,
"ttext": null,
"troles": [],
"tslug": null,
"tmethods": ["GET"],
"tplugin": {}
},
"tdelete": {
"tenable": null,
"ttext": null,
"troles": [],
"tmethods": ["DELETE","POST"],
"tplugin": {}
},
"tcount": {
"tenable": null,
"ttext": "Count records",
"troles": [],
"tmethods": ["GET"],
"tplugin": {}
},
"tverify": {
"tenable": null,
"ttext": "Verify data",
"troles": [],
"tmethods": ["POST"],
"tplugin": {}
},
"tmeta": {
"tmodel": {
"tkey": null,
"tkeys": [],
"tid": null,
"tbackend": null
},
"tmenu": {
"tenable": null,
"tkey": null,
"tname": null,
"titem": null,
"ticon": null
},
"troles": [],
"tfields": {},
"tplugin": {}
}
},
"masterTEntityTHelp": {}
}

View file

@ -0,0 +1,32 @@
module.exports = (function () {
return function DefaultTFieldPlugin() {
this.configPlugin = function (ctx) {
ctx.key = 'defaultTField';
ctx.description = 'Adds the basic data and structure of the tfield.';
ctx.localDir = __dirname;
ctx.localConfigTemplate = 'default-tfield.json';
};
this.fillTField = function(ctx) {
if (ctx.tfield === undefined) {
throw new Error('no tfield');
}
if (ctx.tfield.tid === undefined) {
throw new Error('no tfield.tid');
}
if (ctx.tfield.tid === null) {
throw new Error('null tfield.tid');
}
if (ctx.tfield.tid.length === 0) {
throw new Error('empty tfield.tid');
}
if (ctx.tfield.ttype === null) {
ctx.tfield.ttype = 'text'; // move ?
}
};
};
})();

View file

@ -0,0 +1,54 @@
{
"masterTFieldTemplate": {
"tid": null,
"tname": null,
"ttext": null,
"ttype": null,
"tslug": null,
"tvalidate": {
"io": null
},
"tlist": {
"tenable": true,
"troles": []
},
"tread": {
"tenable": true,
"troles": []
},
"tedit": {
"tenable": true,
"troles": []
},
"tcreate": {
"tenable": true,
"troles": []
}
},
"masterTFieldTHelp": {
"tid": "The id of the field.",
"tname": "The name of the field.",
"ttext": "The description of the field.",
"ttype": "The field type",
"tslug": "The slug of the field.",
"tvalidate": {
"io": "Named validate-io rules for the field."
},
"tlist": {
"tenable": "Is field enabled in crud listing.",
"troles": "Needed roles for listing."
},
"tread": {
"tenable": "Is field enabled in crud reading.",
"troles": "Needed roles for reading."
},
"tedit": {
"tenable": "Is field enabled in crud editing.",
"troles": "Needed roles for editing."
},
"tcreate": {
"tenable": "Is field enabled in crud creating.",
"troles": "Needed roles for creating."
}
}
}

View file

@ -0,0 +1,13 @@
module.exports = (function () {
return function DefaultTServerPlugin() {
this.configPlugin = function (ctx) {
ctx.key = 'defaultTServer';
ctx.description = 'Adds the basic data and structure of the tserver.';
ctx.localDir = __dirname;
ctx.localConfigTemplate = 'default-tserver.json';
};
};
})();

View file

@ -0,0 +1,44 @@
{
"masterTEntityTemplate": {
"tlist": { "tserver": {
"tpipe": {
"query": {
"defaults": { "limit": 10 },
"maxes": { "limit": 50 }
}
}
}},
"tmeta": { "tserver": {
"thost": "http://localhost:8080",
"tslugs": {
"tbase": "/api",
"tserver": "server",
"tentity": "tentity",
"tplugin": "plugin"
},
"tpopfix": true,
"tformats": ["formatJSON","formatXML","formatCSV","serverConfigTView","angular"],
"tapi": {
"cors": true,
"timeoute": 30000
}
}}
},
"masterTEntityTHelp": {
"tmeta": { "tserver": {
"thost": "The host of the server.",
"tslugs": {
"tbase": "The base api prefix slug",
"tserver": "The server slug",
"tentity": "The tentity slug",
"tplugin": "The plugin slug"
},
"tpopfix": "Use tech or format first.",
"tformats": "list of exported formats.",
"tapi": {
"cors": "Allow cors requests on api.",
"timeoute": "Timeout of api requests."
}
}}
}
}

View file

@ -0,0 +1,38 @@
module.exports = (function () {
var addFilteredFields = function(tview,type,tcrud) {
//debug('addFilterFields of: '+type+' from: '+tview.tid);
result = [];
var keys = Object.keys(tcrud.tmeta.tfields);
var result = [];
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var tfield = tcrud.tmeta.tfields[key];
if (tfield[type]) {
if (!tfield[type].tenable) {
continue;
}
}
result.push(key); // default is true..
}
tview[type].tfields = result;
};
return function DefaultTViewPlugin() {
this.configPlugin = function (ctx) {
ctx.key = 'defaultTView';
ctx.description = 'Add copy template for building the tview from the tentity.';
ctx.localDir = __dirname;
ctx.localConfigTemplate = 'default-tview.json';
};
this.fillTView = function(ctx) {
addFilteredFields(ctx.tview,'tlist',ctx.tentity);
addFilteredFields(ctx.tview,'tread',ctx.tentity);
addFilteredFields(ctx.tview,'tedit',ctx.tentity);
addFilteredFields(ctx.tview,'tcreate',ctx.tentity);
};
};
})();

View file

@ -0,0 +1,135 @@
{
"masterTViewTemplate": {
"tid": null,
"tname": null,
"tplural": null,
"tslug": null,
"tcode": null,
"tenable": null,
"troles": null,
"tkeys": [],
"tcount": {
"ttext": null,
"tenable": null,
"troles": null,
"tmethods": null,
"tplugin": null
},
"tlist": {
"tfields": [],
"ttext": null,
"tlinks": null,
"tenable": null,
"troles": null,
"tmethods": null,
"tplugin": null
},
"tread": {
"tfields": [],
"ttext": null,
"tenable": null,
"troles": null,
"tmethods": null,
"tplugin": null
},
"tedit": {
"tfields": [],
"ttext": null,
"tenable": null,
"troles": null,
"tmethods": null,
"tplugin": null
},
"tcreate": {
"tfields": [],
"ttext": null,
"tenable": null,
"troles": null,
"tmethods": null,
"tplugin": null
},
"tdelete": {
"ttext": null,
"tenable": null,
"troles": null,
"tmethods": null,
"tplugin": null
},
"tverify": {
"ttext": null,
"tenable": null,
"troles": null,
"tmethods": null,
"tplugin": null
},
"tmeta": {
"tmodel": null,
"tfields": null,
"tvalidate": null,
"tserver": null,
"tplugin": null,
"tmenu": null
}
},
"masterTViewTHelp": {
"tid": "The name of the view.",
"tplural": "The plural name of the view.",
"tslug": "The slug of the view.",
"tcode": null,
"tkeys": "The primary key fields.",
"tcount": {
"ttext": null,
"tenable": null,
"tmethods": null,
"tplugin": null
},
"tlist": {
"tfields": [],
"ttext": null,
"tlinks": null,
"tenable": null,
"tmethods": null,
"tplugin": null
},
"tread": {
"tfields": [],
"ttext": null,
"tenable": null,
"tmethods": null,
"tplugin": null
},
"tedit": {
"tfields": [],
"ttext": null,
"tenable": null,
"tmethods": null,
"tplugin": null
},
"tcreate": {
"tfields": [],
"ttext": null,
"tenable": null,
"tmethods": null,
"tplugin": null
},
"tdelete": {
"ttext": null,
"tenable": null,
"tmethods": null,
"tplugin": null
},
"tverify": {
"ttext": null,
"tenable": null,
"tmethods": null,
"tplugin": null
},
"tmeta": {
"tmodel": null,
"tfields": null,
"tvalidate": null,
"tserver": null,
"tplugin": null
}
}
}