fix: handle mixed-state bulk toggle actions#104
Merged
Conversation
Fixes #99 by resolving concrete toggle action per selected server instead of inferring one action from the first server. This prevents wrong operations on mixed selections and keeps single-server toggle behavior unchanged. Implementation details: - add shared resolver for toggle families (pause/unpause, suspend/resume, shelve/unshelve, stop/start, lock/unlock, rescue/unrescue) - extend modal.ServerRef with optional per-server Action field for bulk execution plans - build per-server plan in openToggleConfirm for bulk selections - add mixed-action confirm title/body when selection spans multiple concrete actions - execute per-server action in executeBulkAction, preserving existing error aggregation and rescue password reporting - add unit tests for resolver and mixed-action counting/formatting helpers Validation: - cd src && make test - cd src && make build - cd src && make vet Fixes #99
Follow-up to #99 implementation: - add missing hard reboot handling in executeBulkAction - preserve mixed-action summary when rescue passwords are reported This avoids silent no-op on bulk hard reboot and keeps bulk result messaging accurate for mixed rescue/unrescue operations.
There was a problem hiding this comment.
Pull request overview
Fixes incorrect behavior in bulk “toggle” actions when the selected server set contains mixed states (e.g., ACTIVE + SHUTOFF), by resolving and executing the concrete action per selected server instead of deriving a single action from the first selection.
Changes:
- Added a shared toggle-action resolver and bulk action count/format helpers to build a per-server bulk execution plan.
- Updated bulk toggle confirmation to show mixed-action messaging when concrete operations differ across selected servers.
- Updated bulk execution to run each server’s concrete action (and improved bulk error labeling), with unit tests covering the new helpers.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/internal/app/actions_server.go |
Resolves per-server concrete toggle actions, displays mixed-action confirmation text, and executes per-target actions in the bulk path. |
src/internal/ui/modal/confirm.go |
Extends modal.ServerRef to optionally carry a per-server concrete action for bulk plans. |
src/internal/app/actions_server_test.go |
Adds unit tests for toggle resolution and action-count/format helpers used by the bulk plan UX/execution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Why
Issue #99 reports incorrect behavior for mixed-state bulk selections (for example ACTIVE + SHUTOFF with stop/start) where one wrong action was applied to part of the selection.
Changes
Validation
Fixes #99