diff --git a/swarmlab-app/src/run/app.js b/swarmlab-app/src/run/app.js index 82da576..556e8a3 100755 --- a/swarmlab-app/src/run/app.js +++ b/swarmlab-app/src/run/app.js @@ -201,26 +201,17 @@ global.pipelines=[]; // } //} } - function onWatcherReady(){ - console.info('From here can you check for real changes, the initial scan has been completed.'); - } + function onlogfile(path){ - // Declare the listeners of the watcher - watcher - .on('add', function(path) { console.log('File', path, 'has been added'); var pathfileval = pathmodule.basename(path); - //console.log('Filepath1 ', pathfileval, ' check'); - var arrfile = pathfileval.toString().split("-"); + var arrfile = pathfileval.toString().split("-"); var pathfile = arrfile[0]; - //console.log('Filepath ', pathfile, ' check'); - // /var/lab/playground-serverlogs/ondemand_playgroundnodejs_masterJPMqt1Jr-RgpMZFwJ-log - // ondemand_playgroundnodejs_masterPQvbrWga-AQxgfnSJ-output + var indexfind1 = global.pipelines.findIndex(x => x.pathlogfile==pathfileval); + if (indexfind1 === -1 ){ (async() => { var token = "d2539e5a7ae1f9f1b0eb2b8f22ca467a86d28407"; // desto var resdata = await getpipelines(token,pathfile) - //console.log('info-------->>>>>>>>>>>> ', JSON.stringify(resdata)); - //console.log('info----------------------- ', JSON.stringify(resdata.data)); //resdata.data.pathlogfile = 'test' var resob = {} resob.pathlogfile = pathfileval @@ -243,28 +234,9 @@ global.pipelines=[]; //console.log('info', JSON.stringify(resdata)); //console.log('info------------- ', JSON.stringify(global.pipelines)); })() - }) - .on('addDir', function(path) { - console.log('Directory', path, 'has been added'); - }) - .on('change', function(path) { - console.log('File', path, 'has been changed'); - }) - .on('unlink', function(path) { - console.log('File', path, 'has been removed'); - }) - .on('unlinkDir', function(path) { - console.log('Directory', path, 'has been removed'); - }) - .on('error', function(error) { - console.log('Error happened', error); - }) - .on('ready', onWatcherReady) - .on('raw', function(event, path, details) { - // This event should be triggered everytime something happens. - console.log('Raw event info:', event, path, details); - }); + } +} // *************************************************** // rest get