Prometheus: Prevents panel editor crash when switching to Prometheus datasource (#18616)

* Fix: Fixes panel editor crash when switching to Promehteus
Fixes: #18600

* Refactor: Adds tests
This commit is contained in:
Hugo Häggmark
2019-08-19 14:04:16 +02:00
committed by GitHub
parent 90df8c4bb0
commit d7ccf98b1b
2 changed files with 45 additions and 1 deletions

View File

@@ -29,7 +29,7 @@ export function getQueryHints(query: string, series?: any[], datasource?: any):
// Check for monotonicity on series (table results are being ignored here)
if (series && series.length > 0) {
series.forEach(s => {
const datapoints: number[][] = s.datapoints;
const datapoints: number[][] = s.datapoints || s.rows || [];
if (query.indexOf('rate(') === -1 && datapoints.length > 1) {
let increasing = false;
const nonNullData = datapoints.filter(dp => dp[0] !== null);