Commit 38520b03 by Rashid Khan

column panel documentation

parent b85f2c94
/*
## Column
The column panel is sort of a hack to allow you to put multiple, veritcal,
panels next to a bigger panel. Note that it has no group, and setting a group
for the panel itself will do nothing
### Parameters
* panels :: an array of panel objects. All of their spans should be set to 12
### Group Events
#### Sends
* time :: Object Includes from, to and index
*/
angular.module('kibana.column', []) angular.module('kibana.column', [])
.controller('column', function($scope, $rootScope) { .controller('column', function($scope, $rootScope) {
// Set and populate defaults // Set and populate defaults
......
...@@ -12,6 +12,7 @@ a pattern ...@@ -12,6 +12,7 @@ a pattern
* timefield :: The field in which time is stored in the document. * timefield :: The field in which time is stored in the document.
* index :: Index pattern to match. Literals should be double quoted. Default: '_all' * index :: Index pattern to match. Literals should be double quoted. Default: '_all'
* defaultindex :: Index to failover to if index not found * defaultindex :: Index to failover to if index not found
* index_interval :: Time between timestamped indices (can be 'none') for static index
* refresh: Object containing refresh parameters * refresh: Object containing refresh parameters
* enable :: true/false, enable auto refresh by default. Default: false * enable :: true/false, enable auto refresh by default. Default: false
* interval :: Seconds between auto refresh. Default: 30 * interval :: Seconds between auto refresh. Default: 30
...@@ -21,7 +22,7 @@ a pattern ...@@ -21,7 +22,7 @@ a pattern
#### Sends #### Sends
* time :: Object Includes from, to and index * time :: Object Includes from, to and index
#### Receives #### Receives
* get_time :: Receives an object containing a uniqueid, broadcasts to it. * get_time :: Receives an object containing a $id, broadcasts back to it.
*/ */
angular.module('kibana.timepicker', []) angular.module('kibana.timepicker', [])
...@@ -167,8 +168,8 @@ angular.module('kibana.timepicker', []) ...@@ -167,8 +168,8 @@ angular.module('kibana.timepicker', [])
$scope.time_apply(); $scope.time_apply();
} }
$scope.time_check = function(){ //
$scope.time_calc = function(){
// If time picker is defined (on initialization) // If time picker is defined (on initialization)
if(!(_.isUndefined($scope.timepicker))) { if(!(_.isUndefined($scope.timepicker))) {
var from = $scope.panel.mode === 'relative' ? time_ago($scope.panel.timespan) : var from = $scope.panel.mode === 'relative' ? time_ago($scope.panel.timespan) :
...@@ -198,7 +199,7 @@ angular.module('kibana.timepicker', []) ...@@ -198,7 +199,7 @@ angular.module('kibana.timepicker', [])
$scope.time_apply = function() { $scope.time_apply = function() {
// Update internal time object // Update internal time object
$scope.time = $scope.time_check(); $scope.time = $scope.time_calc();
$scope.time.field = $scope.panel.timefield $scope.time.field = $scope.panel.timefield
// Get indices for the time period, then broadcast time range and index list // Get indices for the time period, then broadcast time range and index list
...@@ -213,7 +214,9 @@ angular.module('kibana.timepicker', []) ...@@ -213,7 +214,9 @@ angular.module('kibana.timepicker', [])
eventBus.broadcast($scope.$id,$scope.panel.group,'time',$scope.time) eventBus.broadcast($scope.$id,$scope.panel.group,'time',$scope.time)
} }
// Update panel's string representation of the time object // Update panel's string representation of the time object.Don't update if
// we're in relative mode since we dont want to store the time object in the
// json for relative periods
if($scope.panel.mode !== 'relative') { if($scope.panel.mode !== 'relative') {
$scope.panel.time = { $scope.panel.time = {
from : $scope.time.from.format("mm/dd/yyyy HH:MM:ss"), from : $scope.time.from.format("mm/dd/yyyy HH:MM:ss"),
...@@ -276,6 +279,7 @@ angular.module('kibana.timepicker', []) ...@@ -276,6 +279,7 @@ angular.module('kibana.timepicker', [])
// this is stupid, but there is otherwise no good way to ensure that when // this is stupid, but there is otherwise no good way to ensure that when
// I extract the date from an object that I'm get the UTC date. Stupid js. // I extract the date from an object that I'm get the UTC date. Stupid js.
// I die a little inside every time I call this function. // I die a little inside every time I call this function.
// Update: I just read this again. I died a little more inside.
function fake_utc(date) { function fake_utc(date) {
return new Date(date.getTime() + date.getTimezoneOffset() * 60000); return new Date(date.getTime() + date.getTimezoneOffset() * 60000);
} }
......
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