mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(timepickerv2): more work on new timepicker, now absolute time mixed with relative time works, yesterday, this day last week, etc now work
This commit is contained in:
@@ -11,17 +11,17 @@
|
||||
<i class="fa fa-clock-o"></i>
|
||||
<span ng-bind="ctrl.rangeString"></span>
|
||||
|
||||
<span ng-show="dashboard.refresh" class="text-warning">
|
||||
<span ng-show="ctrl.dashboard.refresh" class="text-warning">
|
||||
|
||||
|
||||
<i class="fa fa-refresh"></i>
|
||||
refreshed every {{dashboard.refresh}}
|
||||
Refreshed every {{ctrl.dashboard.refresh}}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<li class="grafana-menu-refresh" ng-show="!dashboard.refresh">
|
||||
<a ng-click="timeSrv.refreshDashboard()">
|
||||
<li class="grafana-menu-refresh" ng-show="!ctrl.dashboard.refresh">
|
||||
<a ng-click="ctrl.timeSrv.refreshDashboard()">
|
||||
<i class="fa fa-refresh"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -37,21 +37,13 @@ export class TimePickerCtrl {
|
||||
|
||||
init() {
|
||||
this.panel = this.dashboard.timepicker;
|
||||
this.panel.now = false;
|
||||
|
||||
_.defaults(this.panel, TimePickerCtrl.defaults);
|
||||
|
||||
var time = this.timeSrv.timeRange();
|
||||
var timeRaw = this.timeSrv.timeRange(false);
|
||||
|
||||
if (_.isString(timeRaw.to) && timeRaw.to.indexOf('now') === 0) {
|
||||
this.panel.now = true;
|
||||
this.rangeString = rangeUtil.describeTimeRange(timeRaw);
|
||||
} else {
|
||||
this.rangeString = this.dashboard.formatDate(time.from, TimePickerCtrl.tooltipFormat) + ' to ' +
|
||||
this.dashboard.formatDate(time.to, TimePickerCtrl.tooltipFormat);
|
||||
}
|
||||
|
||||
this.rangeString = rangeUtil.describeTimeRange(timeRaw);
|
||||
this.absolute = {fromJs: time.from.toDate(), toJs: time.to.toDate()};
|
||||
this.timeRaw = timeRaw;
|
||||
this.tooltip = this.dashboard.formatDate(time.from) + ' <br>to<br>';
|
||||
|
||||
Reference in New Issue
Block a user