From dae13d71e0642e04ead4a0109afadf8eb3f78823 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 27 Jan 2023 04:08:48 +0300 Subject: [PATCH] started working on an old bug.... Signed-off-by: Alex A. Naanou --- Viewer/features/cli.js | 5 +++++ Viewer/features/core.js | 14 ++++++++++++++ Viewer/features/filesystem.js | 3 +-- Viewer/features/sharp.js | 5 ++--- Viewer/imagegrid/file.js | 3 +-- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Viewer/features/cli.js b/Viewer/features/cli.js index 6b1eb6ea..f2b62f2d 100755 --- a/Viewer/features/cli.js +++ b/Viewer/features/cli.js @@ -57,6 +57,7 @@ var CLIActions = actions.Actions({ // ...move this to progress... // XXX we are missing some beats, is this because we do not let the // bar update before closing??? + // XXX need to reset this when done... __progress: null, showProgress: ['- System/', function(text, value, max){ @@ -429,6 +430,10 @@ var CLIActions = actions.Actions({ // XXX how do we handle rejection??? console.error('Can\'t find or load index at:', path) }) }], + // XXX + cliCloneIndex: ['- System/CLI/clone index', + function(){ + }], // XXX report that can't find an index... // XXX move options to generic object for re-use... // XXX how do we handle errors??? diff --git a/Viewer/features/core.js b/Viewer/features/core.js index d90d79e0..42b93d70 100755 --- a/Viewer/features/core.js +++ b/Viewer/features/core.js @@ -3045,6 +3045,9 @@ function(title, func){ // NOTE: this will prevent the items from getting // processed multiple times when the action // is called multiple times... + // XXX this does not work -- we seem to + // be getting different arrays on + // each call... .splice(0, items.length) .map(function(e){ return [e, ...args] }) @@ -3060,6 +3063,17 @@ function(title, func){ || inputs instanceof runner.FinalizableQueue) ? inputs.then( function(items){ + // XXX BUG: the problem here is that by the time + // this is run the items can accumulate from + // multiple calls but run is still called + // once per original call... + // ...the problem occurs when inputs is a + // queue thus it will resolve to the whole + // set of items and not the item we were + // called with, we are compensating for + // this ( .splice(..) ) above but it does + // not work for some reason -- the array + // seems not to be the same for each run... return run([items, ...args]) }, function(){ q && q.abort() }) diff --git a/Viewer/features/filesystem.js b/Viewer/features/filesystem.js index b553ca17..e517c47f 100755 --- a/Viewer/features/filesystem.js +++ b/Viewer/features/filesystem.js @@ -16,8 +16,7 @@ if(typeof(process) != 'undefined'){ var glob = requirejs('glob') var wglob = requirejs('wildglob') - var file = require('imagegrid/file') -} + var file = require('imagegrid/file') } var data = require('imagegrid/data') var images = require('imagegrid/images') diff --git a/Viewer/features/sharp.js b/Viewer/features/sharp.js index e5746ca4..2fd2d60d 100755 --- a/Viewer/features/sharp.js +++ b/Viewer/features/sharp.js @@ -270,7 +270,7 @@ var SharpActions = actions.Actions({ images : [images], ...args.slice(1), - ]}, + ] }, // prepare index independent data, this can be a tad slow... function(gid, _, path, options={}){ // special case: we already got the paths... @@ -731,8 +731,7 @@ var SharpActions = actions.Actions({ return [gid, size, name] }, function(err){ logger - && logger.emit('skipped', `${gid} / ${size}`) - }) })) })], + && logger.emit('skipped', `${gid} / ${size}`) }) })) })], // XXX revise logging and logger passing... cacheMetadata: ['- Sharp|Image/', diff --git a/Viewer/imagegrid/file.js b/Viewer/imagegrid/file.js index 0bc6f0c3..5e29c3d7 100755 --- a/Viewer/imagegrid/file.js +++ b/Viewer/imagegrid/file.js @@ -19,8 +19,7 @@ if(typeof(process) != 'undefined'){ var guaranteeEvents = requirejs('guarantee-events') } else { - return module -} + return module } var data = require('imagegrid/data') var images = require('imagegrid/images')