Skip to content

Commit

Permalink
Module info.json -based demo UI (WIP) (#219)
Browse files Browse the repository at this point in the history
* initial work

* working with failing test

* now should pass test
  • Loading branch information
jywarren committed Apr 20, 2018
1 parent d887f5e commit c2756ff
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/AddStep.js
@@ -1,16 +1,21 @@
// 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;
o.inBrowser = ref.options.inBrowser;

o.step = {
name: o.name,
description: o.description,
ID: o.number,
imageName: o.image,
inBrowser: ref.options.inBrowser,
Expand Down
1 change: 1 addition & 0 deletions 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_) {
Expand Down
2 changes: 0 additions & 2 deletions src/modules/GreenChannel/Module.js
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/modules/GreenChannel/info.json
@@ -1,5 +1,6 @@
{
"name": "Green Channel",
"description": "Displays only the green channel of an image",
"inputs": {
}
}
1 change: 1 addition & 0 deletions test/modules/image-sequencer.js
Expand Up @@ -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();
});

Expand Down

0 comments on commit c2756ff

Please sign in to comment.