Skip to content

Commit

Permalink
Merge pull request #130 from flygare/fix-color-bug-heatmap
Browse files Browse the repository at this point in the history
Fixed color bug for selecting while timelapsing
  • Loading branch information
Max-Meldrum authored May 10, 2017
2 parents 8d6ce46 + 4e75953 commit 37a09c4
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 37a09c4

Please sign in to comment.