Commit e0d6cd4b by Rashid Khan

Merge pull request #262 from rashidkpc/master

Fixed timepicker
parents 42adfd75 316aa05d
......@@ -86,6 +86,7 @@ angular.module('kibana.timepicker', [])
// In case some other panel broadcasts a time, set us to an absolute range
$scope.$on('refresh', function() {
/*
if(filterSrv.idsByType('time').length > 0) {
var time = filterSrv.timeRange('min');
......@@ -93,6 +94,8 @@ angular.module('kibana.timepicker', [])
$scope.time.to.diff(moment.utc(time.to),'seconds') !== 0)
{
console.log('time mismatch!')
return;
$scope.set_mode('absolute');
// These 3 statements basicly do everything time_apply() does
......@@ -101,6 +104,7 @@ angular.module('kibana.timepicker', [])
update_panel();
}
}
*/
});
};
......@@ -176,12 +180,12 @@ angular.module('kibana.timepicker', [])
//
$scope.time_calc = function(){
var from,to;
// If time picker is defined (usually is)
// If time picker is defined (usually is) TOFIX: Horrible parsing
if(!(_.isUndefined($scope.timepicker))) {
from = $scope.panel.mode === 'relative' ? moment(kbn.time_ago($scope.panel.timespan)) :
moment($scope.timepicker.from.date + " " + $scope.timepicker.from.time,'MM/DD/YYYY HH:mm:ss');
moment(moment.utc($scope.timepicker.from.date).format('MM/DD/YYYY') + " " + $scope.timepicker.from.time,'MM/DD/YYYY HH:mm:ss');
to = $scope.panel.mode !== 'absolute' ? moment() :
moment($scope.timepicker.to.date + " " + $scope.timepicker.to.time,'MM/DD/YYYY HH:mm:ss');
moment(moment.utc($scope.timepicker.to.date).format('MM/DD/YYYY') + " " + $scope.timepicker.to.time,'MM/DD/YYYY HH:mm:ss');
// Otherwise (probably initialization)
} else {
from = $scope.panel.mode === 'relative' ? moment(kbn.time_ago($scope.panel.timespan)) :
......@@ -211,11 +215,13 @@ angular.module('kibana.timepicker', [])
// Remove all other time filters
filterSrv.removeByType('time');
$scope.time = $scope.time_calc();
$scope.time.field = $scope.panel.timefield;
update_panel();
update_panel();
set_time_filter($scope.time);
dashboard.refresh();
};
......
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