confirmation popup when deleting tasks (#4627)
This commit is contained in:
1 parent
52571ccee8
commit
64963c4e9c
3 files changed
+19
-1
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"claude-dev": patch
|
||||
---
|
||||
|
||||
Add confirmation popup when deleting tasks
|
||||
@@ -1,5 +1,6 @@
|
||||
import path from "path"
|
||||
import fs from "fs/promises"
|
||||
import vscode from "vscode"
|
||||
import { Controller } from ".."
|
||||
import { Empty, StringArrayRequest, BooleanRequest } from "../../../shared/proto/common"
|
||||
import { TaskMethodHandler } from "./index"
|
||||
@@ -20,6 +21,18 @@ export const deleteTasksWithIds: TaskMethodHandler = async (
|
||||
throw new Error("Missing task IDs")
|
||||
}
|
||||
|
||||
const taskCount = request.value.length
|
||||
const message =
|
||||
taskCount === 1
|
||||
? "Are you sure you want to delete this task? This action cannot be undone."
|
||||
: `Are you sure you want to delete these ${taskCount} tasks? This action cannot be undone.`
|
||||
|
||||
const userChoice = await vscode.window.showWarningMessage(message, { modal: true }, "Delete")
|
||||
|
||||
if (userChoice === undefined) {
|
||||
return Empty.create()
|
||||
}
|
||||
|
||||
for (const id of request.value) {
|
||||
await deleteTaskWithId(controller, id)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ const DeleteTaskButton: React.FC<{
|
||||
taskSize: string
|
||||
taskId?: string
|
||||
}> = ({ taskSize, taskId }) => (
|
||||
<HeroTooltip content="Delete Task & Checkpoints">
|
||||
<HeroTooltip content="Delete Task">
|
||||
<VSCodeButton
|
||||
appearance="icon"
|
||||
onClick={() => taskId && TaskServiceClient.deleteTasksWithIds(StringArrayRequest.create({ value: [taskId] }))}
|
||||
|
||||
Reference in new issue
Block a user