Commit e7086cf6 by Torkel Ödegaard

Timepicker: Fix for setting custom To date with low refresh interval, Fixes #652

parent af073dad
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
**Fixes** **Fixes**
- [Issue #655](https://github.com/grafana/grafana/issues/655). General: Auto refresh not initiated / started after dashboard loading - [Issue #655](https://github.com/grafana/grafana/issues/655). General: Auto refresh not initiated / started after dashboard loading
- [Issue #652](https://github.com/grafana/grafana/issues/652). Timepicker: Entering custom date range impossible when refresh is low (now is constantly reset)
# 1.7.0-rc1 (2014-08-05) # 1.7.0-rc1 (2014-08-05)
......
...@@ -49,17 +49,17 @@ ...@@ -49,17 +49,17 @@
<div class="timepicker-to-column"> <div class="timepicker-to-column">
<label class="small">To (<a class="link" ng-class="{'strong':panel.now}" ng-click="setNow();panel.now=true">now</a>)</label> <label class="small">To (<a class="link" ng-class="{'strong':tempnow}" ng-click="setNow();tempnow=true">now</a>)</label>
<div class="fake-input timepicker-input"> <div class="fake-input timepicker-input">
<div ng-hide="panel.now"> <div ng-hide="tempnow">
<input class="timepicker-date" type="text" ng-change="validate(temptime)" ng-model="temptime.to.date" data-date-format="yyyy-mm-dd" required bs-datepicker />@ <input class="timepicker-date" type="text" ng-change="validate(temptime)" ng-model="temptime.to.date" data-date-format="yyyy-mm-dd" required bs-datepicker />@
<input class="timepicker-hms" type="text" maxlength="2" ng-change="validate(temptime)" ng-model="temptime.to.hour" required ng-pattern="patterns.hour" onClick="this.select();"/>: <input class="timepicker-hms" type="text" maxlength="2" ng-change="validate(temptime)" ng-model="temptime.to.hour" required ng-pattern="patterns.hour" onClick="this.select();"/>:
<input class="timepicker-hms" type="text" maxlength="2" ng-change="validate(temptime)" ng-model="temptime.to.minute" required ng-pattern="patterns.minute" onClick="this.select();"/>: <input class="timepicker-hms" type="text" maxlength="2" ng-change="validate(temptime)" ng-model="temptime.to.minute" required ng-pattern="patterns.minute" onClick="this.select();"/>:
<input class="timepicker-hms" type="text" maxlength="2" ng-change="validate(temptime)" ng-model="temptime.to.second" required ng-pattern="patterns.second" onClick="this.select();"/>. <input class="timepicker-hms" type="text" maxlength="2" ng-change="validate(temptime)" ng-model="temptime.to.second" required ng-pattern="patterns.second" onClick="this.select();"/>.
<input class="timepicker-ms" type="text" maxlength="3" ng-change="validate(temptime)" ng-model="temptime.to.millisecond" required ng-pattern="patterns.millisecond" onClick="this.select();"/> <input class="timepicker-ms" type="text" maxlength="3" ng-change="validate(temptime)" ng-model="temptime.to.millisecond" required ng-pattern="patterns.millisecond" onClick="this.select();"/>
</div> </div>
<span type="text" ng-show="panel.now" ng-disabled="panel.now">&nbsp <i class="pointer icon-remove-sign" ng-click="setNow();panel.now=false"></i> Right Now <input type="text" name="dummy" style="visibility:hidden" /></span> <span type="text" ng-show="tempnow" ng-disabled="tempnow">&nbsp <i class="pointer icon-remove-sign" ng-click="setNow();tempnow=false;"></i> Right Now <input type="text" name="dummy" style="visibility:hidden" /></span>
</div> </div>
</div> </div>
......
...@@ -78,6 +78,7 @@ function (angular, app, _, moment, kbn) { ...@@ -78,6 +78,7 @@ function (angular, app, _, moment, kbn) {
// Assume the form is valid since we're setting it to something valid // Assume the form is valid since we're setting it to something valid
$scope.input.$setValidity("dummy", true); $scope.input.$setValidity("dummy", true);
$scope.temptime = cloneTime($scope.time); $scope.temptime = cloneTime($scope.time);
$scope.tempnow = $scope.panel.now;
// Date picker needs the date to be at the start of the day // Date picker needs the date to be at the start of the day
$scope.temptime.from.date.setHours(1,0,0,0); $scope.temptime.from.date.setHours(1,0,0,0);
...@@ -129,7 +130,7 @@ function (angular, app, _, moment, kbn) { ...@@ -129,7 +130,7 @@ function (angular, app, _, moment, kbn) {
// Create filter object // Create filter object
var _filter = _.clone(time); var _filter = _.clone(time);
if($scope.panel.now) { if($scope.tempnow) {
_filter.to = "now"; _filter.to = "now";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment