Add delete action in workflows table (#802)

Co-authored-by: Muhammed Salih Altun <muhammedsalihaltun@gmail.com>
This commit is contained in:
Kerem Yilmaz
2024-09-10 11:30:48 -07:00
committed by GitHub
parent c4efdbdbc5
commit 4800fe4f0a
4 changed files with 101 additions and 65 deletions

View File

@@ -28,7 +28,6 @@ import { useCredentialGetter } from "@/hooks/useCredentialGetter";
import { basicTimeFormat } from "@/util/timeFormat";
import { cn } from "@/util/utils";
import {
CounterClockwiseClockIcon,
Pencil2Icon,
PlayIcon,
PlusIcon,
@@ -36,10 +35,10 @@ import {
} from "@radix-ui/react-icons";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { useNavigate, useSearchParams } from "react-router-dom";
import { WorkflowsBetaAlertCard } from "./WorkflowsBetaAlertCard";
import { WorkflowTitle } from "./WorkflowTitle";
import { WorkflowCreateYAMLRequest } from "./types/workflowYamlTypes";
import { stringify as convertToYAML } from "yaml";
import { DeleteWorkflowButton } from "./editor/DeleteWorkflowButton";
import { WorkflowCreateYAMLRequest } from "./types/workflowYamlTypes";
import { WorkflowTitle } from "./WorkflowTitle";
const emptyWorkflowRequest: WorkflowCreateYAMLRequest = {
title: "New Workflow",
@@ -114,10 +113,6 @@ function Workflows() {
},
});
if (workflows?.length === 0 && workflowsPage === 1) {
return <WorkflowsBetaAlertCard />;
}
function handleRowClick(
event: React.MouseEvent<HTMLTableCellElement>,
workflowPermanentId: string,
@@ -215,25 +210,6 @@ function Workflows() {
</TableCell>
<TableCell>
<div className="flex justify-end gap-2">
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<Button
size="icon"
variant="outline"
onClick={(event) => {
handleIconClick(
event,
`/workflows/${workflow.workflow_permanent_id}/runs`,
);
}}
>
<CounterClockwiseClockIcon className="h-4 w-4" />
</Button>
</TooltipTrigger>
<TooltipContent>View Past Runs</TooltipContent>
</Tooltip>
</TooltipProvider>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
@@ -272,6 +248,9 @@ function Workflows() {
<TooltipContent>Create New Run</TooltipContent>
</Tooltip>
</TooltipProvider>
<DeleteWorkflowButton
id={workflow.workflow_permanent_id}
/>
</div>
</TableCell>
</TableRow>