From 92c90fa466bec5de137ab1c781ceb3977d3107df Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 26 Mar 2018 01:10:32 +0300 Subject: [PATCH] minor refactoring and fixes... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/core.js | 2 +- ui (gen4)/features/store.js | 25 ++++++++++++------------- ui (gen4)/features/ui-widgets.js | 7 ++++++- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/ui (gen4)/features/core.js b/ui (gen4)/features/core.js index 53fba97a..ac9c9a9d 100755 --- a/ui (gen4)/features/core.js +++ b/ui (gen4)/features/core.js @@ -726,7 +726,7 @@ var CacheActions = actions.Actions({ // }) }], // cache: function(title, lister){ - if(!this.config.cache){ + if(!(this.config || {}).cache){ return lister.call(this) } var cache = this.__cache = this.__cache || {} diff --git a/ui (gen4)/features/store.js b/ui (gen4)/features/store.js index 29d19a9c..1f3db775 100755 --- a/ui (gen4)/features/store.js +++ b/ui (gen4)/features/store.js @@ -65,19 +65,18 @@ var StoreActions = actions.Actions({ // .stores_actions - dict of store-specific actions get stores(){ return this.cache('stores', function(d){ - var res = {} - - this.actions.forEach(function(action){ - var store = this.getActionAttr(action, 'handle_data_store') - res[store] - && console.warn('Multiple handlers for store:', store) - if(store){ - res[store] = action - } - }.bind(this)) - - return res - }) }, + return d ? + Object.assign({}, d) + : this.actions + .reduce(function(res, action){ + var store = this.getActionAttr(action, 'handle_data_store') + res[store] + && console.warn('Multiple handlers for store:', store) + if(store){ + res[store] = action + } + return res + }.bind(this), {}) }) }, // events... // XXX update signature -- see doc for: .loadStore(..) diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index 45696430..68065440 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -1949,12 +1949,17 @@ var BrowseActionsActions = actions.Actions({ getKeys('browseActions!: "'+ p +'"'), ].filter(function(e){ return e.trim() != '' }).join(' / '), }, + // hide dirs containing only hidden stuff... // XXX this will only check statically hidden stuff... // ...the rest may still get dynamically hidden... hidden: options.no_hidden ? false + // hide dirs containing only (statically) + // hidden items... + // NOTE: we are not checking browseMode + // of other items actively here at + // this point to avoid side-effects... : Object.keys(cur[key]) - // XXX we still need to check browseMode of each child... .filter(function(k){ return (cur[key][k] || [])[1] != 'hidden' }) .length == 0,