-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
storage: Action redesign #19882
Draft
mvollmer
wants to merge
15
commits into
cockpit-project:main
Choose a base branch
from
mvollmer:storage-action-redesign
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
storage: Action redesign #19882
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2618d8f
storage: Move all actions into the menu, except primary ones
mvollmer 804b79b
storage: Move "Format" action one card up
mvollmer 4dfcf04
storage: Move "Lock" and "Unlock" actions to "Encryption" card
mvollmer 37602fc
storage: Remove "Unrmatted Data" and "Locked Data" cards
mvollmer 1b188d9
storage: New "Add encryption" action for unformatted blocks
mvollmer 71603fc
storage: Offer "Format" on "Encryption" card
mvollmer 02854f7
storage: Remove "Reuse existing encryption" option
mvollmer cec67e7
storage: Split "Erase" out from "Format" dialogs
mvollmer c7f54e3
storage: Offer global "Create partition" action
mvollmer 138a1e7
storage: Move swap creation out of filesystem format dialog
mvollmer 0f5983c
storage: Remove "Overwrite" option in Erase dialog
mvollmer 7d35f12
storage: Simplify "Initialize disk" dialog
mvollmer 441df7c
storage: Polish encryption actions and options a bit
mvollmer 5875fe9
FIXUP - rebase conflicts
mvollmer e372e56
storage: Omit "/dev/" prefix from device names everywhere
mvollmer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* This file is part of Cockpit. | ||
* | ||
* Copyright (C) 2024 Red Hat, Inc. | ||
* | ||
* Cockpit is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 2.1 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Cockpit is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Cockpit; If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import cockpit from "cockpit"; | ||
import client from "../client.js"; | ||
|
||
import { | ||
block_name, get_active_usage, teardown_active_usage, | ||
} from "../utils.js"; | ||
|
||
import { | ||
dialog_open, | ||
CheckBoxes, | ||
BlockingMessage, TeardownMessage, | ||
init_teardown_usage, | ||
} from "../dialog.jsx"; | ||
|
||
import { job_progress_wrapper } from "../jobs-panel.jsx"; | ||
|
||
const _ = cockpit.gettext; | ||
|
||
export function erase_dialog(block) { | ||
const usage = get_active_usage(client, block.path, _("erase"), _("delete")); | ||
|
||
if (usage.Blocking) { | ||
dialog_open({ | ||
Title: cockpit.format(_("$0 is in use"), block_name(block)), | ||
Body: BlockingMessage(usage) | ||
}); | ||
return; | ||
} | ||
|
||
dialog_open({ | ||
Title: cockpit.format(_("Erase $0"), block_name(block)), | ||
Teardown: TeardownMessage(usage), | ||
Action: { | ||
Title: _("Erase"), | ||
Danger: _("This will erase all data on the storage device."), | ||
wrapper: job_progress_wrapper(client, block.path), | ||
disable_on_error: usage.Teardown, | ||
action: async function (vals) { | ||
const options = { | ||
'tear-down': { t: 'b', v: true } | ||
}; | ||
|
||
await teardown_active_usage(client, usage); | ||
await block.Format("empty", options); | ||
} | ||
}, | ||
Inits: [ | ||
init_teardown_usage(client, usage), | ||
] | ||
}); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note