Commit 3c1f9457 by Rashid Khan

Improved error display in histogram and table

parent e9d1fc7b
...@@ -76,7 +76,8 @@ angular.module('kibana.controllers', []) ...@@ -76,7 +76,8 @@ angular.module('kibana.controllers', [])
// This is whoafully incomplete, but will do for now // This is whoafully incomplete, but will do for now
$scope.parse_error = function(data) { $scope.parse_error = function(data) {
return data.match("nested: (.*?);")[1] var _error = data.match("nested: (.*?);")
return _.isNull(_error) ? data : _error[1];
} }
$scope.init(); $scope.init();
......
...@@ -187,8 +187,9 @@ angular.module('kibana.dashcontrol', []) ...@@ -187,8 +187,9 @@ angular.module('kibana.dashcontrol', [])
var results = request.query( var results = request.query(
$scope.ejs.QueryStringQuery(query || '*') $scope.ejs.QueryStringQuery(query || '*')
).size($scope.panel.elasticsearch_size).doSearch(); ).size($scope.panel.elasticsearch_size).doSearch();
results.then(function(results) { results.then(function(results) {
if(_.isUndefined(results)) { if(_.isUndefined(results.hits)) {
return; return;
} }
$scope.panel.error = false; $scope.panel.error = false;
......
...@@ -12,5 +12,6 @@ ...@@ -12,5 +12,6 @@
<div class='small' style='display:inline-block'>{{series.label}} ({{series.hits}})</div> <div class='small' style='display:inline-block'>{{series.label}} ({{series.hits}})</div>
</span><span class="small"> per <strong>{{panel.interval}}</strong> | (<strong>{{hits}}</strong> total)</span> </span><span class="small"> per <strong>{{panel.interval}}</strong> | (<strong>{{hits}}</strong> total)</span>
</div> </div>
<center><img ng-show='panel.loading && _.isUndefined(data)' src="common/img/load_big.gif"></center>
<div histogram params="{{panel}}" style="height:{{panel.height || row.height}};position:relative"></div> <div histogram params="{{panel}}" style="height:{{panel.height || row.height}};position:relative"></div>
</kibana-panel> </kibana-panel>
\ No newline at end of file
...@@ -48,6 +48,7 @@ angular.module('kibana.histogram', []) ...@@ -48,6 +48,7 @@ angular.module('kibana.histogram', [])
} }
$scope.get_data = function(segment,query_id) { $scope.get_data = function(segment,query_id) {
delete $scope.panel.error
// Make sure we have everything for the request to complete // Make sure we have everything for the request to complete
if(_.isUndefined($scope.panel.index) || _.isUndefined($scope.time)) if(_.isUndefined($scope.panel.index) || _.isUndefined($scope.time))
return return
...@@ -92,6 +93,13 @@ angular.module('kibana.histogram', []) ...@@ -92,6 +93,13 @@ angular.module('kibana.histogram', [])
query_id = $scope.query_id = new Date().getTime(); query_id = $scope.query_id = new Date().getTime();
} }
// Check for error and abort if found
if(!(_.isUndefined(results.error))) {
$scope.panel.error = $scope.parse_error(results.error);
return;
}
if($scope.query_id === query_id) { if($scope.query_id === query_id) {
var i = 0; var i = 0;
...@@ -183,8 +191,6 @@ angular.module('kibana.histogram', []) ...@@ -183,8 +191,6 @@ angular.module('kibana.histogram', [])
var height = scope.panel.height || scope.row.height; var height = scope.panel.height || scope.row.height;
elem.html('<center><img src="common/img/load_big.gif"></center>')
// Receive render events // Receive render events
scope.$on('render',function(){ scope.$on('render',function(){
render_panel(); render_panel();
......
...@@ -76,6 +76,8 @@ angular.module('kibana.table', []) ...@@ -76,6 +76,8 @@ angular.module('kibana.table', [])
} }
$scope.get_data = function(segment,query_id) { $scope.get_data = function(segment,query_id) {
$scope.panel.error = false;
// Make sure we have everything for the request to complete // Make sure we have everything for the request to complete
if(_.isUndefined($scope.panel.index) || _.isUndefined($scope.time)) if(_.isUndefined($scope.panel.index) || _.isUndefined($scope.time))
return return
...@@ -110,11 +112,11 @@ angular.module('kibana.table', []) ...@@ -110,11 +112,11 @@ angular.module('kibana.table', [])
query_id = $scope.query_id = new Date().getTime() query_id = $scope.query_id = new Date().getTime()
} }
// Check for error and abort if found
if(!(_.isUndefined(results.error))) { if(!(_.isUndefined(results.error))) {
$scope.panel.error = $scope.parse_error(results.error); $scope.panel.error = $scope.parse_error(results.error);
return; return;
} }
$scope.panel.error = false;
// Check that we're still on the same query, if not stop // Check that we're still on the same query, if not stop
if($scope.query_id === query_id) { if($scope.query_id === query_id) {
......
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