Skip to content
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

Merged
merged 1 commit into from Jun 26, 2023

Conversation

benoitf
Copy link
Collaborator

@benoitf benoitf commented Jun 22, 2023

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)

fixes containers#2957
Signed-off-by: Florent Benoit <fbenoit@redhat.com>
@benoitf benoitf requested a review from a team as a code owner June 22, 2023 10:10
@benoitf benoitf requested review from jeffmaury and cdrage and removed request for a team June 22, 2023 10:10
@deboer-tim
Copy link
Collaborator

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.

@benoitf
Copy link
Collaborator Author

benoitf commented Jun 23, 2023

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

Copy link
Contributor

@cdrage cdrage left a 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!

Copy link
Collaborator

@deboer-tim deboer-tim left a 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.

@benoitf benoitf merged commit 43eafa7 into containers:main Jun 26, 2023
8 checks passed
@podman-desktop-bot podman-desktop-bot added this to the 1.2.0 milestone Jun 26, 2023
deboer-tim added a commit to deboer-tim/desktop that referenced this pull request Jul 14, 2023
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>
deboer-tim added a commit to deboer-tim/desktop that referenced this pull request Jul 20, 2023
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>
deboer-tim added a commit that referenced this pull request Jul 31, 2023
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>
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.

Wrong redirect after clicking on deleting a pod from container list
4 participants