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