mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge pull request #4453 from node-red/4413-debounce-uninstall-notifications
Debounce node-removed notifications
This commit is contained in:
commit
21f807aa66
@ -534,6 +534,10 @@ var RED = (function() {
|
||||
RED.view.redrawStatus(node);
|
||||
}
|
||||
});
|
||||
|
||||
let pendingNodeRemovedNotifications = []
|
||||
let pendingNodeRemovedTimeout
|
||||
|
||||
RED.comms.subscribe("notification/node/#",function(topic,msg) {
|
||||
var i,m;
|
||||
var typeList;
|
||||
@ -571,8 +575,15 @@ var RED = (function() {
|
||||
m = msg[i];
|
||||
info = RED.nodes.removeNodeSet(m.id);
|
||||
if (info.added) {
|
||||
typeList = "<ul><li>"+m.types.map(RED.utils.sanitize).join("</li><li>")+"</li></ul>";
|
||||
RED.notify(RED._("palette.event.nodeRemoved", {count:m.types.length})+typeList,"success");
|
||||
pendingNodeRemovedNotifications = pendingNodeRemovedNotifications.concat(m.types.map(RED.utils.sanitize))
|
||||
if (pendingNodeRemovedTimeout) {
|
||||
clearTimeout(pendingNodeRemovedTimeout)
|
||||
}
|
||||
pendingNodeRemovedTimeout = setTimeout(function () {
|
||||
typeList = "<ul><li>"+pendingNodeRemovedNotifications.join("</li><li>")+"</li></ul>";
|
||||
RED.notify(RED._("palette.event.nodeRemoved", {count:pendingNodeRemovedNotifications.length})+typeList,"success");
|
||||
pendingNodeRemovedNotifications = []
|
||||
}, 200)
|
||||
}
|
||||
}
|
||||
loadIconList();
|
||||
|
Loading…
x
Reference in New Issue
Block a user