podman-desktop icon indicating copy to clipboard operation
podman-desktop copied to clipboard

chore: remember last child page visited for kubernetes and preferences pages

Open SoniaSandler opened this issue 1 year ago • 6 comments

What does this PR do?

This PR adds stores to keep track of the last sections visited in submenu pages, so that when leaving and coming back, the user will come back to the last section they visited in the same submenu (can check with Kubernetes for now)

Screenshot / video of UI

Screencast from 2024-10-21 00-38-16.webm

What issues does this PR fix or reference?

Closes https://github.com/containers/podman-desktop/issues/9057

How to test this PR?

Enter the Kubernetes (nodes) page, go to one of the other pages in Kubernetes (e.g. Deployments), exit to some other page in PD that is not in Kubernetes, and then go back to Kubernetes. You should be back in your last visited section page (e.g. Deployments)

  • [X] Tests are covering the bug fix or the new feature

SoniaSandler avatar Oct 17 '24 22:10 SoniaSandler

@deboer-tim I wasn't sure how specific we want the last visited page to be, so for now it is the very last one (could be summary/details page in kubernetes, or create new pages in preferences), but if needed, I can change it to just keep track of the last general section visited (Nodes, Deployments, Services, Preferences, CLI Tools, etc.)

SoniaSandler avatar Oct 17 '24 22:10 SoniaSandler

@deboer-tim since settings is not yet a submenu, should I keep the changes for it or remove them and just update the submenu?

SoniaSandler avatar Oct 18 '24 14:10 SoniaSandler

@deboer-tim since settings is not yet a submenu, should I keep the changes for it or remove them and just update the submenu?

I'd suggest checking if we can do something simpler/less hard-coded for submenus first. If so then yes I'd break it up, otherwise we can re-evaluate.

deboer-tim avatar Oct 18 '24 20:10 deboer-tim

@deboer-tim I've changes the PR to work for submenus and removed the changes for the preferences section, but now the last page visited is less specific. For example, when coming back to the nodes page, it will go to the node list page, even if the last visited Kubernetes page was a specific node, but I can modify it to be more specific if needed

SoniaSandler avatar Oct 21 '24 04:10 SoniaSandler

Silly question, but with this PR, unsure if this should be done within this PR or as a follow-up, but what about remembering sections in extensions that use SubmenuNavigation imported? (ex bootc extension)

cdrage avatar Oct 21 '24 15:10 cdrage

@cdrage I looked in the bootc repo (same for ai-lab), and it looks like it only uses SettingsNavItem from this PR. I think that for extensions we'll have to update their navigation files manually to also remember last child page. TBH, I'm not sure if there is a way for me to generalize it more so that it would also automatically include extensions' submenus. For now, this PR should work for all submenus created/rendered with SubmenuNavigation.svelte, but I can explore the topic of the extension submenus more if needed.

SoniaSandler avatar Oct 21 '24 16:10 SoniaSandler