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() {
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 comp = "payload";
if (type !== 'full') {

View File

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