Commit fcffe102 by Rashid Khan

Fixed caps in line histogram when using segmented loading. Removed the remaining $watch calls

parent ced5f479
......@@ -89,15 +89,20 @@ angular.module('kibana.histogram', [])
_.each(results.facets, function(v, k) {
// Null values at each end of the time range ensure we see entire range
if(_.isUndefined($scope.data[k]) || _segment == 0) {
var data = [[$scope.time.from.getTime(), null]];
var data = [[$scope.time.to.getTime(), null]];
} else {
var data = $scope.data[k].data
}
var segment_data = [];
_.each(v.entries, function(v, k) {
data.push([v['time'],v['count']])
segment_data.push([v['time'],v['count']])
});
data.push([$scope.time.to.getTime(), null])
data = segment_data.concat(data)
if(_segment == $scope.panel.index.length-1)
data.unshift([$scope.time.from.getTime(), null])
var series = {
data: {
......
......@@ -53,7 +53,7 @@
<a ng-click="set_mode('absolute')" ng-class="{'strong': (panel.mode == 'absolute')}">Absolute</a> |
<a ng-click="set_mode('since')" ng-class="{'strong': (panel.mode == 'since')}">Since</a>
<span ng-hide="panel.mode == 'absolute'"> |
<input type="checkbox" ng-model="panel.refresh.enable"> Auto-refresh
<input type="checkbox" ng-model="panel.refresh.enable" ng-change='refresh();'> Auto-refresh
<span ng-class="{'ng-cloak': !panel.refresh.enable}">
every <a data-title="<small>Auto-refresh Settings</small>" data-placement="bottom" bs-popover="'panels/timepicker/refreshctrl.html'">{{panel.refresh.interval}}s</a>.
</span>
......
......@@ -83,23 +83,21 @@ angular.module('kibana.timepicker', [])
eventBus.register($scope,"get_time", function(event,id) {
eventBus.broadcast($scope.$id,id,'time',$scope.time)
});
}
$scope.$watch('panel.refresh.enable', function() {$scope.refresh()});
$scope.$watch('panel.refresh.interval', function() {
$timeout(function(){
if(_.isNumber($scope.panel.refresh.interval)) {
if($scope.panel.refresh.interval < $scope.panel.refresh.min) {
$scope.panel.refresh.interval = $scope.panel.refresh.min
timer.cancel($scope.refresh_timer)
return;
}
timer.cancel($scope.refresh_timer)
$scope.refresh()
} else {
timer.cancel($scope.refresh_timer)
}
});
});
$scope.set_interval = function (refresh_interval) {
$scope.panel.refresh.interval = refresh_interval
if(_.isNumber($scope.panel.refresh.interval)) {
if($scope.panel.refresh.interval < $scope.panel.refresh.min) {
$scope.panel.refresh.interval = $scope.panel.refresh.min
timer.cancel($scope.refresh_timer)
return;
}
timer.cancel($scope.refresh_timer)
$scope.refresh()
} else {
timer.cancel($scope.refresh_timer)
}
}
$scope.refresh = function() {
......
<form name="refreshPopover" class='form-inline input-append' style="margin:0px">
<label><small>Interval (seconds)</small></label><br>
<input type="number" class="input-mini" ng-model="refresh_interval">
<button type="button" class="btn" ng-click="panel.refresh.interval=refresh_interval;dismiss()"><i class="icon-ok"></i></button>
<button type="button" class="btn" ng-click="set_interval(refresh_interval);dismiss()"><i class="icon-ok"></i></button>
</form>
\ No newline at end of file
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