Parcourir la source

fix(templating): fixed duplicate dashboard refresh when changing template variable, #7654

Torkel Ödegaard il y a 8 ans
Parent
commit
e73b306e0c
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      public/app/features/dashboard/time_srv.ts

+ 5 - 1
public/app/features/dashboard/time_srv.ts

@@ -96,11 +96,15 @@ class TimeSrv {
         this.initTimeFromUrl();
         this.initTimeFromUrl();
         this.setTime(this.time, true);
         this.setTime(this.time, true);
       }
       }
-    } else {
+    } else if (this.timeHasChangedSinceLoad()) {
       this.setTime(this.timeAtLoad, true);
       this.setTime(this.timeAtLoad, true);
     }
     }
   }
   }
 
 
+  private timeHasChangedSinceLoad() {
+    return this.timeAtLoad.from !== this.time.from || this.timeAtLoad.to !== this.time.to;
+  }
+
   setAutoRefresh(interval) {
   setAutoRefresh(interval) {
     this.dashboard.refresh = interval;
     this.dashboard.refresh = interval;
     if (interval) {
     if (interval) {