1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Support flow.disabled and .info in /flow API

This commit is contained in:
Nick O'Leary 2018-05-23 22:41:39 +01:00
parent 26bc142cc2
commit fcbea2629c
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -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];
@ -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 = [];
}
@ -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;