Overview lists: a duplicate button beside the trash while selecting copies the picked flows or dashboards as drafts, one request each, then clears the selection. Publish, delete and duplicate share one batch helper with their own toasts. Docs
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
ConfirmDelete,
|
||||
OverviewToolbar,
|
||||
useDeleteSelected,
|
||||
useDuplicateSelected,
|
||||
usePublishAll,
|
||||
} from "@/components/Common/OverviewToolbar"
|
||||
import { PanelsDialog } from "@/components/Dashboard/PanelsDialog"
|
||||
@@ -112,6 +113,15 @@ function Dashboards() {
|
||||
() => queryClient.invalidateQueries({ queryKey: dashboardKeys.all }),
|
||||
)
|
||||
|
||||
const duplicate = useDuplicateSelected(
|
||||
(dashboard) => DashboardsService.duplicateDashboard({ name: dashboard }),
|
||||
"dashboard",
|
||||
() => {
|
||||
selection.clear()
|
||||
queryClient.invalidateQueries({ queryKey: dashboardKeys.all })
|
||||
},
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="grid gap-6">
|
||||
<div className="grid gap-1">
|
||||
@@ -140,6 +150,8 @@ function Dashboards() {
|
||||
onPublishAll={() => publishAll.mutate(drafts)}
|
||||
selectedCount={selection.selected.length}
|
||||
onDeleteSelected={() => setDeleteOpen(true)}
|
||||
duplicating={duplicate.isPending}
|
||||
onDuplicateSelected={() => duplicate.mutate(selection.selected)}
|
||||
>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
ConfirmDelete,
|
||||
OverviewToolbar,
|
||||
useDeleteSelected,
|
||||
useDuplicateSelected,
|
||||
usePublishAll,
|
||||
} from "@/components/Common/OverviewToolbar"
|
||||
import { AlsoDeleteRuns } from "@/components/Flow/FlowPanel"
|
||||
@@ -96,6 +97,15 @@ function Flows() {
|
||||
() => queryClient.invalidateQueries({ queryKey: flowKeys.all }),
|
||||
)
|
||||
|
||||
const duplicate = useDuplicateSelected(
|
||||
(flow) => FlowsService.duplicateFlow({ name: flow }),
|
||||
"flow",
|
||||
() => {
|
||||
selection.clear()
|
||||
queryClient.invalidateQueries({ queryKey: flowKeys.all })
|
||||
},
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="grid gap-6">
|
||||
<div className="grid gap-1">
|
||||
@@ -122,6 +132,8 @@ function Flows() {
|
||||
setWithRuns(false)
|
||||
setDeleteOpen(true)
|
||||
}}
|
||||
duplicating={duplicate.isPending}
|
||||
onDuplicateSelected={() => duplicate.mutate(selection.selected)}
|
||||
/>
|
||||
<DialogContent>
|
||||
<form
|
||||
|
||||
Reference in New Issue
Block a user