From 5fa49c6228889da1fa9410f891941598a52f266c Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Wed, 14 Aug 2013 16:29:22 -0700 Subject: [PATCH] Fixed bug in sorting --- js/services.js | 5 +++++ panels/table/module.html | 11 ++++++----- panels/table/module.js | 23 +++++++++++++++++++---- partials/dasheditor.html | 3 +++ 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/js/services.js b/js/services.js index f286a86fa8f1e..2dfdd42b2a30d 100644 --- a/js/services.js +++ b/js/services.js @@ -449,6 +449,11 @@ angular.module('kibana.services', []) return _.pluck(_.where(self.list,_require),'id'); }; + // TOFIX: Error handling when there is more than one field + this.timeField = function() { + return self.getByType('time')[0].field; + }; + // This special function looks for all time filters, and returns a time range according to the mode // No idea when max would actually be used this.timeRange = function(mode) { diff --git a/panels/table/module.html b/panels/table/module.html index 8a62c1fa91408..eb8e9e04e5692 100644 --- a/panels/table/module.html +++ b/panels/table/module.html @@ -55,11 +55,12 @@
Fields - - + + + + - + @@ -67,7 +68,7 @@
Fields +
{{key}} diff --git a/panels/table/module.js b/panels/table/module.js index c21e2bb38e822..3a6b8643796c0 100644 --- a/panels/table/module.js +++ b/panels/table/module.js @@ -52,6 +52,7 @@ angular.module('kibana.table', []) paging : true, field_list: true, trimFactor: 300, + normTimes : true, spyable : true }; _.defaults($scope.panel,_d); @@ -219,10 +220,9 @@ angular.module('kibana.table', []) // If we're not sorting in reverse chrono order, query every index for // size*pages results // Otherwise, only get size*pages results then stop querying - //($scope.data.length < $scope.panel.size*$scope.panel.pages - // || !(($scope.panel.sort[0] === $scope.time.field) && $scope.panel.sort[1] === 'desc')) - if($scope.data.length < $scope.panel.size*$scope.panel.pages && - _segment+1 < dashboard.indices.length ) { + if (($scope.data.length < $scope.panel.size*$scope.panel.pages || + !(($scope.panel.sort[0] === filterSrv.timeField()) && $scope.panel.sort[1] === 'desc')) && + _segment+1 < dashboard.indices.length) { $scope.get_data(_segment+1,$scope.query_id); } @@ -274,4 +274,19 @@ angular.module('kibana.table', []) } return ''; }; +// WIP +}).filter('tableFieldFormat', function(fields){ + return function(text,field,event,scope) { + var type; + if( + !_.isUndefined(fields.mapping[event._index]) && + !_.isUndefined(fields.mapping[event._index][event._type]) + ) { + type = fields.mapping[event._index][event._type][field]['type']; + if(type === 'date' && scope.panel.normTimes) { + return moment(text).format('YYYY-MM-DD HH:mm:ss'); + } + } + return text; + }; }); diff --git a/partials/dasheditor.html b/partials/dasheditor.html index 80bbb7c593514..0bdb6b6ee889f 100644 --- a/partials/dasheditor.html +++ b/partials/dasheditor.html @@ -30,6 +30,7 @@

Index Settings

[logstash-]YYYY.MM.DD. The [] in "[logstash-]" are important as they instruct Kibana not to treat those letters as a pattern. + Please also note that indices should rollover at midnight UTC.

See http://momentjs.com/docs/#/displaying/format/ @@ -85,6 +86,8 @@

Default Index If +
+