From 5bce84f2a38ef3e9b6226a931da23fc311c9b301 Mon Sep 17 00:00:00 2001 From: zeus Date: Mon, 23 Nov 2020 01:28:25 +0200 Subject: [PATCH] watcher --- swarmlab-app/src/run/app.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/swarmlab-app/src/run/app.js b/swarmlab-app/src/run/app.js index a7f7eda..0b7feb8 100755 --- a/swarmlab-app/src/run/app.js +++ b/swarmlab-app/src/run/app.js @@ -205,18 +205,13 @@ global.online='ob'; (async() => { var token = "d2539e5a7ae1f9f1b0eb2b8f22ca467a86d28407"; // desto var resdata = await getpipelines(token,pathfile) - console.log('info', JSON.stringify(resdata)); - /* - if(isvalid.action == 'ok'){ - console.log("Authserver ok ", s.id + ' - ' + token); - global.SOCKET.user = isvalid.user - global.SOCKET.scope = isvalid.scope // space delimeter - global.SOCKET.token = isvalid.token - s.auth = true; - }else{ - console.log("Authserver no ", s.id + ' - ' + token); - } - */ + var resob = resdata.info.data + var indexfind = global.pipelines.findIndex(x => x.res25swarmlabname==resdata.info.data.res25swarmlabname); + + indexfind === -1 ? global.pipelines.push({resob}) : console.log("object already exists") + + //console.log('info', JSON.stringify(resdata)); + console.log('info', JSON.stringify(global.pipelines)); })() }) .on('addDir', function(path) {