Commit 96ffcd7
authored
[UII] Save agent list table state using session storage (elastic#228875)
## Summary
Resolves elastic/ingest-dev#5213.
This PR makes Fleet's agent list table state be saved using session
storage. The state of the table includes:
- Pagination (rows per page and page #)
- Sort field and direction
- Text search bar
- All other filters (status, tags, agent policy, has upgrade)
Using session storage means that this state will be saved _within_ a
window/tab session. Saving the state this way suffices to manage agents
without losing context and clears up the state for new tabs/sessions.
When some state is declared using URL query params (i.e. `&kuery=` and
`&showInactive=`), the session storage state is overridden with defaults
*plus* state from query params. This is so that referral pages that
apply filters (like from Agent policy > click into count of Unprivileged
agents) do not run into unexpected filtering from the user's session
storage.
Because the filter state is now persistent, I changed `Clear filters`
button to `Reset filters` and updated the behavior accordingly: clicking
it resets back to initial filter state rather than clearing every filter
(i.e. clicking it resets back to 5 active agent statuses, rather than
clearing all statuses which causes inactive agents to be shown).
## Testing
I recommend using `node scripts/create_agents` (from Fleet directory) to
create large number of agents and playing around with filtering the list
UI and navigating between pages.
## Release note
Fleet agent list table now persists state of filters while navigating
within a session.
## To-do
- [x] Make this behave nicely with kuery & other URL query params
### Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.1 parent 2281fc3 commit 96ffcd7
File tree
9 files changed
+778
-132
lines changed9 files changed
+778
-132
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
| 142 | + | |
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| 208 | + | |
| 209 | + | |
208 | 210 | | |
209 | 211 | | |
210 | 212 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| |||
Lines changed: 35 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
20 | 54 | | |
21 | 55 | | |
22 | 56 | | |
| |||
87 | 121 | | |
88 | 122 | | |
89 | 123 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | 124 | | |
99 | 125 | | |
100 | 126 | | |
| |||
149 | 175 | | |
150 | 176 | | |
151 | 177 | | |
152 | | - | |
| 178 | + | |
153 | 179 | | |
154 | 180 | | |
155 | 181 | | |
| |||
Lines changed: 107 additions & 39 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| 34 | + | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
105 | 173 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
128 | 191 | | |
129 | 192 | | |
130 | 193 | | |
| |||
142 | 205 | | |
143 | 206 | | |
144 | 207 | | |
| 208 | + | |
| 209 | + | |
145 | 210 | | |
146 | | - | |
147 | | - | |
| 211 | + | |
148 | 212 | | |
149 | 213 | | |
150 | 214 | | |
151 | | - | |
| 215 | + | |
152 | 216 | | |
153 | 217 | | |
154 | 218 | | |
| |||
192 | 256 | | |
193 | 257 | | |
194 | 258 | | |
195 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
196 | 265 | | |
197 | 266 | | |
198 | 267 | | |
| |||
210 | 279 | | |
211 | 280 | | |
212 | 281 | | |
213 | | - | |
| 282 | + | |
214 | 283 | | |
215 | 284 | | |
216 | 285 | | |
| |||
220 | 289 | | |
221 | 290 | | |
222 | 291 | | |
223 | | - | |
224 | | - | |
| 292 | + | |
| 293 | + | |
225 | 294 | | |
226 | | - | |
227 | | - | |
| 295 | + | |
| 296 | + | |
228 | 297 | | |
229 | 298 | | |
230 | 299 | | |
| |||
377 | 446 | | |
378 | 447 | | |
379 | 448 | | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
| 449 | + | |
384 | 450 | | |
385 | 451 | | |
386 | 452 | | |
387 | 453 | | |
388 | 454 | | |
389 | 455 | | |
390 | 456 | | |
391 | | - | |
| 457 | + | |
392 | 458 | | |
393 | | - | |
394 | 459 | | |
395 | 460 | | |
396 | 461 | | |
397 | 462 | | |
398 | 463 | | |
399 | 464 | | |
400 | 465 | | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
401 | 469 | | |
402 | 470 | | |
0 commit comments