diff --git a/editor/js/main.js b/editor/js/main.js
index 1038facda..4f16af488 100644
--- a/editor/js/main.js
+++ b/editor/js/main.js
@@ -79,6 +79,23 @@
if (/^#flow\/.+$/.test(currentHash)) {
RED.workspaces.show(currentHash.substring(6));
}
+
+ var persistentNotifications = {};
+ RED.comms.subscribe("notification/#",function(topic,msg) {
+ var parts = topic.split("/");
+ var notificationId = parts[1];
+ if (msg.text) {
+ var text = RED._(msg.text,{default:msg.text});
+ if (!persistentNotifications.hasOwnProperty(notificationId)) {
+ persistentNotifications[notificationId] = RED.notify(text,msg.type,msg.timeout === undefined,msg.timeout);
+ } else {
+ persistentNotifications[notificationId].update(text,msg.timeout);
+ }
+ } else if (persistentNotifications.hasOwnProperty(notificationId)) {
+ persistentNotifications[notificationId].close();
+ delete persistentNotifications[notificationId];
+ }
+ });
RED.comms.subscribe("status/#",function(topic,msg) {
var parts = topic.split("/");
var node = RED.nodes.node(parts[1]);
diff --git a/editor/js/ui/notifications.js b/editor/js/ui/notifications.js
index f64bf6f89..6c956be42 100644
--- a/editor/js/ui/notifications.js
+++ b/editor/js/ui/notifications.js
@@ -51,11 +51,17 @@ RED.notify = (function() {
n.update = (function() {
var nn = n;
- return function(msg) {
+ return function(msg,timeout) {
nn.innerHTML = msg;
+ if (timeout !== undefined && timeout > 0) {
+ window.clearTimeout(nn.timeoutid);
+ nn.timeoutid = window.setTimeout(nn.close,timeout);
+ } else {
+ window.clearTimeout(nn.timeoutid);
+ }
}
})();
-
+
if (!fixed) {
$(n).click((function() {
var nn = n;
diff --git a/red/api/comms.js b/red/api/comms.js
index 1a51bfa1e..ba64f7a38 100644
--- a/red/api/comms.js
+++ b/red/api/comms.js
@@ -32,7 +32,9 @@ var lastSentTime;
function handleStatus(event) {
publish("status/"+event.id,event.status,true);
}
-
+function handleRuntimeEvent(event) {
+ publish("notification/"+event.id,event,event.hasOwnProperty('text'));
+}
function init(_server,runtime) {
server = _server;
settings = runtime.settings;
@@ -40,6 +42,9 @@ function init(_server,runtime) {
runtime.events.removeListener("node-status",handleStatus);
runtime.events.on("node-status",handleStatus);
+
+ runtime.events.removeListener("runtime-event",handleRuntimeEvent);
+ runtime.events.on("runtime-event",handleRuntimeEvent);
}
function start() {
diff --git a/red/api/locales/en-US/editor.json b/red/api/locales/en-US/editor.json
index dca0d7ad7..9f6c7e8fc 100644
--- a/red/api/locales/en-US/editor.json
+++ b/red/api/locales/en-US/editor.json
@@ -66,7 +66,8 @@
"warning": "Warning: __message__",
"warnings": {
"undeployedChanges": "node has undeployed changes",
- "nodeActionDisabled": "node actions disabled within subflow"
+ "nodeActionDisabled": "node actions disabled within subflow",
+ "missing-types": "Flows stopped due to missing node types. Check logs for details."
},
"error": "Error: __message__",
diff --git a/red/runtime/nodes/flows/index.js b/red/runtime/nodes/flows/index.js
index 8aa980e06..234d9e30c 100644
--- a/red/runtime/nodes/flows/index.js
+++ b/red/runtime/nodes/flows/index.js
@@ -58,6 +58,7 @@ function init(runtime) {
log.info(log._("nodes.flows.registered-missing", {type:type}));
activeFlowConfig.missingTypes.splice(i,1);
if (activeFlowConfig.missingTypes.length === 0 && started) {
+ events.emit("runtime-event",{id:"runtime-state"});
start();
}
}
@@ -238,6 +239,7 @@ function start(type,diff,muteLog) {
log.info(log._("nodes.flows.missing-type-install-2"));
log.info(" "+settings.userDir);
}
+ events.emit("runtime-event",{id:"runtime-state",type:"warning",text:"notification.warnings.missing-types"});
return when.resolve();
}
if (!muteLog) {