mirror of
https://github.com/timberjoegithub/grafana-statusmap.git
synced 2026-07-22 07:49:47 +00:00
fix: use == operator instead of strict equal
- regression after fix linter issues. See a8e2a8fa.
This commit is contained in:
@@ -32,7 +32,7 @@ export class ColorModeDiscrete {
|
|||||||
|
|
||||||
for (let i = 0; i < thresholds.length; i++) {
|
for (let i = 0; i < thresholds.length; i++) {
|
||||||
for (let j = 0; j < values.length; j++) {
|
for (let j = 0; j < values.length; j++) {
|
||||||
if (values[j] === thresholds[i].value) {
|
if (this.isEqualValues(values[j], thresholds[i].value)) {
|
||||||
tooltips.push({
|
tooltips.push({
|
||||||
tooltip: thresholds[i].tooltip ? thresholds[i].tooltip : values[j],
|
tooltip: thresholds[i].tooltip ? thresholds[i].tooltip : values[j],
|
||||||
color: thresholds[i].color,
|
color: thresholds[i].color,
|
||||||
@@ -43,18 +43,16 @@ export class ColorModeDiscrete {
|
|||||||
return tooltips;
|
return tooltips;
|
||||||
}
|
}
|
||||||
|
|
||||||
convertValueToTooltips(values) {
|
convertValueToTooltips(value) {
|
||||||
let thresholds = this.panel.color.thresholds;
|
let thresholds = this.panel.color.thresholds;
|
||||||
let tooltips = [];
|
let tooltips = [];
|
||||||
|
|
||||||
for (let i = 0; i < thresholds.length; i++) {
|
for (let i = 0; i < thresholds.length; i++) {
|
||||||
//for (let j = 0; j < values.length; j++) {
|
if (this.isEqualValues(value, thresholds[i].value)) {
|
||||||
if (values === thresholds[i].value) {
|
|
||||||
tooltips.push({
|
tooltips.push({
|
||||||
tooltip: thresholds[i].tooltip ? thresholds[i].tooltip : values,
|
tooltip: thresholds[i].tooltip ? thresholds[i].tooltip : value,
|
||||||
color: thresholds[i].color,
|
color: thresholds[i].color,
|
||||||
});
|
});
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tooltips;
|
return tooltips;
|
||||||
@@ -135,7 +133,7 @@ export class ColorModeDiscrete {
|
|||||||
|
|
||||||
for (let i = 0; i < thresholds.length; i++) {
|
for (let i = 0; i < thresholds.length; i++) {
|
||||||
for (let j = 0; j < values.length; j++) {
|
for (let j = 0; j < values.length; j++) {
|
||||||
if (values[j] === thresholds[i].value) {
|
if (this.isEqualValues(values[j], thresholds[i].value)) {
|
||||||
return this.getDiscreteColor(i);
|
return this.getDiscreteColor(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -199,7 +197,7 @@ export class ColorModeDiscrete {
|
|||||||
|
|
||||||
let thresholds = this.panel.color.thresholds;
|
let thresholds = this.panel.color.thresholds;
|
||||||
for (let k = 0; k < thresholds.length; k++) {
|
for (let k = 0; k < thresholds.length; k++) {
|
||||||
if (value === thresholds[k].value) {
|
if (this.isEqualValues(value, thresholds[k].value)) {
|
||||||
return thresholds[k];
|
return thresholds[k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -218,6 +216,13 @@ export class ColorModeDiscrete {
|
|||||||
return thresholds[index];
|
return thresholds[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isEqualValues(val1, val2) {
|
||||||
|
// Relaxed equal operator here is important.
|
||||||
|
// threshold.value can be a number or a string and input value can be a number or a string.
|
||||||
|
/* eslint-disable eqeqeq */
|
||||||
|
return val1 == val2;
|
||||||
|
}
|
||||||
|
|
||||||
roundIntervalCeil(interval) {
|
roundIntervalCeil(interval) {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case interval <= 10:
|
case interval <= 10:
|
||||||
|
|||||||
Reference in New Issue
Block a user