From d50f5c9c0e97e2e6b43f5e7cf3cc42ac29964ba8 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 20 Dec 2018 04:40:30 +0300 Subject: [PATCH] twaked dependencies and some minor stuff... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/cli.js | 109 ++++++++++++++++++++++++++++++- ui (gen4)/features/tags.js | 2 +- ui (gen4)/features/ui-ribbons.js | 8 ++- 3 files changed, 115 insertions(+), 4 deletions(-) diff --git a/ui (gen4)/features/cli.js b/ui (gen4)/features/cli.js index 5596370d..c5a17dc3 100755 --- a/ui (gen4)/features/cli.js +++ b/ui (gen4)/features/cli.js @@ -23,6 +23,71 @@ if(typeof(process) != 'undefined'){ } +/*********************************************************************/ + +// setup logger... +// XXX STUB... +var logger = { + root: true, + message: null, + log: null, + + emit: function(e, v){ + var msg = this.message + var log = this.log = this.log || [] + + // report progress... + // XXX HACK -- need meaningful status... + if(e == 'queued' + || e == 'found'){ + ig.showProgress(msg || ['Progress', e], '+0', '+1') + + } else if(e == 'loaded' || e == 'done' || e == 'written' + || e == 'index'){ + ig.showProgress(msg || ['Progress', e], '+1') + + } else if(e == 'skipping' || e == 'skipped'){ + // XXX if everything is skipped the indicator does not + // get hidden... + //ig.showProgress(msg || ['Progress', e], '+0', '-1') + ig.showProgress(msg || ['Progress', e], '+1') + + // XXX STUB... + } else if(e == 'error' ){ + ig.showProgress(['Error'].concat(msg), '+0', '+1') + console.log(msg ? + ' '+ msg.join(': ') + ':' + : '', ...arguments) + + } else { + // console... + console.log(msg ? + ' '+ msg.join(': ') + ':' + : '', ...arguments) + } + + // XXX + //log.push([msg, e, v]) + }, + + push: function(msg){ + if(msg == null){ + return this + } + + var logger = Object.create(this) + logger.root = false + logger.message = logger.message == null ? [msg] : logger.message.concat([msg]) + logger.log = this.log = this.log || [] + + return logger + }, + pop: function(){ + return !this.__proto__.root ? this.__proto__ : this + }, +} + + /*********************************************************************/ // XXX what we need here is: @@ -51,10 +116,50 @@ if(typeof(process) != 'undefined'){ var CLIActions = actions.Actions({ + // XXX should this be here??? + // ...move this to progress... + __progress: null, + showProgress: ['- System/', + function(text, value, max){ + var msg = text instanceof Array ? text.slice(1).join(': ') : null + text = text instanceof Array ? text[0] : text + + var state = this.__progress = this.__progress || {} + state = state[text] = state[text] || {} + + // normalize max and value... + max = state.max = max != null ? + (typeof(max) == typeof('str') && /[+-][0-9]+/.test(max) ? + (state.max || 0) + parseInt(max) + : max) + : state.max + value = state.value = value != null ? + (typeof(value) == typeof('str') && /[+-][0-9]+/.test(value) ? + (state.value || 0) + parseInt(value) + : value) + : state.value + + // format the message... + msg = msg ? ': '+msg : '' + msg = ' '+ msg + //+ (value && value >= (max || 0) ? ' ('+value+' done)' + + (value && value >= (max || 0) ? ' (done)' + : value && max && value != max ? ' ('+ value +' of '+ max +')' + : '...') + + msg != state.msg + && console.log(msg) + + state.msg = msg + }], + + makeIndex: ['- System/', function(path){ var that = this + this.logger = logger + // XXX is this correct??? path = path || this.location.path @@ -67,7 +172,9 @@ var CLIActions = actions.Actions({ }) // make the previews... .then(function(){ - return that.makePreviews('all') + if(that.makePreviews){ + return that.makePreviews('all') + } }) .then(function(){ //that.readAllMetadata() diff --git a/ui (gen4)/features/tags.js b/ui (gen4)/features/tags.js index d31af663..4efdae21 100755 --- a/ui (gen4)/features/tags.js +++ b/ui (gen4)/features/tags.js @@ -708,7 +708,7 @@ module.TagUI = core.ImageGridFeatures.Feature({ // XXX tag: 'ui-tags', depends: [ - // XXX + 'ui', ], actions: TagUIActions, diff --git a/ui (gen4)/features/ui-ribbons.js b/ui (gen4)/features/ui-ribbons.js index 506f6a82..1c831549 100755 --- a/ui (gen4)/features/ui-ribbons.js +++ b/ui (gen4)/features/ui-ribbons.js @@ -444,7 +444,7 @@ core.ImageGridFeatures.Feature({ tag: 'ui-ribbons-render', exclusive: ['ui-render'], depends: [ - // XXX BUG: for some reason this causes a dependency conflict... + // XXX this causes a dependency loop -- ui <-> ui-render... //'ui', 'base', ], @@ -454,6 +454,8 @@ core.ImageGridFeatures.Feature({ 'ui-partial-ribbons', ], + isApplicable: function(){ return this.runtime.browser }, + actions: RibbonsActions, handlers: [], @@ -532,6 +534,7 @@ core.ImageGridFeatures.Feature({ tag: 'ui-ribbons-edit-render', depends: [ + 'ui', 'edit', 'tags', 'sort', @@ -701,7 +704,7 @@ core.ImageGridFeatures.Feature({ tag: 'ui-partial-ribbons', exclusive: ['ui-partial-ribbons'], depends: [ - //'ui', + 'ui', 'ui-ribbons-render', ], suggested: [ @@ -769,6 +772,7 @@ module.ShiftAnimation = core.ImageGridFeatures.Feature({ tag: 'ui-animation', depends: [ + 'ui', 'ui-ribbons-render', ], // NOTE: this will allow the animations to start as early as possible