Commit b1126cb0 by Torkel Ödegaard Committed by GitHub

AngularPanels: Fixed loading state indication for angular panels (#17900)

parent 98147fd5
...@@ -89,16 +89,13 @@ class MetricsPanelCtrl extends PanelCtrl { ...@@ -89,16 +89,13 @@ class MetricsPanelCtrl extends PanelCtrl {
this.loading = true; this.loading = true;
// load datasource service // load datasource service
return ( return this.datasourceSrv
this.datasourceSrv .get(this.panel.datasource, this.panel.scopedVars)
.get(this.panel.datasource, this.panel.scopedVars) .then(this.updateTimeRange.bind(this))
.then(this.updateTimeRange.bind(this)) .then(this.issueQueries.bind(this))
.then(this.issueQueries.bind(this)) .catch((err: any) => {
// NOTE handleQueryResult is called by panelDataObserver this.processDataError(err);
.catch((err: any) => { });
this.processDataError(err);
})
);
} }
processDataError(err: any) { processDataError(err: any) {
...@@ -134,7 +131,11 @@ class MetricsPanelCtrl extends PanelCtrl { ...@@ -134,7 +131,11 @@ class MetricsPanelCtrl extends PanelCtrl {
return; return;
} }
this.loading = false; // Ignore data in loading state
if (data.state === LoadingState.Loading) {
this.loading = true;
return;
}
if (data.request) { if (data.request) {
const { range, timeInfo } = data.request; const { range, timeInfo } = data.request;
...@@ -223,12 +224,9 @@ class MetricsPanelCtrl extends PanelCtrl { ...@@ -223,12 +224,9 @@ class MetricsPanelCtrl extends PanelCtrl {
} }
handleDataFrame(data: DataFrame[]) { handleDataFrame(data: DataFrame[]) {
this.loading = false;
if (this.dashboard && this.dashboard.snapshot) { if (this.dashboard && this.dashboard.snapshot) {
this.panel.snapshotData = data; this.panel.snapshotData = data;
} }
// Subclasses that asked for DataFrame will override // Subclasses that asked for DataFrame will override
} }
......
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