mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: check if the traefik dashboard is enabled
This commit is contained in:
parent
b5da9291b4
commit
813ffabb8c
@ -28,6 +28,7 @@ import { ShowServerMiddlewareConfig } from "./web-server/show-server-middleware-
|
|||||||
import { ShowServerTraefikConfig } from "./web-server/show-server-traefik-config";
|
import { ShowServerTraefikConfig } from "./web-server/show-server-traefik-config";
|
||||||
import { TerminalModal } from "./web-server/terminal-modal";
|
import { TerminalModal } from "./web-server/terminal-modal";
|
||||||
import { UpdateServer } from "./web-server/update-server";
|
import { UpdateServer } from "./web-server/update-server";
|
||||||
|
import { EditTraefikEnv } from "./web-server/edit-traefik-env";
|
||||||
|
|
||||||
export const WebServer = () => {
|
export const WebServer = () => {
|
||||||
const { data, refetch } = api.admin.one.useQuery();
|
const { data, refetch } = api.admin.one.useQuery();
|
||||||
@ -67,6 +68,9 @@ export const WebServer = () => {
|
|||||||
const { mutateAsync: updateDockerCleanup } =
|
const { mutateAsync: updateDockerCleanup } =
|
||||||
api.settings.updateDockerCleanup.useMutation();
|
api.settings.updateDockerCleanup.useMutation();
|
||||||
|
|
||||||
|
const { data: haveTraefikDashboardPortEnabled, refetch: refetchDashboard } =
|
||||||
|
api.settings.haveTraefikDashboardPortEnabled.useQuery();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="rounded-lg w-full bg-transparent">
|
<Card className="rounded-lg w-full bg-transparent">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
@ -167,37 +171,38 @@ export const WebServer = () => {
|
|||||||
<span>View Traefik config</span>
|
<span>View Traefik config</span>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</ShowMainTraefikConfig>
|
</ShowMainTraefikConfig>
|
||||||
|
<EditTraefikEnv>
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
onClick={async () => {
|
onSelect={(e) => e.preventDefault()}
|
||||||
await toggleDashboard({
|
|
||||||
enableDashboard: true,
|
|
||||||
})
|
|
||||||
.then(async () => {
|
|
||||||
toast.success("Dashboard Enabled");
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
toast.error("Error to enable Dashboard");
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
className="w-full cursor-pointer space-x-3"
|
className="w-full cursor-pointer space-x-3"
|
||||||
>
|
>
|
||||||
<span>Enable Dashboard</span>
|
<span>Modify Env</span>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
|
</EditTraefikEnv>
|
||||||
|
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await toggleDashboard({
|
await toggleDashboard({
|
||||||
enableDashboard: false,
|
enableDashboard: !haveTraefikDashboardPortEnabled,
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
toast.success("Dashboard Disabled");
|
toast.success(
|
||||||
|
`${haveTraefikDashboardPortEnabled ? "Disabled" : "Enabled"} Dashboard`,
|
||||||
|
);
|
||||||
|
refetchDashboard();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
toast.error("Error to disable Dashboard");
|
toast.error(
|
||||||
|
`${haveTraefikDashboardPortEnabled ? "Disabled" : "Enabled"} Dashboard`,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
className="w-full cursor-pointer space-x-3"
|
className="w-full cursor-pointer space-x-3"
|
||||||
>
|
>
|
||||||
<span>Disable Dashboard</span>
|
<span>
|
||||||
|
{haveTraefikDashboardPortEnabled ? "Disable" : "Enable"}{" "}
|
||||||
|
Dashboard
|
||||||
|
</span>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
|
|
||||||
<DockerTerminalModal appName="dokploy-traefik">
|
<DockerTerminalModal appName="dokploy-traefik">
|
||||||
|
Loading…
Reference in New Issue
Block a user