From 3e504bc17def6726a6cbba9cb81b2d3d06297a2e Mon Sep 17 00:00:00 2001 From: Leonardo Menezes Date: Thu, 1 Dec 2016 22:00:12 +0100 Subject: [PATCH] display initializing/relocating shards on cluster overview closes #39 --- public/js/app.js | 6 ++++++ public/overview.html | 10 ++++++++-- src/app/components/overview/controller.js | 6 ++++++ tests/controllers/overview.tests.js | 6 ++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 0d2c1f6f..f75cab6c 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -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; @@ -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; @@ -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; diff --git a/public/overview.html b/public/overview.html index c643866f..a9e51164 100644 --- a/public/overview.html +++ b/public/overview.html @@ -151,11 +151,17 @@ - + -
+
{{unassigned_shards}} unassigned shards
+
+ {{relocating_shards}} relocating shards +
+
+ {{initializing_shards}} initializing shards +
show only unhealthy indices show all indices diff --git a/src/app/components/overview/controller.js b/src/app/components/overview/controller.js index b42b6b13..4775d1c5 100644 --- a/src/app/components/overview/controller.js +++ b/src/app/components/overview/controller.js @@ -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; @@ -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; @@ -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; diff --git a/tests/controllers/overview.tests.js b/tests/controllers/overview.tests.js index ecffc120..8788260b 100644 --- a/tests/controllers/overview.tests.js +++ b/tests/controllers/overview.tests.js @@ -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); @@ -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 @@ -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);