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:
Nick O'Leary
2019-01-09 14:02:46 +00:00
parent 81d5b47fce
commit 0ec04a3624
6 changed files with 85 additions and 12 deletions

View File

@@ -483,20 +483,17 @@
var key = RED.utils.parseContextKey(payload);
payload = this.payloadType+"."+key.key;
}
var label = (this.name||payload);
var label = this._def.label.call(this);
if (label.length > 30) {
label = label.substring(0,50)+"...";
}
label = label.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
if (this.payloadType === "date") { label = this._("inject.timestamp"); }
if (this.payloadType === "none") { label = this._("inject.blank"); }
var node = this;
$.ajax({
url: "inject/"+this.id,
type:"POST",
success: function(resp) {
RED.notify(node._("inject.success",{label:label}),"success");
RED.notify(node._("inject.success",{label:label}),{type:"success",id:"inject"});
},
error: function(jqXHR,textStatus,errorThrown) {
if (jqXHR.status == 404) {