Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
blink-so wants to merge6 commits intomain
base:main
Choose a base branch
Loading
fromfeat/stop-workspace-button
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletionsite/src/pages/WorkspacesPage/WorkspacesTable.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,6 +18,7 @@ import { Avatar } from "components/Avatar/Avatar";
import { AvatarData } from "components/Avatar/AvatarData";
import { AvatarDataSkeleton } from "components/Avatar/AvatarDataSkeleton";
import { Button } from "components/Button/Button";
import { ConfirmDialog } from "components/Dialogs/ConfirmDialog/ConfirmDialog";
import { ExternalImage } from "components/ExternalImage/ExternalImage";
import { VSCodeIcon } from "components/Icons/VSCodeIcon";
import { VSCodeInsidersIcon } from "components/Icons/VSCodeInsidersIcon";
Expand DownExpand Up@@ -49,6 +50,7 @@ import {
BanIcon,
PlayIcon,
RefreshCcwIcon,
SquareIcon,
SquareTerminalIcon,
} from "lucide-react";
import {
Expand All@@ -74,6 +76,7 @@ import {
type PropsWithChildren,
type ReactNode,
useMemo,
useState,
} from "react";
import { useMutation, useQuery, useQueryClient } from "react-query";
import { useNavigate } from "react-router-dom";
Expand DownExpand Up@@ -491,6 +494,9 @@ const WorkspaceActionsCell: FC<WorkspaceActionsCellProps> = ({
onError: onActionError,
});

// State for stop confirmation dialog
const [isStopConfirmOpen, setIsStopConfirmOpen] = useState(false);

const isRetrying =
startWorkspaceMutation.isPending ||
stopWorkspaceMutation.isPending ||
Expand DownExpand Up@@ -535,6 +541,16 @@ const WorkspaceActionsCell: FC<WorkspaceActionsCellProps> = ({
</PrimaryAction>
)}

{abilities.actions.includes("stop") && (
<PrimaryAction
onClick={() => setIsStopConfirmOpen(true)}
isLoading={stopWorkspaceMutation.isPending}
label="Stop workspace"
>
<SquareIcon />
</PrimaryAction>
)}

{abilities.actions.includes("updateAndStart") && (
<>
<PrimaryAction
Expand DownExpand Up@@ -573,6 +589,20 @@ const WorkspaceActionsCell: FC<WorkspaceActionsCellProps> = ({
disabled={!abilities.canAcceptJobs}
/>
</div>

{/* Stop workspace confirmation dialog */}
<ConfirmDialog
open={isStopConfirmOpen}
title="Stop workspace"
description={`Are you sure you want to stop the workspace "${workspace.name}"? This will terminate all running processes and disconnect any active sessions.`}
confirmText="Stop"
onClose={() => setIsStopConfirmOpen(false)}
onConfirm={() => {
stopWorkspaceMutation.mutate({});
setIsStopConfirmOpen(false);
}}
type="delete"
/>
</TableCell>
);
};
Expand All@@ -593,7 +623,12 @@ const PrimaryAction: FC<PrimaryActionProps> = ({
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<Button variant="outline" size="icon-lg" onClick={onClick}>
<Button
variant="outline"
size="icon-lg"
onClick={onClick}
disabled={isLoading}
>
<Spinner loading={isLoading}>{children}</Spinner>
<span className="sr-only">{label}</span>
</Button>
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp