WIP open file for a while
This commit is contained in:
parent
f937019e42
commit
d280fb9af3
122 changed files with 5702 additions and 10 deletions
54
lib/plugin/auto/auto-tenable.js
Normal file
54
lib/plugin/auto/auto-tenable.js
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
var autoFieldEnable = function(tfield,type) {
|
||||
if (type === undefined) {
|
||||
throw new Error('no type');
|
||||
}
|
||||
if (tfield[type] === undefined) {
|
||||
tfield[type] = {}; // todo rm this
|
||||
}
|
||||
if (tfield[type].tenable !== null) {
|
||||
return;
|
||||
}
|
||||
var fieldKey = tfield.tid;
|
||||
var result = true;
|
||||
if ('tlist' === type) {
|
||||
var name = fieldKey.toLowerCase();
|
||||
if (fieldKey.indexOf('description') >= 0) {
|
||||
result = false;
|
||||
} else if (fieldKey.indexOf('comment') >= 0) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
tfield[type].tenable = result;
|
||||
}
|
||||
|
||||
return function AutoTEnablePlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='autoTEnable';
|
||||
ctx.description='Auto enables to true if undefined.';
|
||||
};
|
||||
|
||||
this.fillTEntity = function(ctx) {
|
||||
if (ctx.tentity.tenable === null || ctx.tentity.tenable === undefined) {
|
||||
ctx.tentity.tenable = true;
|
||||
}
|
||||
autoFieldEnable(ctx.tentity,'tlist');
|
||||
autoFieldEnable(ctx.tentity,'tread');
|
||||
autoFieldEnable(ctx.tentity,'tedit');
|
||||
autoFieldEnable(ctx.tentity,'tcreate');
|
||||
autoFieldEnable(ctx.tentity,'tdelete');
|
||||
autoFieldEnable(ctx.tentity,'tcount');
|
||||
autoFieldEnable(ctx.tentity,'tverify');
|
||||
}
|
||||
|
||||
this.fillTField = function(ctx) {
|
||||
autoFieldEnable(ctx.tfield,'tlist');
|
||||
autoFieldEnable(ctx.tfield,'tread');
|
||||
autoFieldEnable(ctx.tfield,'tedit');
|
||||
autoFieldEnable(ctx.tfield,'tcreate');
|
||||
}
|
||||
};
|
||||
})();
|
||||
45
lib/plugin/auto/auto-tmenu.js
Normal file
45
lib/plugin/auto/auto-tmenu.js
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
return function AutoTMenuPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='autoTMenu';
|
||||
ctx.description='Auto enables menu items.';
|
||||
ctx.dependencies.push('autoTEntityTPlural');
|
||||
};
|
||||
|
||||
this.fillTEntity = function(ctx) {
|
||||
if (ctx.tentity.tparent === null) {
|
||||
return; // root node
|
||||
}
|
||||
if (ctx.tentity.tmeta.tmodel.tid === null) {
|
||||
ctx.tentity.tmeta.tmenu.titem = false; // auto menu for items
|
||||
}
|
||||
|
||||
if (ctx.tentity.tmeta.tmenu.tenable === null || ctx.tentity.tmeta.tmenu.tenable === undefined) {
|
||||
ctx.tentity.tmeta.tmenu.tenable = true;
|
||||
}
|
||||
if (ctx.tentity.tmeta.tmenu.titem === null || ctx.tentity.tmeta.tmenu.titem === undefined) {
|
||||
ctx.tentity.tmeta.tmenu.titem = true;
|
||||
}
|
||||
if (ctx.tentity.tmeta.tmenu.tname === null || ctx.tentity.tmeta.tmenu.tname === undefined) {
|
||||
ctx.tentity.tmeta.tmenu.tname = ctx.tentity.tplural.substring(0,1).toUpperCase()+ctx.tentity.tplural.substring(1);
|
||||
}
|
||||
if (ctx.tentity.tmeta.tmenu.tkey === null || ctx.tentity.tmeta.tmenu.tkey === undefined) {
|
||||
if (ctx.tentity.tmeta.tmenu.titem) {
|
||||
ctx.tentity.tmeta.tmenu.tkey = ctx.tentity.tparent.tid;
|
||||
} else {
|
||||
ctx.tentity.tmeta.tmenu.tkey = ctx.tentity.tid;
|
||||
}
|
||||
}
|
||||
if (ctx.tentity.tmeta.tmenu.ticon === null || ctx.tentity.tmeta.tmenu.ticon === undefined) {
|
||||
if (ctx.tentity.tmeta.tmenu.titem) {
|
||||
ctx.tentity.tmeta.tmenu.ticon = 'fa fa-table';
|
||||
} else {
|
||||
ctx.tentity.tmeta.tmenu.ticon = 'fa fa-cubes';
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
50
lib/plugin/auto/auto-tname.js
Normal file
50
lib/plugin/auto/auto-tname.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
var createName = function (fieldKey,fieldName) {
|
||||
if (fieldKey === undefined) {
|
||||
throw new Error('no fieldKey');
|
||||
}
|
||||
if (fieldName && fieldName.length !== 0) {
|
||||
return fieldName;
|
||||
}
|
||||
var result = '';
|
||||
var names = fieldKey.split('_');
|
||||
for (var i in names) {
|
||||
var name = names[i];
|
||||
if (name.length > 1) {
|
||||
name = name.substring(0,1).toUpperCase() + name.substring(1);
|
||||
}
|
||||
result = result + ' ' + name;
|
||||
}
|
||||
return result.substring(1); // remove first space
|
||||
};
|
||||
|
||||
var filterName = function(ctx,value) {
|
||||
return ctx.filterValue(value,['_','-','.',','],' ', function (part) {
|
||||
return part.substring(0,1).toUpperCase()+part.substring(1).toLowerCase();
|
||||
});
|
||||
};
|
||||
|
||||
return function AutoTNamePlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='autoTName';
|
||||
ctx.description='Auto fills and checks the tname fields.';
|
||||
};
|
||||
|
||||
this.fillTField = function(ctx) {
|
||||
if (ctx.tfield.tname === null) {
|
||||
ctx.tfield.tname = createName(ctx.tfield.tid);
|
||||
} else {
|
||||
//ctx.tfield.tname = filterName(ctx,ctx.tfield.tname);
|
||||
}
|
||||
};
|
||||
|
||||
this.fillTEntity = function(ctx) {
|
||||
if (ctx.tentity.tname === null) {
|
||||
ctx.tentity.tname = ctx.tentity.tid;//
|
||||
}
|
||||
};
|
||||
};
|
||||
})();
|
||||
47
lib/plugin/auto/auto-tslug.js
Normal file
47
lib/plugin/auto/auto-tslug.js
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
var filterSlug = function(ctx,value) {
|
||||
return ctx.filterValue(value,['.',',','/','=','&','?',' '],'', function (part) {
|
||||
return part; // todo use fully correct uri removeal and escaping.
|
||||
})
|
||||
};
|
||||
|
||||
var createTViewSlug = function(tentity) {
|
||||
var uriViewSlash = '/';
|
||||
var slug = uriViewSlash + tentity.tslug;
|
||||
if (!tentity.tenable || !tentity.tparent) {
|
||||
slug = '';
|
||||
}
|
||||
if (tentity.tparent) {
|
||||
return createTViewSlug(tentity.tparent)+slug;
|
||||
}
|
||||
return slug;
|
||||
};
|
||||
|
||||
return function AutoTSlugPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='autoTSlug';
|
||||
ctx.description='Auto fills and checks the tslug fields.';
|
||||
};
|
||||
|
||||
this.fillTField = function(ctx) {
|
||||
if (ctx.tfield.tslug === undefined || ctx.tfield.tslug === null) {
|
||||
ctx.tfield.tslug = ctx.tfield.tid;
|
||||
}
|
||||
ctx.tfield.tslug = filterSlug(ctx,ctx.tfield.tslug);
|
||||
};
|
||||
|
||||
this.fillTEntity = function(ctx) {
|
||||
if (ctx.tentity.tslug === null) {
|
||||
ctx.tentity.tslug = ctx.tentity.tid;
|
||||
}
|
||||
ctx.tentity.tslug = filterSlug(ctx,ctx.tentity.tslug);
|
||||
};
|
||||
|
||||
this.fillTView = function(ctx) {
|
||||
ctx.tview.tslug = createTViewSlug(ctx.tentity).substring(1);
|
||||
}
|
||||
};
|
||||
})();
|
||||
24
lib/plugin/auto/tentity/auto-tentity-tcode.js
Normal file
24
lib/plugin/auto/tentity/auto-tentity-tcode.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
var filterCode = function(ctx,value) {
|
||||
return ctx.filterValue(value,[' ','_','-','.',','],'',function (part) {
|
||||
return part.toLowerCase();
|
||||
});
|
||||
}
|
||||
|
||||
return function AutoTEntityTCodePlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='autoTEntityTCode';
|
||||
ctx.description='Fills and filters tcode to be code-safe for generating variables/functions.';
|
||||
};
|
||||
|
||||
this.fillTEntity = function(ctx) {
|
||||
if (ctx.tentity.tcode === null || ctx.tentity.tcode === null) {
|
||||
ctx.tentity.tcode = ctx.tentity.tid;
|
||||
}
|
||||
ctx.tentity.tcode = filterCode(ctx,ctx.tentity.tcode);
|
||||
};
|
||||
};
|
||||
})();
|
||||
29
lib/plugin/auto/tentity/auto-tentity-tkey.js
Normal file
29
lib/plugin/auto/tentity/auto-tentity-tkey.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
var makeTKey = function(ctx) {
|
||||
var keySlug = '';
|
||||
for (var i = 0; i < ctx.tentity.tmeta.tmodel.tkeys.length; i++) {
|
||||
var key = ctx.tentity.tmeta.tmodel.tkeys[i];
|
||||
keySlug += ':'+key;
|
||||
if (i < (ctx.tentity.tmeta.tmodel.tkeys.length - 1)) {
|
||||
keySlug += '/';
|
||||
}
|
||||
}
|
||||
return keySlug;
|
||||
};
|
||||
|
||||
return function AutoTEntityTKeyPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='autoTEntityTKey';
|
||||
ctx.description='Auto creates the tmode.tkey parameter slug.';
|
||||
};
|
||||
|
||||
this.fillTEntity = function(ctx) {
|
||||
if (ctx.tentity.tmeta.tmodel.tkey === null) {
|
||||
ctx.tentity.tmeta.tmodel.tkey = makeTKey(ctx);
|
||||
}
|
||||
};
|
||||
};
|
||||
})();
|
||||
32
lib/plugin/auto/tentity/auto-tentity-tplural.js
Normal file
32
lib/plugin/auto/tentity/auto-tentity-tplural.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
var makePlural = function(name) {
|
||||
if (name.slice(-1) === 's') {
|
||||
return name;
|
||||
}
|
||||
if (name.slice(-1) === 'y') {
|
||||
name = name.slice(0,-1) + 'ie';
|
||||
}
|
||||
return name + 's';
|
||||
}
|
||||
|
||||
return function AutoTEntityTPluralPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='autoTEntityTPlural';
|
||||
ctx.description='Auto create tplurals from the tname/tid field.';
|
||||
ctx.dependencies.push('autoTName');
|
||||
};
|
||||
|
||||
this.fillTEntity = function(ctx) {
|
||||
if (ctx.tentity.tplural === null) {
|
||||
if (ctx.tentity.tname === null) {
|
||||
ctx.tentity.tplural = makePlural(ctx.tentity.tid);
|
||||
} else {
|
||||
ctx.tentity.tplural = makePlural(ctx.tentity.tname);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
})();
|
||||
53
lib/plugin/auto/tview/auto-tview-ftl.js
Normal file
53
lib/plugin/auto/tview/auto-tview-ftl.js
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
function forceLookupTFields(tview) {
|
||||
var keys = Object.keys(tview.tmeta.tfields);
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
var keyNew = 'FTL_' +forceLookupKeySimple() + '_' + key.substring(key.length/3,key.length/3*2); // no....its; Force template lookup
|
||||
var tfield = tview.tmeta.tfields[key];
|
||||
tview.tmeta.tfields[key] = undefined;
|
||||
tview.tmeta.tfields[keyNew] = tfield;
|
||||
|
||||
var ckeys = Object.keys(tview);
|
||||
for (var ii = 0; ii < ckeys.length; ii++) {
|
||||
var ckey = ckeys[ii];
|
||||
if (ckey === 'tmeta') {
|
||||
continue;
|
||||
}
|
||||
var obj = tview[ckey];
|
||||
if (obj && obj.tfields) {
|
||||
var tfieldsNew = [];
|
||||
for (var iii = 0; iii < obj.tfields.length; iii++) {
|
||||
var tkey = obj.tfields[iii];
|
||||
if (tkey === key) {
|
||||
tfieldsNew.push(keyNew);
|
||||
} else {
|
||||
tfieldsNew.push(tkey);
|
||||
}
|
||||
}
|
||||
obj.tfields = tfieldsNew;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function forceLookupKeySimple() {
|
||||
var low = 100000;
|
||||
var high = 999999;
|
||||
return Math.floor(Math.random() * (high - low + 1) + low).toString(16).toUpperCase();
|
||||
}
|
||||
|
||||
return function AutoTViewFTLPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='autoTViewFTL';
|
||||
ctx.description='Automatic tview tfields key change to force table lookup.';
|
||||
};
|
||||
|
||||
this.fillTView = function(ctx) {
|
||||
forceLookupTFields(ctx.tview);
|
||||
};
|
||||
};
|
||||
})();
|
||||
21
lib/plugin/format/format-csv.js
Normal file
21
lib/plugin/format/format-csv.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
return function FormatCsvPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key = 'formatCSV';
|
||||
ctx.description = 'Export tentity list/read api in csv format.';
|
||||
ctx.localDir = __dirname;
|
||||
ctx.localConfigTemplate = 'format-csv.json';
|
||||
};
|
||||
|
||||
this.configApiTListExport = function (ctx) {
|
||||
return ctx.renderTemplateDataList(ctx.tview.tmeta.tplugin.formatCSV.tmime);
|
||||
};
|
||||
|
||||
this.configApiTReadExport = function (ctx) {
|
||||
return ctx.renderTemplateDataRead(ctx.tview.tmeta.tplugin.formatCSV.tmime);
|
||||
};
|
||||
};
|
||||
})();
|
||||
18
lib/plugin/format/format-csv.json
Normal file
18
lib/plugin/format/format-csv.json
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"masterTEntityTemplate": {
|
||||
"tlist": { "tplugin": { "formatCSV": { "tslug": "list" }}},
|
||||
"tread": { "tplugin": { "formatCSV": { "tslug": "read" }}},
|
||||
"tmeta": { "tplugin": { "formatCSV": {
|
||||
"tslug": "csv",
|
||||
"tmime": "text/csv"
|
||||
}}}
|
||||
},
|
||||
"masterTEntityTHelp": {
|
||||
"tlist": { "tplugin": { "formatCSV": { "tslug": "csv slug of api url" }}},
|
||||
"tread": { "tplugin": { "formatCSV": { "tslug": "csv slug of api url" }}},
|
||||
"tmeta": { "tplugin": { "formatCSV": {
|
||||
"tslug": "The csv slug of api url.",
|
||||
"tmime": "The csv mime type header."
|
||||
}}}
|
||||
}
|
||||
}
|
||||
35
lib/plugin/format/format-json.js
Normal file
35
lib/plugin/format/format-json.js
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
|
||||
// TODO: move to default-format-json.js ??
|
||||
|
||||
module.exports = (function () {
|
||||
|
||||
return function FormatJsonPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key = 'formatJSON';
|
||||
ctx.description = 'Export the tentity api in json format.';
|
||||
ctx.localDir = __dirname;
|
||||
ctx.localConfigTemplate = 'format-json.json';
|
||||
};
|
||||
|
||||
// flag that we support these all crud types.
|
||||
|
||||
this.configApiTListExport = function (ctx) {
|
||||
};
|
||||
|
||||
this.configApiTCreateExport = function (ctx) {
|
||||
};
|
||||
|
||||
this.configApiTReadExport = function (ctx) {
|
||||
};
|
||||
|
||||
this.configApiTEditExport = function (ctx) {
|
||||
};
|
||||
|
||||
this.configApiTDeleteExport = function (ctx) {
|
||||
};
|
||||
|
||||
this.configApiTCountExport = function (ctx) {
|
||||
};
|
||||
};
|
||||
})();
|
||||
22
lib/plugin/format/format-json.json
Normal file
22
lib/plugin/format/format-json.json
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"masterTEntityTemplate": {
|
||||
"tlist": { "tplugin": { "formatJSON": { "tslug": "list" }}},
|
||||
"tcreate": { "tplugin": { "formatJSON": { "tslug": "create" }}},
|
||||
"tedit": { "tplugin": { "formatJSON": { "tslug": "edit" }}},
|
||||
"tread": { "tplugin": { "formatJSON": { "tslug": "read" }}},
|
||||
"tdelete": { "tplugin": { "formatJSON": { "tslug": "delete" }}},
|
||||
"tcount": { "tplugin": { "formatJSON": { "tslug": "list-count" }}},
|
||||
"tverify": { "tplugin": { "formatJSON": { "tslug": "verify" }}},
|
||||
"tmeta": { "tplugin": { "formatJSON": { "tslug": "json" }}}
|
||||
},
|
||||
"masterTEntityTHelp": {
|
||||
"tlist": { "tplugin": { "formatJSON": { "tslug": "tlist json slug part api url" }}},
|
||||
"tcreate": { "tplugin": { "formatJSON": { "tslug": "tcreate json slug part api url" }}},
|
||||
"tedit": { "tplugin": { "formatJSON": { "tslug": "tedit json slug part api url" }}},
|
||||
"tread": { "tplugin": { "formatJSON": { "tslug": "tread json slug part api url" }}},
|
||||
"delete": { "tplugin": { "formatJSON": { "tslug": "tdelete json slug part api url" }}},
|
||||
"tcount": { "tplugin": { "formatJSON": { "tslug": "tcount json slug part api url" }}},
|
||||
"tverify": { "tplugin": { "formatJSON": { "tslug": "tverifiy json slug part api url"}}},
|
||||
"tmeta": { "tplugin": { "formatJSON": { "tslug": "json group part api url" }}}
|
||||
}
|
||||
}
|
||||
13
lib/plugin/format/format-rss.js
Normal file
13
lib/plugin/format/format-rss.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
return function FormatRssPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key = 'formatRSS';
|
||||
ctx.description = 'Export tentity list/read api in rss format.';
|
||||
ctx.localDir = __dirname;
|
||||
ctx.localConfigTemplate = 'format-rss.json';
|
||||
};
|
||||
};
|
||||
})();
|
||||
17
lib/plugin/format/format-rss.json
Normal file
17
lib/plugin/format/format-rss.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"masterTEntityTemplate": {
|
||||
"tlist": { "tplugin": { "formatRSS": { "tslug": "list" }}},
|
||||
"tmeta": { "tplugin": { "formatRSS": {
|
||||
"tslug": "rss",
|
||||
"itemTitle": "$data._id",
|
||||
"itemLink": "$siteLink/ui/$modelUri/read/$[\"data._id\"]",
|
||||
"itemDate": "",
|
||||
"itemDescription": "",
|
||||
"itemFields": ""
|
||||
}}}
|
||||
},
|
||||
"masterTEntityTHelp": {
|
||||
"tlist": { "tplugin": { "formatRSS": { "tslug": "rss slug of api url" }}},
|
||||
"tmeta": { "tplugin": { "formatRSS": { "tslug": "rss slug of api url" }}}
|
||||
}
|
||||
}
|
||||
75
lib/plugin/format/format-xml.js
Normal file
75
lib/plugin/format/format-xml.js
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
var xmlmapping = require('xml-mapping');
|
||||
var rawbody = require('raw-body');
|
||||
var typeis = require('type-is');
|
||||
|
||||
module.exports = (function () {
|
||||
|
||||
function bodyParserXml() {
|
||||
return function(req, res, next) {
|
||||
if (req._body) return next();
|
||||
req.body = req.body || {};
|
||||
|
||||
if (!typeis(req, 'xml')) return next();
|
||||
|
||||
// flag as parsed
|
||||
req._body = true;
|
||||
|
||||
// parse
|
||||
rawbody(req, {
|
||||
limit: options.limit || '100kb',
|
||||
length: req.headers['content-length'],
|
||||
encoding: 'utf8'
|
||||
}, function (err, buf) {
|
||||
if (err) return next(err);
|
||||
|
||||
if (0 == buf.length) {
|
||||
return next(error(400, 'invalid xml, empty body'));
|
||||
}
|
||||
try {
|
||||
req.body = xmlmapping.dump(buf/*, options.reviver*/);
|
||||
} catch (err){
|
||||
err.body = buf;
|
||||
err.status = 400;
|
||||
return next(err);
|
||||
}
|
||||
next();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return function FormatXmlPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key = 'formatXML';
|
||||
ctx.description = 'Export the tentity api in xml format.';
|
||||
ctx.localDir = __dirname;
|
||||
ctx.localConfigTemplate = 'format-xml.json';
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
ctx.server.use(bodyParserXml());
|
||||
}
|
||||
|
||||
// flag that we support these all crud types.
|
||||
|
||||
this.configApiTListExport = function (ctx) {
|
||||
return ctx.renderTemplateDataList(ctx.tview.tmeta.tplugin.formatXML.tmime);
|
||||
};
|
||||
|
||||
this.configApiTCreateExport = function (ctx) {
|
||||
};
|
||||
|
||||
this.configApiTReadExport = function (ctx) {
|
||||
return ctx.renderTemplateDataRead(ctx.tview.tmeta.tplugin.formatXML.tmime);
|
||||
};
|
||||
|
||||
this.configApiTEditExport = function (ctx) {
|
||||
};
|
||||
|
||||
this.configApiTDeleteExport = function (ctx) {
|
||||
};
|
||||
|
||||
this.configApiTCountExport = function (ctx) {
|
||||
};
|
||||
};
|
||||
})();
|
||||
28
lib/plugin/format/format-xml.json
Normal file
28
lib/plugin/format/format-xml.json
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"masterTEntityTemplate": {
|
||||
"tlist": { "tplugin": { "formatXML": { "tslug": "list" }}},
|
||||
"tcreate": { "tplugin": { "formatXML": { "tslug": "create" }}},
|
||||
"tedit": { "tplugin": { "formatXML": { "tslug": "edit" }}},
|
||||
"tread": { "tplugin": { "formatXML": { "tslug": "read" }}},
|
||||
"tdelete": { "tplugin": { "formatXML": { "tslug": "delete" }}},
|
||||
"tcount": { "tplugin": { "formatXML": { "tslug": "list-count" }}},
|
||||
"tverify": { "tplugin": { "formatXML": { "tslug": "verify" }}},
|
||||
"tmeta": { "tplugin": { "formatXML": {
|
||||
"tslug": "xml",
|
||||
"tmime": "text/xml"
|
||||
}}}
|
||||
},
|
||||
"masterTEntityTHelp": {
|
||||
"tlist": { "tplugin": { "formatXML": { "tslug": "xml slug of api url" }}},
|
||||
"tcreate": { "tplugin": { "formatXML": { "tslug": "xml slug of api url" }}},
|
||||
"tedit": { "tplugin": { "formatXML": { "tslug": "xml slug of api url" }}},
|
||||
"tread": { "tplugin": { "formatXML": { "tslug": "xml slug of api url" }}},
|
||||
"tdelete": { "tplugin": { "formatXML": { "tslug": "xml slug of api url" }}},
|
||||
"tcount": { "tplugin": { "formatXML": { "tslug": "xml slug of api url" }}},
|
||||
"tverify": { "tplugin": { "formatXML": { "tslug": "xml slug of api url" }}},
|
||||
"tmeta": { "tplugin": { "formatXML": {
|
||||
"tslug": "The xml slug of api url.",
|
||||
"tmime": "The xml mime type header."
|
||||
}}}
|
||||
}
|
||||
}
|
||||
63
lib/plugin/server/config/config-resources-mobile.js
Normal file
63
lib/plugin/server/config/config-resources-mobile.js
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
var debug = require('debug')('ff:tcrud:plugin:server:config:resouces:mobile');
|
||||
var configRegistry = require('./../../../config-registry');
|
||||
var configUtil = require('./../../../config-util');
|
||||
var fetch = require('fetch');
|
||||
|
||||
module.exports = (function () {
|
||||
|
||||
var webAssets = [];
|
||||
|
||||
var fetchHashResource = function(fetchEntry,cb) {
|
||||
fetch.fetchUrl(fetchEntry.url,function(err, meta, data) {
|
||||
debug('fetched url: '+fetchEntry.url+' length: '+meta.responseHeaders['content-length']);
|
||||
var assetHash = configUtil.stringHash(''+data);
|
||||
webAssets.push({
|
||||
url: fetchEntry.url,
|
||||
type: fetchEntry.type,
|
||||
hash: assetHash
|
||||
});
|
||||
cb();
|
||||
});
|
||||
};
|
||||
|
||||
var fetchHashResources = function(fetchList, cb) {
|
||||
var startTime = new Date().getTime();
|
||||
debug('createHashResources: '+fetchList.length);
|
||||
var resourceStack = fetchList;
|
||||
var resourceLoader = function() {
|
||||
resourceStack = resourceStack.slice(1);
|
||||
if (resourceStack.length === 0) {
|
||||
debug('fetchHashResources done in '+(new Date().getTime()-startTime)+' ms.');
|
||||
cb();
|
||||
} else {
|
||||
fetchHashResource(resourceStack[0],resourceLoader);
|
||||
}
|
||||
};
|
||||
fetchHashResource(resourceStack[0],resourceLoader);
|
||||
};
|
||||
|
||||
return function ServerConfigResourcesMobilePlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key = 'serverConfigResourcesMobile';
|
||||
ctx.description = 'Exports client resources mobile.';
|
||||
ctx.localDir = __dirname;
|
||||
ctx.localConfigTemplate = 'config-resources-mobile.json';
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
ctx.server.get(ctx.createSlugApiServerBase(),ctx.renderFunctionJSON(function () {
|
||||
return {
|
||||
resources: webAssets
|
||||
}
|
||||
}));
|
||||
};
|
||||
|
||||
this.configPostBoot = function(ctx) {
|
||||
fetchHashResources(configRegistry.createClientResourceFetchList(), function() {
|
||||
debug('Total assets build: '+webAssets.length);
|
||||
});
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
12
lib/plugin/server/config/config-resources-mobile.json
Normal file
12
lib/plugin/server/config/config-resources-mobile.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"masterTEntityTemplate": {
|
||||
"tmeta": { "tplugin": { "serverConfigResourcesMobile": {
|
||||
"tslug": "config/client-resources-mobile"
|
||||
}}}
|
||||
},
|
||||
"masterTEntityTHelp": {
|
||||
"tmeta": { "tplugin": { "serverConfigResourcesMobile": {
|
||||
"tslug": "The client resource for mobile slug."
|
||||
}}}
|
||||
}
|
||||
}
|
||||
144
lib/plugin/server/config/config-resources-web.js
Normal file
144
lib/plugin/server/config/config-resources-web.js
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
var debug = require('debug')('ff:tcrud:plugin:server:config:resouces:web');
|
||||
var configRegistry = require('./../../../config-registry');
|
||||
var configUtil = require('./../../../config-util');
|
||||
var fetch = require('fetch');
|
||||
|
||||
// FIXME: use type as key
|
||||
var assetCss = '';
|
||||
var assetCssUrl = '';
|
||||
var assetCssHash = '';
|
||||
var assetCssData = '';
|
||||
var assetCssDataUrl = '';
|
||||
var assetCssDataHash = '';
|
||||
var assetJs = '';
|
||||
var assetJsUrl = '';
|
||||
var assetJsHash = '';
|
||||
|
||||
var plugin = (function () {
|
||||
|
||||
var webAssets = [];
|
||||
|
||||
var fetchResource = function(fetchEntry,cb) {
|
||||
fetch.fetchUrl(fetchEntry.url,function(err, meta, data) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
debug('fetched url: '+fetchEntry.url+' length: '+meta.responseHeaders['content-length']);
|
||||
//debug('meta: '+JSON.stringify(meta));
|
||||
|
||||
if (fetchEntry.type === 'css') {
|
||||
assetCss += '\n/* FILE: '+fetchEntry.url+' */\n';
|
||||
assetCss += data;
|
||||
} else if (fetchEntry.type === 'js') {
|
||||
assetJs += '\n/* FILE: '+fetchEntry.url+' */\n';
|
||||
assetJs += data;
|
||||
} else if (fetchEntry.type === 'dss') {
|
||||
assetCssData += '\n/* FILE: '+fetchEntry.url+' */\n';
|
||||
assetCssData += data;
|
||||
}
|
||||
cb();
|
||||
});
|
||||
};
|
||||
|
||||
var fetchResources = function(fetchList, cb) {
|
||||
var startTime = new Date().getTime();
|
||||
debug('createResources: '+fetchList.length);
|
||||
var resourceStack = fetchList;
|
||||
var resourceLoader = function() {
|
||||
resourceStack = resourceStack.slice(1);
|
||||
if (resourceStack.length === 0) {
|
||||
debug('fetchResources done in '+(new Date().getTime()-startTime)+' ms.');
|
||||
cb();
|
||||
} else {
|
||||
fetchResource(resourceStack[0],resourceLoader);
|
||||
}
|
||||
};
|
||||
fetchResource(resourceStack[0],resourceLoader);
|
||||
};
|
||||
|
||||
return function ServerConfigResourcesWebPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key = 'serverConfigResourcesWeb';
|
||||
ctx.description = 'Exports client resources web.';
|
||||
ctx.localDir = __dirname;
|
||||
ctx.localConfigTemplate = 'config-resources-web.json';
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
ctx.server.get(ctx.createSlugApiServerBase(),ctx.renderFunctionJSON(function () {
|
||||
return {
|
||||
resources: webAssets
|
||||
}
|
||||
}));
|
||||
};
|
||||
|
||||
this.configPostBoot = function(ctx) {
|
||||
fetchResources(configRegistry.createClientResourceFetchList(), function() {
|
||||
assetJsHash = configUtil.stringHash(assetJs);
|
||||
assetCssHash = configUtil.stringHash(assetCss);
|
||||
assetCssDataHash = configUtil.stringHash(assetCssData);
|
||||
debug('Total size assets.js: '+assetJs.length+' hash: '+assetJsHash);
|
||||
debug('Total size assets.css: '+assetCss.length+' hash: '+assetCssHash);
|
||||
debug('Total size assets-data.css: '+assetCssData.length+' hash: '+assetCssDataHash);
|
||||
// note: js first to inject href asap by loader
|
||||
webAssets.push({
|
||||
url: assetJsUrl,
|
||||
type: 'js',
|
||||
hash: assetJsHash
|
||||
});
|
||||
webAssets.push({
|
||||
url: assetCssUrl,
|
||||
type: 'css',
|
||||
hash: assetCssHash
|
||||
});
|
||||
webAssets.push({
|
||||
url: assetCssDataUrl,
|
||||
type: 'dss',
|
||||
hash: assetCssDataHash
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
var pluginDownload = (function () {
|
||||
|
||||
return function ServerConfigResourcesWebAssetPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key = 'serverConfigResourcesWebAsset';
|
||||
ctx.description = 'Exports downloaded client web resources.';
|
||||
ctx.dependencies.push('serverConfigResourcesWeb');
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
|
||||
assetCssDataUrl = ctx.createSlugApiPluginBase('assets-data.css');
|
||||
ctx.server.get(assetCssDataUrl,function (req, res, next) {
|
||||
res.set('Content-Type','text/css');
|
||||
res.write(assetCssData);
|
||||
res.end();
|
||||
});
|
||||
|
||||
assetCssUrl = ctx.createSlugApiPluginBase('assets.css');
|
||||
ctx.server.get(assetCssUrl,function (req, res, next) {
|
||||
res.set('Content-Type','text/css');
|
||||
res.write(assetCss);
|
||||
res.end();
|
||||
});
|
||||
|
||||
assetJsUrl = ctx.createSlugApiPluginBase('assets.js');
|
||||
ctx.server.get(assetJsUrl,function (req, res, next) {
|
||||
res.set('Content-Type','application/javascript');
|
||||
res.write(assetJs);
|
||||
res.end();
|
||||
});
|
||||
};
|
||||
};
|
||||
})();
|
||||
|
||||
module.exports = {
|
||||
web: plugin,
|
||||
webAssets: pluginDownload
|
||||
};
|
||||
12
lib/plugin/server/config/config-resources-web.json
Normal file
12
lib/plugin/server/config/config-resources-web.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"masterTEntityTemplate": {
|
||||
"tmeta": { "tplugin": { "serverConfigResourcesWeb": {
|
||||
"tslug": "config/client-resources-web"
|
||||
}}}
|
||||
},
|
||||
"masterTEntityTHelp": {
|
||||
"tmeta": { "tplugin": { "serverConfigResourcesWeb": {
|
||||
"tslug": "The client resources web slug."
|
||||
}}}
|
||||
}
|
||||
}
|
||||
68
lib/plugin/server/config/config-routes.js
Normal file
68
lib/plugin/server/config/config-routes.js
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
var buildServerExpress = require('./../../../build-server-express');
|
||||
|
||||
module.exports = (function () {
|
||||
|
||||
var renderServerRoutes = function (server) {
|
||||
if (!server) {
|
||||
throw new Error('no server');
|
||||
}
|
||||
return function (req, res, next) {
|
||||
var routeList = buildServerExpress.getRoutes(server);
|
||||
if (!routeList) {
|
||||
routeList = [];
|
||||
}
|
||||
var reqGroups = req.query.groups;
|
||||
var groupList = [];
|
||||
if (reqGroups) {
|
||||
groupList = reqGroups.split(',');
|
||||
}
|
||||
var result = {
|
||||
all: [],
|
||||
};
|
||||
for (var i = 0; i < groupList.length; i++) {
|
||||
var groupName = groupList[i].split('/').join('_');
|
||||
result[groupName] = [];
|
||||
}
|
||||
groupList.sort(function(a, b) {
|
||||
return a.length < b.length; // longest first as we break on first hit
|
||||
});
|
||||
|
||||
for (i = 0; i < routeList.length; i++) {
|
||||
var route = routeList[i];
|
||||
var added = false;
|
||||
for (var ii = 0; ii < groupList.length; ii++) {
|
||||
if (route.uriPath.indexOf(groupList[ii]) > 0) {
|
||||
var groupName = groupList[ii].split('/').join('_');
|
||||
result[groupName].push(route);
|
||||
added = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!added) {
|
||||
result.all.push(route);
|
||||
}
|
||||
}
|
||||
res.json({
|
||||
data: result
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return function ServerConfigRoutesPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key = 'serverConfigRoutes';
|
||||
ctx.description = 'Exports all server routes.';
|
||||
ctx.localDir = __dirname;
|
||||
ctx.localConfigTemplate = 'config-routes.json';
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
ctx.server.get(ctx.createSlugApiServerBase(),renderServerRoutes(ctx.server));
|
||||
};
|
||||
|
||||
this.configPostBoot = function(ctx) {
|
||||
buildServerExpress.saveRoutes(ctx.server);
|
||||
};
|
||||
};
|
||||
})();
|
||||
12
lib/plugin/server/config/config-routes.json
Normal file
12
lib/plugin/server/config/config-routes.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"masterTEntityTemplate": {
|
||||
"tmeta": { "tplugin": { "serverConfigRoutes": {
|
||||
"tslug": "config/routes"
|
||||
}}}
|
||||
},
|
||||
"masterTEntityTHelp": {
|
||||
"tmeta": { "tplugin": { "serverConfigRoutes": {
|
||||
"tslug": "The routes slug."
|
||||
}}}
|
||||
}
|
||||
}
|
||||
28
lib/plugin/server/config/config-tmenu.js
Normal file
28
lib/plugin/server/config/config-tmenu.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
var configRegistry = require('./../../../config-registry');
|
||||
|
||||
module.exports = (function () {
|
||||
|
||||
return function ServerConfigTMenuPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key = 'serverConfigTMenu';
|
||||
ctx.description = 'Exports tmenu.';
|
||||
ctx.localDir = __dirname;
|
||||
ctx.localConfigTemplate = 'config-tmenu.json';
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
ctx.server.get(ctx.createSlugApiServerBase(),ctx.renderFunctionJSON(function() {
|
||||
var result = {};
|
||||
for (var key in configRegistry.getMasterConfig().rootTMenu) {
|
||||
var value = configRegistry.getMasterConfig().rootTMenu[key];
|
||||
if (value.items.length > 0) {
|
||||
result[key] = value; // remove empty menus
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}));
|
||||
};
|
||||
};
|
||||
})();
|
||||
|
||||
12
lib/plugin/server/config/config-tmenu.json
Normal file
12
lib/plugin/server/config/config-tmenu.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"masterTEntityTemplate": {
|
||||
"tmeta": { "tplugin": { "serverConfigTMenu": {
|
||||
"tslug": "config/menu"
|
||||
}}}
|
||||
},
|
||||
"masterTEntityTHelp": {
|
||||
"tmeta": { "tplugin": { "serverConfigTMenu": {
|
||||
"tslug": "The config tmenu slug."
|
||||
}}}
|
||||
}
|
||||
}
|
||||
23
lib/plugin/server/config/config-tview.js
Normal file
23
lib/plugin/server/config/config-tview.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
var configRegistry = require('./../../../config-registry');
|
||||
|
||||
module.exports = (function () {
|
||||
|
||||
return function ServerConfigTViewPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key = 'serverConfigTView';
|
||||
ctx.description = 'Exports tentity tviews.';
|
||||
ctx.localDir = __dirname;
|
||||
ctx.localConfigTemplate = 'config-tview.json';
|
||||
};
|
||||
|
||||
this.configApi = function(ctx) {
|
||||
ctx.server.get(ctx.createSlugApiTEntityBase(),ctx.renderFunctionJSON(function () {
|
||||
return {
|
||||
tview: ctx.tview
|
||||
}
|
||||
}));
|
||||
};
|
||||
};
|
||||
})();
|
||||
|
||||
12
lib/plugin/server/config/config-tview.json
Normal file
12
lib/plugin/server/config/config-tview.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"masterTEntityTemplate": {
|
||||
"tmeta": { "tplugin": { "serverConfigTView": {
|
||||
"tslug": "config/tview"
|
||||
}}}
|
||||
},
|
||||
"masterTEntityTHelp": {
|
||||
"tmeta": { "tplugin": { "serverConfigTView": {
|
||||
"tslug": "The config tview slug."
|
||||
}}}
|
||||
}
|
||||
}
|
||||
42
lib/plugin/server/debug.js
Normal file
42
lib/plugin/server/debug.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
var configRegistry = require('./../../config-registry');
|
||||
|
||||
module.exports = (function () {
|
||||
|
||||
var masterDebug = function(ctx,modelName,modelType,model) {
|
||||
ctx.server.get(
|
||||
ctx.createSlugApiServerBase('master')+
|
||||
'/'+modelName+
|
||||
'/'+modelType
|
||||
,ctx.renderFunctionJSON(function() {
|
||||
var result = {};
|
||||
result[modelName] = model;
|
||||
return result;
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
return function ServerDebugPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key = 'serverDebug';
|
||||
ctx.description = 'Exports some debug data.';
|
||||
ctx.localDir = __dirname;
|
||||
ctx.localConfigTemplate = 'debug.json';
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
var mt = configRegistry.getMasterTemplates();
|
||||
masterDebug(ctx,'tfield', 'template', mt.masterTFieldTemplate);
|
||||
masterDebug(ctx,'tfield', 'thelp', mt.masterTFieldTHelp);
|
||||
masterDebug(ctx,'tentity', 'template', mt.masterTEntityTemplate);
|
||||
masterDebug(ctx,'tentity', 'thelp', mt.masterTEntityTHelp);
|
||||
masterDebug(ctx,'tview', 'template', mt.masterTViewTemplate);
|
||||
masterDebug(ctx,'tview', 'thelp', mt.masterTViewTHelp);
|
||||
|
||||
// todo: TypeError: Converting circular structure to JSON
|
||||
//ctx.server.get(ctx.createSlugApiServerBase('config/root-tentity'),this.renderFunction(function() {
|
||||
// return configRegistry.rootTEntity;
|
||||
//}));
|
||||
};
|
||||
};
|
||||
})();
|
||||
12
lib/plugin/server/debug.json
Normal file
12
lib/plugin/server/debug.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"masterTEntityTemplate": {
|
||||
"tmeta": { "tplugin": { "serverDebug": {
|
||||
"tslug": "debug"
|
||||
}}}
|
||||
},
|
||||
"masterTEntityTHelp": {
|
||||
"tmeta": { "tplugin": { "serverDebug": {
|
||||
"tslug": "The server debug slug."
|
||||
}}}
|
||||
}
|
||||
}
|
||||
55
lib/plugin/server/info/info-plugins.js
Normal file
55
lib/plugin/server/info/info-plugins.js
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
var configRegistry = require('./../../../config-registry');
|
||||
|
||||
module.exports = (function () {
|
||||
|
||||
var createPluginInfo = function() {
|
||||
var result = {};
|
||||
for (var pluginIdx in configRegistry.getMasterConfig().plugins) {
|
||||
var plugin = configRegistry.getMasterConfig().plugins[pluginIdx];
|
||||
var pluginExtensions = Object.keys(plugin).slice(0,-1);
|
||||
//TODO: pluginExtensions.remove('tmeta');
|
||||
var pluginData = {
|
||||
extensions: pluginExtensions,
|
||||
tmeta: plugin.tmeta,
|
||||
troutes: plugin.troutes
|
||||
};
|
||||
result[plugin.tmeta.key] = pluginData;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
var createPluginKeyList = function() {
|
||||
var result = [];
|
||||
for (var pluginIdx in configRegistry.getMasterConfig().plugins) {
|
||||
var plugin = configRegistry.getMasterConfig().plugins[pluginIdx];
|
||||
result.push(plugin.tmeta.key);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
return function ServerInfoPluginsPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='serverInfoPlugins';
|
||||
ctx.description='Makes the server plugins info public as json';
|
||||
ctx.localDir = __dirname;
|
||||
ctx.localConfigTemplate = 'info-plugins.json';
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
ctx.server.get(ctx.createSlugApiServerBase(),ctx.renderFunctionJSON(function () {
|
||||
return {
|
||||
plugins: {
|
||||
keys: {
|
||||
registrated: createPluginKeyList(),
|
||||
backends: Object.keys(configRegistry.getMasterConfig().backends),
|
||||
validators: Object.keys(configRegistry.getMasterConfig().validators)
|
||||
},
|
||||
info: createPluginInfo()
|
||||
}
|
||||
}
|
||||
}));
|
||||
};
|
||||
};
|
||||
})();
|
||||
|
||||
12
lib/plugin/server/info/info-plugins.json
Normal file
12
lib/plugin/server/info/info-plugins.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"masterTEntityTemplate": {
|
||||
"tmeta": { "tplugin": { "serverInfoPlugins": {
|
||||
"tslug": "info/plugins"
|
||||
}}}
|
||||
},
|
||||
"masterTEntityTHelp": {
|
||||
"tmeta": { "tplugin": { "serverInfoPlugins": {
|
||||
"tslug": "The info plugins slug."
|
||||
}}}
|
||||
}
|
||||
}
|
||||
28
lib/plugin/server/info/info-uptime.js
Normal file
28
lib/plugin/server/info/info-uptime.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
var timeBoot = new Date().getTime();
|
||||
|
||||
return function ServerInfoUptimePlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='serverInfoUptime';
|
||||
ctx.description='Makes the server uptime info public as json';
|
||||
ctx.localDir = __dirname;
|
||||
ctx.localConfigTemplate = 'info-uptime.json';
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
ctx.server.get(ctx.createSlugApiServerBase(),ctx.renderFunctionJSON(function () {
|
||||
var timeNow = new Date().getTime();
|
||||
return {
|
||||
serverInfoUptime: {
|
||||
time_boot: timeBoot,
|
||||
time_now: timeNow,
|
||||
uptime: timeNow-timeBoot
|
||||
}
|
||||
}
|
||||
}));
|
||||
};
|
||||
};
|
||||
})();
|
||||
12
lib/plugin/server/info/info-uptime.json
Normal file
12
lib/plugin/server/info/info-uptime.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"masterTEntityTemplate": {
|
||||
"tmeta": { "tplugin": { "serverInfoUptime": {
|
||||
"tslug": "info/uptime"
|
||||
}}}
|
||||
},
|
||||
"masterTEntityTHelp": {
|
||||
"tmeta": { "tplugin": { "serverInfoUptime": {
|
||||
"tslug": "The info uptime slug."
|
||||
}}}
|
||||
}
|
||||
}
|
||||
25
lib/plugin/ui/angular/server/ui-angular-server-plugins.js
vendored
Normal file
25
lib/plugin/ui/angular/server/ui-angular-server-plugins.js
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
return function UIAngularServerRoutesPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key = 'uiAngularServerPlugins';
|
||||
ctx.description = 'Adds an angular server plugins page.';
|
||||
ctx.dependencies.push('angular');
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
ctx.hostTemplateJS('js/server-plugins');
|
||||
ctx.hostTemplateHTML('thtml/plugins',true);
|
||||
|
||||
ctx.registrateMenuItem({
|
||||
name: 'Server Plugins',
|
||||
link: ctx.troot.tmeta.tplugin.angular.tbase+'/server/plugins',
|
||||
enable: true,
|
||||
roles: [],
|
||||
icon: 'fa fa-umbrella'
|
||||
},'server');
|
||||
};
|
||||
};
|
||||
})();
|
||||
26
lib/plugin/ui/angular/server/ui-angular-server-routes.js
vendored
Normal file
26
lib/plugin/ui/angular/server/ui-angular-server-routes.js
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
return function UIAngularServerRoutesPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key = 'uiAngularServerRoutes';
|
||||
ctx.description = 'Adds an angular server routes page.';
|
||||
ctx.dependencies.push('angular');
|
||||
ctx.dependencies.push('serverInfoPlugins');
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
ctx.hostTemplateJS('js/server-routes');
|
||||
ctx.hostTemplateHTML('thtml/routes',true);
|
||||
|
||||
ctx.registrateMenuItem({
|
||||
name: 'Server Routes',
|
||||
link: ctx.troot.tmeta.tplugin.angular.tbase+'/server/routes',
|
||||
enable: true,
|
||||
roles: [],
|
||||
icon: 'fa fa-road'
|
||||
},'server');
|
||||
};
|
||||
};
|
||||
})();
|
||||
128
lib/plugin/ui/angular/ui-angular.js
vendored
Normal file
128
lib/plugin/ui/angular/ui-angular.js
vendored
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
var debug = require('debug')('ff:tcrud:ui:angular:boot');
|
||||
|
||||
module.exports = (function () {
|
||||
|
||||
var renderCrudController = function (tview, thtmlPrefix, tapiPrefix, tapiPrefix2) {
|
||||
|
||||
if (tview.tmeta.tmodel.tkeys.length === 0) {
|
||||
throw Error('no model keys in: '+tview.tid);
|
||||
}
|
||||
|
||||
var keySlug = '';
|
||||
for (var i = 0; i < tview.tmeta.tmodel.tkeys.length; i++) {
|
||||
var key = tview.tmeta.tmodel.tkeys[i];
|
||||
keySlug += '$routeParams.'+key;
|
||||
if (i < (tview.tmeta.tmodel.tkeys.length - 1)) {
|
||||
keySlug += '/';
|
||||
}
|
||||
}
|
||||
|
||||
var tviewCode = '';
|
||||
var slugParts = tview.tslug.split('/');
|
||||
for (var i = 0; i < slugParts.length; i++) {
|
||||
var part = slugParts[i];
|
||||
part = part.replace(/-/g,''); // TODO use tcode which is already cleaned ?
|
||||
tviewCode += part.substring(0,1).toUpperCase()+part.substring(1);
|
||||
}
|
||||
//debug('tviewCode: $s',tviewCode);
|
||||
|
||||
return function (req, res, next) {
|
||||
res.set('Content-Type', 'text/javascript');
|
||||
res.render('node-ff-tcrud/angular/js/crud/controller',{
|
||||
tview: tview,
|
||||
tviewCode: tviewCode,
|
||||
thtmlPrefix: thtmlPrefix,
|
||||
tapiPrefix: tapiPrefix,
|
||||
tapiPrefix2: tapiPrefix2,
|
||||
ejsRouteParams: keySlug
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
var renderCrudTemplate = function (tview,paction) {
|
||||
|
||||
var ejsKeyRow = '';
|
||||
var ejsKeyData = '';
|
||||
for (var i = 0; i < tview.tmeta.tmodel.tkeys.length; i++) {
|
||||
var key = tview.tmeta.tmodel.tkeys[i];
|
||||
ejsKeyRow += '{{row.'+key+'}}';
|
||||
ejsKeyData += '{{data.'+key+'}}';
|
||||
if (i < (tview.tmeta.tmodel.tkeys.length - 1)) {
|
||||
ejsKeyRow += '/';
|
||||
ejsKeyData += '/';
|
||||
}
|
||||
}
|
||||
|
||||
return function (req, res, next) {
|
||||
res.render('node-ff-tcrud/angular/'+paction+'/'+req.params.action,{
|
||||
tview: tview,
|
||||
ejsKeyRow: ejsKeyRow,
|
||||
ejsKeyData: ejsKeyData
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return function UIAngularCorePlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key = 'angular';
|
||||
ctx.description = 'Exports angular ui data.';
|
||||
ctx.localDir = __dirname;
|
||||
ctx.localConfigTemplate = 'ui-angular.json';
|
||||
ctx.dependencies.push('uiLibAngular');
|
||||
ctx.dependencies.push('uiLibFFSpaLoader');
|
||||
//ctx.dependencies.push('uiLibTopcoat');
|
||||
ctx.dependencies.push('serverConfigTMenu');
|
||||
ctx.dependencies.push('uiLibFontFaceOnLoad');
|
||||
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
ctx.hostTemplateJS('js/application');
|
||||
ctx.hostTemplateJS('js/application-font');
|
||||
ctx.hostTemplateJS('js/application-controller')
|
||||
ctx.hostTemplateJS('js/navigation-service');
|
||||
|
||||
ctx.hostTemplateHTML('thtml/application-view',true);;
|
||||
ctx.hostTemplateHTML('thtml/application-top',true);
|
||||
ctx.hostTemplateHTML('thtml/application-top-action',true);
|
||||
ctx.hostTemplateHTML('thtml/application-top-tabs',true);
|
||||
|
||||
var uiPath = ctx.troot.tmeta.tplugin.angular.tbase;
|
||||
debug('Exported uiPath: %s',uiPath);
|
||||
|
||||
ctx.server.get('/', ctx.renderRedirect(uiPath));
|
||||
ctx.server.get(uiPath, ctx.renderTemplate('index','text/html'));
|
||||
ctx.server.get(uiPath+'/*', ctx.renderTemplate('index','text/html')); // must be last; for HTML5 history
|
||||
|
||||
ctx.registrateMenu({
|
||||
name: 'Server',
|
||||
icon: 'fa fa-server'
|
||||
},'server'); // move ?
|
||||
};
|
||||
|
||||
this.configApi = function(ctx) {
|
||||
var uriPrefix = ctx.createSlugApiTEntityBase();
|
||||
var thtmlPrefix = uriPrefix + '/' + ctx.tview.tmeta.tplugin.angular.thtml;
|
||||
var tapiPrefix = ctx.createSlugApiTEntityBasePlugin('formatJSON'); // TODO: move to tview ?
|
||||
var tapiPrefix2 = ctx.createSlugApiTEntityBasePlugin('serverConfigTView'); // TODO: move to tview ?
|
||||
|
||||
|
||||
ctx.server.get(uriPrefix + '/thtml/crud/:action', renderCrudTemplate(ctx.tview,'thtml/crud/'));
|
||||
ctx.server.get(uriPrefix + '/crud/controller.js', renderCrudController(ctx.tview,thtmlPrefix,tapiPrefix,tapiPrefix2));
|
||||
//ctx.server.get(uriPrefix + '/service.js', renderCrudService(tview))
|
||||
|
||||
ctx.registrateClientJSResource(uriPrefix + '/crud/controller.js');
|
||||
|
||||
if (ctx.tview.tmeta.tmenu.tenable && ctx.tview.tmeta.tmenu.tkey !== null && ctx.tview.tmeta.tmenu.titem) {
|
||||
ctx.registrateMenuItem({
|
||||
name: ctx.tview.tmeta.tmenu.tname,
|
||||
link: ctx.tview.tmeta.tplugin.angular.tbase+'/'+ctx.tview.tslug+'/'+ctx.tview.tlist.tplugin.angular.tslug,
|
||||
enable: ctx.tview.tlist.tenable,
|
||||
roles: ctx.tview.tlist.troles,
|
||||
icon: ctx.tview.tmeta.tmenu.ticon
|
||||
},ctx.tview.tmeta.tmenu.tkey);
|
||||
}
|
||||
};
|
||||
};
|
||||
})();
|
||||
72
lib/plugin/ui/angular/ui-angular.json
Normal file
72
lib/plugin/ui/angular/ui-angular.json
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
{
|
||||
"masterTEntityTemplate": {
|
||||
"tlist": { "tplugin": { "angular": {
|
||||
"tslug": "list",
|
||||
"thtml": "crud/list",
|
||||
"tcontroller": {
|
||||
"prefix": "tcrudAuto",
|
||||
"postfix": "ListCntr",
|
||||
"argu": "$scope, $http, $location, $routeParams, navigationService"
|
||||
},
|
||||
"tlinks": {
|
||||
"DataTODO":"/ui/XNodeData/list/XNode/{{row.net_id}}/{{row.net_id}}"
|
||||
}
|
||||
}}},
|
||||
"tcreate": { "tplugin": { "angular": {
|
||||
"tslug": "create",
|
||||
"thtml": "crud/create",
|
||||
"tcontroller": {
|
||||
"prefix": "tcrudAuto",
|
||||
"postfix": "CreateCntr",
|
||||
"argu": "$scope, $http, $location, $routeParams, navigationService"
|
||||
}
|
||||
}}},
|
||||
"tedit": { "tplugin": { "angular": {
|
||||
"tslug": "edit",
|
||||
"thtml": "crud/edit",
|
||||
"tcontroller": {
|
||||
"prefix": "tcrudAuto",
|
||||
"postfix": "EditCntr",
|
||||
"argu": "$scope, $http, $location, $routeParams, navigationService"
|
||||
}
|
||||
}}},
|
||||
"tread": { "tplugin": { "angular": {
|
||||
"tslug": "read",
|
||||
"thtml": "crud/read",
|
||||
"troute": {
|
||||
|
||||
},
|
||||
"tcontroller": {
|
||||
"prefix": "tcrudAuto",
|
||||
"postfix": "ReadCntr",
|
||||
"argu": "$scope, $http, $location, $routeParams, navigationService"
|
||||
}
|
||||
}}},
|
||||
"tdelete": { "tplugin": { "angular": {
|
||||
"tslug": "delete",
|
||||
"thtml": "crud/delete",
|
||||
"tcontroller": {
|
||||
"prefix": "tcrudAuto",
|
||||
"postfix": "DeleteCntr",
|
||||
"argu": "$scope, $http, $location, $routeParams, navigationService"
|
||||
}
|
||||
}}},
|
||||
"tcount": { "tplugin": { "angular": { "tslug": "list-count" }}},
|
||||
"tverify": { "tplugin": { "angular": { "tslug": "verify" }}},
|
||||
"tmeta": { "tplugin": { "angular": {
|
||||
"tslug": "angular",
|
||||
"tbase": "/ui",
|
||||
"thtml": "thtml"
|
||||
}}}
|
||||
},
|
||||
"masterTEntityTHelp": {
|
||||
"tlist": { "tplugin": { "angular": { "tslug": "slug of api url" }}},
|
||||
"tcreate": { "tplugin": { "angular": { "tslug": "slug of api url" }}},
|
||||
"tedit": { "tplugin": { "angular": { "tslug": "slug of api url" }}},
|
||||
"tread": { "tplugin": { "angular": { "tslug": "slug of api url" }}},
|
||||
"tdelete": { "tplugin": { "angular": { "tslug": "slug of api url" }}},
|
||||
"tcount": { "tplugin": { "angular": { "tslug": "slug of api url" }}},
|
||||
"tverify": { "tplugin": { "angular": { "tslug": "slug of api url" }}},
|
||||
"tmeta": { "tplugin": { "angular": { "tslug": "slug of api url" }}}
|
||||
}
|
||||
}
|
||||
46
lib/plugin/ui/lib/ui-lib-angular.js
Normal file
46
lib/plugin/ui/lib/ui-lib-angular.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
var incHostFileJSNodeModule = function(ctx,includeFile,namePart) {
|
||||
if (includeFile) {
|
||||
ctx.hostFileJSNodeModule({file: 'angular-'+namePart+'.min.js', path: 'angular-'+namePart});
|
||||
}
|
||||
};
|
||||
|
||||
return function UILibAngularPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='uiLibAngular';
|
||||
ctx.description='Adds angular libs to resources.';
|
||||
ctx.localDir = __dirname;
|
||||
ctx.localConfigTemplate = 'ui-lib-angular.json';
|
||||
ctx.dependencies.push('uiLibJQuery');
|
||||
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
ctx.hostFileJSNodeModule({file: 'angular.min.js', path: 'angular'});
|
||||
|
||||
var inc = ctx.troot.tmeta.tplugin.uiLibAngular.include;
|
||||
incHostFileJSNodeModule(ctx,inc.animate,'animate');
|
||||
incHostFileJSNodeModule(ctx,inc.resource,'resource');
|
||||
incHostFileJSNodeModule(ctx,inc.route,'route');
|
||||
incHostFileJSNodeModule(ctx,inc.touch,'touch');
|
||||
|
||||
if (inc['ui-grid']) {
|
||||
var filter = {
|
||||
'(^.*url.*?;)': '', // removed all urls
|
||||
'(@font-face[\\s\\S]*?})': '', // remove font-face
|
||||
'(^\\s+)': '', // clean up white space
|
||||
'(\\{[\\s\\/]+\\/.*)': '{', // rm comment on functions
|
||||
'(^|\\s\\/\\/.*)': '', // rm comment lines
|
||||
'(\\/\\*[\\s\\*\\!][\\s\\S]*?\\*\\/)': '', // rm comment blocks
|
||||
};
|
||||
ctx.hostFileJSNodeModule({file: 'ui-grid.min.js', path: 'angular-ui-grid'});
|
||||
ctx.hostFileCSSNodeModule({file: 'ui-grid.css', path: 'angular-ui-grid', filterRegex: filter});
|
||||
|
||||
ctx.hostFileCSSFontNodeModule({file: 'ui-grid.ttf', path: 'angular-ui-grid/', fontFamily: 'ui-grid'});
|
||||
}
|
||||
};
|
||||
};
|
||||
})();
|
||||
19
lib/plugin/ui/lib/ui-lib-angular.json
Normal file
19
lib/plugin/ui/lib/ui-lib-angular.json
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"masterTEntityTemplate": {
|
||||
"tmeta": { "tplugin": { "uiLibAngular": {
|
||||
"tslug": "uiLibAngular",
|
||||
"include": {
|
||||
"animate": true,
|
||||
"resource": true,
|
||||
"route": true,
|
||||
"touch": true,
|
||||
"ui-grid": true
|
||||
}
|
||||
}}}
|
||||
},
|
||||
"masterTEntityTHelp": {
|
||||
"tmeta": { "tplugin": { "uiLibAngular": {
|
||||
"tslug": "The angular lib slug."
|
||||
}}}
|
||||
}
|
||||
}
|
||||
27
lib/plugin/ui/lib/ui-lib-bootswatch.js
Normal file
27
lib/plugin/ui/lib/ui-lib-bootswatch.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
return function UILibBootstrapPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='uiLibBootswatch';
|
||||
ctx.description='Adds and hosts bootstrap.css as client resource.';
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
var filter = {
|
||||
'(^.*url.*?;)': '', // removed all urls
|
||||
'(@font-face[\\s\\S]*?})': '', // remove font-face
|
||||
//'(body[\\s\\S]*?})': '', // remove body
|
||||
'(^\\s+)': '', // clean up white space
|
||||
'(\\{[\\s\\/]+\\/.*)': '{', // rm comment on functions
|
||||
'(^|\\s\\/\\/.*)': '', // rm comment lines
|
||||
'(\\/\\*[\\s\\*\\!][\\s\\S]*?\\*\\/)': '', // rm comment blocks
|
||||
};
|
||||
ctx.hostFileCSSNodeModule({file: 'bootstrap.css', path: 'bootswatch/paper', filterRegex: filter});
|
||||
ctx.hostFileJSNodeModule({file: 'bootstrap.js', path: 'bootstrap/dist/js'});
|
||||
|
||||
ctx.hostFileCSSFontNodeModule({file: 'glyphicons-halflings-regular.ttf', path: 'bootswatch/fonts/', fontFamily: 'Glyphicons Halflings'});
|
||||
};
|
||||
};
|
||||
})();
|
||||
20
lib/plugin/ui/lib/ui-lib-ff-spa-loader.js
Normal file
20
lib/plugin/ui/lib/ui-lib-ff-spa-loader.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
return function UILibSpaLoaderPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='uiLibFFSpaLoader';
|
||||
ctx.description='Adds FFSpaLoader lib to resources.';
|
||||
ctx.localDir = __dirname;
|
||||
ctx.dependencies.push('serverConfigResourcesWeb');
|
||||
ctx.dependencies.push('serverConfigResourcesMobile'); // TODO: is this opt ?
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
//ctx.hostFileJSNodeModule({file: 'es5-ff-spa-loader.js', path: 'es5-ff-spa-loader/dist', registrate: false});
|
||||
ctx.hostFileJSNodeModule({file: 'es5-ff-spa-loader.js', path: '../../es5-ff-spa-loader', registrate: false});
|
||||
ctx.hostFileCSSNodeModule({file: 'es5-ff-spa-loader.css', path: '../../es5-ff-spa-loader', registrate: false});
|
||||
};
|
||||
};
|
||||
})();
|
||||
39
lib/plugin/ui/lib/ui-lib-flot.js
Normal file
39
lib/plugin/ui/lib/ui-lib-flot.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
var incHostFileJSNodeModule = function(ctx,includeFile,namePart) {
|
||||
if (includeFile) {
|
||||
ctx.hostFileJSNodeModule({file: 'jquery.flot.'+namePart+'.js',path: 'flot'});
|
||||
}
|
||||
};
|
||||
|
||||
return function UILibFlotPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='uiLibFlot';
|
||||
ctx.description='Adds basic flot js libs to resources.';
|
||||
ctx.localDir = __dirname;
|
||||
ctx.localConfigTemplate = 'ui-lib-flot.json';
|
||||
ctx.dependencies.push('uiLibJQuery');
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
ctx.hostFileJSNodeModule({file: 'jquery.flot.js', path: 'flot'});
|
||||
|
||||
var inc = ctx.troot.tmeta.tplugin.uiLibFlot.include;
|
||||
incHostFileJSNodeModule(ctx,inc.categories, 'categories');
|
||||
incHostFileJSNodeModule(ctx,inc.crosshair, 'crosshair');
|
||||
incHostFileJSNodeModule(ctx,inc.errorbars, 'errorbars');
|
||||
incHostFileJSNodeModule(ctx,inc.fillbetween, 'fillbetween');
|
||||
incHostFileJSNodeModule(ctx,inc.image, 'image');
|
||||
incHostFileJSNodeModule(ctx,inc.navigate, 'navigate');
|
||||
incHostFileJSNodeModule(ctx,inc.pie, 'pie');
|
||||
incHostFileJSNodeModule(ctx,inc.resize, 'resize');
|
||||
incHostFileJSNodeModule(ctx,inc.selection, 'selection');
|
||||
incHostFileJSNodeModule(ctx,inc.stack, 'stack');
|
||||
incHostFileJSNodeModule(ctx,inc.symbol, 'symbol');
|
||||
incHostFileJSNodeModule(ctx,inc.threshold, 'threshold');
|
||||
incHostFileJSNodeModule(ctx,inc.time, 'time');
|
||||
};
|
||||
};
|
||||
})();
|
||||
27
lib/plugin/ui/lib/ui-lib-flot.json
Normal file
27
lib/plugin/ui/lib/ui-lib-flot.json
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"masterTEntityTemplate": {
|
||||
"tmeta": { "tplugin": { "uiLibFlot": {
|
||||
"tslug": "uiLibFlot",
|
||||
"include": {
|
||||
"categories": false,
|
||||
"crosshair": false,
|
||||
"errorbars": false,
|
||||
"fillbetween": false,
|
||||
"image": false,
|
||||
"navigate": false,
|
||||
"pie": true,
|
||||
"resize": true,
|
||||
"selection": false,
|
||||
"stack": true,
|
||||
"symbol": false,
|
||||
"threshold": false,
|
||||
"time": true
|
||||
}
|
||||
}}}
|
||||
},
|
||||
"masterTEntityTHelp": {
|
||||
"tmeta": { "tplugin": { "uiLibFlot": {
|
||||
"tslug": "The server debug slug."
|
||||
}}}
|
||||
}
|
||||
}
|
||||
25
lib/plugin/ui/lib/ui-lib-fontawesome.js
Normal file
25
lib/plugin/ui/lib/ui-lib-fontawesome.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
return function UILibBootstrapPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='uiLibFontAwesome';
|
||||
ctx.description='Adds fontawesome client resources.';
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
var filter = {
|
||||
'(^.*url.*?;)': '', // removed all urls
|
||||
'(@font-face[\\s\\S]*?})': '', // remove font-face
|
||||
'(^\\s+)': '', // clean up white space
|
||||
'(\\{[\\s\\/]+\\/.*)': '{', // rm comment on functions
|
||||
'(^|\\s\\/\\/.*)': '', // rm comment lines
|
||||
'(\\/\\*[\\s\\*\\!][\\s\\S]*?\\*\\/)': '', // rm comment blocks
|
||||
};
|
||||
ctx.hostFileCSSNodeModule({file: 'font-awesome.css', path: 'font-awesome/css', filterRegex: filter});
|
||||
|
||||
ctx.hostFileCSSFontNodeModule({file: 'fontawesome-webfont.ttf', path: 'font-awesome/fonts/', fontFamily: 'FontAwesome'});
|
||||
};
|
||||
};
|
||||
})();
|
||||
15
lib/plugin/ui/lib/ui-lib-fontfaceonload.js
Normal file
15
lib/plugin/ui/lib/ui-lib-fontfaceonload.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
return function UILibFontFaceOnLoadPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='uiLibFontFaceOnLoad';
|
||||
ctx.description='Adds fontfaceonload js lib to resources.';
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
ctx.hostFileJSNodeModule({file: 'fontfaceonload.js', path: 'fontfaceonload/dist'});
|
||||
};
|
||||
};
|
||||
})();
|
||||
15
lib/plugin/ui/lib/ui-lib-jquery.js
Normal file
15
lib/plugin/ui/lib/ui-lib-jquery.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
return function UILibJQueryPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='uiLibJQuery';
|
||||
ctx.description='Adds jquery js lib to resources.';
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
ctx.hostFileJSNodeModule({file: 'jquery.min.js', path: 'jquery/dist'});
|
||||
};
|
||||
};
|
||||
})();
|
||||
18
lib/plugin/ui/spa/ui-spa-style.js
Normal file
18
lib/plugin/ui/spa/ui-spa-style.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
return function UISpaStylePlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='uiSpaStyle';
|
||||
ctx.description='Adds basic styling resources.';
|
||||
ctx.dependencies.push('uiSpaTopcoatFont');
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
ctx.hostTemplateCSS('css/flot');
|
||||
ctx.hostTemplateCSS('css/panel');
|
||||
ctx.hostTemplateCSS('css/style');
|
||||
};
|
||||
};
|
||||
})();
|
||||
19
lib/plugin/ui/spa/ui-spa-topcoat-font.js
Normal file
19
lib/plugin/ui/spa/ui-spa-topcoat-font.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
var fontPath = 'topcoat-fonts/font/SourceSansPro/';
|
||||
|
||||
return function UISpaTopcoatFontPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='uiSpaTopcoatFont';
|
||||
ctx.description='Adds Source Sans Pro fonts.';
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
ctx.hostFileCSSFontNodeModule({file: 'SourceSansPro-Light.otf', path: fontPath, fontFamily: 'Source Sans', fontWeight: 200});
|
||||
ctx.hostFileCSSFontNodeModule({file: 'SourceSansPro-Regular.otf', path: fontPath, fontFamily: 'Source Sans', fontWeight: 400});
|
||||
ctx.hostFileCSSFontNodeModule({file: 'SourceSansPro-Semibold.otf',path: fontPath, fontFamily: 'Source Sans', fontWeight: 600});
|
||||
};
|
||||
};
|
||||
})();
|
||||
24
lib/plugin/ui/spa/ui-spa-topcoat.js-old
Normal file
24
lib/plugin/ui/spa/ui-spa-topcoat.js-old
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
module.exports = (function () {
|
||||
|
||||
return function UISpaTopcoatPlugin() {
|
||||
|
||||
this.configPlugin = function (ctx) {
|
||||
ctx.key='uiSpaTopcoat';
|
||||
ctx.description='Adds and hosts topcoat.css as client resource.';
|
||||
};
|
||||
|
||||
this.configServer = function(ctx) {
|
||||
var filter = {
|
||||
'(^.*url.*?;)': '', // removed all urls
|
||||
'(@font[\\s\\S]*?})': '', // remove font-face
|
||||
'(body[\\s\\S]*?})': '', // remove body
|
||||
'(^\\s+)': '', // clean up white space
|
||||
'(\\{[\\s\\/]+\\/.*)': '{', // rm comment on functions
|
||||
'(^|\\s\\/\\/.*)': '', // rm comment lines
|
||||
'(\\/\\*[\\s\\*\\!][\\s\\S]*?\\*\\/)': '', // rm comment blocks
|
||||
};
|
||||
ctx.hostFileCSSNodeModule({file: 'topcoat-mobile-dark.css',path: 'topcoat/css', filterRegex: filter});
|
||||
};
|
||||
};
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue