Require stopping a box before it can be deleted - #218
Open
kacperpaczos wants to merge 3 commits into
Open
Conversation
Delete Box removes the container with --force, so it would happily tear down a box that is still running and whatever is working inside it. Disable the Delete row while the box is up, with a subtitle pointing at the Stop button that is already on the header, and enable it again once the box is down.
A one-line predicate and its tests said nothing the condition itself does not; the row is now gated directly on dbox.is_running.
The note under the row made it taller only while the box was running, so the list shifted on Start and Stop; the greyed-out row is clear enough by itself.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deleting a box runs
distrobox rm --force, which will tear the container down even while it is running — and with it whatever is working inside. That felt too easy to do by accident, so this makes you stop the box first.While the box is up, the Delete Box row is greyed out; the Stop button already sits on the header for a running box, and once the box is stopped the row enables itself again. The row keeps its place and its height in both states, so nothing on the page shifts when the box starts or stops.
It is one
set_sensitive(!dbox.is_running)on the row; I confirmed the greyed-out row on a running box and the live one on a stopped box on a virtual display with a stubdistrobox list.