mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Hotfix for Explore (empty page after running query)
Since #13212 adhoc filters are being gathered, in Explore the template service has no variables set and then throws when iterating over them.
This commit is contained in:
parent
270b736302
commit
1a38c45dde
@ -50,18 +50,20 @@ export class TemplateSrv {
|
|||||||
getAdhocFilters(datasourceName) {
|
getAdhocFilters(datasourceName) {
|
||||||
let filters = [];
|
let filters = [];
|
||||||
|
|
||||||
for (let i = 0; i < this.variables.length; i++) {
|
if (this.variables) {
|
||||||
const variable = this.variables[i];
|
for (let i = 0; i < this.variables.length; i++) {
|
||||||
if (variable.type !== 'adhoc') {
|
const variable = this.variables[i];
|
||||||
continue;
|
if (variable.type !== 'adhoc') {
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// null is the "default" datasource
|
// null is the "default" datasource
|
||||||
if (variable.datasource === null || variable.datasource === datasourceName) {
|
if (variable.datasource === null || variable.datasource === datasourceName) {
|
||||||
filters = filters.concat(variable.filters);
|
|
||||||
} else if (variable.datasource.indexOf('$') === 0) {
|
|
||||||
if (this.replace(variable.datasource) === datasourceName) {
|
|
||||||
filters = filters.concat(variable.filters);
|
filters = filters.concat(variable.filters);
|
||||||
|
} else if (variable.datasource.indexOf('$') === 0) {
|
||||||
|
if (this.replace(variable.datasource) === datasourceName) {
|
||||||
|
filters = filters.concat(variable.filters);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user