k9s icon indicating copy to clipboard operation
k9s copied to clipboard

feat(app): history navigation preserves filters

Open tyzbit opened this issue 6 months ago • 4 comments

previously, when navigating the history using [, ] and -, filters were not saved, so if you went to pods, filtered for /nginx, then went to services and then back to pods, the /nginx filter would not be used and the default pod view would be shown. now, that filter is saved.

closes #3220

tyzbit avatar Jun 18 '25 03:06 tyzbit

Tested this and it seems to work well.

However, I noticed an issue that occurs specifically when filtering by label. The filter is applied correctly, but it’s not visibly shown in the UI.

Steps to reproduce:

Go to :pods

Apply a label filter: -l app.kubernetes.io/instance=cert-manager

Navigate to a different view

Return to :pods

At this point, the correct filter is still applied, but it’s not displayed in the UI, which might be misleading.

image

image

uozalp avatar Jun 18 '25 06:06 uozalp

@uozalp this is technically a pre-existing bug as I can reproduce it on v0.50.6 by doing :po /-l app.kubernetes.io/instance=cert-manager but it definitely needs to be fixed. I will either include the fix here in this PR or if it's a little involved, make a separate one.

tyzbit avatar Jun 18 '25 14:06 tyzbit

The filter title issue should be fixed by #3405, and does not need to be depended upon for merging or wait for this PR to be merged.

tyzbit avatar Jun 18 '25 16:06 tyzbit

Oh, one side-effect of this is that the filters get saved to the config and upon restart, k9s restores them. I think I like this behavior, but perhaps it should be adapted so users do not start k9s and see filtered results.

tyzbit avatar Jun 18 '25 16:06 tyzbit

@tyzbit Thank you for this update! Looks like we have conflicts, can you take a peek?

derailed avatar Jul 16 '25 14:07 derailed

It looks like doing a simple rebase results in broken code because this area of the code was refactored in master.

tyzbit avatar Jul 16 '25 15:07 tyzbit

This PR is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Aug 16 '25 02:08 github-actions[bot]

I don't plan to fix the merge conflicts, so I'm closing this PR.

tyzbit avatar Aug 16 '25 14:08 tyzbit