Skip to content
This repository was archived by the owner on Mar 5, 2021. It is now read-only.

Commit a45920f

Browse files
committed
display closed indices with different style
closes #84
1 parent dd8c7ab commit a45920f

File tree

6 files changed

+93
-53
lines changed

6 files changed

+93
-53
lines changed

dist/kopf.css

+10
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,16 @@ a.cluster-map-header-cluster-action {
466466
background: #f9f9f9;
467467
border-bottom: 0px !important;
468468
}
469+
470+
.closed-index {
471+
color: #D0D0D0 !important;
472+
font-weight: 300 !important;
473+
}
474+
475+
.closed-index-cell {
476+
background: #F9F9F9;
477+
}
478+
469479
.cluster-map-header-index-name {
470480
overflow: hidden;
471481
white-space: nowrap;

dist/kopf.js

+29-19
Original file line numberDiff line numberDiff line change
@@ -764,27 +764,29 @@ function Index(index_name,index_info, index_metadata, index_status) {
764764
var unassigned = [];
765765

766766
// adds shard information
767-
768-
$.map(index_info.shards, function(shards, shard_num) {
769-
$.map(shards, function(shard_routing, shard_copy) {
770-
if (shard_routing.node === null) {
771-
unassigned.push(new UnassignedShard(shard_routing));
772-
} else {
773-
if (!isDefined(index_shards[shard_routing.node])) {
774-
index_shards[shard_routing.node] = [];
775-
}
776-
var shard_status = null;
777-
if (isDefined(index_status) && isDefined(index_status.shards[shard_routing.shard])) {
778-
index_status.shards[shard_routing.shard].forEach(function(status) {
779-
if (status.routing.node == shard_routing.node && status.routing.shard == shard_routing.shard) {
780-
shard_status = status;
781-
}
782-
});
767+
768+
if (isDefined(index_info)) {
769+
$.map(index_info.shards, function(shards, shard_num) {
770+
$.map(shards, function(shard_routing, shard_copy) {
771+
if (shard_routing.node === null) {
772+
unassigned.push(new UnassignedShard(shard_routing));
773+
} else {
774+
if (!isDefined(index_shards[shard_routing.node])) {
775+
index_shards[shard_routing.node] = [];
776+
}
777+
var shard_status = null;
778+
if (isDefined(index_status) && isDefined(index_status.shards[shard_routing.shard])) {
779+
index_status.shards[shard_routing.shard].forEach(function(status) {
780+
if (status.routing.node == shard_routing.node && status.routing.shard == shard_routing.shard) {
781+
shard_status = status;
782+
}
783+
});
784+
}
785+
index_shards[shard_routing.node].push(new Shard(shard_routing, shard_status));
783786
}
784-
index_shards[shard_routing.node].push(new Shard(shard_routing, shard_status));
785-
}
787+
});
786788
});
787-
});
789+
}
788790

789791
this.unassigned = unassigned;
790792

@@ -861,6 +863,14 @@ function Index(index_name,index_info, index_metadata, index_status) {
861863
this.equals=function(index) {
862864
return index.name == this.name;
863865
};
866+
867+
this.closed=function() {
868+
return this.state === "close";
869+
};
870+
871+
this.open=function() {
872+
return this.state === "open";
873+
};
864874
}
865875
function EditableIndexSettings(settings) {
866876
// FIXME: 0.90/1.0 check

partials/index_header.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<div class="dropdown">
66
<a data-toggle="dropdown" href="#" class="cluster-map-header-index-name">
77
<i class="icon-angle-down pull-right cluster-map-header-index-icon"></i>
8-
<span class="cluster-map-header-index-name">{{index(position).name}} </span>
8+
<span ng-class="{'closed-index': index(position).closed()}" class="cluster-map-header-index-name">{{index(position).name}} </span>
99
</a>
1010
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
1111
<li role="presentation">
@@ -14,10 +14,10 @@
1414
</a>
1515
</li>
1616
<li role="presentation">
17-
<a ng-show="index(position).state == 'open'" data-toggle="modal" href="#confirm_dialog" class="cluster-map-header-index-action" data-backdrop="static" role="menuitem" tabindex="-1" ng-click="closeIndex(index(position).name)">
17+
<a ng-show="index(position).open()" data-toggle="modal" href="#confirm_dialog" class="cluster-map-header-index-action" data-backdrop="static" role="menuitem" tabindex="-1" ng-click="closeIndex(index(position).name)">
1818
<i class="icon-folder-open index-menu-icon"></i> close index
1919
</a>
20-
<a data-toggle="modal" ng-show="index(position).state == 'close'" href="#confirm_dialog" class="cluster-map-header-index-action" data-backdrop="static" role="menuitem" tabindex="-1" ng-click="openIndex(index(position).name)">
20+
<a data-toggle="modal" ng-show="index(position).closed()" href="#confirm_dialog" class="cluster-map-header-index-action" data-backdrop="static" role="menuitem" tabindex="-1" ng-click="openIndex(index(position).name)">
2121
<i class="icon-folder-close index-menu-icon" title="open index" ></i> open index
2222
</a>
2323
</li>
@@ -53,7 +53,7 @@
5353
</div>
5454
<div class="row">
5555
<div class="col-lg-12">
56-
<div class="cluster-map-header-index-alias">
56+
<div class="cluster-map-header-index-alias" ng-class="{'closed-index': index(position).closed()}">
5757
<span title="{{index(position).num_of_shards}} shards and {{index(position).num_of_replicas}} replicas">shards: {{index(position).num_of_shards}} * {{index(position).num_of_replicas + 1}} |</span>
5858
<span title="{{index(position).num_docs}} docs, {{index(position).max_doc}} max docs, {{index(position).deleted_docs}} deleted docs">docs: {{index(position).num_docs}} |</span>
5959
<span title="size: {{index(position).size_in_bytes}}, total size: {{index(position).total_size_in_bytes}}">size: {{index(position).size_in_bytes}}</span>

partials/shard_map_body.html

+11-11
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@
3434
</div>
3535
</div>
3636
</td>
37-
<td ng-init="position = 0" ng-include src="'partials/index_body.html'"></td>
38-
<td ng-init="position = 1" ng-include src="'partials/index_body.html'"></td>
39-
<td ng-init="position = 2" ng-include src="'partials/index_body.html'"></td>
40-
<td ng-init="position = 3" ng-include src="'partials/index_body.html'"></td>
41-
<td ng-init="position = 4" ng-include src="'partials/index_body.html'"></td>
37+
<td ng-init="position = 0" ng-include src="'partials/index_body.html'" ng-class="{'closed-index-cell': index(position).closed()}"></td>
38+
<td ng-init="position = 1" ng-include src="'partials/index_body.html'" ng-class="{'closed-index-cell': index(position).closed()}"></td>
39+
<td ng-init="position = 2" ng-include src="'partials/index_body.html'" ng-class="{'closed-index-cell': index(position).closed()}"></td>
40+
<td ng-init="position = 3" ng-include src="'partials/index_body.html'" ng-class="{'closed-index-cell': index(position).closed()}"></td>
41+
<td ng-init="position = 4" ng-include src="'partials/index_body.html'" ng-class="{'closed-index-cell': index(position).closed()}"></td>
4242
</tr>
4343
<!-- Unassigned shards -->
4444
<tr>
45-
<td class="node-cell">
45+
<td class="node-cell closed-index-cell">
4646
<div class="row">
4747
<div class="col-lg-1">
4848
<div class="row">
@@ -60,9 +60,9 @@
6060
</div>
6161
</div>
6262
</td>
63-
<td ng-init="position = 0" ng-include src="'partials/index_unassigned.html'" class="shards"></td>
64-
<td ng-init="position = 1" ng-include src="'partials/index_unassigned.html'" class="shards"></td>
65-
<td ng-init="position = 2" ng-include src="'partials/index_unassigned.html'" class="shards"></td>
66-
<td ng-init="position = 3" ng-include src="'partials/index_unassigned.html'" class="shards"></td>
67-
<td ng-init="position = 4" ng-include src="'partials/index_unassigned.html'" class="shards"></td>
63+
<td ng-init="position = 0" ng-include src="'partials/index_unassigned.html'" class="shards closed-index-cell"></td>
64+
<td ng-init="position = 1" ng-include src="'partials/index_unassigned.html'" class="shards closed-index-cell"></td>
65+
<td ng-init="position = 2" ng-include src="'partials/index_unassigned.html'" class="shards closed-index-cell"></td>
66+
<td ng-init="position = 3" ng-include src="'partials/index_unassigned.html'" class="shards closed-index-cell"></td>
67+
<td ng-init="position = 4" ng-include src="'partials/index_unassigned.html'" class="shards closed-index-cell"></td>
6868
</tr>

src/kopf/css/cluster_overview.css

+10
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ a.cluster-map-header-cluster-action {
3939
background: #f9f9f9;
4040
border-bottom: 0px !important;
4141
}
42+
43+
.closed-index {
44+
color: #D0D0D0 !important;
45+
font-weight: 300 !important;
46+
}
47+
48+
.closed-index-cell {
49+
background: #F9F9F9;
50+
}
51+
4252
.cluster-map-header-index-name {
4353
overflow: hidden;
4454
white-space: nowrap;

src/kopf/elastic/index.js

+29-19
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,29 @@ function Index(index_name,index_info, index_metadata, index_status) {
3030
var unassigned = [];
3131

3232
// adds shard information
33-
34-
$.map(index_info.shards, function(shards, shard_num) {
35-
$.map(shards, function(shard_routing, shard_copy) {
36-
if (shard_routing.node === null) {
37-
unassigned.push(new UnassignedShard(shard_routing));
38-
} else {
39-
if (!isDefined(index_shards[shard_routing.node])) {
40-
index_shards[shard_routing.node] = [];
41-
}
42-
var shard_status = null;
43-
if (isDefined(index_status) && isDefined(index_status.shards[shard_routing.shard])) {
44-
index_status.shards[shard_routing.shard].forEach(function(status) {
45-
if (status.routing.node == shard_routing.node && status.routing.shard == shard_routing.shard) {
46-
shard_status = status;
47-
}
48-
});
33+
34+
if (isDefined(index_info)) {
35+
$.map(index_info.shards, function(shards, shard_num) {
36+
$.map(shards, function(shard_routing, shard_copy) {
37+
if (shard_routing.node === null) {
38+
unassigned.push(new UnassignedShard(shard_routing));
39+
} else {
40+
if (!isDefined(index_shards[shard_routing.node])) {
41+
index_shards[shard_routing.node] = [];
42+
}
43+
var shard_status = null;
44+
if (isDefined(index_status) && isDefined(index_status.shards[shard_routing.shard])) {
45+
index_status.shards[shard_routing.shard].forEach(function(status) {
46+
if (status.routing.node == shard_routing.node && status.routing.shard == shard_routing.shard) {
47+
shard_status = status;
48+
}
49+
});
50+
}
51+
index_shards[shard_routing.node].push(new Shard(shard_routing, shard_status));
4952
}
50-
index_shards[shard_routing.node].push(new Shard(shard_routing, shard_status));
51-
}
53+
});
5254
});
53-
});
55+
}
5456

5557
this.unassigned = unassigned;
5658

@@ -127,4 +129,12 @@ function Index(index_name,index_info, index_metadata, index_status) {
127129
this.equals=function(index) {
128130
return index.name == this.name;
129131
};
132+
133+
this.closed=function() {
134+
return this.state === "close";
135+
};
136+
137+
this.open=function() {
138+
return this.state === "open";
139+
};
130140
}

0 commit comments

Comments
 (0)