diff --git a/packages/node_modules/@node-red/editor-client/src/js/red.js b/packages/node_modules/@node-red/editor-client/src/js/red.js index 814f5c542..f9f4eff00 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/red.js +++ b/packages/node_modules/@node-red/editor-client/src/js/red.js @@ -372,7 +372,7 @@ var RED = (function() { node.status = msg; node.dirtyStatus = true; node.dirty = true; - RED.view.redraw(); + RED.view.redrawStatus(node); } }); RED.comms.subscribe("notification/node/#",function(topic,msg) { diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index b49e4a836..91f45db86 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -3424,6 +3424,37 @@ RED.view = (function() { } } + function redrawStatus(d,nodeEl) { + if (d.z !== RED.workspaces.active()) { + return; + } + if (!nodeEl) { + nodeEl = document.getElementById(d.id); + } + if (nodeEl) { + if (!showStatus || !d.status) { + nodeEl.__statusGroup__.style.display = "none"; + } else { + nodeEl.__statusGroup__.style.display = "inline"; + var fill = status_colours[d.status.fill]; // Only allow our colours for now + if (d.status.shape == null && fill == null) { + nodeEl.__statusShape__.style.display = "none"; + nodeEl.__statusGroup__.setAttribute("transform","translate(-14,"+(d.h+3)+")"); + } else { + nodeEl.__statusGroup__.setAttribute("transform","translate(3,"+(d.h+3)+")"); + var statusClass = "red-ui-flow-node-status-"+(d.status.shape||"dot")+"-"+d.status.fill; + nodeEl.__statusShape__.style.display = "inline"; + nodeEl.__statusShape__.setAttribute("class","red-ui-flow-node-status "+statusClass); + } + if (d.status.hasOwnProperty('text')) { + nodeEl.__statusLabel__.textContent = d.status.text; + } else { + nodeEl.__statusLabel__.textContent = ""; + } + } + delete d.dirtyStatus; + } + } var pendingRedraw; @@ -3992,27 +4023,7 @@ RED.view = (function() { } if (d.dirtyStatus) { - if (!showStatus || !d.status) { - this.__statusGroup__.style.display = "none"; - } else { - this.__statusGroup__.style.display = "inline"; - var fill = status_colours[d.status.fill]; // Only allow our colours for now - if (d.status.shape == null && fill == null) { - this.__statusShape__.style.display = "none"; - this.__statusGroup__.setAttribute("transform","translate(-14,"+(d.h+3)+")"); - } else { - this.__statusGroup__.setAttribute("transform","translate(3,"+(d.h+3)+")"); - var statusClass = "red-ui-flow-node-status-"+(d.status.shape||"dot")+"-"+d.status.fill; - this.__statusShape__.style.display = "inline"; - this.__statusShape__.setAttribute("class","red-ui-flow-node-status "+statusClass); - } - if (d.status.hasOwnProperty('text')) { - this.__statusLabel__.textContent = d.status.text; - } else { - this.__statusLabel__.textContent = ""; - } - } - delete d.dirtyStatus; + redrawStatus(d,this); } d.dirty = false; if (d.g) { @@ -4928,6 +4939,7 @@ RED.view = (function() { }, clipboard: function() { return clipboard - } + }, + redrawStatus: redrawStatus }; })();