Skip to content

Commit 91b8b22

Browse files
-
1 parent d18bcd2 commit 91b8b22

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Controller/ElasticsearchShardController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public function stats(Request $request): Response
9898
$data['totals']['shards_total'] = 0;
9999
$data['totals']['shards_total_primary'] = 0;
100100
$data['totals']['shards_total_unassigned'] = 0;
101+
$data['totals']['shards_total_unassigned_reason'] = 0;
101102
if (true === isset($clusterStats['indices']['shards']['replication'])) {
102103
$data['totals']['shards_replication'] = round($clusterStats['indices']['shards']['replication']*100, 2).'%';
103104
}
@@ -117,6 +118,9 @@ public function stats(Request $request): Response
117118
if ('unassigned' == $shard->getState()) {
118119
$data['totals']['shards_total_unassigned']++;
119120
}
121+
if ($shard->getUnassignedReason()) {
122+
$data['totals']['shards_total_unassigned_reason']++;
123+
}
120124
$data['totals']['shards_total_documents'] += $shard->getDocuments();
121125
$data['totals']['shards_total_size'] += $shard->getSize();
122126

templates/Modules/shard/shard_stats.html.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
{% else %}
3030
{{ appImport.dashboardKpi({'title': ('stats_data.' ~ key)|trans, 'badge': {'title': total}}) }}
3131
{% endif %}
32+
{% elseif 'shards_total_unassigned_reason' == key %}
3233
{% elseif 'shards_total_unassigned' == key %}
3334
{% if is_granted('SHARDS', 'global') and 0 < total %}
3435
{{ appImport.dashboardKpi({'title': ('stats_data.' ~ key)|trans, 'badge': {'title': total, 'context': 'danger', 'link': path('shards', {'state[]': 'unassigned'})}}) }}
@@ -54,7 +55,7 @@
5455
{% block content %}
5556
{% for row in results %}
5657
{% if 'shards_by_unassigned_reason' == key %}
57-
{% set percent = appImport.getPercent(data.totals.shards_total_unassigned, row.total, 1) %}
58+
{% set percent = appImport.getPercent(data.totals.shards_total_unassigned_reason, row.total, 1) %}
5859
{% else %}
5960
{% set percent = appImport.getPercent(data.totals.shards_total, row.total, 1) %}
6061
{% endif %}

0 commit comments

Comments
 (0)