AngularPanels: Fixed loading spinner being stuck in some rare cases (#20878)

This commit is contained in:
Torkel Ödegaard 2019-12-05 08:59:07 +01:00 committed by GitHub
parent 9a7a1b86ee
commit 62f0aca3e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,6 +115,14 @@ class MetricsPanelCtrl extends PanelCtrl {
this.error = err.data.error; this.error = err.data.error;
} }
} }
this.angularDirtyCheck();
}
angularDirtyCheck() {
if (!this.$scope.$$phase) {
this.$scope.$digest();
}
} }
// Updates the response with information from the stream // Updates the response with information from the stream
@ -128,6 +136,7 @@ class MetricsPanelCtrl extends PanelCtrl {
// Ignore data in loading state // Ignore data in loading state
if (data.state === LoadingState.Loading) { if (data.state === LoadingState.Loading) {
this.loading = true; this.loading = true;
this.angularDirtyCheck();
return; return;
} }
@ -149,6 +158,8 @@ class MetricsPanelCtrl extends PanelCtrl {
const legacy = data.series.map(v => toLegacyResponseData(v)); const legacy = data.series.map(v => toLegacyResponseData(v));
this.handleQueryResult({ data: legacy }); this.handleQueryResult({ data: legacy });
} }
this.angularDirtyCheck();
}, },
}; };