Skip to content

Commit

Permalink
Merge pull request #2178 from simianhacker/fix-2172
Browse files Browse the repository at this point in the history
Closes #2172 - Adding shard failures
  • Loading branch information
simianhacker committed Dec 9, 2014
2 parents 6014a5c + e3bdf61 commit aab7b19
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/kibana/plugins/discover/controllers/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ define(function (require) {
$scope.fields = null;

var init = _.once(function () {
var showTotal = 5;
$scope.failuresShown = showTotal;
$scope.showAllFailures = function () {
$scope.failuresShown = $scope.failures.length;
};
$scope.showLessFailures = function () {
$scope.failuresShown = showTotal;
};
return $scope.updateDataSource()
.then(function () {
setFields();
Expand Down Expand Up @@ -250,6 +258,7 @@ define(function (require) {

function flushResponseData() {
$scope.hits = 0;
$scope.faliures = [];
$scope.rows = [];
$scope.rows.fieldCounts = {};
}
Expand Down Expand Up @@ -311,6 +320,13 @@ define(function (require) {
flushResponseData();
}

if (resp._shards.failed > 0) {
$scope.failures = _.union($scope.failures, resp._shards.failures);
$scope.failures = _.uniq($scope.failures, false, function (failure) {
return failure.index + failure.shard + failure.reason;
});
}

$scope.hits += resp.hits.total;
var rows = $scope.rows;
var counts = rows.fieldCounts;
Expand Down
10 changes: 10 additions & 0 deletions src/kibana/plugins/discover/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ <h1>No results found <i class="fa fa-meh-o"></i></h1>
Unfortunately I could not find any results matching your search. I tried really hard. I looked all over the place and frankly, I just couldn't find anything good. Help me, help you. Here's some ideas:
</p>

<div class="shard-failures" ng-show="failures">
<h3>Shard Failures</h3>
<p>The following shard failures ocurred:</p>
<ul>
<li ng-repeat="failure in failures | limitTo: failuresShown"><strong>Index:</strong> {{failure.index}} <strong>Shard:</strong> {{failure.shard}} <strong>Reason:</strong> {{failure.reason}} </li>
</ul>
<a ng-click="showAllFailures()" ng-if="failures.length > failuresShown">Show More</a>
<a ng-click="showLessFailures()" ng-if="failures.length === failuresShown && failures.length > 5">Show Less</a>
</div>

<div ng-show="opts.timefield">
<p>
<h3>Expand your time range</h3>
Expand Down
11 changes: 11 additions & 0 deletions src/kibana/plugins/discover/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@
}
}

.shard-failures {
color: @brand-danger;
background-color: lighten(@brand-danger, 40%) !important;
border: 1px solid @brand-danger;
border-radius: @border-radius-base;
padding: 0 20px 20px;
li {
padding-bottom: 5px;
}
}

.discover-overlay {
position: absolute;
top: 0;
Expand Down

0 comments on commit aab7b19

Please sign in to comment.