Skip to content

Commit

Permalink
Fixed color bug for selecting while timelapsing
Browse files Browse the repository at this point in the history
this closes #128
  • Loading branch information
KimSvenSand committed May 10, 2017
1 parent 8d6ce46 commit 4e75953
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions heatmap_panel/src/HeatmapCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,31 @@ export class HeatmapCtrl extends MetricsPanelCtrl {
this.circles.setCircleColor(this.currentDataList, index, '.circle', this.lightTheme ? 'lightgrey' : 'white');
} else {
this.selected.push(serviceName);

if (this.timelapse.state !== 'stop') {
let rearragned = [];
for (let i = 0; i < this.currentDataList.length; i++) {
let productName = this.targetParser.parseName(this.currentDataList[i].target)

if (this.selected.includes(productName)) {
rearragned.push(productName);
} else {
this.circles.setCircleColor(this.currentDataList, i, '.circle', this.lightTheme ? 'lightgrey' : 'white');
}
}

for (let i = 0; i < rearragned.length; i++) {
let k = 0;

while (rearragned[i] !== this.targetParser.parseName(this.currentDataList[k].target) && this.currentDataList[k + 1] !== undefined) {
k++;
}

if (rearragned[i] === this.targetParser.parseName(this.currentDataList[k].target)) {
this.circles.setCircleColor(this.currentDataList, k, '.circle', this.panel.colors[i]);
}
}
}
}

this.productSelector.buildSimple('products', this.selected); // Add product to grafana template variable.
Expand Down

0 comments on commit 4e75953

Please sign in to comment.