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

Keep subflow palette appearance in sync with edits

This commit is contained in:
Nick O'Leary 2019-03-05 14:37:07 +00:00
parent f80b172022
commit b011b9203b
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 15 additions and 1 deletions

View File

@ -388,6 +388,17 @@ RED.palette = (function() {
var portInput = paletteNode.find(".palette_port_input"); var portInput = paletteNode.find(".palette_port_input");
var portOutput = paletteNode.find(".palette_port_output"); var portOutput = paletteNode.find(".palette_port_output");
var paletteLabel = paletteNode.find(".palette_label");
paletteLabel.attr("class","palette_label"
+ (((!sf._def.align && sf.in.length !== 0 && sf.out.length === 0) || "right" === sf._def.align) ? " palette_label_right" : "")
);
var paletteIconContainer = paletteNode.find(".palette_icon_container");
paletteIconContainer.attr("class","palette_icon_container"
+ (((!sf._def.align && sf.in.length !== 0 && sf.out.length === 0) || "right" === sf._def.align) ? " palette_icon_container_right" : "")
);
if (portInput.length === 0 && sf.in.length > 0) { if (portInput.length === 0 && sf.in.length > 0) {
var portIn = document.createElement("div"); var portIn = document.createElement("div");
portIn.className = "palette_port palette_port_input"; portIn.className = "palette_port palette_port_input";

View File

@ -89,6 +89,7 @@ RED.subflow = (function() {
RED.view.redraw(); RED.view.redraw();
$("#workspace-subflow-input-add").addClass("active"); $("#workspace-subflow-input-add").addClass("active");
$("#workspace-subflow-input-remove").removeClass("active"); $("#workspace-subflow-input-remove").removeClass("active");
RED.palette.refresh();
} }
function removeSubflowInput() { function removeSubflowInput() {
@ -110,6 +111,7 @@ RED.subflow = (function() {
$("#workspace-subflow-input-add").removeClass("active"); $("#workspace-subflow-input-add").removeClass("active");
$("#workspace-subflow-input-remove").addClass("active"); $("#workspace-subflow-input-remove").addClass("active");
activeSubflow.changed = true; activeSubflow.changed = true;
RED.palette.refresh();
return {subflowInputs: [ removedInput ], links:removedInputLinks}; return {subflowInputs: [ removedInput ], links:removedInputLinks};
} }
@ -150,6 +152,7 @@ RED.subflow = (function() {
RED.nodes.dirty(true); RED.nodes.dirty(true);
RED.view.redraw(); RED.view.redraw();
$("#workspace-subflow-output .spinner-value").text(subflow.out.length); $("#workspace-subflow-output .spinner-value").text(subflow.out.length);
RED.palette.refresh();
} }
function removeSubflowOutput(removedSubflowOutputs) { function removeSubflowOutput(removedSubflowOutputs) {
@ -189,7 +192,7 @@ RED.subflow = (function() {
} }
} }
activeSubflow.changed = true; activeSubflow.changed = true;
RED.palette.refresh();
return {subflowOutputs: removedSubflowOutputs, links: removedLinks} return {subflowOutputs: removedSubflowOutputs, links: removedLinks}
} }