From c2756ffdbb5bcc6a3159f25c0750475fab33d9ff Mon Sep 17 00:00:00 2001 From: Jeffrey Warren Date: Fri, 20 Apr 2018 09:34:08 -0400 Subject: [PATCH] Module info.json -based demo UI (WIP) (#219) * initial work * working with failing test * now should pass test --- src/AddStep.js | 9 +++++++-- src/InsertStep.js | 1 + src/modules/GreenChannel/Module.js | 2 -- src/modules/GreenChannel/info.json | 1 + test/modules/image-sequencer.js | 1 + 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/AddStep.js b/src/AddStep.js index 53792b40..7116fa9f 100644 --- a/src/AddStep.js +++ b/src/AddStep.js @@ -1,9 +1,13 @@ +// add steps to the sequencer function AddStep(ref, image, name, o) { function addStep(image, name, o_) { + var moduleInfo = ref.modules[name][1]; + var o = ref.copy(o_); - o.number = ref.options.sequencerCounter++; //Gives a Unique ID to each step - o.name = o_.name || name; + o.number = ref.options.sequencerCounter++; // gives a unique ID to each step + o.name = o_.name || name || moduleInfo.name; + o.description = o_.description || moduleInfo.description; o.selector = o_.selector || 'ismod-' + name; o.container = o_.container || ref.options.selector; o.image = image; @@ -11,6 +15,7 @@ function AddStep(ref, image, name, o) { o.step = { name: o.name, + description: o.description, ID: o.number, imageName: o.image, inBrowser: ref.options.inBrowser, diff --git a/src/InsertStep.js b/src/InsertStep.js index 8b7cb36e..0af5e501 100644 --- a/src/InsertStep.js +++ b/src/InsertStep.js @@ -1,3 +1,4 @@ +// insert one or more steps at a given index in the sequencer function InsertStep(ref, image, index, name, o) { function insertStep(image, index, name, o_) { diff --git a/src/modules/GreenChannel/Module.js b/src/modules/GreenChannel/Module.js index 5872be30..48adbbda 100644 --- a/src/modules/GreenChannel/Module.js +++ b/src/modules/GreenChannel/Module.js @@ -4,8 +4,6 @@ module.exports = function GreenChannel(options,UI) { options = options || {}; - options.title = "Green channel only"; - options.description = "Displays only the green channel of an image"; // Tell UI that a step has been set up UI.onSetup(options.step); diff --git a/src/modules/GreenChannel/info.json b/src/modules/GreenChannel/info.json index 7a6116cf..fd368745 100644 --- a/src/modules/GreenChannel/info.json +++ b/src/modules/GreenChannel/info.json @@ -1,5 +1,6 @@ { "name": "Green Channel", + "description": "Displays only the green channel of an image", "inputs": { } } diff --git a/test/modules/image-sequencer.js b/test/modules/image-sequencer.js index 236ac93d..b9e46dda 100644 --- a/test/modules/image-sequencer.js +++ b/test/modules/image-sequencer.js @@ -85,6 +85,7 @@ test('addSteps("image","name") adds a step', function (t) { sequencer.addSteps('test','green-channel'); t.equal(sequencer.images.test.steps.length, 2, "Length of steps increased") t.equal(sequencer.images.test.steps[1].options.name, "green-channel", "Correct Step Added"); + t.equal(sequencer.images.test.steps[1].options.description, "Displays only the green channel of an image", "Step description shown"); t.end(); });