Skip to content

Commit 8fad7fa

Browse files
committed
show warning in status not debug window
1 parent 329bcc2 commit 8fad7fa

1 file changed

Lines changed: 22 additions & 7 deletions

File tree

OpenFlowNodeRED/src/nodered/nodes/api_nodes.ts

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,9 @@ export class api_add {
273273

274274
if (!NoderedUtil.IsNullUndefinded(_data)) {
275275
if (!Array.isArray(_data)) { data.push(_data); } else { data = _data; }
276-
if (data.length === 0) { this.node.warn("input array is empty"); }
276+
if (data.length === 0) {
277+
this.node.status({ fill: "yellow", shape: "dot", text: "input array is empty" });
278+
}
277279
} else { this.node.warn("Input data is null"); }
278280

279281
this.node.status({ fill: "blue", shape: "dot", text: "processing " + data.length + " items" });
@@ -376,7 +378,9 @@ export class api_addmany {
376378
let data: any[] = [];
377379
if (!NoderedUtil.IsNullUndefinded(_data)) {
378380
if (!Array.isArray(_data)) { data.push(_data); } else { data = _data; }
379-
if (data.length === 0) { this.node.warn("input array is empty"); }
381+
if (data.length === 0) {
382+
this.node.status({ fill: "yellow", shape: "dot", text: "input array is empty" });
383+
}
380384
} else { this.node.warn("Input data is null"); }
381385

382386
if (data.length > 0) {
@@ -463,7 +467,9 @@ export class api_update {
463467
let data: any[] = [];
464468
if (!NoderedUtil.IsNullUndefinded(_data)) {
465469
if (!Array.isArray(_data)) { data.push(_data); } else { data = _data; }
466-
if (data.length === 0) { this.node.warn("input array is empty"); }
470+
if (data.length === 0) {
471+
this.node.status({ fill: "yellow", shape: "dot", text: "input array is empty" });
472+
}
467473
} else { this.node.warn("Input data is null"); }
468474

469475
this.node.status({ fill: "blue", shape: "dot", text: "processing ..." });
@@ -490,6 +496,7 @@ export class api_update {
490496
for (let i: number = 0; i < errors.length; i++) {
491497
NoderedUtil.HandleError(this, errors[i], msg);
492498
}
499+
return;
493500
}
494501
data = data.filter(result => !NoderedUtil.IsString(result) && !(result instanceof Error));
495502
if (this.config.entities == null && this.config.resultfield != null) {
@@ -558,7 +565,9 @@ export class api_addorupdate {
558565
let data: any[] = [];
559566
if (!NoderedUtil.IsNullUndefinded(_data)) {
560567
if (!Array.isArray(_data)) { data.push(_data); } else { data = _data; }
561-
if (data.length === 0) { this.node.warn("input array is empty"); }
568+
if (data.length === 0) {
569+
this.node.status({ fill: "yellow", shape: "dot", text: "input array is empty" });
570+
}
562571
} else { this.node.warn("Input data is null"); }
563572

564573
this.node.status({ fill: "blue", shape: "dot", text: "processing ..." });
@@ -640,7 +649,9 @@ export class api_delete {
640649
let data: any[] = [];
641650
if (!NoderedUtil.IsNullUndefinded(_data)) {
642651
if (!Array.isArray(_data)) { data.push(_data); } else { data = _data; }
643-
if (data.length === 0) { this.node.warn("input array is empty"); }
652+
if (data.length === 0) {
653+
this.node.status({ fill: "yellow", shape: "dot", text: "input array is empty" });
654+
}
644655
} else { this.node.warn("Input data is null"); }
645656

646657
this.node.status({ fill: "blue", shape: "dot", text: "processing ..." });
@@ -1014,7 +1025,9 @@ export class grant_permission {
10141025
const _data = NoderedUtil.FetchFromObject(msg, this.config.entities);
10151026
if (!NoderedUtil.IsNullUndefinded(_data)) {
10161027
if (!Array.isArray(_data)) { data.push(_data); } else { data = _data; }
1017-
if (data.length === 0) { this.node.warn("input array is empty"); }
1028+
if (data.length === 0) {
1029+
this.node.status({ fill: "yellow", shape: "dot", text: "input array is empty" });
1030+
}
10181031
} else { this.node.warn("Input data is null"); }
10191032

10201033
this.node.status({ fill: "blue", shape: "dot", text: "processing ..." });
@@ -1083,7 +1096,9 @@ export class revoke_permission {
10831096
const _data = NoderedUtil.FetchFromObject(msg, this.config.entities);
10841097
if (!NoderedUtil.IsNullUndefinded(_data)) {
10851098
if (!Array.isArray(_data)) { data.push(_data); } else { data = _data; }
1086-
if (data.length === 0) { this.node.warn("input array is empty"); }
1099+
if (data.length === 0) {
1100+
this.node.status({ fill: "yellow", shape: "dot", text: "input array is empty" });
1101+
}
10871102
} else { this.node.warn("Input data is null"); }
10881103

10891104
for (let i = 0; i < data.length; i++) {

0 commit comments

Comments
 (0)