Merge pull request #15100 from grafana/annotation-dashboard-switch-fix

Fix for annotations not clearing when switching dashboards
This commit is contained in:
Torkel Ödegaard
2019-01-29 06:53:20 +01:00
committed by GitHub

View File

@@ -21,12 +21,16 @@ export class AnnotationsSrv {
constructor(private $rootScope, private $q, private datasourceSrv, private backendSrv, private timeSrv) {} constructor(private $rootScope, private $q, private datasourceSrv, private backendSrv, private timeSrv) {}
init(dashboard: DashboardModel) { init(dashboard: DashboardModel) {
// always clearPromiseCaches when loading new dashboard
this.clearPromiseCaches();
// clear promises on refresh events // clear promises on refresh events
dashboard.on('refresh', () => { dashboard.on('refresh', this.clearPromiseCaches.bind(this));
this.globalAnnotationsPromise = null; }
this.alertStatesPromise = null;
this.datasourcePromises = null; clearPromiseCaches() {
}); this.globalAnnotationsPromise = null;
this.alertStatesPromise = null;
this.datasourcePromises = null;
} }
getAnnotations(options) { getAnnotations(options) {