Skip to content
This repository has been archived by the owner on Mar 31, 2024. It is now read-only.

Commit

Permalink
Cleaning up refresh interval options.
Browse files Browse the repository at this point in the history
  • Loading branch information
grouma committed Dec 18, 2014
1 parent f137a65 commit 64b9d7f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 18 deletions.
23 changes: 23 additions & 0 deletions src/kibana/components/timepicker/refresh_intervals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
define(function (require) {
var module = require('modules').get('kibana');

module.constant('refreshIntervals', [
{ value : 0, display: 'Off', section: 0},

{ value : 5000, display: '5 seconds', section: 1},
{ value : 10000, display: '10 seconds', section: 1},
{ value : 30000, display: '30 seconds', section: 1},
{ value : 45000, display: '45 seconds', section: 1},

{ value : 60000, display: '1 minute', section: 2},
{ value : 300000, display: '5 minutes', section: 2},
{ value : 900000, display: '15 minutes', section: 2},
{ value : 1800000, display: '30 minutes', section: 2},

{ value : 3600000, display: '1 hour', section: 3},
{ value : 7200000, display: '2 hour', section: 3},
{ value : 43200000, display: '12 hour', section: 3},
{ value : 86400000, display: '1 day', section: 3}
]);

});
11 changes: 7 additions & 4 deletions src/kibana/components/timepicker/timepicker.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
padding: 0px 15px;
}

.kbn-refresh-list {
.kbn-refresh-section {
float: left;
padding: 0px 15px;
}

Expand Down Expand Up @@ -155,9 +156,11 @@
<!-- Refresh Intervals -->
<div ng-show="tab == 'interval'" role="tabpanel" class="tab-pane active">
</br>
<ul class="list-unstyled kbn-refresh-list">
<li ng-repeat="interval in refreshIntervals"><a ng-click="setRefreshInterval(interval)">{{interval.display}}</a></li>
</ul>
<div ng-repeat="list in refreshLists" class="kbn-refresh-section">
<ul class="list-unstyled">
<li ng-repeat="interval in list"><a ng-click="setRefreshInterval(interval)">{{interval.display}}</a></li>
</ul>
</div>
</div>
</div>
</div>
Expand Down
19 changes: 5 additions & 14 deletions src/kibana/components/timepicker/timepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ define(function (require) {

require('directives/input_datetime');
require('components/timepicker/quick_ranges');
require('components/timepicker/refresh_intervals');
require('components/timepicker/time_units');

module.directive('kbnTimepicker', function (quickRanges, timeUnits) {
module.directive('kbnTimepicker', function (quickRanges, timeUnits, refreshIntervals) {
return {
restrict: 'E',
scope: {
Expand All @@ -33,19 +34,9 @@ define(function (require) {
return _.filter(quickRanges, {section: section});
});

$scope.refreshIntervals = [
{ value : 0, display: 'Off'},
{ value : 5000, display: '5 seconds'},
{ value : 10000, display: '10 seconds'},
{ value : 30000, display: '30 seconds'},
{ value : 60000, display: '1 minute'},
{ value : 300000, display: '5 minutes'},
{ value : 900000, display: '15 minutes'},
{ value : 1800000, display: '30 minutes'},
{ value : 3600000, display: '1 hour'},
{ value : 7200000, display: '2 hour'},
{ value : 86400000, display: '1 day'}
];
$scope.refreshLists = _.map(_.uniq(_.pluck(refreshIntervals, 'section')), function (section) {
return _.filter(refreshIntervals, {section: section});
});

$scope.relative = {
count: 1,
Expand Down

0 comments on commit 64b9d7f

Please sign in to comment.