Commit de70cc9
[8.19] [Watcher] Fix watches table (elastic#218853) (elastic#219392)
# Backport
This will backport the following commits from `main` to `8.19`:
- [[Watcher] Fix watches table
(elastic#218853)](elastic#218853)
<!--- Backport version: 9.6.6 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)
<!--BACKPORT [{"author":{"name":"Elena
Stoeva","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-04-28T13:07:42Z","message":"[Watcher]
Fix watches table (elastic#218853)\n\nFixes
https://github.com/elastic/kibana/issues/218341\n\n## Summary\n\nThis PR
fixes the watches table where only up to 10 watches were\npreviously
displayed because the Query Watch API returns maximum 10\nwatches by
default. To fix this and to avoid performance issues for\nclusters with
a large number of watches, we use pagination to only fetch\nthe watches
for the current page.\n\n**Limitations:**\n- The Query Watch API only
allows sorting by `_id` and `metadata.*`\nfields. However, we cannot
allow sorting by ID in the table because this\nrequires enabling the
`indices.id_field_data.enabled` cluster setting,\nwhich is disabled by
default in the cluster. We can only sort by Name\nbecause the name is
part of the `metadata` property. Therefore, we need\nto remove sorting
for all columns but the Name.\n- We cannot utilize the native behavior
of the Search bar where the\ntable would filter all items by itself,
since in this case it would only\nfilter the current page of watches. We
need to pass the query to the\nQuery Watches API. However, again only
the `_id` and `metadata.*` fields\ncan be searched. Additionally, for
`_id` we cannot use a wildcard query\nso the user would need to input
the whole id for the requested watch to\nbe displayed. For name, we can
use a wildcard query so searching by a\nsubstring of a name should
work.\n\n**How to test:**\n1. Create more than 10 watches through the UI
or with a Console request:\n\n```\nPUT _watcher/watch/{id}\n{\n
\"metadata\": {\n \"name\": \"test-watch-{id}\",\n \"xpack\": {\n
\"type\": \"json\"\n }\n },\n \"trigger\": {\n \"schedule\": {\n
\"interval\": \"30m\"\n }\n }\n}\n```\n2. Verify that all watches can be
viewed in the table and that they can\nbe sorted by Name and search by
Name or
ID.\n\n\n\n\n\nhttps://github.com/user-attachments/assets/6c812c5d-51e9-472c-a4d9-b1035843b9bb\n\n---------\n\nCo-authored-by:
kibanamachine
<[email protected]>\nCo-authored-by:
Matthew Kime
<[email protected]>","sha":"d9c481799f0edb3088595d21e4d7615b1a4e12f6","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Watcher","Team:Kibana
Management","release_note:skip","backport:prev-minor","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[Watcher]
Fix watches
table","number":218853,"url":"https://github.com/elastic/kibana/pull/218853","mergeCommit":{"message":"[Watcher]
Fix watches table (elastic#218853)\n\nFixes
https://github.com/elastic/kibana/issues/218341\n\n## Summary\n\nThis PR
fixes the watches table where only up to 10 watches were\npreviously
displayed because the Query Watch API returns maximum 10\nwatches by
default. To fix this and to avoid performance issues for\nclusters with
a large number of watches, we use pagination to only fetch\nthe watches
for the current page.\n\n**Limitations:**\n- The Query Watch API only
allows sorting by `_id` and `metadata.*`\nfields. However, we cannot
allow sorting by ID in the table because this\nrequires enabling the
`indices.id_field_data.enabled` cluster setting,\nwhich is disabled by
default in the cluster. We can only sort by Name\nbecause the name is
part of the `metadata` property. Therefore, we need\nto remove sorting
for all columns but the Name.\n- We cannot utilize the native behavior
of the Search bar where the\ntable would filter all items by itself,
since in this case it would only\nfilter the current page of watches. We
need to pass the query to the\nQuery Watches API. However, again only
the `_id` and `metadata.*` fields\ncan be searched. Additionally, for
`_id` we cannot use a wildcard query\nso the user would need to input
the whole id for the requested watch to\nbe displayed. For name, we can
use a wildcard query so searching by a\nsubstring of a name should
work.\n\n**How to test:**\n1. Create more than 10 watches through the UI
or with a Console request:\n\n```\nPUT _watcher/watch/{id}\n{\n
\"metadata\": {\n \"name\": \"test-watch-{id}\",\n \"xpack\": {\n
\"type\": \"json\"\n }\n },\n \"trigger\": {\n \"schedule\": {\n
\"interval\": \"30m\"\n }\n }\n}\n```\n2. Verify that all watches can be
viewed in the table and that they can\nbe sorted by Name and search by
Name or
ID.\n\n\n\n\n\nhttps://github.com/user-attachments/assets/6c812c5d-51e9-472c-a4d9-b1035843b9bb\n\n---------\n\nCo-authored-by:
kibanamachine
<[email protected]>\nCo-authored-by:
Matthew Kime
<[email protected]>","sha":"d9c481799f0edb3088595d21e4d7615b1a4e12f6"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/218853","number":218853,"mergeCommit":{"message":"[Watcher]
Fix watches table (elastic#218853)\n\nFixes
https://github.com/elastic/kibana/issues/218341\n\n## Summary\n\nThis PR
fixes the watches table where only up to 10 watches were\npreviously
displayed because the Query Watch API returns maximum 10\nwatches by
default. To fix this and to avoid performance issues for\nclusters with
a large number of watches, we use pagination to only fetch\nthe watches
for the current page.\n\n**Limitations:**\n- The Query Watch API only
allows sorting by `_id` and `metadata.*`\nfields. However, we cannot
allow sorting by ID in the table because this\nrequires enabling the
`indices.id_field_data.enabled` cluster setting,\nwhich is disabled by
default in the cluster. We can only sort by Name\nbecause the name is
part of the `metadata` property. Therefore, we need\nto remove sorting
for all columns but the Name.\n- We cannot utilize the native behavior
of the Search bar where the\ntable would filter all items by itself,
since in this case it would only\nfilter the current page of watches. We
need to pass the query to the\nQuery Watches API. However, again only
the `_id` and `metadata.*` fields\ncan be searched. Additionally, for
`_id` we cannot use a wildcard query\nso the user would need to input
the whole id for the requested watch to\nbe displayed. For name, we can
use a wildcard query so searching by a\nsubstring of a name should
work.\n\n**How to test:**\n1. Create more than 10 watches through the UI
or with a Console request:\n\n```\nPUT _watcher/watch/{id}\n{\n
\"metadata\": {\n \"name\": \"test-watch-{id}\",\n \"xpack\": {\n
\"type\": \"json\"\n }\n },\n \"trigger\": {\n \"schedule\": {\n
\"interval\": \"30m\"\n }\n }\n}\n```\n2. Verify that all watches can be
viewed in the table and that they can\nbe sorted by Name and search by
Name or
ID.\n\n\n\n\n\nhttps://github.com/user-attachments/assets/6c812c5d-51e9-472c-a4d9-b1035843b9bb\n\n---------\n\nCo-authored-by:
kibanamachine
<[email protected]>\nCo-authored-by:
Matthew Kime
<[email protected]>","sha":"d9c481799f0edb3088595d21e4d7615b1a4e12f6"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
Co-authored-by: Elena Stoeva <[email protected]>
Co-authored-by: Matthew Kime <[email protected]>1 parent 78f1be0 commit de70cc9
File tree
9 files changed
+267
-139
lines changed- x-pack
- platform/plugins/private
- translations/translations
- watcher
- __jest__/client_integration
- common/types
- public/application
- lib
- sections/watch_list_page
- server/routes/api/watches
- test/api_integration/apis/watcher
9 files changed
+267
-139
lines changedLines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51653 | 51653 | | |
51654 | 51654 | | |
51655 | 51655 | | |
51656 | | - | |
51657 | 51656 | | |
51658 | 51657 | | |
51659 | 51658 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51613 | 51613 | | |
51614 | 51614 | | |
51615 | 51615 | | |
51616 | | - | |
51617 | 51616 | | |
51618 | 51617 | | |
51619 | 51618 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51697 | 51697 | | |
51698 | 51698 | | |
51699 | 51699 | | |
51700 | | - | |
51701 | 51700 | | |
51702 | 51701 | | |
51703 | 51702 | | |
| |||
Lines changed: 6 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | 79 | | |
88 | | - | |
89 | | - | |
90 | | - | |
| 80 | + | |
91 | 81 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 82 | + | |
111 | 83 | | |
112 | 84 | | |
113 | 85 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
121 | 90 | | |
122 | 91 | | |
123 | 92 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
Lines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
34 | 43 | | |
35 | 44 | | |
36 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
37 | 53 | | |
38 | 54 | | |
39 | 55 | | |
40 | 56 | | |
41 | 57 | | |
| 58 | + | |
42 | 59 | | |
43 | 60 | | |
44 | 61 | | |
| |||
0 commit comments