unclean SPARC
This commit is contained in:
@@ -0,0 +1,184 @@
|
||||
class MarklogicModel extends EICModel {
|
||||
|
||||
entityTypes = [
|
||||
{
|
||||
ref: '',
|
||||
label: '(entity)',
|
||||
icon: '',
|
||||
filters: [ ]
|
||||
},
|
||||
{
|
||||
ref: 'person',
|
||||
label: 'Person',
|
||||
icon: '',
|
||||
filters: [ 'id', 'euLogin', 'email' ]
|
||||
},
|
||||
{
|
||||
ref: 'application',
|
||||
label: 'App',
|
||||
icon: '',
|
||||
filters: [ ]
|
||||
},
|
||||
{
|
||||
ref: 'evaluation',
|
||||
label: 'SP Evaluation',
|
||||
icon: '',
|
||||
filters: [ ]
|
||||
},
|
||||
{
|
||||
ref: 'organisation',
|
||||
label: 'Organisation',
|
||||
icon: '',
|
||||
filters: [ 'id', 'pic' ]
|
||||
}
|
||||
]
|
||||
|
||||
payload = {
|
||||
entities: [],
|
||||
relations: []
|
||||
};
|
||||
|
||||
constructor(privileges) {
|
||||
|
||||
super('explorer', privileges);
|
||||
|
||||
}
|
||||
|
||||
getType(type) { return this.entityTypes.find(item => item.ref == type) || this.entityTypes.find(item => item.ref == ''); }
|
||||
|
||||
filters() {
|
||||
//if(!this.hasPrivilege('list')) return( new Promise((resolve, reject) => reject()))
|
||||
|
||||
let endpoint = this.getApiEndpoint('filters');
|
||||
|
||||
return (
|
||||
this.request(endpoint.uri, endpoint.method)
|
||||
.then( async serverData => {
|
||||
return serverData.payload;
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
search(filters) {
|
||||
//if(!this.hasPrivilege('list')) return( new Promise((resolve, reject) => reject()))
|
||||
|
||||
let endpoint = this.getApiEndpoint('search');
|
||||
|
||||
return (
|
||||
this.request(endpoint.uri, endpoint.method, filters)
|
||||
.then( async serverData => {
|
||||
return serverData.payload;
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
app.registerClass('MarklogicModel', MarklogicModel);
|
||||
|
||||
/* Leftovers
|
||||
|
||||
addPerson() {
|
||||
let fnames = ['Mike', 'Marc', 'Nico', 'John', 'Jack', 'Sam', 'Steve', 'Mary', 'July']
|
||||
let lnames = ['Myers', 'Vandenbroek', 'Dumoulin', 'Smith', 'Yamaha', 'Roland', 'Jones', 'Flintstone', 'Moog']
|
||||
|
||||
let fname = fnames[Math.floor(Math.random() * fnames.length)]
|
||||
let lname = lnames[Math.floor(Math.random() * lnames.length)]
|
||||
let item = {
|
||||
id: crypto.randomUUID().substring(0,8),
|
||||
label: fname + ' ' + lname,
|
||||
type: 'person',
|
||||
userProfile: {
|
||||
euLogin: lname.substring(0,5).toLowerCase() + fname.substring(0,2).toLowerCase(),
|
||||
roles: [
|
||||
{
|
||||
role: [
|
||||
{
|
||||
referenceItemKey: {
|
||||
key: "dK1kTbD_kSAS64tAxGB4LoQ",
|
||||
_value: "ByPass Project Officer"
|
||||
}
|
||||
},
|
||||
{
|
||||
referenceItemKey: {
|
||||
key: "dlcsLwB2vQMOPEXN5D8PUQg",
|
||||
_value: "EIC Developer"
|
||||
}
|
||||
},
|
||||
{
|
||||
referenceItemKey: {
|
||||
key: "d3XJP_8OETQyb4Qqmip2ypw",
|
||||
_value: "EIC_Admin"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
information: {
|
||||
gender: {
|
||||
referenceItemKey: {
|
||||
key: "dKQGjloGhSbGlOKIiABV8eQ",
|
||||
_value: "M"
|
||||
}
|
||||
},
|
||||
name: {
|
||||
firstName: fname,
|
||||
lastName: lname
|
||||
},
|
||||
contacts: {
|
||||
email: fname + '.' + lname + '@someemail.com',
|
||||
phone: '+324' + Math.random().toString().slice(2,8)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
this.payload.entities.push(item);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
addOrg() {
|
||||
let fnames = ['co', 'glass', 'alu', 'art', 'steel', 'eco', 'son', 'digit', 'net', 'tech', 'bio', 'nano', 'tron']
|
||||
let lnames = ['sprl', 'ltd', 'inc.', 'gmbh', 'intl.', 'sa']
|
||||
|
||||
let name = fnames[Math.floor(Math.random() * fnames.length)] + fnames[Math.floor(Math.random() * fnames.length)] + ' ' + lnames[Math.floor(Math.random() * lnames.length)]
|
||||
|
||||
let item = {
|
||||
id: crypto.randomUUID().substring(0,8),
|
||||
label: name,
|
||||
type: 'organisation',
|
||||
information: {
|
||||
pic: '8' + Math.random().toString().slice(2,8),
|
||||
legalName: name
|
||||
},
|
||||
statusHistory: [
|
||||
{
|
||||
status: {
|
||||
value: "created",
|
||||
dateTime: "2023-07-18T15:27:06.397381Z",
|
||||
changedByKey: "d4rP8zgrURMiAAv-StY9YKQ"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
this.payload.entities.push(item);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
addLink(org, person) {
|
||||
if(!this.payload.relations.find(
|
||||
item => (item.source == org.id && item.target == person.id) || (item.target == org.id && item.source == person.id))) {
|
||||
let relation = {
|
||||
source: org.id,
|
||||
target: person.id
|
||||
}
|
||||
|
||||
this.payload.relations.push(relation)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
Reference in New Issue
Block a user