Skip to content

Commit cf95a2e

Browse files
ES 8.2.0 (CAT component templates)
1 parent 069f673 commit cf95a2e

File tree

6 files changed

+41
-0
lines changed

6 files changed

+41
-0
lines changed

docs/elasticsearch-feature-detection.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Elasticsearch version tracking (for feature detection)
22

3+
## 8.2.0 [Release notes](https://www.elastic.co/guide/en/elasticsearch/reference/8.2/release-notes-8.2.0.html)
4+
5+
- Adding cat api for component template #71274 (issue: #68941)
6+
37
## 8.0.0 [Release notes](https://www.elastic.co/guide/en/elasticsearch/reference/8.0/release-notes-8.0.0.html)
48

59
- Remove endpoint for freezing indices #78918 (issues: #70192, #77273)

src/Form/Type/ElasticsearchCatType.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
4747
'segments/{index}',
4848
'thread_pool',
4949
];
50+
if (true === $this->callManager->hasFeature('cat_component_templates')) {
51+
$commands[] = 'component_templates';
52+
$commands[] = 'component_templates/{name}';
53+
}
5054
if (true === $this->callManager->hasFeature('cat_transforms')) {
5155
$commands[] = 'transforms';
5256
}
@@ -74,6 +78,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
7478
$fields = [];
7579

7680
$fields[] = 'command';
81+
$fields[] = 'name';
7782
$fields[] = 'index';
7883
$fields[] = 'repository';
7984
$fields[] = 'alias';
@@ -105,6 +110,12 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
105110
],
106111
]);
107112
break;
113+
case 'name':
114+
$builder->add('name', TextType::class, [
115+
'label' => 'name',
116+
'required' => false,
117+
]);
118+
break;
108119
case 'index':
109120
$builder->add('index', TextType::class, [
110121
'label' => 'index',

src/Manager/CallManager.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class CallManager
2424
public ?array $license = null;
2525

2626
private array $featuresByVersion = [
27+
'cat_component_templates' => '8.2',
2728
'repository_plugins_to_modules' => '8.0',
2829
'freezing_endpoint_removed' => '8.0',
2930
'_xpack_endpoint_removed' => '8.0',

src/Manager/ElasticsearchClusterManager.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public function getMaintenanceTable(): array
9696
['es_version' => '7.17.0', 'eol_date' => '2023-08-01', 'maintained_until' => '9.0.0'],
9797
['es_version' => '8.0.0', 'eol_date' => '2023-08-10', 'maintained_until' => '8.1.0'],
9898
['es_version' => '8.1.0', 'eol_date' => '2023-09-08', 'maintained_until' => '8.2.0'],
99+
['es_version' => '8.2.0', 'eol_date' => '2023-10-26', 'maintained_until' => '8.3.0'],
99100
];
100101
}
101102

src/Model/ElasticsearchCatModel.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ class ElasticsearchCatModel extends AbstractAppModel
99
{
1010
private ?string $command = null;
1111

12+
private ?string $name = null;
13+
1214
private ?string $index = null;
1315

1416
private ?string $repository = null;
@@ -33,6 +35,18 @@ public function setCommand(?string $command): self
3335
return $this;
3436
}
3537

38+
public function getName(): ?string
39+
{
40+
return $this->name;
41+
}
42+
43+
public function setName(?string $name): self
44+
{
45+
$this->name = $name;
46+
47+
return $this;
48+
}
49+
3650
public function getIndex(): ?string
3751
{
3852
return $this->index;
@@ -110,6 +124,10 @@ public function getCommandReplace(): ?string
110124
$command = $this->command;
111125

112126
if (null !== $this->command) {
127+
if (null !== $this->name && strstr($this->command, '{name}')) {
128+
$command = str_replace('{name}', $this->name, $command);
129+
}
130+
113131
if (null !== $this->index && strstr($this->command, '{index}')) {
114132
$command = str_replace('{index}', $this->index, $command);
115133
}

templates/Modules/cat/cat_index.html.twig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@
117117
function toggle() {
118118
var commandValue = command.value;
119119
120+
if (commandValue.indexOf('{name}') != -1) {
121+
enable('name');
122+
} else {
123+
disable('name');
124+
}
125+
120126
if (commandValue.indexOf('{index}') != -1) {
121127
enable('index');
122128
} else {

0 commit comments

Comments
 (0)