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
fix: do not redirect to /pods when deleting pod in containerlist #2963
Conversation
fixes containers#2957 Signed-off-by: Florent Benoit <fbenoit@redhat.com>
Can we handle this differently: have no redirect from delete actions, but add a listener that will redirect you to the parent page if you're on a details page and the thing you're looking at gets deleted? This wouldn't require the delete action to be special and have flags to override its behaviour, and would work the same way if someone deleted the pod (or image, container) outside of Podman Desktop. |
I think it's nice but it'll require a lot more work, so probably a follow-up PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works, LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think we'll eventually want to auto-close the details pages on delete and that will end up undoing a bunch of this, but just confirming that I'm ok merging for now.
Issue 3011 opened to track auto-close.
Added a close() function on DetailsPage so that child pages do not need to import lastPage and router. This means they do need to bind DetailsPage, but that seemed like simpler logic/less dependencies to me. Each page just checks if they had the object before and can no longer find it. Once we've done this, the router.goto() when the user triggers deletion via each action is unnecessary and can be removed. If the user triggers the action from a page like Images the goto wasn't doing anything, and if they are in Image Details this new mechanism will do the same thing and revert to the previous page. The pods page was unsubscribing the listener, but I've switched it to returning the unsubscribe so it's handled by Svelte - no need for onDestroy() or imports. The other three pages weren't unsubscribing the listener, so I've fixed that by adding a return statement. This change was meant to handle external deletion, but once it is in there is no longer a need for any of the delete actions to use goto() and the redirectAfterDelete from PR containers#2963 can be cleaned up. We also get a minor bug fix b/c if you went from Containers > Pod Details and delete it we'll now go back to Containers instead of Pods. The PodActions test will fail because it is checking for the explicit redirect when a pod (that's not registered) gets deleted. Putting this up to start review of the rest and decide if we just delete the test or these is something else I can do. Fixes containers#3217. Signed-off-by: Tim deBoer <git@tdeboer.ca>
Added a close() function on DetailsPage so that child pages do not need to import lastPage and router. This means they do need to bind DetailsPage, but that seemed like simpler logic/less dependencies to me. Each page just checks if they had the object before and can no longer find it. Once we've done this, the router.goto() when the user triggers deletion via each action is unnecessary and can be removed. If the user triggers the action from a page like Images the goto wasn't doing anything, and if they are in Image Details this new mechanism will do the same thing and revert to the previous page. The pods page was unsubscribing the listener, but I've switched it to returning the unsubscribe so it's handled by Svelte - no need for onDestroy() or imports. The other three pages weren't unsubscribing the listener, so I've fixed that by adding a return statement. This change was meant to handle external deletion, but once it is in there is no longer a need for any of the delete actions to use goto() and the redirectAfterDelete from PR containers#2963 can be cleaned up. We also get a minor bug fix b/c if you went from Containers > Pod Details and delete it we'll now go back to Containers instead of Pods. The PodActions test will fail because it is checking for the explicit redirect when a pod (that's not registered) gets deleted. Putting this up to start review of the rest and decide if we just delete the test or these is something else I can do. Fixes containers#3217. Signed-off-by: Tim deBoer <git@tdeboer.ca>
Added a close() function on DetailsPage so that child pages do not need to import lastPage and router. This means they do need to bind DetailsPage, but that seemed like simpler logic/less dependencies to me. Each page just checks if they had the object before and can no longer find it. Once we've done this, the router.goto() when the user triggers deletion via each action is unnecessary and can be removed. If the user triggers the action from a page like Images the goto wasn't doing anything, and if they are in Image Details this new mechanism will do the same thing and revert to the previous page. The pods page was unsubscribing the listener, but I've switched it to returning the unsubscribe so it's handled by Svelte - no need for onDestroy() or imports. The other three pages weren't unsubscribing the listener, so I've fixed that by adding a return statement. This change was meant to handle external deletion, but once it is in there is no longer a need for any of the delete actions to use goto() and the redirectAfterDelete from PR #2963 can be cleaned up. We also get a minor bug fix b/c if you went from Containers > Pod Details and delete it we'll now go back to Containers instead of Pods. The PodActions test will fail because it is checking for the explicit redirect when a pod (that's not registered) gets deleted. Putting this up to start review of the rest and decide if we just delete the test or these is something else I can do. Fixes #3217. Signed-off-by: Tim deBoer <git@tdeboer.ca>
What does this PR do?
do not redirect to /pods when deleting pod in containerlist
Screenshot/screencast of this PR
What issues does this PR fix or reference?
fixes #2957
How to test this PR?
Unit test
also try with the test case of the linked issue (delete a pod from container list page)