Merge pull request #14192 from grafana/davkal/fix-14190

Explore: Fix JS error when switching between 2 prometheus datasources
This commit is contained in:
David 2018-11-26 14:20:16 +01:00 committed by GitHub
commit 2257f63543
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -437,7 +437,7 @@ export class PrometheusDatasource {
}
getQueryHints(query: DataQuery, result: any[]) {
return getQueryHints(query.expr, result, this);
return getQueryHints(query.expr || '', result, this);
}
loadRules() {

View File

@ -96,7 +96,7 @@ export function getQueryHints(query: string, series?: any[], datasource?: any):
}
}
if (series.length >= SUM_HINT_THRESHOLD_COUNT) {
if (series && series.length >= SUM_HINT_THRESHOLD_COUNT) {
const simpleMetric = query.trim().match(/^\w+$/);
if (simpleMetric) {
hints.push({