Skip to content

Commit

Permalink
Support flow.disabled and .info in /flow API
Browse files Browse the repository at this point in the history
  • Loading branch information
knolleary committed May 23, 2018
1 parent 26bc142 commit fcbea26
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions red/runtime/nodes/flows/index.js
Expand Up @@ -477,11 +477,19 @@ function addFlow(flow) {
}
flow.id = redUtil.generateId();

var nodes = [{
var tabNode = {
type:'tab',
label:flow.label,
id:flow.id
}];
}
if (flow.hasOwnProperty('info')) {
tabNode.info = flow.info;
}
if (flow.hasOwnProperty('disabled')) {
tabNode.disabled = flow.disabled;
}

var nodes = [tabNode];

for (i=0;i<flow.nodes.length;i++) {
node = flow.nodes[i];
Expand Down Expand Up @@ -534,6 +542,12 @@ function getFlow(id) {
if (flow.label) {
result.label = flow.label;
}
if (flow.disabled) {
result.disabled = flow.disabled;
}
if (flow.hasOwnProperty('info')) {
result.info = flow.info;
}
if (id !== 'global') {
result.nodes = [];
}
Expand Down Expand Up @@ -623,6 +637,13 @@ function updateFlow(id,newFlow) {
label:newFlow.label,
id:id
}
if (newFlow.hasOwnProperty('info')) {
tabNode.info = newFlow.info;
}
if (newFlow.hasOwnProperty('disabled')) {
tabNode.disabled = newFlow.disabled;
}

nodes = [tabNode].concat(newFlow.nodes||[]).concat(newFlow.configs||[]);
nodes.forEach(function(n) {
n.z = id;
Expand Down

0 comments on commit fcbea26

Please sign in to comment.