mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-15 16:35:17 +00:00
* refactor: add sidebar * chore: add deps * refactor: update sidebar * refactor: another layout * refactor: update variant * refactor: change layout * refactor: change variant * refactor: enhance sidebar navigation with active state management * feat: add project button to dashboard * Merge branch 'canary' into feat/add-sidebar * refactor: add loader * refactor: update destinations and refactor * refactor: ui refactor certificates * refactor: delete unused files * refactor: remove unused files and duplicate registry * refactor: update style registry * refactor: add new design registry * refactor: enhance git providers * refactor: remove duplicate files * refactor: update * refactor: update users * refactor: delete unused files * refactor: update profile * refactor: apply changes * refactor: update UI * refactor: enhance Docker monitoring UI layout * refactor: add theme toggle and language selection to user navigation (#1083) * refactor: remove unused files * feat: add filter to services * refactor: add active items * refactor: remove tab prop * refactor: remove unused files * refactor: remove duplicated files * refactor: remove unused files * refactor: remove duplicate files * refactor: remove unused files * refactor: delete unused files * refactor: remove unsued files * refactor: delete unused files * refactor: lint * refactor: remove unused secuirty * refactor: delete unused files * refactor: delete unused files * remove imports * refactor: add update button * refactor: delete unused files * refactor: remove unused code * refactor: remove unused files * refactor: update login page * refactor: update login UI * refactor: update ui reset password * refactor: add justify end * feat: add suscriptions * feat: add sheet * feat: add logs for postgres * feat: add logs for all databases * feat: add server logs with drawer logs * refactor: remove unused files * refactor: add refetch when closing * refactor: fix linter * chore: bump node-20 * revert * refactor: fix conflicts * refactor: update * refactor: add missing deps * refactor: delete duplicate files * refactor: delete unsued files * chore: lint * refactor: remove unsued file * refactor: add refetch * refactor: remove duplicated files * refactor: delete unused files * refactor: update setup onboarding * refactor: add breadcrumb * refactor: apply updates * refactor: add faker * refactor: use 0 in validation * refactor: show correct state * refactor: update --------- Co-authored-by: vishalkadam47 <[email protected]> Co-authored-by: Vishal kadam <[email protected]>
135 lines
4.0 KiB
TypeScript
135 lines
4.0 KiB
TypeScript
import { AlertBlock } from "@/components/shared/alert-block";
|
|
import { DialogAction } from "@/components/shared/dialog-action";
|
|
import { Button } from "@/components/ui/button";
|
|
import {
|
|
Card,
|
|
CardContent,
|
|
CardDescription,
|
|
CardHeader,
|
|
CardTitle,
|
|
} from "@/components/ui/card";
|
|
import { type RouterOutputs, api } from "@/utils/api";
|
|
import { ArrowDownUp } from "lucide-react";
|
|
import Link from "next/link";
|
|
import * as React from "react";
|
|
import { toast } from "sonner";
|
|
import { RequestDistributionChart } from "./request-distribution-chart";
|
|
import { RequestsTable } from "./requests-table";
|
|
|
|
export type LogEntry = NonNullable<
|
|
RouterOutputs["settings"]["readStatsLogs"]["data"]
|
|
>[0];
|
|
|
|
export const ShowRequests = () => {
|
|
const { data: isLogRotateActive, refetch: refetchLogRotate } =
|
|
api.settings.getLogRotateStatus.useQuery();
|
|
|
|
const { mutateAsync: toggleLogRotate } =
|
|
api.settings.toggleLogRotate.useMutation();
|
|
|
|
const { data: isActive, refetch } =
|
|
api.settings.haveActivateRequests.useQuery();
|
|
const { mutateAsync: toggleRequests } =
|
|
api.settings.toggleRequests.useMutation();
|
|
|
|
return (
|
|
<>
|
|
<div className="w-full">
|
|
<Card className="h-full bg-sidebar p-2.5 rounded-xl max-w-8xl mx-auto">
|
|
<div className="rounded-xl bg-background shadow-md ">
|
|
<CardHeader className="">
|
|
<CardTitle className="text-xl flex flex-row gap-2">
|
|
<ArrowDownUp className="size-6 text-muted-foreground self-center" />
|
|
Requests
|
|
</CardTitle>
|
|
<CardDescription>
|
|
See all the incoming requests that pass trough Traefik
|
|
</CardDescription>
|
|
|
|
<AlertBlock type="warning">
|
|
When you activate, you need to reload traefik to apply the
|
|
changes, you can reload traefik in{" "}
|
|
<Link
|
|
href="/dashboard/settings/server"
|
|
className="text-primary"
|
|
>
|
|
Settings
|
|
</Link>
|
|
</AlertBlock>
|
|
</CardHeader>
|
|
<CardContent className="space-y-2 py-8 border-t">
|
|
<div className="flex w-full gap-4 justify-end">
|
|
<DialogAction
|
|
title={isActive ? "Deactivate Requests" : "Activate Requests"}
|
|
description="You will also need to restart Traefik to apply the changes"
|
|
type={isActive ? "destructive" : "default"}
|
|
onClick={async () => {
|
|
await toggleRequests({ enable: !isActive })
|
|
.then(() => {
|
|
refetch();
|
|
toast.success(
|
|
`Requests ${isActive ? "deactivated" : "activated"}`,
|
|
);
|
|
})
|
|
.catch((err) => {
|
|
toast.error(err.message);
|
|
});
|
|
}}
|
|
>
|
|
<Button>{isActive ? "Deactivate" : "Activate"}</Button>
|
|
</DialogAction>
|
|
|
|
<DialogAction
|
|
title={
|
|
isLogRotateActive
|
|
? "Activate Log Rotate"
|
|
: "Deactivate Log Rotate"
|
|
}
|
|
description={
|
|
isLogRotateActive
|
|
? "This will make the logs rotate on interval 1 day and maximum size of 100 MB and maximum 6 logs"
|
|
: "The log rotation will be disabled"
|
|
}
|
|
onClick={() => {
|
|
toggleLogRotate({
|
|
enable: !isLogRotateActive,
|
|
})
|
|
.then(() => {
|
|
toast.success(
|
|
`Log rotate ${isLogRotateActive ? "activated" : "deactivated"}`,
|
|
);
|
|
refetchLogRotate();
|
|
})
|
|
.catch((err) => {
|
|
toast.error(err.message);
|
|
});
|
|
}}
|
|
>
|
|
<Button variant="secondary">
|
|
{isLogRotateActive
|
|
? "Activate Log Rotate"
|
|
: "Deactivate Log Rotate"}
|
|
</Button>
|
|
</DialogAction>
|
|
</div>
|
|
|
|
<div>
|
|
{isActive ? (
|
|
<RequestDistributionChart />
|
|
) : (
|
|
<div className="flex items-center justify-center min-h-[25vh]">
|
|
<span className="text-muted-foreground py-6">
|
|
You need to activate requests
|
|
</span>
|
|
</div>
|
|
)}
|
|
{isActive && <RequestsTable />}
|
|
</div>
|
|
</CardContent>
|
|
</div>
|
|
</Card>
|
|
</div>
|
|
</>
|
|
);
|
|
};
|