Skip to content

feat(app): history navigation preserves filters #3404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tyzbit
Copy link
Contributor

@tyzbit tyzbit commented Jun 18, 2025

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

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 derailed#3220
@uozalp
Copy link
Contributor

uozalp commented Jun 18, 2025

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

@tyzbit tyzbit changed the title feat(app): history navigation preserves filters draft: feat(app): history navigation preserves filters Jun 18, 2025
@tyzbit
Copy link
Contributor Author

tyzbit commented Jun 18, 2025

@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 added a commit to tyzbit/k9s that referenced this pull request Jun 18, 2025
…ided

curently, if you use `:svc -l app.kubernetes.io/instance=cert-manager` in k9s and then navigate history, when returning to the page the results are correct but the filter is not shown. here, we ensure that the table title string is not an empty string.

reported in derailed#3404, but unrelated

bug originally introduced in derailed#3293, which I have not reviewed for any other rippling effects.
tyzbit added a commit to tyzbit/k9s that referenced this pull request Jun 18, 2025
…ided

currently, if you use `:svc -l app.kubernetes.io/instance=cert-manager` in k9s and then navigate history, when returning to the page the results are correct but the filter is not shown. here, we ensure that the table title string is not an empty string.

reported in derailed#3404, but unrelated

bug originally introduced in derailed#3293, which I have not reviewed for any other rippling effects.
@tyzbit
Copy link
Contributor Author

tyzbit commented Jun 18, 2025

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 added a commit to tyzbit/k9s that referenced this pull request Jun 18, 2025
…ided

currently, if you use `:svc -l app.kubernetes.io/instance=cert-manager` in k9s and then navigate history, when returning to the page the results are correct but the filter is not shown. here, we ensure that the table title string is not an empty string.

reported in derailed#3404, but unrelated

bug originally introduced in derailed#3293, which I have not reviewed for any other rippling effects.
@tyzbit
Copy link
Contributor Author

tyzbit commented Jun 18, 2025

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 tyzbit changed the title draft: feat(app): history navigation preserves filters feat(app): history navigation preserves filters Jun 18, 2025
@tyzbit tyzbit force-pushed the preserve-command-filter branch from a06d43a to 85932b2 Compare June 18, 2025 19:08
@derailed
Copy link
Owner

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

@tyzbit
Copy link
Contributor Author

tyzbit commented Jul 16, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preserve Filter State When Navigating History
3 participants