mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Propagate changed flag to parent subflow
This commit is contained in:
parent
35042132fa
commit
1d10eba0cc
@ -28,17 +28,22 @@ RED.editor = (function() {
|
||||
*/
|
||||
function validateNode(node) {
|
||||
var oldValue = node.valid;
|
||||
var oldChanged = node.changed;
|
||||
node.valid = true;
|
||||
var subflow;
|
||||
var isValid;
|
||||
var hasChanged;
|
||||
|
||||
if (node.type.indexOf("subflow:")===0) {
|
||||
subflow = RED.nodes.subflow(node.type.substring(8));
|
||||
isValid = subflow.valid;
|
||||
hasChanged = subflow.changed;
|
||||
if (isValid === undefined) {
|
||||
isValid = validateNode(subflow);
|
||||
hasChanged = subflow.changed;
|
||||
}
|
||||
node.valid = isValid;
|
||||
node.changed = hasChanged;
|
||||
} else if (node._def) {
|
||||
node.valid = validateNodeProperties(node, node._def.defaults, node);
|
||||
if (node._def._creds) {
|
||||
@ -48,15 +53,19 @@ RED.editor = (function() {
|
||||
var subflowNodes = RED.nodes.filterNodes({z:node.id});
|
||||
for (var i=0;i<subflowNodes.length;i++) {
|
||||
isValid = subflowNodes[i].valid;
|
||||
hasChanged = subflowNodes[i].changed;
|
||||
if (isValid === undefined) {
|
||||
isValid = validateNode(subflowNodes[i]);
|
||||
hasChanged = subflowNodes[i].changed;
|
||||
}
|
||||
node.valid = node.valid && isValid;
|
||||
node.changed = node.changed || hasChanged;
|
||||
}
|
||||
var subflowInstances = RED.nodes.filterNodes({type:"subflow:"+node.id});
|
||||
var modifiedTabs = {};
|
||||
for (i=0;i<subflowInstances.length;i++) {
|
||||
subflowInstances[i].valid = node.valid;
|
||||
subflowInstances[i].changed = node.changed;
|
||||
subflowInstances[i].dirty = true;
|
||||
modifiedTabs[subflowInstances[i].z] = true;
|
||||
}
|
||||
@ -67,7 +76,7 @@ RED.editor = (function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
if (oldValue !== node.valid) {
|
||||
if (oldValue !== node.valid || oldChanged !== node.changed) {
|
||||
node.dirty = true;
|
||||
subflow = RED.nodes.subflow(node.z);
|
||||
if (subflow) {
|
||||
|
@ -333,7 +333,6 @@ RED.view = (function() {
|
||||
if (!m) {
|
||||
nn.inputs = nn._def.inputs || 0;
|
||||
nn.outputs = nn._def.outputs;
|
||||
nn.changed = true;
|
||||
|
||||
for (var d in nn._def.defaults) {
|
||||
if (nn._def.defaults.hasOwnProperty(d)) {
|
||||
@ -350,6 +349,7 @@ RED.view = (function() {
|
||||
nn.outputs = subflow.out.length;
|
||||
}
|
||||
|
||||
nn.changed = true;
|
||||
nn.h = Math.max(node_height,(nn.outputs||0) * 15);
|
||||
RED.history.push({t:'add',nodes:[nn.id],dirty:RED.nodes.dirty()});
|
||||
RED.nodes.add(nn);
|
||||
|
Loading…
Reference in New Issue
Block a user