mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Improved error display in histogram and table
This commit is contained in:
parent
e9d1fc7b1a
commit
3c1f9457bd
@ -76,7 +76,8 @@ angular.module('kibana.controllers', [])
|
||||
|
||||
// This is whoafully incomplete, but will do for now
|
||||
$scope.parse_error = function(data) {
|
||||
return data.match("nested: (.*?);")[1]
|
||||
var _error = data.match("nested: (.*?);")
|
||||
return _.isNull(_error) ? data : _error[1];
|
||||
}
|
||||
|
||||
$scope.init();
|
||||
|
@ -187,8 +187,9 @@ angular.module('kibana.dashcontrol', [])
|
||||
var results = request.query(
|
||||
$scope.ejs.QueryStringQuery(query || '*')
|
||||
).size($scope.panel.elasticsearch_size).doSearch();
|
||||
|
||||
results.then(function(results) {
|
||||
if(_.isUndefined(results)) {
|
||||
if(_.isUndefined(results.hits)) {
|
||||
return;
|
||||
}
|
||||
$scope.panel.error = false;
|
||||
|
@ -12,5 +12,6 @@
|
||||
<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>
|
||||
</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>
|
||||
</kibana-panel>
|
@ -48,6 +48,7 @@ angular.module('kibana.histogram', [])
|
||||
}
|
||||
|
||||
$scope.get_data = function(segment,query_id) {
|
||||
delete $scope.panel.error
|
||||
// Make sure we have everything for the request to complete
|
||||
if(_.isUndefined($scope.panel.index) || _.isUndefined($scope.time))
|
||||
return
|
||||
@ -92,6 +93,13 @@ angular.module('kibana.histogram', [])
|
||||
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) {
|
||||
|
||||
var i = 0;
|
||||
@ -183,8 +191,6 @@ angular.module('kibana.histogram', [])
|
||||
|
||||
var height = scope.panel.height || scope.row.height;
|
||||
|
||||
elem.html('<center><img src="common/img/load_big.gif"></center>')
|
||||
|
||||
// Receive render events
|
||||
scope.$on('render',function(){
|
||||
render_panel();
|
||||
|
@ -76,6 +76,8 @@ angular.module('kibana.table', [])
|
||||
}
|
||||
|
||||
$scope.get_data = function(segment,query_id) {
|
||||
$scope.panel.error = false;
|
||||
|
||||
// Make sure we have everything for the request to complete
|
||||
if(_.isUndefined($scope.panel.index) || _.isUndefined($scope.time))
|
||||
return
|
||||
@ -110,11 +112,11 @@ angular.module('kibana.table', [])
|
||||
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;
|
||||
}
|
||||
$scope.panel.error = false;
|
||||
|
||||
// Check that we're still on the same query, if not stop
|
||||
if($scope.query_id === query_id) {
|
||||
|
Loading…
Reference in New Issue
Block a user