From d8787ec11d5c0780491f28f053068abdc776ec7f Mon Sep 17 00:00:00 2001 From: 190km Date: Tue, 3 Dec 2024 03:55:56 +0100 Subject: [PATCH] style: added autodeploy switch --- .../dashboard/application/general/show.tsx | 46 +++++++++---------- .../dashboard/compose/general/actions.tsx | 43 ++++++++--------- apps/dokploy/components/ui/switch.tsx | 6 ++- 3 files changed, 49 insertions(+), 46 deletions(-) diff --git a/apps/dokploy/components/dashboard/application/general/show.tsx b/apps/dokploy/components/dashboard/application/general/show.tsx index 277ae1eb..65c99e9b 100644 --- a/apps/dokploy/components/dashboard/application/general/show.tsx +++ b/apps/dokploy/components/dashboard/application/general/show.tsx @@ -2,9 +2,9 @@ import { ShowBuildChooseForm } from "@/components/dashboard/application/build/sh import { ShowProviderForm } from "@/components/dashboard/application/general/generic/show"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; -import { Toggle } from "@/components/ui/toggle"; +import { Switch } from "@/components/ui/switch"; import { api } from "@/utils/api"; -import { CheckCircle2, Terminal } from "lucide-react"; +import { Terminal } from "lucide-react"; import React from "react"; import { toast } from "sonner"; import { DockerTerminalModal } from "../../settings/web-server/docker-terminal-modal"; @@ -39,27 +39,6 @@ export const ShowGeneralApplication = ({ applicationId }: Props) => { appName={data?.appName || ""} /> - { - await update({ - applicationId, - autoDeploy: enabled, - }) - .then(async () => { - toast.success("Auto Deploy Updated"); - await refetch(); - }) - .catch(() => { - toast.error("Error to update Auto Deploy"); - }); - }} - className="flex flex-row gap-2 items-center" - > - Autodeploy - {data?.autoDeploy && } - {data?.applicationStatus === "idle" ? ( @@ -75,6 +54,27 @@ export const ShowGeneralApplication = ({ applicationId }: Props) => { Open Terminal +
+ Autodeploy + { + await update({ + applicationId, + autoDeploy: enabled, + }) + .then(async () => { + toast.success("Auto Deploy Updated"); + await refetch(); + }) + .catch(() => { + toast.error("Error to update Auto Deploy"); + }); + }} + className="flex flex-row gap-2 items-center" + /> +
diff --git a/apps/dokploy/components/dashboard/compose/general/actions.tsx b/apps/dokploy/components/dashboard/compose/general/actions.tsx index 365e37f5..1531942f 100644 --- a/apps/dokploy/components/dashboard/compose/general/actions.tsx +++ b/apps/dokploy/components/dashboard/compose/general/actions.tsx @@ -8,7 +8,7 @@ import { DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; -import { Toggle } from "@/components/ui/toggle"; +import { Switch } from "@/components/ui/switch"; import { api } from "@/utils/api"; import { CheckCircle2, ExternalLink, Globe, Terminal } from "lucide-react"; import Link from "next/link"; @@ -50,26 +50,6 @@ export const ComposeActions = ({ composeId }: Props) => { return (
- { - await update({ - composeId, - autoDeploy: enabled, - }) - .then(async () => { - toast.success("Auto Deploy Updated"); - await refetch(); - }) - .catch(() => { - toast.error("Error to update Auto Deploy"); - }); - }} - className="flex flex-row gap-2 items-center" - > - Autodeploy {data?.autoDeploy && } - {data?.composeType === "docker-compose" && ( @@ -84,6 +64,27 @@ export const ComposeActions = ({ composeId }: Props) => { Open Terminal +
+ Autodeploy + { + await update({ + composeId, + autoDeploy: enabled, + }) + .then(async () => { + toast.success("Auto Deploy Updated"); + await refetch(); + }) + .catch(() => { + toast.error("Error to update Auto Deploy"); + }); + }} + className="flex flex-row gap-2 items-center" + /> +
{domains.length > 0 && ( diff --git a/apps/dokploy/components/ui/switch.tsx b/apps/dokploy/components/ui/switch.tsx index 96809024..21cb8582 100644 --- a/apps/dokploy/components/ui/switch.tsx +++ b/apps/dokploy/components/ui/switch.tsx @@ -1,3 +1,5 @@ +"use client"; + import * as SwitchPrimitives from "@radix-ui/react-switch"; import * as React from "react"; @@ -9,7 +11,7 @@ const Switch = React.forwardRef< >(({ className, ...props }, ref) => (