Commit d62e5c92 by Rashid Khan

update timepicker on set_time event

parent d1169b4b
......@@ -261,7 +261,7 @@ angular.module('kibana.histogram', [])
scope.time.from = new Date(ranges.xaxis.from);
scope.time.to = new Date(ranges.xaxis.to)
scope.set_time(scope.time);
eventBus.broadcast(scope.$id,scope.panel.group,'time',scope.time)
eventBus.broadcast(scope.$id,scope.panel.group,'set_time',scope.time)
});
}
};
......
......@@ -83,6 +83,14 @@ angular.module('kibana.timepicker', [])
eventBus.register($scope,"get_time", function(event,id) {
eventBus.broadcast($scope.$id,id,'time',$scope.time)
});
// In case some other panel broadcasts a time, set us to an absolute range
eventBus.register($scope,"set_time", function(event,time) {
$scope.panel.mode = 'absolute';
set_timepicker(time.from,time.to)
$scope.time_apply()
});
$scope.$on('render', function (){
$scope.time_apply();
});
......@@ -157,18 +165,8 @@ angular.module('kibana.timepicker', [])
if (from.getTime() >= to.getTime())
from = new Date(to.getTime() - 1000)
// Janky 0s timeout to get around $scope queue processing view issue
$timeout(function(){
$scope.timepicker = {
from : {
time : from.format("HH:MM:ss"),
date : from.format("mm/dd/yyyy")
},
to : {
time : to.format("HH:MM:ss"),
date : to.format("mm/dd/yyyy")
}
}
set_timepicker(from,to)
});
return {
......@@ -202,6 +200,20 @@ angular.module('kibana.timepicker', [])
};
};
function set_timepicker(from,to) {
// Janky 0s timeout to get around $scope queue processing view issue
$scope.timepicker = {
from : {
time : from.format("HH:MM:ss"),
date : from.format("mm/dd/yyyy")
},
to : {
time : to.format("HH:MM:ss"),
date : to.format("mm/dd/yyyy")
}
}
}
// returns a promise containing an array of all indices matching the index
// pattern that exist in a given range
function indices(from,to) {
......
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