tracker schema
This commit is contained in:
parent
baef67ef98
commit
9b64d946cd
4
.gitignore
vendored
4
.gitignore
vendored
@ -18,10 +18,6 @@
|
||||
!objects/
|
||||
!objects/options/
|
||||
!objects/options/**
|
||||
!objects/tpldata/
|
||||
!objects/tpldata/**
|
||||
!objects/screens/
|
||||
!objects/screens/**
|
||||
!objects/tplstrings/
|
||||
!objects/tplstrings/**
|
||||
|
||||
|
@ -47,15 +47,18 @@ Wwws.getwco = (wconame, ctx) => {
|
||||
const wcoinfo = fs.readJSONSync(wcoconf);
|
||||
const webpage = fs.readJSONSync(webconf);
|
||||
// check that webconf for tailwindcsscontent property exist for this wco request
|
||||
const pathtocheckfortw=[`../adminapi/objects/wco/${wconame}/*.{html,js,mustache}`,`../${ctx.tribe}/objects/wwws/${ctx.xapp}/src/**/*.{html,js,mustache}`]
|
||||
const pathtocheckfortw = [
|
||||
`../adminapi/objects/wco/${wconame}/*.{html,js,mustache}`,
|
||||
`../${ctx.tribe}/objects/wwws/${ctx.xapp}/src/**/*.{html,js,mustache}`,
|
||||
];
|
||||
if (!webpage.tailwindcsscontent) {
|
||||
webpage.tailwindcsscontent=[]
|
||||
webpage.tailwindcsscontent = [];
|
||||
}
|
||||
pathtocheckfortw.forEach(tw=>{
|
||||
pathtocheckfortw.forEach((tw) => {
|
||||
if (!webpage.tailwindcsscontent.includes(tw)) {
|
||||
webpage.tailwindcsscontent.push(tw)
|
||||
webpage.tailwindcsscontent.push(tw);
|
||||
}
|
||||
})
|
||||
});
|
||||
// check that all tpl for this compoent are well in pages tpl object
|
||||
if (wcoinfo.tpl && Object.keys(wcoinfo.tpl).length > 0) {
|
||||
Object.keys(wcoinfo.tpl).forEach((t) => {
|
||||
@ -68,27 +71,61 @@ Wwws.getwco = (wconame, ctx) => {
|
||||
});
|
||||
}
|
||||
// check that tpldata exist for the wco, if not create them with template data example into the project
|
||||
if (ctx.tagid && wcoinfo.tpldatamodel && Object.keys(wcoinfo.tpldatamodel).length > 0) {
|
||||
//console.log(wcoinfo,ctx)
|
||||
if (
|
||||
!ctx.tagid &&
|
||||
wcoinfo.tpldatamodel &&
|
||||
Object.keys(wcoinfo.tpldatamodel).length > 0
|
||||
) {
|
||||
console.log(
|
||||
`Warning: you add a wco that request tagid to initiate tpldata into your project, please add in wwws/getwco/${wcoinfo.wconame}.js?xx&tagid=id1,id2 where this wco is used`
|
||||
);
|
||||
}
|
||||
if (
|
||||
ctx.tagid &&
|
||||
wcoinfo.tpldatamodel &&
|
||||
Object.keys(wcoinfo.tpldatamodel).length > 0
|
||||
) {
|
||||
Object.keys(wcoinfo.tpldatamodel).forEach((t) => {
|
||||
const pathtpldata = `${ctx.tribe}/objects/wwws/${ctx.xapp}/src/tpldata/${ctx.pagename}/${ctx.tagid}_${t}`;
|
||||
const localdbname=`${ctx.pagename}_${ctx.tagid}_${t}`
|
||||
if (!Object.keys(webpage.pages[ctx.pagename].tpldata).includes(localdbname)) {
|
||||
//tagid can concern many id then tagid=idA,idB,idC
|
||||
ctx.tagid = ctx.tagid.includes(",") ? ctx.tagid.split(",") : [ctx.tagid];
|
||||
ctx.tagid.forEach((tid) => {
|
||||
const pathtpldata = `${ctx.tribe}/objects/wwws/${ctx.xapp}/src/tpldata/${ctx.pagename}/${tid}_${t}`;
|
||||
console.log("pathtpldata:", pathtpldata);
|
||||
const localdbname = `${ctx.pagename}_${tid}_${t}`;
|
||||
if (
|
||||
!Object.keys(webpage.pages[ctx.pagename].tpldata).includes(
|
||||
localdbname
|
||||
)
|
||||
) {
|
||||
webpage.pages[ctx.pagename].tpldata[localdbname] = pathtpldata;
|
||||
}
|
||||
wcoinfo.lang.forEach((l) => {
|
||||
if (!fs.existsSync(`../${wcoinfo.tpldatamodel[t]}_${l}.json`)) {
|
||||
console.log(
|
||||
`Warning, this file is suppose to exist ../${wcoinfo.tpldatamodel[t]}_${l}.json check lg or mispelling`
|
||||
);
|
||||
}
|
||||
if (
|
||||
!fs.existsSync(`../${pathtpldata}_${l}.json`) &&
|
||||
fs.existsSync(`../${wcoinfo.tpldatamodel[t]}_${l}.json`)
|
||||
) {
|
||||
const tpldataexample=fs.readJSONSync(`../${wcoinfo.tpldatamodel[t]}_${l}.json`)
|
||||
Object.keys(ctx).forEach(k=>{
|
||||
tpldataexample[k]=ctx[k]
|
||||
})
|
||||
fs.outputJSONSync(
|
||||
`../${pathtpldata}_${l}.json`,tpldataexample
|
||||
const tpldataexample = fs.readJSONSync(
|
||||
`../${wcoinfo.tpldatamodel[t]}_${l}.json`
|
||||
);
|
||||
Object.keys(ctx).forEach((k) => {
|
||||
if (k == "tagid") {
|
||||
tpldataexample[k] = tid;
|
||||
} else {
|
||||
tpldataexample[k] = ctx[k];
|
||||
}
|
||||
});
|
||||
fs.outputJSONSync(`../${pathtpldata}_${l}.json`, tpldataexample, {
|
||||
spaces: 2,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
// check if referential are there for this wco
|
||||
@ -122,6 +159,12 @@ Wwws.getwco = (wconame, ctx) => {
|
||||
|
||||
Wwws.build = (tribeId, webapp, srcdist, options) => {
|
||||
console.log(`Building ${tribeId}/objects/wwws/${webapp}/${srcdist}`);
|
||||
/*
|
||||
mettre en cdn de la tribe /cdn/share/lib/nom du fichier
|
||||
/adminapi/node_modules/axios/dist/axios.min.js ds /cdn/lib/axios/dist/axios.min.js
|
||||
et dans html le build sera src="/cdn/lib/axios/dist/axios.min.js"
|
||||
|
||||
*/
|
||||
const pathto = `../${tribeId}/objects/wwws`;
|
||||
let confwww;
|
||||
if (fs.existsSync(`${pathto}/itm/${webapp}.json`)) {
|
||||
@ -379,7 +422,12 @@ Wwws.initlocaldata = (tribe, appname, pagename, version, profils, lg) => {
|
||||
const fileparam = `../${tribe}/objects/wwws/itm/${appname}.json`;
|
||||
//console.log(path.resolve(fileparam));
|
||||
if (!fs.existsSync(fileparam)) {
|
||||
return { status: 404, ref: "Wwws", msg: "appdoesnotexist", data: {} };
|
||||
return {
|
||||
status: 404,
|
||||
ref: "Wwws",
|
||||
msg: "appdoesnotexist",
|
||||
data: { fileparam },
|
||||
};
|
||||
}
|
||||
const locals = fs.readJSONSync(fileparam);
|
||||
if (!locals.pages[pagename]) {
|
||||
@ -427,7 +475,7 @@ Wwws.initlocaldata = (tribe, appname, pagename, version, profils, lg) => {
|
||||
ref: {},
|
||||
schema: {},
|
||||
screens: {},
|
||||
screensnew:{}
|
||||
screensnew: {},
|
||||
};
|
||||
localstorage.headers.xlang = lg;
|
||||
// A faire plus tard charger tous les referentiele et les data pour une page adminpage
|
||||
@ -494,6 +542,7 @@ Wwws.initlocaldata = (tribe, appname, pagename, version, profils, lg) => {
|
||||
}
|
||||
if (loc.tpl) {
|
||||
Object.keys(loc.tpl).forEach((r) => {
|
||||
// possible to store an independant language mustache
|
||||
let src = `../${loc.tpl[r]}`;
|
||||
if (!fs.existsSync(src)) {
|
||||
src += `_${lg}.mustache`;
|
||||
@ -540,7 +589,7 @@ Wwws.initlocaldata = (tribe, appname, pagename, version, profils, lg) => {
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!loc.screens) loc.screens={}
|
||||
if (!loc.screens) loc.screens = {};
|
||||
if (loc.screens) {
|
||||
Object.keys(loc.screens).forEach((r) => {
|
||||
let src = `../${loc.screens[r]}`;
|
||||
@ -557,7 +606,7 @@ Wwws.initlocaldata = (tribe, appname, pagename, version, profils, lg) => {
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!loc.screensnew) loc.screensnew={}
|
||||
if (!loc.screensnew) loc.screensnew = {};
|
||||
if (loc.screensnew) {
|
||||
Object.keys(loc.screensnew).forEach((r) => {
|
||||
let src = `../${loc.screensnew[r]}`;
|
||||
|
@ -24,7 +24,7 @@
|
||||
# .setup.sh smatchit https://testwall-ants.ndda.fr https://gitea.ndda.fr/smatchit/smatchit
|
||||
|
||||
tribe=$1 # name of the tribe to install
|
||||
url=$2 # url to get the data from OR newtribe
|
||||
url=$2 # url to get the data from OR "newtribe" value
|
||||
gitrepo=$3 # url to get apxtri code from a git repo (empty if must come from a backup or the url)
|
||||
codekey=$4 # code to access backend of the tribe in case it is not newtribe or adminapi tribe
|
||||
|
||||
|
30
objects/options/dayofweek_en.json
Normal file
30
objects/options/dayofweek_en.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"title": "Country Code",
|
||||
"description": "Country Code and Info",
|
||||
"commment": "Alpha-2 country code (ISO 3166-2:XX)",
|
||||
"lastupdatedata": "",
|
||||
"lst_idx": ["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],
|
||||
"itms": {
|
||||
"monday": {
|
||||
"title": "Monday"
|
||||
},
|
||||
"tuesday": {
|
||||
"title": "Tuesday"
|
||||
},
|
||||
"wednesday": {
|
||||
"title": "Wednesday"
|
||||
},
|
||||
"thursday": {
|
||||
"title": "Thursday"
|
||||
},
|
||||
"friday": {
|
||||
"title": "Friday"
|
||||
},
|
||||
"saturday": {
|
||||
"title": "Saturday"
|
||||
},
|
||||
"sunday": {
|
||||
"title": "Sunday"
|
||||
}
|
||||
}
|
||||
}
|
30
objects/options/dayofweek_fr.json
Normal file
30
objects/options/dayofweek_fr.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"title": "Country Code",
|
||||
"description": "Country Code and Info",
|
||||
"commment": "Alpha-2 country code (ISO 3166-2:XX)",
|
||||
"lastupdatedata": "",
|
||||
"lst_idx": ["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],
|
||||
"itms": {
|
||||
"monday": {
|
||||
"title": "Lundi"
|
||||
},
|
||||
"tuesady": {
|
||||
"title": "Mardi"
|
||||
},
|
||||
"wednesday": {
|
||||
"title": "Mercredi"
|
||||
},
|
||||
"thursday": {
|
||||
"title": "Jeudi"
|
||||
},
|
||||
"friday": {
|
||||
"title": "Vendredi"
|
||||
},
|
||||
"saturday": {
|
||||
"title": "Samedi"
|
||||
},
|
||||
"sunday": {
|
||||
"title": "Dimanche"
|
||||
}
|
||||
}
|
||||
}
|
71
schema/devices.json
Normal file
71
schema/devices.json
Normal file
@ -0,0 +1,71 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "adminapi/schema/wco",
|
||||
"title": "web components",
|
||||
"description": "A web component wco is a folder with list of mustache and one name.js that deal all the business logic",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"wconame": {
|
||||
"description": "Folder name into a tribeId/objects/wco/itm",
|
||||
"title": "Web component reusable in web project based with tailwindcss",
|
||||
"type": "string"
|
||||
},
|
||||
"owner": {
|
||||
"description": "owner that earn some fees",
|
||||
"type": "string"
|
||||
},
|
||||
"codehash": {
|
||||
"description": "Code signature of alias publickey",
|
||||
"type": "string"
|
||||
},
|
||||
"thumbnail":{
|
||||
"title":"Thumbnail of the component",
|
||||
"type":"string"
|
||||
},
|
||||
"title":{
|
||||
"title":"Short description of the wco",
|
||||
"type":"string"
|
||||
},
|
||||
"description":{
|
||||
"title":"Long description in html of the component",
|
||||
"type":"string"
|
||||
},
|
||||
"tpl":{
|
||||
"description":"list of mustache template to manage components each file must ended by _xx.mustache where xx is the language of the template, so you can add translation easily",
|
||||
"type":"array"
|
||||
},
|
||||
"tpldata":{
|
||||
"description":"Example of tpldata that you have to add in your local to customize the wco ended by _xx.json where xx is the language of the template",
|
||||
"type":"array"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"wconame",
|
||||
"owner",
|
||||
"title"
|
||||
],
|
||||
"apxid": "wconame",
|
||||
"apxuniquekey": [
|
||||
"wconame"
|
||||
],
|
||||
"apxidx": [
|
||||
{
|
||||
"name": "lst_wconame",
|
||||
"type": "array",
|
||||
"keyval": "wconame"
|
||||
}
|
||||
],
|
||||
"apxaccessrights": {
|
||||
"owner": {
|
||||
"D": [],
|
||||
"R": [],
|
||||
"U": []
|
||||
},
|
||||
"mayor": {
|
||||
"C": []
|
||||
},
|
||||
"person": {
|
||||
"R": []
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user