mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Add RED.view.redrawStatus to avoid full redraw on update
This commit is contained in:
		@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
    };
 | 
			
		||||
})();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user