Skip to content

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

blink-so[bot]
Copy link
Contributor

@blink-so blink-so bot commented Jun 13, 2025

Summary

Adds a stop workspace button with confirmation dialog to complement the existing start button, addressing the feature request in #18298.

Changes

  • Stop Button: Added a stop workspace button with square icon that replaces the start button for running workspaces
  • Confirmation Dialog: Implemented confirmation dialog to prevent accidental workspace stops
  • State Management: Button visibility is controlled by existing workspace status logic
  • API Integration: Uses existing stopWorkspace API mutation
  • UI Consistency: Follows established patterns for workspace action buttons

Behavior

  • Stopped workspaces: Show start button (play icon)
  • Running workspaces: Show stop button (square icon)
  • Stop action: Triggers confirmation dialog before executing
  • Loading states: Button shows spinner during stop operation

Testing

  • Code passes biome quality checks
  • Follows existing TypeScript patterns
  • Uses established component patterns from the codebase

Fixes #18298

- 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 actions

Fixes #18298

Co-authored-by: matifali <10648092+matifali@users.noreply.github.com>
Copy link
Contributor

@Copilot Copilot AI left a 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}
Copy link
Preview

Copilot AI Jun 13, 2025

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 while stopWorkspaceMutation is pending (e.g., pass a disabled prop to PrimaryAction or the underlying Button) to prevent duplicate clicks during the loading state.

Suggested change
isLoading={stopWorkspaceMutation.isPending}
isLoading={stopWorkspaceMutation.isPending}
disabled={stopWorkspaceMutation.isPending}

Copilot uses AI. Check for mistakes.

@matifali matifali marked this pull request as draft June 13, 2025 20:11
blink-so bot and others added 2 commits June 13, 2025 20:13
- 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 operation

Co-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 clicks

Co-authored-by: matifali <10648092+matifali@users.noreply.github.com>
@matifali matifali marked this pull request as ready for review June 13, 2025 20:29
@BrunoQuaresma
Copy link
Collaborator

@matifali I'm in a rush with the website right now, so I will not have time this weeek to QA and review this PR. Maybe someone in the FE guild, can help with that in the meantime.

@BrunoQuaresma BrunoQuaresma removed their request for review June 16, 2025 12:39
@matifali matifali requested review from a team and code-asher and removed request for a team June 16, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: stop workspace button
1 participant