diff --git a/.gitignore b/.gitignore
index 6cded5a6..1efad910 100644
--- a/.gitignore
+++ b/.gitignore
@@ -66,7 +66,7 @@ src/scripts/
useful_command.txt
password.txt
-
+api/mail_server.js
.idea/
docs/
diff --git a/api/server.js b/api/server.js
index 2f3ba621..1f1886f8 100644
--- a/api/server.js
+++ b/api/server.js
@@ -56,8 +56,11 @@ const errors = require('@arangodb').errors;
const queues = require('@arangodb/foxx/queues')
const getUserName = require("./queries/get-user-name");
const telegram = require("./queries/telegram-chat");
-const { exec } = require('child_process');
-//const { spawn } = require('child_process');
+var child_process = require('child_process');
+
+//const { exec } = require('child_process');
+//const spawn = require('child_process').spawn;
+const path = require('path')
//const uuidV4 = require('uuid/v4');
//const uuid = require('uuid');
//const { v4: uuidv4 } = require('uuid');
@@ -371,12 +374,30 @@ router.get('/get_person_id/:user_key', function (req, res) {
person = db._query(aql`FOR edge IN ${users_edge} FILTER edge._from == ${user_id} AND CONTAINS(edge._to,"persons") RETURN edge._to`).toArray();
res.send(person);
})
- .pathParam('user_key', joi.string().required(), 'user id of the entry.')
+.pathParam('user_key', joi.string().required(), 'user id of the entry.')
//.response(joi.array().items(joi.object().required()).required(), 'List of entry keys.')
.response(joi.array().items(joi.object().required()).required(), 'List of entry keys.')
.summary('List entry keys')
.description('Assembles a list of keys of entries in the collection.');
+router.get('/get_persons/:model_key/:collection_type', function (req, res) {
+ var model_id = req.pathParams.collection_type +"/"+req.pathParams.model_key;
+ var person = [];
+ var persons_coll = 'persons'
+ if (!db._collection(persons_coll)) {
+ db._createCollection(persons_coll);
+ }
+ const persons = db._collection(persons_coll);
+ person = db._query(aql`FOR v, e, s IN 1..1 OUTBOUND ${model_id} GRAPH 'global' PRUNE e._from ==${model_id} FILTER CONTAINS(e._to, "persons") RETURN s.vertices[1]`);
+ res.send(person);
+})
+.pathParam('model_key', joi.string().required(), 'investigation id of the parent\'s entry.')
+.pathParam('collection_type', joi.string().required(), 'collection_type of the parent\'s entry.')
+//.response(joi.array().items(joi.object().required()).required(), 'List of entry keys.')
+.response(joi.array().items(joi.object().required()).required(), 'List of entry keys.')
+.summary('List entry keys')
+.description('Assembles a list of keys of entries in the collection.');
+
router.get('/get_person/:person_id', function (req, res) {
var person_id = req.pathParams.person_id;
var person = [];
@@ -555,7 +576,6 @@ router.post('/authenticate_group', function (req, res) {
res.send({ success: false, message: 'group key ' + group_key + ' doesn\'t exists', group: {} });
}
else {
-
// add edge in group edge
var groups_edge_coll = 'groups_edge'
if (!db._collection(groups_edge_coll)) {
@@ -569,7 +589,6 @@ router.post('/authenticate_group', function (req, res) {
"roles": roles
};
var edges = db._query(aql`UPSERT ${edge_obj} INSERT ${edge_obj} UPDATE {} IN ${groups_edge} RETURN NEW `);
-
res.send({ success: true, message: 'group key ' + group_key + ' found', group: group_array['_documents'][0] });
}
}
@@ -578,6 +597,7 @@ router.post('/authenticate_group', function (req, res) {
username: joi.string().required(),
password: joi.string().required(),
group_key: joi.string().required(),
+ roles: joi.object().required(),
group_password: joi.string().required()
}).required(), 'Values to check.')
.response(
@@ -946,56 +966,8 @@ router.post('/request-reset', (req, res) => {
let personId = result[0]['person']['Person ID']
var edges = db._query(aql`UPSERT {'Person ID':${personId}} INSERT {} UPDATE {'token':${token}} IN ${users} RETURN NEW `);
// send mail with email and token
-
- /* const { child_process } = require('child_process');
- child_process.execFile('./scripts/send_mail.sh',[req.body.email,req.body.token], (err, data) => {
- if (err) {
- console.log("error "+err);
- return res.status(500).send('Error');
- }
- else{
- console.log("good")
- }
- }); */
- //var spawn = require('child_process').spawn
-
- var command = "sh ./scripts/send_mail.sh " + email + " " + token;
- var sendmail = exec(command,
- (error, stdout, stderr) => {
- if (error !== null) {
- console.log(`exec error: ${error}`);
- res.send({ success: false });
- }
- else {
- res.send({ success: true });
- }
- });
-
- /* const child = require('child_process').spawn("./scripts/send_mail.sh'",[email,token], { detached: true } );
- child.stdout.on('data', data => {
- console.log(`stdout:\n${data}`);
- res.send({ success: true });
- });
+ res.send({ success: true , token:token})
- child.stderr.on('data', data => {
- console.error(`stderr: ${data}`);
- res.send({ success: false });
- }); */
- ////res.send('end spawn launch');
-
- /* const exec = require('child_process').exec;
- var child;
- const myShellScript = exec('sh send_mail.sh ');
- myShellScript.stdout.on('data', (data)=>{
- console.log(data);
- // do whatever you want here with data
- });
- myShellScript.stderr.on('data', (data)=>{
- console.error(data);
- }); */
-
-
-
}
catch (e) {
if (!e.isArangoError || e.errorNum !== DOC_NOT_FOUND) {
@@ -1004,7 +976,7 @@ router.post('/request-reset', (req, res) => {
res.throw(404, 'The entry does not exist', e);
}
-
+ res.send({ success: true , token:token})
@@ -1015,7 +987,7 @@ router.post('/request-reset', (req, res) => {
//sendMail({'email':email})
//res.json(sendMail({'email':email}));
- res.send({ success: true })
+ //res.send({ success: true })
})
.body(joi.object({
email: joi.string().required(),
@@ -1166,7 +1138,51 @@ router.get('/get_ncbi_taxon_data/', function (req, res) {
.summary('List entry keys')
.description('Assembles a list of keys of entries in the collection.');
-
+router.get('/get_ncbi_taxon_data_by_species_regex/:regex', function (req, res) {
+ var regex = req.pathParams.regex;
+ const coll = db._collection('NCBITaxons');
+ if (!coll) {
+ db._createDocumentCollection('NCBITaxons');
+ }
+ var get_data = db._query(aql`
+ FOR entry IN ${coll}
+ LET RES=(FOR data in entry.data
+ FILTER CONTAINS(data.species,${regex})
+ RETURN data)
+ RETURN RES
+ `).toArray();
+ //var result=get_data[0]
+ //console.log(get_data[0]['species'].length)
+ res.send(get_data[0]);
+ })
+ .pathParam('regex', joi.string().required(), 'regex to find reduced species set.')
+ .response(joi.array().items(joi.object().required()).required(), 'List of entry keys.')
+ .summary('List entry keys')
+ .description('Assembles a list of keys of entries in the collection.');
+
+router.get('/get_ncbi_taxon_data_by_taxon_regex/:regex', function (req, res) {
+ var regex = req.pathParams.regex;
+ const coll = db._collection('NCBITaxons');
+ if (!coll) {
+ db._createDocumentCollection('NCBITaxons');
+ }
+ var get_data = db._query(aql`
+ FOR entry IN ${coll}
+ LET RES=(FOR data in entry.data
+ FILTER CONTAINS(data.taxon,${regex})
+ RETURN data)
+ RETURN RES
+ `).toArray();
+ //var result=get_data[0]
+ //console.log(get_data[0]['species'].length)
+ res.send(get_data[0]);
+ })
+ .pathParam('regex', joi.string().required(), 'regex to find reduced species set.')
+ .response(joi.array().items(joi.object().required()).required(), 'List of entry keys.')
+ .summary('List entry keys')
+ .description('Assembles a list of keys of entries in the collection.');
+
+
/* var get_data = db._query(aql`
LET document = DOCUMENT("NCBITaxons/33550834")
LET alteredList = (
@@ -1259,12 +1275,12 @@ router.get('/get_max_level/:model_type', function (req, res) {
.description('Assembles a list of keys of entries in the collection.');
-router.get('/get_lindaID_by_studyID/:study_unique_id/:parent_key', function (req, res) {
- var study_unique_id = req.pathParams.study_unique_id;
+router.get('/get_lindaID_by_studyName/:study_name/:parent_key', function (req, res) {
+ var study_name = req.pathParams.study_name;
var parent_key = req.pathParams.parent_key;
var parent_id = "investigations/" + parent_key;
var data = {}
- data = db._query(aql`FOR v, e IN 1..1 OUTBOUND ${parent_id} GRAPH 'global' FILTER v['Study unique ID']==${study_unique_id} RETURN {_id:v._id}`).toArray();
+ data = db._query(aql`FOR v, e IN 1..1 OUTBOUND ${parent_id} GRAPH 'global' FILTER v['Study Name']==${study_name} RETURN {_id:v._id}`).toArray();
if (data.length > 0) {
data[0]["success"] = true
res.send(data[0]);
@@ -1275,7 +1291,7 @@ router.get('/get_lindaID_by_studyID/:study_unique_id/:parent_key', function (req
}
})
- .pathParam('study_unique_id', joi.string().required(), 'username of the entry.')
+ .pathParam('study_name', joi.string().required(), 'username of the entry.')
.pathParam('parent_key', joi.string().required(), 'username of the entry.')
.response(joi.object().required(), 'Entry stored in the collection.')
.summary('List entry keys')
@@ -1619,6 +1635,9 @@ router.get('/get_childs_by_model/:model_type/:model_key', function (req, res) {
else if (model_type == "environment") {
isa_model = "study_isa/Study_isa"
}
+ else if (model_type == "event") {
+ isa_model = "event_isa/Event_isa"
+ }
else {
isa_model = "assay_isa/assay_Isa"
}
@@ -2294,7 +2313,7 @@ router.post('/upload_data', function (req, res) {
var password = req.body.password;
var parent_id = req.body.parent_id;
var values = req.body.values;
- const edge = db._collection("studies_edge");
+ const edge = db._collection("investigations_edge");
var coll = db._collection("data_files");
// //first check if user exist
/////////////////////////////
@@ -2763,7 +2782,6 @@ router.post('/update_document', function (req, res) {
var username = req.body.username;
var password = req.body.password;
var _key = req.body._key;
-
var values = req.body.values;
var model_type = req.body.model_type;
var datatype = "";
@@ -3005,7 +3023,7 @@ router.post('/update_multiple_field', function (req, res) {
if (model_data[field] === value) {
if (datafile_key !== '') {
let df_id = "data_files/" + datafile_key
- if (model_field === 'Study unique ID') {
+ if (model_field === 'Study Name') {
const edges3 = db._query(aql`
LET document = DOCUMENT(${df_id})
LET alteredData = (
@@ -4439,7 +4457,11 @@ router.post('/add_multiple', function (req, res) {
const edges = db._query(aql`UPSERT ${obj} INSERT ${obj} UPDATE {} IN ${edge} RETURN NEW `);
///res.send({ success: true, message: 'Everything is good ', _id: data[0].id });
+ var linda_unique_id="LINDA:"+data[0].id.split('/')[1]
if (model_type === 'investigation') {
+ var update = db._query(aql` FOR entry IN ${coll} FILTER entry._id == ${data[0].id} UPDATE {_key:${data[0].id.split('/')[1]}} WITH {'Investigation unique ID': ${linda_unique_id}} IN ${coll} RETURN NEW`).toArray();
+
+
var person = get_person_id_from_user_id(user[0]['_id'], users_edge)
console.log(person)
var obj2 = {
@@ -4452,6 +4474,8 @@ router.post('/add_multiple', function (req, res) {
const edges2 = db._query(aql`UPSERT ${obj2} INSERT ${obj2} UPDATE {} IN ${investigations_edge} RETURN NEW `);
}
if (model_type === 'study') {
+ var update = db._query(aql` FOR entry IN ${coll} FILTER entry._id == ${data[0].id} UPDATE {_key:${data[0].id.split('/')[1]}} WITH {'Study unique ID': ${linda_unique_id}} IN ${coll} RETURN NEW`).toArray();
+
var person = get_person_id_from_user_id(user[0]['_id'], users_edge)
console.log(person)
var obj2 = {
@@ -4686,6 +4710,7 @@ router.post('/add', function (req, res) {
data = db._query(aql`INSERT ${values} IN ${coll} RETURN { new: NEW, id: NEW._id } `).toArray();
if (model_type !== 'observation_unit') {
+
// var data = [];
// data = db._query(aql`INSERT ${values} IN ${coll} RETURN { new: NEW, id: NEW._id } `).toArray();
@@ -4699,14 +4724,22 @@ router.post('/add', function (req, res) {
}
//Document exists add edges in edge collection
else {
+
var obj = {
"_from": parent_id,
"_to": data[0].id,
};
+ var linda_unique_id="LINDA:"+data[0].id.split('/')[1]
const edges = db._query(aql`UPSERT ${obj} INSERT ${obj} UPDATE {} IN ${edge} RETURN NEW `);
///res.send({ success: true, message: 'Everything is good ', _id: data[0].id });
+
if (model_type === 'investigation') {
+ //update Investigation unique ID
+
+ var update = db._query(aql` FOR entry IN ${coll} FILTER entry._id == ${data[0].id} UPDATE {_key:${data[0].id.split('/')[1]}} WITH {'Investigation unique ID': ${linda_unique_id}} IN ${coll} RETURN NEW`).toArray();
+
+
var person = get_person_id_from_user_id(user[0]['_id'], users_edge)
console.log(person)
var obj2 = {
@@ -4719,6 +4752,10 @@ router.post('/add', function (req, res) {
const edges2 = db._query(aql`UPSERT ${obj2} INSERT ${obj2} UPDATE {} IN ${investigations_edge} RETURN NEW `);
}
if (model_type === 'study') {
+
+ //update Study unique ID
+ var update = db._query(aql` FOR entry IN ${coll} FILTER entry._id == ${data[0].id} UPDATE {_key:${data[0].id.split('/')[1]}} WITH {'Study unique ID': ${linda_unique_id}} IN ${coll} RETURN NEW`).toArray();
+
var person = get_person_id_from_user_id(user[0]['_id'], users_edge)
console.log(person)
var obj2 = {
@@ -5066,8 +5103,6 @@ router.post('/add_parent_and_child', function (req, res) {
//Search unique id in studies collection for this parent id ???
//check = db._query(aql`FOR v, e IN 1..1 OUTBOUND ${parent_id} GRAPH 'global' FILTER v['Study unique ID'] == ${ID} RETURN {v_id:v._id,id:v['Study unique ID'], study:v}`).toArray();
check = db._query(aql`FOR v, e IN 1..1 OUTBOUND ${parent_id} GRAPH 'global' FILTER CONTAINS(v['Study unique ID'], ${ID}) RETURN {v_id:v._id,id:v['Study unique ID'], study:v}`).toArray();
-
-
//check = db._query(aql` FOR entry IN ${coll} FILTER entry['Study unique ID'] == ${ID} RETURN entry`).toArray()
// ID was not found
if (check.length === 0) {
@@ -5461,7 +5496,7 @@ router.post('/check', function (req, res) {
//var user_id = user[0]._id
if (as_template) {
check = db._query(aql`FOR v, e IN 1..3 OUTBOUND ${parent_id} GRAPH 'global' FILTER v.${field} == ${value} AND CONTAINS('e._to','templates') RETURN {eto:e._to, vertice:v}`).toArray();
- f
+
}
else {
check = db._query(aql`FOR v, e IN 1..3 OUTBOUND ${parent_id} GRAPH 'global' FILTER v.${field} == ${value} RETURN {eto:e._to, vertice:v}`).toArray();
@@ -5547,6 +5582,154 @@ router.get('/event', function (req, res) {
******************************************************************************************
******************************************************************************************
******************************************************************************************/
+ router.post('/add_observation_units_factor_value', function (req, res) {
+ var username = req.body.username;
+ var password = req.body.password;
+ var experimental_factor_values = req.body.experimental_factor_values;
+ var obs_unit_id = req.body.obs_unit_id;
+ var factor_type = req.body.factor_type
+ //observation unit edge
+ var observation_unit_edge_coll = 'observation_units_edge'
+ if (!db._collection(observation_unit_edge_coll)) {
+ db._createEdgeCollection(observation_unit_edge_coll);
+ }
+ var observation_unit_edge = db._collection(observation_unit_edge_coll);
+
+ //observation units collection
+ var observation_unit_coll = db._collection('observation_units');
+ if (!observation_unit_coll) {
+ db._createDocumentCollection('observation_units');
+ }
+ /////////////////////////////
+ //first check if user exist
+ /////////////////////////////
+ const user = db._query(aql`
+ FOR entry IN ${users}
+ FILTER entry.username == ${username}
+ FILTER entry.password == ${password}
+ RETURN entry
+ `);
+ if (user.next() === null) {
+ res.send({ success: false, message: 'Username ' + username + ' doesn\'t exists' });
+ }
+ else {
+ const factors_values = db._query(aql`FOR entry IN ${observation_unit_coll}
+ FILTER entry._id==${obs_unit_id}
+ RETURN entry['Observation Unit factor value']
+ `).toArray();
+ console.log(factors_values)
+ console.log(factors_values)
+ console.log(factor_type)
+ for (var j = 0; j < experimental_factor_values.length; j++) {
+ let obj={}
+ obj[factor_type]=experimental_factor_values[j]
+ factors_values[0][j].push(obj)
+ }
+ console.log(factors_values)
+ /* LET alteredFactorsValues = (
+ FOR element IN document['Observation Unit factor value']
+ LET newItem = PUSH(element,"3")
+ RETURN newItem
+ ) */
+ const data = db._query(aql`
+ LET document = DOCUMENT(${obs_unit_id})
+ UPDATE document
+ WITH { 'Observation Unit factor value': ${factors_values[0]} }
+ IN observation_units
+ RETURN {after: NEW }
+ `);
+ res.send({ success: true, message: 'document has been updated ', _id: obs_unit_id });
+
+ }
+
+ }).body(joi.object().keys({
+ username: joi.string().required(),
+ password: joi.string().required(),
+ experimental_factor_values: joi.array().items(joi.string().required()).required(),
+ obs_unit_id:joi.string().required(),
+ factor_type:joi.string().required()
+}).required(), 'Values to check.')
+.response(joi.object().keys({
+ success: joi.boolean().required(),
+ message: joi.string().required(),
+ _id: joi.string().required()
+}).required(), 'response.')
+.summary('List entry keys')
+.description('add MIAPPE description for given model.');
+
+
+
+ router.post('/add_observation_units_observed_variables', function (req, res) {
+ var username = req.body.username;
+ var password = req.body.password;
+ var parent_id = req.body.parent_id;//observation unit id
+ var values = req.body.values;
+ var observed_variable_id=req.body.observed_variable_id;
+ //var model_type = req.body.model_type;
+ var datatype = "observation_units";
+
+ //observation unit edge
+ var observation_unit_edge_coll = datatype + '_edge'
+ if (!db._collection(observation_unit_edge_coll)) {
+ db._createEdgeCollection(observation_unit_edge_coll);
+ }
+ var observation_unit_edge = db._collection(observation_unit_edge_coll);
+
+ //observation units collection
+ var observation_unit_coll = db._collection(datatype);
+ if (!observation_unit_coll) {
+ db._createDocumentCollection(datatype);
+ }
+ /////////////////////////////
+ //first check if user exist
+ /////////////////////////////
+ const user = db._query(aql`
+ FOR entry IN ${users}
+ FILTER entry.username == ${username}
+ FILTER entry.password == ${password}
+ RETURN entry
+ `);
+ if (user.next() === null) {
+ res.send({ success: false, message: 'Username ' + username + ' doesn\'t exists' });
+ }
+ else {
+ var observation_data = values['observations'];
+ var observed_variable_obj = {
+ "_from": parent_id,
+ "_to": observed_variable_id,
+ "observations": []
+ }
+ // add Observed variable link to observation unit edge
+ if (observation_data !== undefined) {
+ for (var j = 0; j < observation_data.length; j++) {
+ observation_data[j]['Observed variable ID'] = observed_variable_id
+ observed_variable_obj["observations"].push(observation_data[j])
+ }
+ }
+ if ("_from" in observed_variable_obj) {
+ db._query(aql`UPSERT ${observed_variable_obj} INSERT ${observed_variable_obj} UPDATE {} IN ${observation_unit_edge} RETURN NEW `);
+ res.send({ success: true, message: 'Everything is good ', _id: observed_variable_id });
+ }
+ }
+})
+ .body(joi.object().keys({
+ username: joi.string().required(),
+ password: joi.string().required(),
+ parent_id: joi.string().required(),
+ values: joi.object({
+ observations: joi.array().items(joi.object().required()).required(),
+ }).required(),
+ observed_variable_id: joi.string().required(),
+ }).required(), 'Values to check.')
+ .response(joi.object().keys({
+ success: joi.boolean().required(),
+ message: joi.string().required(),
+ _id: joi.string().required()
+ }).required(), 'response.')
+ .summary('List entry keys')
+ .description('add MIAPPE description for given model.');
+
+
//Post new data
router.post('/add_observation_units_samples', function (req, res) {
var username = req.body.username;
@@ -6093,12 +6276,66 @@ router.post('/add_observation_units', function (req, res) {
.summary('List entry keys')
.description('add MIAPPE description for given model.');
+router.post('/add_observation_unit_factor', function (req, res) {
+ var username = req.body.username;
+ var password = req.body.password;
+ var observation_unit_id = req.body.observation_unit_id;
+ var experimental_factor = req.body.experimental_factor;
+ var datatype = "observation_units";
+
+ //observation unit edge
+ var observation_unit_edge_coll = 'observation_units_edge'
+ if (!db._collection(observation_unit_edge_coll)) {
+ db._createEdgeCollection(observation_unit_edge_coll);
+ }
+ var observation_unit_edge = db._collection(observation_unit_edge_coll);
+
+ //observation units collection
+ var observation_unit_coll = db._collection(datatype);
+ if (!observation_unit_coll) {
+ db._createDocumentCollection(datatype);
+ }
+
+ /////////////////////////////
+ //first check if user exist
+ /////////////////////////////
+ const user = db._query(aql`
+ FOR entry IN ${users}
+ FILTER entry.username == ${username}
+ FILTER entry.password == ${password}
+ RETURN entry
+ `);
+ if (user.next() === null) {
+ res.send({ success: false, message: 'Username ' + username + ' doesn\'t exists' , _id:username});
+ }
+ else {
+ var ef_obj = {
+ "_from": observation_unit_id,
+ "_to": experimental_factor['_id']
+ }
+ const result=db._query(aql`UPSERT ${ef_obj} INSERT ${ef_obj} UPDATE {} IN ${observation_unit_edge} RETURN NEW `);
+ res.send({ success: true, message: 'successfully added factor in observation unit edge' , _id:result['_id']});
+ }
+})
+.body(joi.object().keys({
+ username: joi.string().required(),
+ password: joi.string().required(),
+ observation_unit_id: joi.string().required(),
+ experimental_factor: joi.object().required()
+}).required(), 'Values to check.')
+.response(joi.object().keys({
+ success: joi.boolean().required(),
+ message: joi.string().required(),
+ _id: joi.string().required()
+}).required(), 'response.')
+.summary('List entry keys')
+.description('add MIAPPE description for given model.');
router.post('/remove_observation_unit', function (req, res) {
var username = req.body.username;
var password = req.body.password;
- var id = req.body.id;
+ var id = req.body.id;//observation unit
const user = db._query(aql`
FOR entry IN ${users}
@@ -6132,7 +6369,7 @@ router.post('/remove_observation_unit', function (req, res) {
//Delete child vertice in collection
if ((childs[i].v_id !== null) || (childs[i].v_key !== null)) {
- if (childs[i].v_id.split("/")[0] !== "biological_materials" && childs[i].v_id.split("/")[0] !== "experimental_factors") {
+ if (childs[i].v_id.split("/")[0] !== "biological_materials" && childs[i].v_id.split("/")[0] !== "experimental_factors" && childs[i].v_id.split("/")[0] !== "observed_variables") {
var child_coll = childs[i].v_id.split("/")[0];
var child_vkey = childs[i].v_key;
try {
@@ -7389,10 +7626,10 @@ router.get('/get_templates/:person_key', function (req, res) {
//Get templates - used in template selection dialog component
-router.get('/get_templates_by_user/:user_key/:model_coll/', function (req, res) {
+router.get('/get_templates_by_user/:user_key/:model_type/', function (req, res) {
try {
var user_key = req.pathParams.user_key;
- var model_coll = req.pathParams.model_coll;
+ var model_type = req.pathParams.model_type;
var coll_name = 'templates'
var data = [];
@@ -7417,8 +7654,7 @@ router.get('/get_templates_by_user/:user_key/:model_coll/', function (req, res)
}
//data = coll.byExample().toArray();
-
-
+ data=data.filter(template=>template['_model_type']===model_type)
res.send(data);
}
catch (e) {
@@ -7430,7 +7666,7 @@ router.get('/get_templates_by_user/:user_key/:model_coll/', function (req, res)
})
.pathParam('user_key', joi.string().required(), 'model requested.')
- .pathParam('model_coll', joi.string().required(), 'unique key.')
+ .pathParam('model_type', joi.string().required(), 'unique key.')
.response(joi.array().items(joi.object().required()).required(), 'Entry stored in the collection.')
.summary('Retrieve an entry')
.description('Retrieves an entry from the "myFoxxCollection" collection by key.');
diff --git a/package-lock.json b/package-lock.json
index 34bdab40..db09a65a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3950,9 +3950,9 @@
"dev": true
},
"ansi-regex": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
- "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz",
+ "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA=="
},
"ansi-styles": {
"version": "3.2.1",
@@ -4906,34 +4906,86 @@
"dev": true
},
"body-parser": {
- "version": "1.19.0",
- "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
- "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
- "dev": true,
+ "version": "1.20.0",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz",
+ "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==",
"requires": {
- "bytes": "3.1.0",
+ "bytes": "3.1.2",
"content-type": "~1.0.4",
"debug": "2.6.9",
- "depd": "~1.1.2",
- "http-errors": "1.7.2",
+ "depd": "2.0.0",
+ "destroy": "1.2.0",
+ "http-errors": "2.0.0",
"iconv-lite": "0.4.24",
- "on-finished": "~2.3.0",
- "qs": "6.7.0",
- "raw-body": "2.4.0",
- "type-is": "~1.6.17"
+ "on-finished": "2.4.1",
+ "qs": "6.10.3",
+ "raw-body": "2.5.1",
+ "type-is": "~1.6.18",
+ "unpipe": "1.0.0"
},
"dependencies": {
"bytes": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
- "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==",
- "dev": true
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="
+ },
+ "depd": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="
+ },
+ "destroy": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
+ "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg=="
+ },
+ "http-errors": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
+ "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
+ "requires": {
+ "depd": "2.0.0",
+ "inherits": "2.0.4",
+ "setprototypeof": "1.2.0",
+ "statuses": "2.0.1",
+ "toidentifier": "1.0.1"
+ }
+ },
+ "inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
+ },
+ "on-finished": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
+ "requires": {
+ "ee-first": "1.1.1"
+ }
},
"qs": {
- "version": "6.7.0",
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
- "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==",
- "dev": true
+ "version": "6.10.3",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz",
+ "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==",
+ "requires": {
+ "side-channel": "^1.0.4"
+ }
+ },
+ "setprototypeof": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
+ },
+ "statuses": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
+ "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="
+ },
+ "toidentifier": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="
}
}
},
@@ -5963,8 +6015,7 @@
"content-type": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
- "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==",
- "dev": true
+ "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
},
"convert-source-map": {
"version": "1.7.0",
@@ -6666,7 +6717,6 @@
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
- "dev": true,
"requires": {
"ms": "2.0.0"
}
@@ -7063,8 +7113,7 @@
"ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
- "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=",
- "dev": true
+ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"electron-to-chromium": {
"version": "1.3.550",
@@ -7634,11 +7683,47 @@
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=",
"dev": true
},
+ "body-parser": {
+ "version": "1.19.0",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
+ "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
+ "dev": true,
+ "requires": {
+ "bytes": "3.1.0",
+ "content-type": "~1.0.4",
+ "debug": "2.6.9",
+ "depd": "~1.1.2",
+ "http-errors": "1.7.2",
+ "iconv-lite": "0.4.24",
+ "on-finished": "~2.3.0",
+ "qs": "6.7.0",
+ "raw-body": "2.4.0",
+ "type-is": "~1.6.17"
+ }
+ },
+ "bytes": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
+ "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==",
+ "dev": true
+ },
"qs": {
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==",
"dev": true
+ },
+ "raw-body": {
+ "version": "2.4.0",
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
+ "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
+ "dev": true,
+ "requires": {
+ "bytes": "3.1.0",
+ "http-errors": "1.7.2",
+ "iconv-lite": "0.4.24",
+ "unpipe": "1.0.0"
+ }
}
}
},
@@ -8819,6 +8904,13 @@
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
"requires": {
"ansi-regex": "^2.0.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
+ }
}
},
"has-bigints": {
@@ -12972,8 +13064,7 @@
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
- "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=",
- "dev": true
+ "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
},
"mem": {
"version": "4.3.0",
@@ -13263,9 +13354,9 @@
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
},
"moment": {
- "version": "2.29.2",
- "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.2.tgz",
- "integrity": "sha512-UgzG4rvxYpN15jgCmVJwac49h9ly9NurikMWGPdVxm8GZD6XjkKPxDTjQQ43gtGgnV3X0cAyWDdP2Wexoquifg=="
+ "version": "2.29.3",
+ "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.3.tgz",
+ "integrity": "sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw=="
},
"move-concurrently": {
"version": "1.0.1",
@@ -15178,22 +15269,57 @@
"dev": true
},
"raw-body": {
- "version": "2.4.0",
- "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
- "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
- "dev": true,
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
+ "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
"requires": {
- "bytes": "3.1.0",
- "http-errors": "1.7.2",
+ "bytes": "3.1.2",
+ "http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"unpipe": "1.0.0"
},
"dependencies": {
"bytes": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
- "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==",
- "dev": true
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="
+ },
+ "depd": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="
+ },
+ "http-errors": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
+ "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
+ "requires": {
+ "depd": "2.0.0",
+ "inherits": "2.0.4",
+ "setprototypeof": "1.2.0",
+ "statuses": "2.0.1",
+ "toidentifier": "1.0.1"
+ }
+ },
+ "inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
+ },
+ "setprototypeof": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
+ },
+ "statuses": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
+ "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="
+ },
+ "toidentifier": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="
}
}
},
@@ -16911,6 +17037,13 @@
"integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=",
"requires": {
"ansi-regex": "^2.0.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
+ }
}
},
"strip-bom": {
@@ -17721,7 +17854,6 @@
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
- "dev": true,
"requires": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
@@ -17884,8 +18016,7 @@
"unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
- "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
- "dev": true
+ "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
},
"unset-value": {
"version": "1.0.0",
diff --git a/package.json b/package.json
index 87b771be..6587587d 100644
--- a/package.json
+++ b/package.json
@@ -39,7 +39,9 @@
"ag-grid-enterprise": "^27.1.0",
"angular-datatables": "^8.1.0",
"angular-ui-tour": "^0.9.4",
+ "ansi-regex": "^6.0.1",
"auth0": "^2.38.1",
+ "body-parser": "^1.20.0",
"bootstrap": "^3.4.1",
"core-js": "^3.6.5",
"csv": "^6.0.5",
@@ -60,7 +62,7 @@
"mdb-ui-kit": "^3.4.0",
"minimist": "^1.2.6",
"mkdirp": "^1.0.4",
- "moment": "^2.29.2",
+ "moment": "^2.29.3",
"ng-bootstrap": "^1.6.3",
"ng-gantt": "^2.5.0",
"ngx-guided-tour": "^1.1.11",
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index fe7b5842..e3d3a693 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -7,13 +7,13 @@ import { HomeComponent } from './modules/general/home/home.component';
import { AdminComponent } from './components/admin/admin.component'
import { HomeNewComponent } from './modules/general/home/home-new.component';
import { NotFoundComponent } from './modules/general/not-found/not-found.component';
-import { ResponseResetComponent } from './modules/general/response-reset/response-reset.component';
+//import { ResponseResetComponent } from './modules/general/response-reset/response-reset.component';
const routes: Routes = [
{ path: '', redirectTo: 'home2', pathMatch: 'full' },
//{ path: 'home', component: HomeComponent, canActivate: [AuthGuard]},
- { path: 'home2',component: HomeNewComponent, canActivate: [AuthGuard]},
- { path: 'response-reset',component: ResponseResetComponent},
+ { path: 'home2',component: HomeNewComponent},
+ //{ path: 'response-reset',component: ResponseResetComponent},
{
path: 'login',
loadChildren: () => import('./modules/general/login/login.module')
@@ -118,11 +118,11 @@ const routes: Routes = [
loadChildren: () => import('./modules/general/request-reset/request-reset.module')
.then(m => m.RequestResetModule)
},
- /* {
+ {
path: 'response-reset',
loadChildren: () => import('./modules/general/response-reset/response-reset.module')
.then(m => m.ResponseResetModule)
- }, */
+ },
// DOCUMENTATION MODULE
{
path: '',
diff --git a/src/app/app.component.css b/src/app/app.component.css
index d59ff064..70f08698 100644
--- a/src/app/app.component.css
+++ b/src/app/app.component.css
@@ -1,9 +1,10 @@
.scrollable-menu {
height: auto;
max-height: 200px;
- overflow-x: hidden;
+ /* overflow-x: hidden; */
}
+
button {
padding-top: 2px;
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 9d8110a3..2a938d3e 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -64,6 +64,7 @@ import { HomeComponent } from './modules/general/home/home.component';
import { HomeNewComponent } from './modules/general/home/home-new.component';
import { NotFoundComponent } from './modules/general/not-found/not-found.component';
import { ResponseResetComponent } from './modules/general/response-reset/response-reset.component';
+import { ResponseResetModule } from './modules/general/response-reset/response-reset.module';
@@ -79,8 +80,8 @@ import { ResponseResetComponent } from './modules/general/response-reset/respons
DragDropDirective,
PublicationsComponent,
HomeNewComponent,
- NotFoundComponent,
- ResponseResetComponent
+ NotFoundComponent//,
+ //ResponseResetComponent
],
imports: [
BrowserModule,
@@ -125,7 +126,8 @@ import { ResponseResetComponent } from './modules/general/response-reset/respons
AlertModule,
MapModule,
AssignModule,
- RequestResetModule
+ RequestResetModule,
+ ResponseResetModule
//DocumentationModule
//ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production })
],
diff --git a/src/app/components/admin/admin.component.ts b/src/app/components/admin/admin.component.ts
index 01437156..09ca7b57 100644
--- a/src/app/components/admin/admin.component.ts
+++ b/src/app/components/admin/admin.component.ts
@@ -4,104 +4,104 @@ import { UserInterface } from 'src/app/models/linda/person';
import { User } from '../../models/user';
declare const annyang: any;
@Component({
- selector: 'app-admin',
- templateUrl: './admin.component.html',
- styleUrls: ['./admin.component.css']
+ selector: 'app-admin',
+ templateUrl: './admin.component.html',
+ styleUrls: ['./admin.component.css']
})
export class AdminComponent implements OnInit {
- voiceActiveSectionDisabled: boolean = true;
+ voiceActiveSectionDisabled: boolean = true;
voiceActiveSectionError: boolean = false;
voiceActiveSectionSuccess: boolean = false;
voiceActiveSectionListening: boolean = false;
voiceText: any;
- users: UserInterface[] = [];
- constructor(private ngZone: NgZone) { }
+ users: UserInterface[] = [];
+ constructor(private ngZone: NgZone) { }
- ngOnInit() {}
+ ngOnInit() { }
- initializeVoiceRecognitionCallback(): void {
+ initializeVoiceRecognitionCallback(): void {
annyang.addCallback('error', (err) => {
- if(err.error === 'network'){
- this.voiceText = "Internet is require";
- annyang.abort();
- this.ngZone.run(() => this.voiceActiveSectionSuccess = true);
- } else if (this.voiceText === undefined) {
+ if (err.error === 'network') {
+ this.voiceText = "Internet is require";
+ annyang.abort();
+ this.ngZone.run(() => this.voiceActiveSectionSuccess = true);
+ } else if (this.voiceText === undefined) {
this.ngZone.run(() => this.voiceActiveSectionError = true);
annyang.abort();
}
});
annyang.addCallback('soundstart', (res) => {
- this.ngZone.run(() => this.voiceActiveSectionListening = true);
+ this.ngZone.run(() => this.voiceActiveSectionListening = true);
});
annyang.addCallback('end', () => {
- if (this.voiceText === undefined) {
- this.ngZone.run(() => this.voiceActiveSectionError = true);
+ if (this.voiceText === undefined) {
+ this.ngZone.run(() => this.voiceActiveSectionError = true);
annyang.abort();
}
});
annyang.addCallback('result', (userSaid) => {
this.ngZone.run(() => this.voiceActiveSectionError = false);
- alert("I think the user said: " + userSaid[0] + "
But then again, it could be any of the following: " + userSaid);
+ alert("I think the user said: " + userSaid[0] + "
But then again, it could be any of the following: " + userSaid);
let queryText: any = userSaid[0];
annyang.abort();
- this.voiceText = queryText;
- console.log(queryText)
+ this.voiceText = queryText;
+ console.log(queryText)
this.ngZone.run(() => this.voiceActiveSectionListening = false);
- this.ngZone.run(() => this.voiceActiveSectionSuccess = true);
+ this.ngZone.run(() => this.voiceActiveSectionSuccess = true);
});
}
startVoiceRecognition(): void {
- this.voiceActiveSectionDisabled = false;
+ this.voiceActiveSectionDisabled = false;
this.voiceActiveSectionError = false;
this.voiceActiveSectionSuccess = false;
- this.voiceText = undefined;
+ this.voiceText = undefined;
if (annyang) {
- console.log(this.voiceText)
-// let commands = {
-// 'demo-annyang': () => { },
-// 'hello-world' : () => { console.log("hello world")}
-// }
+ console.log(this.voiceText)
+ // let commands = {
+ // 'demo-annyang': () => { },
+ // 'hello-world' : () => { console.log("hello world")}
+ // }
- const commands = {
- 'hello': () => { alert('Hello world!'); }
+ const commands = {
+ 'hello': () => { alert('Hello world!'); }
- };
+ };
annyang.addCommands(commands);
- this.initializeVoiceRecognitionCallback();
+ this.initializeVoiceRecognitionCallback();
annyang.start({ autoRestart: false, continuous: false });
}
}
closeVoiceRecognition(): void {
- this.voiceActiveSectionDisabled = true;
+ this.voiceActiveSectionDisabled = true;
this.voiceActiveSectionError = false;
this.voiceActiveSectionSuccess = false;
this.voiceActiveSectionListening = false;
-
+
this.voiceText = undefined;
- if(annyang){
- annyang.abort();
- }
+ if (annyang) {
+ annyang.abort();
+ }
}
-// private loadAllUsers() {
-// this.userService.getAll().pipe(first()).subscribe(users => {
-// this.users = users;
-// });
-// }
-// deleteUser(id: string) {
-// this.userService.delete(id).pipe(first()).subscribe(() => {
-// this.loadAllUsers()
-// });
-// }
+ // private loadAllUsers() {
+ // this.userService.getAll().pipe(first()).subscribe(users => {
+ // this.users = users;
+ // });
+ // }
+ // deleteUser(id: string) {
+ // this.userService.delete(id).pipe(first()).subscribe(() => {
+ // this.loadAllUsers()
+ // });
+ // }
}
diff --git a/src/app/components/chip-list/chip-list.component.css b/src/app/components/chip-list/chip-list.component.css
new file mode 100644
index 00000000..e69de29b
diff --git a/src/app/components/chip-list/chip-list.component.html b/src/app/components/chip-list/chip-list.component.html
new file mode 100644
index 00000000..29a21186
--- /dev/null
+++ b/src/app/components/chip-list/chip-list.component.html
@@ -0,0 +1,6 @@
+