Commit 5fa49c62 by Rashid Khan

Fixed bug in sorting

parent 39fa135f
...@@ -449,6 +449,11 @@ angular.module('kibana.services', []) ...@@ -449,6 +449,11 @@ angular.module('kibana.services', [])
return _.pluck(_.where(self.list,_require),'id'); 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 // 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 // No idea when max would actually be used
this.timeRange = function(mode) { this.timeRange = function(mode) {
......
...@@ -55,11 +55,12 @@ ...@@ -55,11 +55,12 @@
</th> </th>
</thead> </thead>
<tbody ng-repeat="row in data | slice:panel.offset:panel.offset+panel.size" ng-class-odd="'odd'"> <tbody ng-repeat="event in data | slice:panel.offset:panel.offset+panel.size" ng-class-odd="'odd'">
<tr ng-click="toggle_details(row)" class="pointer"> <tr ng-click="toggle_details(event)" class="pointer">
<td ng-repeat="field in panel.fields" ng-bind-html-unsafe="(row.highlight[field]||row._source[field]) | tableHighlight | tableTruncate:panel.trimFactor:panel.fields.length"></td> <!--<td ng-repeat="field in panel.fields" ng-bind-html-unsafe="(event.highlight[field]||event._source[field]) | tableFieldFormat:field:event:this |tableHighlight | tableTruncate:panel.trimFactor:panel.fields.length"></td>-->
<td ng-repeat="field in panel.fields" ng-bind-html-unsafe="(event.highlight[field]||event._source[field]) |tableHighlight | tableTruncate:panel.trimFactor:panel.fields.length"></td>
</tr> </tr>
<tr ng-show="row.kibana.details"> <tr ng-show="event.kibana.details">
<td colspan=1000> <td colspan=1000>
<table class='table table-bordered table-condensed'> <table class='table table-bordered table-condensed'>
<thead> <thead>
...@@ -67,7 +68,7 @@ ...@@ -67,7 +68,7 @@
<th>Action</th> <th>Action</th>
<th>Value</th> <th>Value</th>
</thead> </thead>
<tr ng-repeat="(key,value) in row.kibana.details._source" ng-class-odd="'odd'"> <tr ng-repeat="(key,value) in event.kibana.details._source" ng-class-odd="'odd'">
<td>{{key}}</td> <td>{{key}}</td>
<td> <td>
<i class='icon-search pointer' ng-click="build_search(key,value)"></i> <i class='icon-search pointer' ng-click="build_search(key,value)"></i>
......
...@@ -52,6 +52,7 @@ angular.module('kibana.table', []) ...@@ -52,6 +52,7 @@ angular.module('kibana.table', [])
paging : true, paging : true,
field_list: true, field_list: true,
trimFactor: 300, trimFactor: 300,
normTimes : true,
spyable : true spyable : true
}; };
_.defaults($scope.panel,_d); _.defaults($scope.panel,_d);
...@@ -219,10 +220,9 @@ angular.module('kibana.table', []) ...@@ -219,10 +220,9 @@ angular.module('kibana.table', [])
// If we're not sorting in reverse chrono order, query every index for // If we're not sorting in reverse chrono order, query every index for
// size*pages results // size*pages results
// Otherwise, only get size*pages results then stop querying // Otherwise, only get size*pages results then stop querying
//($scope.data.length < $scope.panel.size*$scope.panel.pages if (($scope.data.length < $scope.panel.size*$scope.panel.pages ||
// || !(($scope.panel.sort[0] === $scope.time.field) && $scope.panel.sort[1] === 'desc')) !(($scope.panel.sort[0] === filterSrv.timeField()) && $scope.panel.sort[1] === 'desc')) &&
if($scope.data.length < $scope.panel.size*$scope.panel.pages && _segment+1 < dashboard.indices.length) {
_segment+1 < dashboard.indices.length ) {
$scope.get_data(_segment+1,$scope.query_id); $scope.get_data(_segment+1,$scope.query_id);
} }
...@@ -274,4 +274,19 @@ angular.module('kibana.table', []) ...@@ -274,4 +274,19 @@ angular.module('kibana.table', [])
} }
return ''; 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;
};
}); });
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
<code>[logstash-]YYYY.MM.DD</code>. The [] in "[logstash-]" are <code>[logstash-]YYYY.MM.DD</code>. The [] in "[logstash-]" are
important as they instruct Kibana not to treat those letters as a important as they instruct Kibana not to treat those letters as a
pattern. pattern.
Please also note that indices should rollover at midnight <strong>UTC</strong>.
</p> </p>
<p class="small"> <p class="small">
See <a href="http://momentjs.com/docs/#/displaying/format/">http://momentjs.com/docs/#/displaying/format/</a> See <a href="http://momentjs.com/docs/#/displaying/format/">http://momentjs.com/docs/#/displaying/format/</a>
...@@ -85,6 +86,8 @@ ...@@ -85,6 +86,8 @@
</div> </div>
</form> </form>
</div> </div>
<div class="row-fluid" ng-show="editor.index == 3">
</div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button ng-click="add_row(dashboard.current,row); reset_row();" class="btn btn-success" ng-show="editor.index == 2">Create Row</button> <button ng-click="add_row(dashboard.current,row); reset_row();" class="btn btn-success" ng-show="editor.index == 2">Create Row</button>
......
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