Add confirmation input to delete agent modal #256
+150
−19
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.
Add confirmation input to delete agent modal
Summary
This PR enhances the
DeleteAgentConfirmModalcomponent by adding a confirmation input safeguard to prevent accidental deletion of agent working directories. The destructive "delete with directory" action now requires users to type the exact agent name before the button becomes enabled.Closes #206
Screenshots
Old UI (with no confirmation on the destructive "Confirm and Erase" button):
New UI:
And the "Agent + Work Directory" button only becomes enabled when the agent name is filled in:
Files Changed
src/renderer/components/DeleteAgentConfirmModal.tsxsrc/__tests__/renderer/components/DeleteAgentConfirmModal.test.tsxCode Changes
DeleteAgentConfirmModal.tsx
1. Added state management for confirmation input:
2. Renamed buttons for clarity:
3. Added disabled state logic to the destructive button:
4. Added danger warning and confirmation input field:
DeleteAgentConfirmModal.test.tsx
Added a new test suite
confirmation inputwith the following test cases:Reason for Changes
The previous implementation allowed users to accidentally delete an agent's entire working directory with a single click. This is a destructive and irreversible operation that could result in significant data loss. The confirmation input pattern (similar toGitHub's repository deletion) adds a deliberate friction point that:
Impact of Changes
aria-labelfor screen readersPotential Bugs / Considerations
Case Sensitivity: The confirmation is case-sensitive (
confirmationText === agentName). This is intentional for security but users may be confused if they type the name with different casing.Copy-Paste: Users can copy-paste the agent name from the modal text, which somewhat defeats the purpose of the confirmation. Consider whether this is acceptable UX.
State Persistence: The
confirmationTextstate resets when the modal unmounts. If the modal is closed and reopened, users must type the name again (expected behavior).Test Plan
Run tests with:
npm test -- DeleteAgentConfirmModalAdditional Notes
===), not a case-insensitive comparison. This is a deliberate design choice to require exact input.opacity-50andcursor-not-allowedfor the disabled state, maintaining consistency with common UI patterns.