Flow delete offers to delete its runs, history included
DELETE /runs?flow= removes every Run row of the flow but left its flow_run rows, so a deleted flow kept appearing in the history. history=true now drops those too, and the flow delete dialogs (editor and bulk) send it when "Also delete its runs" is ticked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WgBfkm4rCmtd1T4vHWjEPx
This commit is contained in:
@@ -3,7 +3,7 @@ import { createFileRoute, useNavigate } from "@tanstack/react-router"
|
||||
import { Workflow } from "lucide-react"
|
||||
import { useState } from "react"
|
||||
|
||||
import { FlowsService } from "@/client"
|
||||
import { FlowsService, RunsService } from "@/client"
|
||||
import { OverviewCard, useSelection } from "@/components/Common/OverviewCard"
|
||||
import {
|
||||
ConfirmDelete,
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
useDeleteSelected,
|
||||
usePublishAll,
|
||||
} from "@/components/Common/OverviewToolbar"
|
||||
import { AlsoDeleteRuns } from "@/components/Flow/FlowPanel"
|
||||
import { flowKeys, flowsQueryOptions } from "@/components/Flow/queries"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import {
|
||||
@@ -43,6 +44,7 @@ function Flows() {
|
||||
const [search, setSearch] = useState("")
|
||||
const [dialogOpen, setDialogOpen] = useState(false)
|
||||
const [deleteOpen, setDeleteOpen] = useState(false)
|
||||
const [withRuns, setWithRuns] = useState(false)
|
||||
|
||||
const create = useMutation({
|
||||
mutationFn: (flow: string) =>
|
||||
@@ -86,7 +88,10 @@ function Flows() {
|
||||
|
||||
const selection = useSelection(flows.map((flow) => flow.name))
|
||||
const remove = useDeleteSelected(
|
||||
(flow) => FlowsService.deleteFlow({ name: flow }),
|
||||
async (flow) => {
|
||||
await FlowsService.deleteFlow({ name: flow })
|
||||
if (withRuns) await RunsService.deleteRuns({ flow, history: true })
|
||||
},
|
||||
"flow",
|
||||
() => queryClient.invalidateQueries({ queryKey: flowKeys.all }),
|
||||
)
|
||||
@@ -113,7 +118,10 @@ function Flows() {
|
||||
publishing={publishAll.isPending}
|
||||
onPublishAll={() => publishAll.mutate(drafts)}
|
||||
selectedCount={selection.selected.length}
|
||||
onDeleteSelected={() => setDeleteOpen(true)}
|
||||
onDeleteSelected={() => {
|
||||
setWithRuns(false)
|
||||
setDeleteOpen(true)
|
||||
}}
|
||||
/>
|
||||
<DialogContent>
|
||||
<form
|
||||
@@ -160,7 +168,13 @@ function Flows() {
|
||||
setDeleteOpen(false)
|
||||
remove.mutate(selection.selected)
|
||||
}}
|
||||
/>
|
||||
>
|
||||
<AlsoDeleteRuns
|
||||
checked={withRuns}
|
||||
onCheckedChange={setWithRuns}
|
||||
plural={selection.selected.length > 1}
|
||||
/>
|
||||
</ConfirmDelete>
|
||||
|
||||
{isPending ? (
|
||||
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">
|
||||
|
||||
Reference in New Issue
Block a user