mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add RED.view.redrawStatus to avoid full redraw on update
This commit is contained in:
parent
979c5351a8
commit
612c565cfd
@ -372,7 +372,7 @@ var RED = (function() {
|
|||||||
node.status = msg;
|
node.status = msg;
|
||||||
node.dirtyStatus = true;
|
node.dirtyStatus = true;
|
||||||
node.dirty = true;
|
node.dirty = true;
|
||||||
RED.view.redraw();
|
RED.view.redrawStatus(node);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
RED.comms.subscribe("notification/node/#",function(topic,msg) {
|
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;
|
var pendingRedraw;
|
||||||
|
|
||||||
@ -3992,27 +4023,7 @@ RED.view = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (d.dirtyStatus) {
|
if (d.dirtyStatus) {
|
||||||
if (!showStatus || !d.status) {
|
redrawStatus(d,this);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
d.dirty = false;
|
d.dirty = false;
|
||||||
if (d.g) {
|
if (d.g) {
|
||||||
@ -4928,6 +4939,7 @@ RED.view = (function() {
|
|||||||
},
|
},
|
||||||
clipboard: function() {
|
clipboard: function() {
|
||||||
return clipboard
|
return clipboard
|
||||||
}
|
},
|
||||||
|
redrawStatus: redrawStatus
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user