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

Ensure node labels are reordered properly to match outputs

This commit is contained in:
Nick O'Leary 2017-05-19 22:56:29 +01:00
parent 483306e73c
commit e69e5b4f50
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -937,11 +937,20 @@ RED.editor = (function() {
changed = true; changed = true;
} }
hasNonBlankLabel = false; hasNonBlankLabel = false;
newValue = outputLabels.map(function() { newValue = new Array(editing_node.outputs);
outputLabels.each(function() {
var index = $(this).attr('id').substring(23); // node-label-form-output-<index>
if (outputMap.hasOwnProperty(index)) {
index = parseInt(outputMap[index]);
if (index === -1) {
return;
}
}
var v = $(this).val(); var v = $(this).val();
hasNonBlankLabel = hasNonBlankLabel || v!== ""; hasNonBlankLabel = hasNonBlankLabel || v!== "";
return v; newValue[index] = v;
}).toArray().slice(0,editing_node.outputs); })
if ((editing_node.outputLabels === undefined && hasNonBlankLabel) || if ((editing_node.outputLabels === undefined && hasNonBlankLabel) ||
(editing_node.outputLabels !== undefined && JSON.stringify(newValue) !== JSON.stringify(editing_node.outputLabels))) { (editing_node.outputLabels !== undefined && JSON.stringify(newValue) !== JSON.stringify(editing_node.outputLabels))) {
changes.outputLabels = editing_node.outputLabels; changes.outputLabels = editing_node.outputLabels;