4 Commits
Author SHA1 Message Date
Ivan MikheykinandGitHub f90015723a Merge pull request #186 from flant/prepare_v0_4_1
Prepare release 0.4.1
2021-02-18 12:20:43 +03:00
Ivan Mikheykin 15d9132cbe Prepare release 0.4.1 2021-02-18 12:19:30 +03:00
Ivan MikheykinandGitHub e9e36d7f39 Merge pull request #185 from flant/fix_discrete_mode_regression
fix: use == operator instead of strict equal
2021-02-18 12:16:57 +03:00
Ivan Mikheykin 6372ddf8df fix: use == operator instead of strict equal
- regression after fix linter issues. See a8e2a8fa.
2021-02-18 12:11:39 +03:00
3 changed files with 18 additions and 9 deletions
+4
View File
@@ -1,5 +1,9 @@
# Changelog
## v0.4.1
- Fix regression in discrete mode. "Data has value with undefined color"
## v0.4.0
- Add __y_label_trim variable for tooltip items.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "flant-statusmap-panel",
"version": "0.4.0",
"version": "0.4.1",
"description": "Grafana panel plugin to visualize status of multiple objects over time",
"main": "README.md",
"scripts": {
+13 -8
View File
@@ -32,7 +32,7 @@ export class ColorModeDiscrete {
for (let i = 0; i < thresholds.length; i++) {
for (let j = 0; j < values.length; j++) {
if (values[j] === thresholds[i].value) {
if (this.isEqualValues(values[j], thresholds[i].value)) {
tooltips.push({
tooltip: thresholds[i].tooltip ? thresholds[i].tooltip : values[j],
color: thresholds[i].color,
@@ -43,18 +43,16 @@ export class ColorModeDiscrete {
return tooltips;
}
convertValueToTooltips(values) {
convertValueToTooltips(value) {
let thresholds = this.panel.color.thresholds;
let tooltips = [];
for (let i = 0; i < thresholds.length; i++) {
//for (let j = 0; j < values.length; j++) {
if (values === thresholds[i].value) {
if (this.isEqualValues(value, thresholds[i].value)) {
tooltips.push({
tooltip: thresholds[i].tooltip ? thresholds[i].tooltip : values,
tooltip: thresholds[i].tooltip ? thresholds[i].tooltip : value,
color: thresholds[i].color,
});
//}
}
}
return tooltips;
@@ -135,7 +133,7 @@ export class ColorModeDiscrete {
for (let i = 0; i < thresholds.length; i++) {
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);
}
}
@@ -199,7 +197,7 @@ export class ColorModeDiscrete {
let thresholds = this.panel.color.thresholds;
for (let k = 0; k < thresholds.length; k++) {
if (value === thresholds[k].value) {
if (this.isEqualValues(value, thresholds[k].value)) {
return thresholds[k];
}
}
@@ -218,6 +216,13 @@ export class ColorModeDiscrete {
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) {
switch (true) {
case interval <= 10: