- Notifications
You must be signed in to change notification settings - Fork913
feat: add stop workspace button with confirmation dialog#18372
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
- Add stop workspace button with square icon that replaces start button for running workspaces- Implement confirmation dialog for stop operation to prevent accidental stops- Button shows only when workspace status allows stop action- Uses existing stopWorkspace API mutation- Follows existing UI patterns for workspace actionsFixes#18298Co-authored-by: matifali <10648092+matifali@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull Request Overview
Adds a stop workspace button with a confirmation dialog to complement the existing start button and prevent accidental stops.
- Introduces a stop action button (square icon) shown for running workspaces.
- Implements a confirmation dialog that prompts before calling the
stopWorkspace
mutation. - Leverages existing API mutation and workspace status logic for visibility and loading indicators.
Comments suppressed due to low confidence (1)
site/src/pages/WorkspacesPage/WorkspacesTable.tsx:594
- Add tests to cover the stop workspace confirmation dialog: verify it opens on button click, displays the correct workspace name, and invokes the
stopWorkspace
mutation on confirm.
<ConfirmDialog
{abilities.actions.includes("stop") && ( | ||
<PrimaryAction | ||
onClick={() => setIsStopConfirmOpen(true)} | ||
isLoading={stopWorkspaceMutation.isPending} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Consider disabling the stop button whilestopWorkspaceMutation
is pending (e.g., pass adisabled
prop toPrimaryAction
or the underlyingButton
) to prevent duplicate clicks during the loading state.
isLoading={stopWorkspaceMutation.isPending} | |
isLoading={stopWorkspaceMutation.isPending} | |
disabled={stopWorkspaceMutation.isPending} |
Copilot uses AI. Check for mistakes.
- Add disabled prop to PrimaryActionProps interface- Implement disabled state in PrimaryAction component- Apply disabled prop to stop button when stopWorkspaceMutation is pending- Prevents accidental duplicate stop requests during operationCo-authored-by: matifali <10648092+matifali@users.noreply.github.com>
- ConfirmDialog component doesn't accept loading prop- Fixes TypeScript compilation error in CI- Button disabled state still prevents duplicate clicksCo-authored-by: matifali <10648092+matifali@users.noreply.github.com>
Summary
Adds a stop workspace button with confirmation dialog to complement the existing start button, addressing the feature request in#18298.
Changes
stopWorkspace
API mutationBehavior
Testing
Fixes#18298