mirror of
https://github.com/andwati/dokploy.git
synced 2026-12-01 07:28:45 +00:00
feat: add dialog action for enabling/disabling Traefik dashboard and enhance manage ports component with warning alert
This commit is contained in:
+34
-6
@@ -1,5 +1,7 @@
|
|||||||
import { useTranslation } from "next-i18next";
|
import { useTranslation } from "next-i18next";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
|
import { AlertBlock } from "@/components/shared/alert-block";
|
||||||
|
import { DialogAction } from "@/components/shared/dialog-action";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
@@ -85,7 +87,26 @@ export const ShowTraefikActions = ({ serverId }: Props) => {
|
|||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</EditTraefikEnv>
|
</EditTraefikEnv>
|
||||||
|
|
||||||
<DropdownMenuItem
|
<DialogAction
|
||||||
|
title={
|
||||||
|
haveTraefikDashboardPortEnabled
|
||||||
|
? "Disable Traefik Dashboard"
|
||||||
|
: "Enable Traefik Dashboard"
|
||||||
|
}
|
||||||
|
description={
|
||||||
|
<div className="space-y-4">
|
||||||
|
<AlertBlock type="warning">
|
||||||
|
The Traefik container will be recreated from scratch. This
|
||||||
|
means the container will be deleted and created again, which
|
||||||
|
may cause downtime in your applications.
|
||||||
|
</AlertBlock>
|
||||||
|
<p>
|
||||||
|
Are you sure you want to{" "}
|
||||||
|
{haveTraefikDashboardPortEnabled ? "disable" : "enable"} the
|
||||||
|
Traefik dashboard?
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await toggleDashboard({
|
await toggleDashboard({
|
||||||
enableDashboard: !haveTraefikDashboardPortEnabled,
|
enableDashboard: !haveTraefikDashboardPortEnabled,
|
||||||
@@ -104,12 +125,19 @@ export const ShowTraefikActions = ({ serverId }: Props) => {
|
|||||||
toast.error(errorMessage);
|
toast.error(errorMessage);
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
className="w-full cursor-pointer space-x-3"
|
disabled={toggleDashboardIsLoading}
|
||||||
|
type="default"
|
||||||
>
|
>
|
||||||
<span>
|
<DropdownMenuItem
|
||||||
{haveTraefikDashboardPortEnabled ? "Disable" : "Enable"} Dashboard
|
onSelect={(e) => e.preventDefault()}
|
||||||
</span>
|
className="w-full cursor-pointer space-x-3"
|
||||||
</DropdownMenuItem>
|
>
|
||||||
|
<span>
|
||||||
|
{haveTraefikDashboardPortEnabled ? "Disable" : "Enable"}{" "}
|
||||||
|
Dashboard
|
||||||
|
</span>
|
||||||
|
</DropdownMenuItem>
|
||||||
|
</DialogAction>
|
||||||
<ManageTraefikPorts serverId={serverId}>
|
<ManageTraefikPorts serverId={serverId}>
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
onSelect={(e) => e.preventDefault()}
|
onSelect={(e) => e.preventDefault()}
|
||||||
|
|||||||
@@ -158,11 +158,11 @@ export const ManageTraefikPorts = ({ children, serverId }: Props) => {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<ScrollArea className="h-[400px] pr-4">
|
<ScrollArea className="pr-4">
|
||||||
<div className="grid gap-4">
|
<div className="grid gap-4">
|
||||||
{fields.map((field, index) => (
|
{fields.map((field, index) => (
|
||||||
<Card key={field.id} className="bg-transparent">
|
<Card key={field.id} className="bg-transparent">
|
||||||
<CardContent className="grid grid-cols-[1fr_1fr_1fr_auto] gap-4 p-4 transparent">
|
<CardContent className="grid grid-cols-4 gap-4 p-4 transparent">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name={`ports.${index}.targetPort`}
|
name={`ports.${index}.targetPort`}
|
||||||
@@ -305,6 +305,12 @@ export const ManageTraefikPorts = ({ children, serverId }: Props) => {
|
|||||||
</div>
|
</div>
|
||||||
</AlertBlock>
|
</AlertBlock>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<AlertBlock type="warning">
|
||||||
|
The Traefik container will be recreated from scratch. This
|
||||||
|
means the container will be deleted and created again, which
|
||||||
|
may cause downtime in your applications.
|
||||||
|
</AlertBlock>
|
||||||
</div>
|
</div>
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Reference in New Issue
Block a user