mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 21:12:13 +08:00
AngularPanels: Fixed loading state indication for angular panels (#17900)
This commit is contained in:
2213
devenv/dev-dashboards/panel-common/lazy_loading.json
Normal file
2213
devenv/dev-dashboards/panel-common/lazy_loading.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -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))
|
||||||
// NOTE handleQueryResult is called by panelDataObserver
|
|
||||||
.catch((err: any) => {
|
.catch((err: any) => {
|
||||||
this.processDataError(err);
|
this.processDataError(err);
|
||||||
})
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processDataError(err: any) {
|
processDataError(err: any) {
|
||||||
@ -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 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user