Skip to content

Commit 6c1b9a6

Browse files
enrich CAT list (badges)
1 parent a130776 commit 6c1b9a6

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/Controller/ElasticsearchCatController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ public function index(Request $request): Response
9999
$callResponse = $this->callManager->call($callRequest);
100100
$parameters['help'] = $callResponse->getContentRaw();
101101

102-
$parameters['command'] = $catModel->getCommandReplace();
102+
$parameters['command'] = $catModel->getCommand();
103+
$parameters['command_replace'] = $catModel->getCommandReplace();
103104
}
104105

105106
$parameters['form'] = $form->createView();

templates/Modules/cat/cat_index.html.twig

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends 'base.html.twig' %}
22
{% import 'Import/app_import.html.twig' as appImport %}
33

4-
{% block head_title %}{{ 'cat'|trans }}{% if rows is defined or help is defined %} - {{ command }}{% endif %}{% endblock %}
4+
{% block head_title %}{{ 'cat'|trans }}{% if rows is defined or help is defined %} - {{ command_replace }}{% endif %}{% endblock %}
55

66
{% block heading_1 %}
77
{{ appImport.heading({'level': 1, 'title': 'cat'|trans}) }}
@@ -29,9 +29,9 @@
2929
{% import 'Import/app_import.html.twig' as appImport %}
3030
{% block content %}
3131
{% if rows is defined %}
32-
{{ appImport.heading({'level': 3, 'title': command, 'badge': {'title': rows.total}}) }}
32+
{{ appImport.heading({'level': 3, 'title': command_replace, 'badge': {'title': rows.total}}) }}
3333
{% else %}
34-
{{ appImport.heading({'level': 3, 'title': command}) }}
34+
{{ appImport.heading({'level': 3, 'title': command_replace}) }}
3535
{% endif %}
3636

3737
{% if help is defined %}
@@ -85,6 +85,12 @@
8585
{{ column }}{{ appImport.badge({'title': 'master'|trans, 'context': 'master_node'}) }}
8686
{% elseif command in ['nodes', 'plugins'] and 'name' == k and master_node == column %}
8787
{{ column }}{{ appImport.badge({'title': 'master'|trans, 'context': 'master_node'}) }}
88+
{% elseif 'status' == k and 'health' == command %}
89+
{{ appImport.badge({'title': column|trans, 'context': column}) }}
90+
{% elseif k in ['health', 'status'] and command in ['indices', 'indices/{index}'] %}
91+
{{ appImport.badge({'title': column|trans, 'context': column}) }}
92+
{% elseif 'state' == k and command in ['shards', 'shards/{index}'] %}
93+
{{ appImport.badge({'title': column|lower|trans, 'context': column|lower}) }}
8894
{% else %}
8995
{{ column }}
9096
{% endif %}

0 commit comments

Comments
 (0)