Added server status to nodes that didn't have it

This commit is contained in:
Skylar Sadlier 2021-08-18 14:19:56 -06:00
parent 2b2c628904
commit dc5f744e5f
4 changed files with 40 additions and 0 deletions

View File

@ -24,6 +24,16 @@ module.exports = function(RED) {
return pathTemplate; return pathTemplate;
}; };
node.status({ fill: "red", shape: "ring", text: "disconnected" });
node.server.on("disconnected", function(){
node.status({ fill: "red", shape: "ring", text: "disconnected" });
});
node.server.on("connected", function() {
node.status({ fill: "green", shape: "ring", text: "connected" });
});
node.on("input", function (msg) { node.on("input", function (msg) {
if (! node.server || ! node.server.matrixClient) { if (! node.server || ! node.server.matrixClient) {
node.warn("No matrix server selected"); node.warn("No matrix server selected");

View File

@ -24,6 +24,16 @@ module.exports = function(RED) {
return pathTemplate; return pathTemplate;
}; };
node.status({ fill: "red", shape: "ring", text: "disconnected" });
node.server.on("disconnected", function(){
node.status({ fill: "red", shape: "ring", text: "disconnected" });
});
node.server.on("connected", function() {
node.status({ fill: "green", shape: "ring", text: "connected" });
});
node.on("input", function (msg) { node.on("input", function (msg) {
if (! node.server || ! node.server.matrixClient) { if (! node.server || ! node.server.matrixClient) {
node.warn("No matrix server selected"); node.warn("No matrix server selected");

View File

@ -22,6 +22,16 @@ module.exports = function(RED) {
return; return;
} }
node.status({ fill: "red", shape: "ring", text: "disconnected" });
node.server.on("disconnected", function(){
node.status({ fill: "red", shape: "ring", text: "disconnected" });
});
node.server.on("connected", function() {
node.status({ fill: "green", shape: "ring", text: "connected" });
});
node.on("input", function (msg) { node.on("input", function (msg) {
if(!msg.payload.username) { if(!msg.payload.username) {

View File

@ -24,6 +24,16 @@ module.exports = function(RED) {
return pathTemplate; return pathTemplate;
}; };
node.status({ fill: "red", shape: "ring", text: "disconnected" });
node.server.on("disconnected", function(){
node.status({ fill: "red", shape: "ring", text: "disconnected" });
});
node.server.on("connected", function() {
node.status({ fill: "green", shape: "ring", text: "connected" });
});
node.on("input", function (msg) { node.on("input", function (msg) {
if (! node.server || ! node.server.matrixClient) { if (! node.server || ! node.server.matrixClient) {
node.warn("No matrix server selected"); node.warn("No matrix server selected");