Commit acf24bd6 by Torkel Ödegaard

Clear query models when changing data source type, fixes #14394

parent 336fb418
...@@ -89,10 +89,17 @@ export class MetricsTabCtrl { ...@@ -89,10 +89,17 @@ export class MetricsTabCtrl {
target.datasource = config.defaultDatasource; target.datasource = config.defaultDatasource;
} }
}); });
} else if (this.datasourceInstance && this.datasourceInstance.meta.mixed) { } else if (this.datasourceInstance) {
_.each(this.panel.targets, target => { // if switching from mixed
delete target.datasource; if (this.datasourceInstance.meta.mixed) {
}); _.each(this.panel.targets, target => {
delete target.datasource;
});
} else if (this.datasourceInstance.meta.id !== datasource.meta.id) {
// we are changing data source type, clear queries
this.panel.targets = [{ refId: 'A' }];
this.panelCtrl.nextRefId = this.dashboard.getNextQueryLetter(this.panel);
}
} }
this.datasourceInstance = datasource; this.datasourceInstance = datasource;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment