|
|
@@ -93,6 +93,7 @@ class MetricsPanelCtrl extends PanelCtrl {
|
|
|
// load datasource service
|
|
|
this.setTimeQueryStart();
|
|
|
this.datasourceSrv.get(this.panel.datasource)
|
|
|
+ .then(this.updateTimeRange.bind(this))
|
|
|
.then(this.issueQueries.bind(this))
|
|
|
.then(this.handleQueryResult.bind(this))
|
|
|
.catch(err => {
|
|
|
@@ -119,7 +120,8 @@ class MetricsPanelCtrl extends PanelCtrl {
|
|
|
this.timing.queryEnd = new Date().getTime();
|
|
|
}
|
|
|
|
|
|
- updateTimeRange() {
|
|
|
+ updateTimeRange(datasource?) {
|
|
|
+ this.datasource = datasource || this.datasource;
|
|
|
this.range = this.timeSrv.timeRange();
|
|
|
this.rangeRaw = this.range.raw;
|
|
|
|
|
|
@@ -132,6 +134,8 @@ class MetricsPanelCtrl extends PanelCtrl {
|
|
|
}
|
|
|
|
|
|
this.calculateInterval();
|
|
|
+
|
|
|
+ return this.datasource;
|
|
|
};
|
|
|
|
|
|
calculateInterval() {
|
|
|
@@ -194,7 +198,6 @@ class MetricsPanelCtrl extends PanelCtrl {
|
|
|
|
|
|
issueQueries(datasource) {
|
|
|
this.datasource = datasource;
|
|
|
- this.updateTimeRange();
|
|
|
|
|
|
if (!this.panel.targets || this.panel.targets.length === 0) {
|
|
|
return this.$q.when([]);
|