Преглед на файлове

Fixed bug with auto refresh option being reset when changing relative time when now delay is configured, Fixes #2042

Torkel Ödegaard преди 10 години
родител
ревизия
99556057d1
променени са 2 файла, в които са добавени 7 реда и са изтрити 1 реда
  1. 1 1
      public/app/features/dashboard/timeSrv.js
  2. 6 0
      public/test/specs/timeSrv-specs.js

+ 1 - 1
public/app/features/dashboard/timeSrv.js

@@ -93,7 +93,7 @@ define([
       _.extend(this.time, time);
 
       // disable refresh if we have an absolute time
-      if (time.to !== 'now') {
+      if (time.to && time.to.indexOf('now') === -1) {
         this.old_refresh = this.dashboard.refresh || this.old_refresh;
         this.set_interval(false);
       }

+ 6 - 0
public/test/specs/timeSrv-specs.js

@@ -90,6 +90,12 @@ define([
         ctx.service.setTime({from: '2011-01-01', to: 'now' });
         expect(_dashboard.refresh).to.be('10s');
       });
+
+      it('should keep refresh after relative time range is changed and now delay exists', function() {
+        _dashboard.refresh = '10s';
+        ctx.service.setTime({from: 'now-1h', to: 'now-10s' });
+        expect(_dashboard.refresh).to.be('10s');
+      });
     });
 
   });