diff --git a/ui (gen4)/features/base.js b/ui (gen4)/features/base.js index f3dd6a8b..2f3b8c99 100755 --- a/ui (gen4)/features/base.js +++ b/ui (gen4)/features/base.js @@ -544,6 +544,7 @@ module.Base = core.ImageGridFeatures.Feature({ suggested: [ 'tags', 'sort', + 'tasks', ], */ diff --git a/ui (gen4)/features/core.js b/ui (gen4)/features/core.js index 7100846f..1916df99 100755 --- a/ui (gen4)/features/core.js +++ b/ui (gen4)/features/core.js @@ -48,10 +48,15 @@ function(attr, states, a, b){ /*********************************************************************/ +// Root ImageGrid.viewer object... +// var ImageGridFeatures = module.ImageGridFeatures = Object.create(features.FeatureSet) +//--------------------------------------------------------------------- +// Setup runtime info... + // nw or node... if(typeof(process) != 'undefined'){ @@ -96,6 +101,7 @@ if(typeof(process) != 'undefined'){ /*********************************************************************/ +// System life-cycle... // XXX should this be a generic library thing??? // XXX should his have state??? @@ -213,6 +219,7 @@ module.LifeCycle = ImageGridFeatures.Feature({ //--------------------------------------------------------------------- +// Workspace... // // Basic protocol: // A participating feature should: @@ -368,6 +375,63 @@ module.Workspace = ImageGridFeatures.Feature({ +//--------------------------------------------------------------------- +// Tasks... +// XXX should this be a separate module??? + +var tasks = require('lib/tasks') + +// XXX see if a protocol can be practical here to: +// - serialize/restore jobs +// - ... +var TaskActions = actions.Actions({ + config: { + }, + + get jobs(){ + return this.__jobs + }, + + getJob: ['- Jobs/', + function(name){ + name = name || this.data.newGid() + + // get/init task dict... + var t = this.__jobs = this.__jobs || {} + // get/init task... + var job = t[name] = t[name] || tasks.Queue() + job.name = name + + return job + }], + + // XXX stop +}) + + +var Tasks = +module.Tasks = ImageGridFeatures.Feature({ + title: '', + + tag: 'tasks', + + depends: [ ], + + actions: TaskActions, + + handlers: [ + ['start', + function(){ + // XXX prepare for recovery and recover... + }], + ['stop', + function(){ + // XXX stop tasks and prepare for recovery... + }], + ], +}) + + /********************************************************************** * vim:set ts=4 sw=4 : */ diff --git a/ui (gen4)/features/filesystem.js b/ui (gen4)/features/filesystem.js index 6c5bdbf3..fd0e5ee9 100755 --- a/ui (gen4)/features/filesystem.js +++ b/ui (gen4)/features/filesystem.js @@ -375,6 +375,7 @@ module.FileSystemLoader = core.ImageGridFeatures.Feature({ tag: 'fs-loader', depends: [ 'location', + 'tasks', ], suggested: [ 'ui-fs-loader', diff --git a/ui (gen4)/lib/actions.js b/ui (gen4)/lib/actions.js index 3554358c..2cc553f2 100755 --- a/ui (gen4)/lib/actions.js +++ b/ui (gen4)/lib/actions.js @@ -478,7 +478,8 @@ module.MetaActions = { var handler = typeof(c) == 'function' ? c : b var tag = typeof(c) == 'function' ? b : c - actions = typeof(actions) == 'string' ? actions.split(' ') : actions + // XXX make this split by whitespace... + actions = typeof(actions) == 'string' ? actions.split(/ +/) : actions var that = this actions.forEach(function(action){ @@ -498,7 +499,7 @@ module.MetaActions = { // via. .off(..) a_handler.orig_handler = old_handler.orig_handler || old_handler - // mot pre mode... + // not pre mode... } else if(mode != 'pre') { // XXX throw 'Unknown action mode: '+action+'.'+mode diff --git a/ui (gen4)/lib/widget/browse-walk.js b/ui (gen4)/lib/widget/browse-walk.js index ce10c607..f6fae1ae 100755 --- a/ui (gen4)/lib/widget/browse-walk.js +++ b/ui (gen4)/lib/widget/browse-walk.js @@ -152,7 +152,9 @@ function(path, make){ var res = [] if(that.options.dotDirs){ - //files.splice(0, 0, '.', '..') + // NOTE: this sometimes gets reordered so we aren't + // using it... (BUG?) + // files.splice(0, 0, '.', '..') // NOTE: we are counting these here so as to ensure // they are always first and not delayed by some // odd delay on a stat...