|
|
@ -278,7 +278,45 @@ cors(corsOptions), (req, res, next) => { |
|
|
|
console.log("LOG "+JSON.stringify(req.body[0].message)); |
|
|
|
console.log("PATH "+JSON.stringify(req.body[0].tailed_path)); |
|
|
|
for (var i = 0; i < req.body.length; i++){ |
|
|
|
var getpath = await onlogfile(req.body[i].tailed_path) |
|
|
|
//var getpath = await onlogfile(req.body[i].tailed_path)
|
|
|
|
|
|
|
|
var path = req.body[i].tailed_path |
|
|
|
|
|
|
|
console.log('File', path, 'has been added'); |
|
|
|
var pathfileval = pathmodule.basename(path); |
|
|
|
var arrfile = pathfileval.toString().split("-"); |
|
|
|
var pathfile = arrfile[0]; |
|
|
|
var indexfind1 = global.pipelines.findIndex(x => x.pathlogfile==pathfileval); |
|
|
|
console.log('file11111111111111111111111111111111 ' + JSON.stringify(pathfileval)) |
|
|
|
if (indexfind1 === -1 ){ |
|
|
|
(async() => { |
|
|
|
console.log('file2222222222222222222222222222222222222 ' + JSON.stringify(pathfileval)) |
|
|
|
var token = "d2539e5a7ae1f9f1b0eb2b8f22ca467a86d28407"; // desto
|
|
|
|
var resdata = await getpipelines(token,pathfile) |
|
|
|
//resdata.data.pathlogfile = 'test'
|
|
|
|
var resob = {} |
|
|
|
resob.pathlogfile = pathfileval |
|
|
|
var resobarray = [] |
|
|
|
for (let i in resdata.data) { |
|
|
|
var resob1 = {} |
|
|
|
resob1.data = resdata.data[i].res25swarmlabname |
|
|
|
resob1.user25user = resdata.data[i].res25user |
|
|
|
resob1.res25creator = resdata.data[i].res25creator |
|
|
|
resob1.res25fileforce = resdata.data[i].res25fileforce |
|
|
|
resobarray.push(resob1) |
|
|
|
} |
|
|
|
resob.data = resobarray |
|
|
|
//var indexfind = global.pipelines.findIndex(x => x.res25swarmlabname==resdata.data[0].res25swarmlabname);
|
|
|
|
var indexfind = global.pipelines.findIndex(x => x.pathlogfile==pathfileval); |
|
|
|
|
|
|
|
//indexfind === -1 ? global.pipelines.push({resob}) : console.log("object already exists")
|
|
|
|
indexfind === -1 ? global.pipelines.push(resob) : console.log("object already exists "+pathfileval) |
|
|
|
|
|
|
|
//console.log('info', JSON.stringify(resdata));
|
|
|
|
//console.log('info------------- ', JSON.stringify(global.pipelines));
|
|
|
|
})() |
|
|
|
} |
|
|
|
//
|
|
|
|
var obj = req.body[i]; |
|
|
|
|
|
|
|
//var indexfind = global.pipelines.findIndex(x => x.res25swarmlabname==resdata.data.res25swarmlabname);
|
|
|
|