From 406cfaefeff6ccfa9308f7f7597ba939a978c370 Mon Sep 17 00:00:00 2001 From: karamvir Date: Tue, 29 Aug 2023 20:07:27 -0700 Subject: [PATCH] cleanup --- frontend/src/resources/deployment/actions.tsx | 64 ++----------------- 1 file changed, 7 insertions(+), 57 deletions(-) diff --git a/frontend/src/resources/deployment/actions.tsx b/frontend/src/resources/deployment/actions.tsx index 66d4f981c..6b8786a26 100644 --- a/frontend/src/resources/deployment/actions.tsx +++ b/frontend/src/resources/deployment/actions.tsx @@ -1,16 +1,15 @@ -import { ActionWithDialog, ConfirmButton } from "@components/util"; -import { Play, Trash, Pause, Rocket } from "lucide-react"; -import { useExecute, useRead, useWrite } from "@hooks"; +import { + ActionButton, + ActionWithDialog, + ConfirmButton, +} from "@components/util"; +import { Play, Trash, Pause, Rocket, Pen } from "lucide-react"; +import { useExecute, useInvalidate, useRead, useWrite } from "@hooks"; import { DockerContainerState } from "@monitor/client/dist/types"; import { useNavigate } from "react-router-dom"; import { Input } from "@ui/input"; -import { useState } from "react"; -import { useQueryClient } from "@tanstack/react-query"; import { useToast } from "@ui/toast/use-toast"; -import { Input } from "@ui/input"; import { useState } from "react"; -import { useQueryClient } from "@tanstack/react-query"; -import { useToast } from "@ui/toast/use-toast"; interface DeploymentId { deployment_id: string; @@ -140,55 +139,6 @@ export const DeleteDeployment = ({ id }: { id: string }) => { ); }; -export const RenameDeployment = ({ id }: { id: string }) => { - const invalidate = useInvalidate(); - - const { toast } = useToast(); - const { mutate, isLoading } = useWrite("RenameDeployment", { - onSuccess: () => { - invalidate(["ListDeployments"]); - toast({ title: "Deployment Renamed" }); - set(""); - }, - }); - - const [name, set] = useState(""); - - return ( -
-
Rename Deployment
-
- set(e.target.value)} - className="w-96" - placeholder="Enter new name" - /> - } - disabled={isLoading} - onClick={() => mutate({ id, name })} - /> -
-
- ); - return ( - } - onClick={async () => { - await mutateAsync({ deployment_id: id }); - nav("/"); - }} - disabled={isLoading} - loading={deleting} - /> - ); -}; - export const RenameDeployment = ({ id }: { id: string }) => { const invalidate = useInvalidate();