@@ -32,11 +32,9 @@ export class TimePickerCtrl {
32
32
constructor ( private $scope , private $rootScope , private timeSrv ) {
33
33
$scope . ctrl = this ;
34
34
35
- $rootScope . onAppEvent ( 'refresh' , ( ) => this . init ( ) , $scope ) ;
36
35
$rootScope . onAppEvent ( 'zoom-out' , ( ) => this . zoom ( 2 ) , $scope ) ;
37
- $rootScope . onAppEvent ( 'dash-editor-hidden' , ( ) => {
38
- this . isOpen = false ;
39
- } , $scope ) ;
36
+ $rootScope . onAppEvent ( 'refresh' , ( ) => this . init ( ) , $scope ) ;
37
+ $rootScope . onAppEvent ( 'dash-editor-hidden' , ( ) => this . isOpen = false , $scope ) ;
40
38
41
39
this . init ( ) ;
42
40
}
@@ -64,9 +62,14 @@ export class TimePickerCtrl {
64
62
65
63
this . rangeString = rangeUtil . describeTimeRange ( timeRaw ) ;
66
64
this . absolute = { fromJs : time . from . toDate ( ) , toJs : time . to . toDate ( ) } ;
67
- this . timeRaw = timeRaw ;
68
65
this . tooltip = this . dashboard . formatDate ( time . from ) + ' <br>to<br>' ;
69
66
this . tooltip += this . dashboard . formatDate ( time . to ) ;
67
+
68
+ // do not update time raw when dropdown is open
69
+ // as auto refresh will reset the from/to input fields
70
+ if ( ! this . isOpen ) {
71
+ this . timeRaw = timeRaw ;
72
+ }
70
73
}
71
74
72
75
zoom ( factor ) {
@@ -88,6 +91,7 @@ export class TimePickerCtrl {
88
91
}
89
92
90
93
openDropdown ( ) {
94
+ this . init ( ) ;
91
95
this . isOpen = true ;
92
96
this . timeOptions = rangeUtil . getRelativeTimesList ( this . panel , this . rangeString ) ;
93
97
this . refresh = {
0 commit comments