Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #2172 - Adding shard failures #2178

Merged
merged 2 commits into from
Dec 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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