feat(timepicker2): more work on new timepicker

This commit is contained in:
Torkel Ödegaard
2015-09-18 08:17:19 +02:00
parent 5eefa36111
commit 2a52d9bdf6
9 changed files with 55 additions and 68 deletions

View File

@@ -1,13 +1,4 @@
<div class="row pull-right">
<div class="gf-timepicker-relative-section">
<h3>Quick ranges</h3>
<ul ng-repeat="group in timeOptions">
<li bindonce ng-repeat='option in group' ng-class="{active: option.active}">
<a ng-click="ctrl.setRelativeFilter(option)" bo-text="option.display"></a>
</li>
</ul>
</div>
<div class="gf-timepicker-absolute-section">
<h3>Time range</h3>
<label class="small">From:</label>
@@ -31,8 +22,22 @@
</div>
<label class="small">Refreshing every:</label>
<select ng-model="dashboard.refresh" class='input-large' ng-options="f for f in ['5m','10m']"></select>
<select ng-model="currentRefresh" class='input-large' ng-options="f for f in refreshOptions"></select>
<button class="btn btn-inverse pull-right" type="button" ng-click="applyCustomTimeRange()">
Apply
</button>
</div>
<div class="gf-timepicker-relative-section">
<h3>Quick ranges</h3>
<ul ng-repeat="group in timeOptions">
<li bindonce ng-repeat='option in group' ng-class="{active: option.active}">
<a ng-click="ctrl.setRelativeFilter(option)" bo-text="option.display"></a>
</li>
</ul>
</div>
</div>
<div class="clearfix"></div>

View File

@@ -7,17 +7,22 @@
</li>
<li>
<a class="timepicker-dropdown" bs-tooltip="tooltip" data-placement="bottom" ng-click="ctrl.loadTimeOptions()">
<a class="timepicker-dropdown" bs-tooltip="tooltip" data-placement="bottom" ng-click="ctrl.openDropdown()">
<i class="fa fa-clock-o"></i>
<span ng-bind="rangeString"></span>
<i class="fa fa-caret-down"></i>
<span ng-show="dashboard.refresh" class="text-warning">
&nbsp;
&nbsp;
<i class="fa fa-refresh"></i>
refreshed every {{dashboard.refresh}}
</span>
</a>
</li>
<li class="grafana-menu-refresh">
<li class="grafana-menu-refresh" ng-show="!dashboard.refresh">
<a ng-click="timeSrv.refreshDashboard()">
<i class="fa fa-refresh"></i>
<span ng-show="dashboard.refresh" class="text-warning">refreshed every {{dashboard.refresh}} </span>
</a>
</li>

View File

@@ -54,18 +54,22 @@ export class TimePickerCtrl {
this.$scope.dashboard.formatDate(time.to, format);
}
this.$scope.timeRaw = timeRaw;
this.$scope.absolute = {form: time.from.toDate(), to: time.to.toDate()};
this.$scope.timeRaw = timeRaw;
this.$scope.tooltip = this.$scope.dashboard.formatDate(time.from) + ' <br>to<br>';
this.$scope.tooltip += this.$scope.dashboard.formatDate(time.to);
this.$scope.onAppEvent('zoom-out', function() {
this.$scope.zoom(2);
});
this.$scope.tooltip = this.$scope.dashboard.formatDate(time.from.date) + ' <br>to<br>';
this.$scope.tooltip += this.$scope.dashboard.formatDate(time.to.date);
}
loadTimeOptions() {
openDropdown() {
this.$scope.timeOptions = rangeUtil.getRelativeTimesList(this.$scope.panel, this.$scope.rangeString);
this.$scope.currentRefresh = this.$scope.dashboard.refresh || 'off';
this.$scope.refreshOptions = this.$scope.panel.refresh_intervals;
this.$scope.refreshOptions.unshift('off');
this.$scope.appEvent('show-dash-editor', {
src: 'app/features/dashboard/timepicker/dropdown.html',
scope: this.$scope,