diff --git a/Viewer/features/core.js b/Viewer/features/core.js index f5e2e319..36ca23cf 100755 --- a/Viewer/features/core.js +++ b/Viewer/features/core.js @@ -2947,7 +2947,20 @@ var TaskActions = actions.Actions({ - // isolated tasks (XXX EXPERIMENTAL) + // contexts (XXX EXPERIMENTAL) + // + // XXX would be nice to have a context manager: + // - context id's (index? ...sparse array?) + // - manager API + // - create/remove + // - context api (feature) + // .then(..)/.catch(..)/.finally(..) + // XXX is peer stuff just a special context??? + // ...feels like yes + // XXX is context manager a special case of task manager??? + // XXX move to a separate feature... + + get contexts(){}, // XXX would be nice to have an ability to partially clone the instance... // ...currently we can do a full clone and remove things we do @@ -2970,7 +2983,7 @@ var TaskActions = actions.Actions({ // link clone in... clone.logger = this.logger.push(['Task', clones.length].join(' ')) - clones.push(clone) + clone.context_id = clones.push(clone) return clone }], // XXX this is the same as LinkedTask(..) make a meta-function... IsolatedTask: ['- System/', @@ -2999,22 +3012,41 @@ var TaskActions = actions.Actions({ // cleared or reloaded this will retain the old data... // // XXX should this be a prop -- .linked??? + // XXX would be a good idea to store all the links in once place... __linked: null, get linked(){ return (this.__linked = this.__linked || []) }, link: ['- System/', - function(){ + function(title){ var that = this var links = this.linked - var link = ImageGridFeatures.setup([...this.features.input, '-ui']) + // get link already created... + var link = this.linked + .filter(function(l){ + return title ? + l.title == title + : (l.data === that.data + && l.images === that.images) }) + .last() + if(link){ + return link } + + // create a link... + link = ImageGridFeatures.setup([...this.features.input, '-ui']) return Object.assign( link, this, - {parent: this}) + { + // XXX revise... + parent: this, + title: title, + // XXX change this when data/images changes... + type: 'link', + }) .run(function(){ this.logger = that.logger.push(['Task', links.length].join(' ')) - links.push(this) }) }], + this.context_id = links.push(this) }) }], // XXX this should delete the clone when done... LinkedTask: ['- System/', function(){}], diff --git a/Viewer/package-lock.json b/Viewer/package-lock.json index 50519b8c..831e5580 100755 --- a/Viewer/package-lock.json +++ b/Viewer/package-lock.json @@ -1211,9 +1211,9 @@ "integrity": "sha512-7gSU0Qg4E0rnCPuITu6nJzgr4N73tFN57CISVrQjB+EglixfDI5SwOVRgPtG0EBOgtE8IL4O7fmq/UV87OUYyA==" }, "ig-types": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/ig-types/-/ig-types-6.0.4.tgz", - "integrity": "sha512-6127GzvMz1Ow8Qizbs0vEvMdYsOJR9HVs0By8dQJIYnX2RRAviUStI+E/wwEH/OxHZpkmFHxwZ6xvmC0S7KP3w==", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/ig-types/-/ig-types-6.0.6.tgz", + "integrity": "sha512-TOW58/yBQ7YqFukFT5K2Qd7u9k1CYgoQXXreS6u7pw9ttcWJLC3hJUTcLWsHTPKm3vNbFJ0NVI1o1U3SQlUu5w==", "requires": { "ig-object": "^5.4.12", "object-run": "^1.0.1" diff --git a/Viewer/package.json b/Viewer/package.json index 184dd927..c2534eb6 100755 --- a/Viewer/package.json +++ b/Viewer/package.json @@ -34,7 +34,7 @@ "ig-argv": "^2.16.3", "ig-features": "^3.4.5", "ig-object": "^5.4.14", - "ig-types": "^6.0.4", + "ig-types": "^6.0.6", "json5": "^2.1.3", "object-run": "^1.0.1", "requirejs": "^2.3.6",