Skip to content

Commit

Permalink
display initializing/relocating shards on cluster overview
Browse files Browse the repository at this point in the history
closes #39
  • Loading branch information
Leonardo Menezes committed Dec 1, 2016
1 parent e371c25 commit 3e504bc
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
6 changes: 6 additions & 0 deletions public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,8 @@ angular.module('cerebro').controller('OverviewController', ['$scope', '$http',
$scope.indices = undefined;
$scope.nodes = undefined;
$scope.unassigned_shards = 0;
$scope.relocating_shards = 0;
$scope.initializing_shards = 0;
$scope.closed_indices = 0;
$scope.special_indices = 0;
$scope.expandedView = false;
Expand Down Expand Up @@ -652,6 +654,8 @@ angular.module('cerebro').controller('OverviewController', ['$scope', '$http',
$scope.setIndices(data.indices);
$scope.setNodes(data.nodes);
$scope.unassigned_shards = data.unassigned_shards;
$scope.relocating_shards = data.relocating_shards;
$scope.initializing_shards = data.initializing_shards;
$scope.closed_indices = data.closed_indices;
$scope.special_indices = data.special_indices;
$scope.shardAllocation = data.shard_allocation;
Expand All @@ -662,6 +666,8 @@ angular.module('cerebro').controller('OverviewController', ['$scope', '$http',
$scope.indices = undefined;
$scope.nodes = undefined;
$scope.unassigned_shards = 0;
$scope.relocating_shards = 0;
$scope.initializing_shards = 0;
$scope.closed_indices = 0;
$scope.special_indices = 0;
$scope.shardAllocation = true;
Expand Down
10 changes: 8 additions & 2 deletions public/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,17 @@
</tr>
</thead>
<tbody>
<tr ng-show="unassigned_shards > 0">
<tr ng-show="unassigned_shards > 0 || relocating_shards > 0 || initializing_shards > 0">
<td>
<div class="subtitle">
<div class="subtitle" ng-show="unassigned_shards >= 0">
<i class="fa fa-warning alert-warning"> </i> {{unassigned_shards}} unassigned shards
</div>
<div class="subtitle" ng-show="relocating_shards > 0">
<i class="fa fa-refresh fa-spin"> </i> {{relocating_shards}} relocating shards
</div>
<div class="subtitle" ng-show="initializing_shards > 0">
<i class="fa fa-spinner fa-spin"> </i> {{initializing_shards}} initializing shards
</div>
<div>
<span class="normal-action" ng-show="indices_filter.healthy" ng-click="indices_filter.healthy = false"><i><small>show only unhealthy indices</small></i></span>
<span class="normal-action" ng-hide="indices_filter.healthy" ng-click="indices_filter.healthy = true"><i><small>show all indices</small></i></span>
Expand Down
6 changes: 6 additions & 0 deletions src/app/components/overview/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ angular.module('cerebro').controller('OverviewController', ['$scope', '$http',
$scope.indices = undefined;
$scope.nodes = undefined;
$scope.unassigned_shards = 0;
$scope.relocating_shards = 0;
$scope.initializing_shards = 0;
$scope.closed_indices = 0;
$scope.special_indices = 0;
$scope.expandedView = false;
Expand Down Expand Up @@ -53,6 +55,8 @@ angular.module('cerebro').controller('OverviewController', ['$scope', '$http',
$scope.setIndices(data.indices);
$scope.setNodes(data.nodes);
$scope.unassigned_shards = data.unassigned_shards;
$scope.relocating_shards = data.relocating_shards;
$scope.initializing_shards = data.initializing_shards;
$scope.closed_indices = data.closed_indices;
$scope.special_indices = data.special_indices;
$scope.shardAllocation = data.shard_allocation;
Expand All @@ -63,6 +67,8 @@ angular.module('cerebro').controller('OverviewController', ['$scope', '$http',
$scope.indices = undefined;
$scope.nodes = undefined;
$scope.unassigned_shards = 0;
$scope.relocating_shards = 0;
$scope.initializing_shards = 0;
$scope.closed_indices = 0;
$scope.special_indices = 0;
$scope.shardAllocation = true;
Expand Down
6 changes: 6 additions & 0 deletions tests/controllers/overview.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ describe('OverviewController', function() {
expect(this.scope.indices).toEqual(undefined);
expect(this.scope.nodes).toEqual(undefined);
expect(this.scope.unassigned_shards).toEqual(0);
expect(this.scope.initializing_shards).toEqual(0);
expect(this.scope.relocating_shards).toEqual(0);
expect(this.scope.shardAllocation).toEqual(true);
expect(this.scope.closed_indices).toEqual(0);
expect(this.scope.special_indices).toEqual(0);
Expand Down Expand Up @@ -67,6 +69,8 @@ describe('OverviewController', function() {
indices: indices,
nodes: nodes,
unassigned_shards: 1,
relocating_shards: 2,
initializing_shards: 3,
closed_indices: 2,
special_indices: 3,
shard_allocation: true
Expand All @@ -80,6 +84,8 @@ describe('OverviewController', function() {
this.scope.refresh();
expect(this.DataService.getOverview).toHaveBeenCalledWith(jasmine.any(Function), jasmine.any(Function));
expect(this.scope.unassigned_shards).toEqual(1);
expect(this.scope.initializing_shards).toEqual(3);
expect(this.scope.relocating_shards).toEqual(2);
expect(this.scope.closed_indices).toEqual(2);
expect(this.scope.special_indices).toEqual(3);
expect(this.scope.shardAllocation).toEqual(true);
Expand Down

1 comment on commit 3e504bc

@wvidana
Copy link

@wvidana wvidana commented on 3e504bc Dec 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👍 🎉

Please sign in to comment.