1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Added condition that.statusType === "counter" in the debug.html file

This commit is contained in:
Rafael Muynarsk 2022-04-24 17:13:53 -03:00
parent 8924ac2783
commit a63dfc4650
2 changed files with 14 additions and 6 deletions

View File

@ -521,7 +521,10 @@
$("#node-input-tostatus").on('change',function() { $("#node-input-tostatus").on('change',function() {
if ($(this).is(":checked")) { if ($(this).is(":checked")) {
if (!that.hasOwnProperty("statusVal") || that.statusVal !== "") { if (that.statusType === "counter") {
that.statusVal = "";
}
else if (!that.hasOwnProperty("statusVal") || that.statusVal === "") {
var type = $("#node-input-typed-complete").typedInput('type'); var type = $("#node-input-typed-complete").typedInput('type');
var comp = "payload"; var comp = "payload";
if (type !== 'full') { if (type !== 'full') {

View File

@ -37,7 +37,8 @@ module.exports = function(RED) {
var node = this; var node = this;
if ( node.statusType === "counter" ){ if ( node.statusType === "counter" ){
node.status({fill:"blue", shape:"ring", text: node.counter}); node.status({fill:"blue", shape:"ring", text: node.counter});
} else { }
else {
node.status({fill:"", shape:"", text: ""}); node.status({fill:"", shape:"", text: ""});
} }
var preparedEditExpression = null; var preparedEditExpression = null;
@ -125,18 +126,22 @@ module.exports = function(RED) {
if (err) { node.error(err); return; } if (err) { node.error(err); return; }
if ( node.statusType === "counter" ){ if ( node.statusType === "counter" ){
const differenceOfTime = ((new Date()).getTime() - node.lastTime); const differenceOfTime = (new Date().getTime() - node.lastTime);
node.lastTime = new Date().getTime(); node.lastTime = new Date().getTime();
node.counter++; node.counter++;
if ( differenceOfTime > 100 ){ if ( differenceOfTime > 100 ){
node.status({fill:"blue", shape:"ring", text: node.counter}); node.status({fill:"blue", shape:"ring", text: node.counter});
} else { }
if (node.timeout) { clearTimeout(node.timeout) } else {
if (node.timeout) {
clearTimeout(node.timeout)
}
node.timeout = setTimeout(() => { node.timeout = setTimeout(() => {
node.status({fill:"blue", shape:"ring", text: node.counter}) node.status({fill:"blue", shape:"ring", text: node.counter})
}, 200) }, 200)
} }
} else { }
else {
var output = debugMsg.msg; var output = debugMsg.msg;
var st = (typeof output === 'string') ? output : util.inspect(output); var st = (typeof output === 'string') ? output : util.inspect(output);
var fill = "grey"; var fill = "grey";