Merge branch 'master' into dev

This commit is contained in:
Nick O'Leary
2020-11-18 16:36:56 +00:00
25 changed files with 247 additions and 55 deletions

View File

@@ -38,12 +38,20 @@ function handleCommsEvent(event) {
publish(event.topic,event.data,event.retain);
}
function handleStatusEvent(event) {
var status = {
text: event.status.text,
fill: event.status.fill,
shape: event.status.shape
};
publish("status/"+event.id,status,true);
if (!event.status) {
delete retained["status/"+event.id]
} else if (!event.status.text && !event.status.fill && !event.status.shape) {
if (retained["status/"+event.id]) {
publish("status/"+event.id,{},false);
}
} else {
var status = {
text: event.status.text,
fill: event.status.fill,
shape: event.status.shape
};
publish("status/"+event.id,status,true);
}
}
function handleRuntimeEvent(event) {
runtime.log.trace("runtime event: "+JSON.stringify(event));

View File

@@ -319,6 +319,11 @@ class Flow {
node.error(err);
}
}
if (removedMap[stopList[i]]) {
events.emit("node-status",{
id: node.id
});
}
}
}
return Promise.all(promises);

View File

@@ -18,6 +18,7 @@ const clone = require("clone");
const Flow = require('./Flow').Flow;
const context = require('../nodes/context');
const util = require("util");
const events = require("../events");
const redUtil = require("@node-red/util").util;
const flowUtil = require("./util");
@@ -308,7 +309,26 @@ class Subflow extends Flow {
super.start(diff);
}
/**
* Stop this subflow.
* The `stopList` argument helps define what needs to be stopped in the case
* of a modified-nodes/flows type deploy.
* @param {[type]} stopList [description]
* @param {[type]} removedList [description]
* @return {[type]} [description]
*/
stop(stopList, removedList) {
const nodes = Object.keys(this.activeNodes);
return super.stop(stopList, removedList).then(res => {
nodes.forEach(id => {
events.emit("node-status",{
id: id
});
})
return res;
})
}
/**
* Get environment variable of subflow
* @param {String} name name of env var