mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Allow notifications to be reused in place rather than stack
For example, clipboard actions now reuse the same notification. Similarly the Inject node will reuse its notification when injecting.
This commit is contained in:
@@ -142,10 +142,10 @@ RED.comms = (function() {
|
||||
connectWS();
|
||||
} else {
|
||||
var msg = RED._("notification.errors.lostConnectionReconnect",{time: connectCountdown})+' <a href="#">'+ RED._("notification.errors.lostConnectionTry")+'</a>';
|
||||
errornotification.update(msg);
|
||||
errornotification.update(msg,{silent:true});
|
||||
$(errornotification).find("a").click(function(e) {
|
||||
e.preventDefault();
|
||||
errornotification.update(RED._("notification.errors.lostConnection"));
|
||||
errornotification.update(RED._("notification.errors.lostConnection"),{silent:true});
|
||||
clearInterval(connectCountdownTimer);
|
||||
connectWS();
|
||||
})
|
||||
|
@@ -72,7 +72,7 @@ RED.clipboard = (function() {
|
||||
$("#clipboard-export").select();
|
||||
document.execCommand("copy");
|
||||
document.getSelection().removeAllRanges();
|
||||
RED.notify(RED._("clipboard.nodesExported"));
|
||||
RED.notify(RED._("clipboard.nodesExported"),{id:"clipboard"});
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
},
|
||||
|
@@ -56,6 +56,11 @@ RED.notifications = (function() {
|
||||
type = options.type;
|
||||
}
|
||||
|
||||
if (options.id && persistentNotifications.hasOwnProperty(options.id)) {
|
||||
persistentNotifications[options.id].update(msg,options);
|
||||
return persistentNotifications[options.id];
|
||||
}
|
||||
|
||||
if (options.modal) {
|
||||
$("#full-shade").show();
|
||||
}
|
||||
@@ -181,7 +186,9 @@ RED.notifications = (function() {
|
||||
if (typeof options === 'number') {
|
||||
timeout = options;
|
||||
} else if (options !== undefined) {
|
||||
timeout = options.timeout;
|
||||
if (!options.fixed) {
|
||||
timeout = options.timeout || 5000;
|
||||
}
|
||||
if (options.buttons) {
|
||||
var buttonSet = $('<div style="margin-top: 20px;" class="ui-dialog-buttonset"></div>').appendTo(nn)
|
||||
options.buttons.forEach(function(buttonDef) {
|
||||
@@ -203,6 +210,11 @@ RED.notifications = (function() {
|
||||
}
|
||||
if (nn.hidden) {
|
||||
nn.showNotification();
|
||||
} else if (!options || !options.silent){
|
||||
$(nn).addClass("notification-shake-horizontal");
|
||||
setTimeout(function() {
|
||||
$(nn).removeClass("notification-shake-horizontal");
|
||||
},300);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -221,7 +233,9 @@ RED.notifications = (function() {
|
||||
currentNotifications.push(n);
|
||||
if (options.id) {
|
||||
persistentNotifications[options.id] = n;
|
||||
notificationButtonWrapper.show();
|
||||
if (options.fixed) {
|
||||
notificationButtonWrapper.show();
|
||||
}
|
||||
}
|
||||
c+=1;
|
||||
return n;
|
||||
|
@@ -1636,7 +1636,7 @@ RED.view = (function() {
|
||||
}
|
||||
}
|
||||
clipboard = JSON.stringify(nns);
|
||||
RED.notify(RED._("clipboard.nodeCopied",{count:nns.length}));
|
||||
RED.notify(RED._("clipboard.nodeCopied",{count:nns.length}),{id:"clipboard"});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3255,7 +3255,7 @@ RED.view = (function() {
|
||||
}
|
||||
if (counts.length > 0) {
|
||||
var countList = "<ul><li>"+counts.join("</li><li>")+"</li></ul>";
|
||||
RED.notify("<p>"+RED._("clipboard.nodesImported")+"</p>"+countList);
|
||||
RED.notify("<p>"+RED._("clipboard.nodesImported")+"</p>"+countList,{id:"clipboard"});
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user