Browse Source

add rest

master
zeus 4 years ago
parent
commit
f71ac9535f
  1. 25
      swarmlab-app/src/run/app.js

25
swarmlab-app/src/run/app.js

@ -402,38 +402,26 @@ cors(corsOptions), (req, res, next) => {
var reslab = ''
db.collection('logs').find({}, {}).toArray()
.then(item => {
console.log('cccccccccccccccccccccccc '+item)
console.log(' vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv '+ JSON.stringify(item))
for (let i in item) {
reslab = item[i].tailed_path
var segment_array = reslab.split( '/' );
var last_segment = segment_array.pop();
var fieldstmp = last_segment.split('-');
var nameofswarmlab = fieldstmp[0];
console.log('------------------- ' + item[i].tailed_path)
console.log('-----++++++++++++++++++++++++--- ' + nameofswarmlab)
//if( resdata.data.filter(item1 => item1.res25swarmlabname.includes(nameofswarmlab)).length > 0 ){
var regexlog = new RegExp(nameofswarmlab);
//const res = data.filter(item => item.Date.indexOf(filterKey) === 0);
for (let ii in resdata.data) {
console.log(')))))))))))))))))))))))))))))))))))))))))) '+resdata.data[ii].res25swarmlabname)
if( regexlog.test(resdata.data[ii].res25swarmlabname) ){
console.log('-----oooooooooooooooooooooo--- ' + JSON.stringify(item[i]))
resdataarray.push(item[i])
RES.found = item[i]
}else{
console.log('-----<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<--- ' + nameofswarmlab)
}
}
}
RES.error_msg = "ok"
RES.data = item
RES.dataserver = resdataarray
RES.dataservertmp = resdata
RES.data = resdataarray
//RES.dataserver = resdataarray
//RES.dataservertmp = resdata
res.json(RES)
})
.catch(err => {
@ -441,13 +429,6 @@ cors(corsOptions), (req, res, next) => {
RES.error_msg = err
res.json(RES)
})
//stream.on('data', function (doc) {
// console.log(JSON.stringify(doc))
//socket.write(JSON.stringify({'action': 'log','param': doc.log}));
//});
}
});
}else{

Loading…
Cancel
Save