diff --git a/apps/dokploy/components/dashboard/docker/logs/docker-logs-id.tsx b/apps/dokploy/components/dashboard/docker/logs/docker-logs-id.tsx index 3e490a1f6..110e0faa3 100644 --- a/apps/dokploy/components/dashboard/docker/logs/docker-logs-id.tsx +++ b/apps/dokploy/components/dashboard/docker/logs/docker-logs-id.tsx @@ -3,7 +3,7 @@ import { Input } from "@/components/ui/input"; import { api } from "@/utils/api"; import { Download as DownloadIcon, Loader2 } from "lucide-react"; import React, { useEffect, useRef } from "react"; -import { SinceLogsFilter } from "./since-logs-filter"; +import { SinceLogsFilter, type TimeFilter } from "./since-logs-filter"; import { StatusLogsFilter } from "./status-logs-filter"; import { TerminalLine } from "./terminal-line"; import { type LogLine, getLogType, parseLogs } from "./utils"; @@ -13,8 +13,6 @@ interface Props { serverId?: string | null; } -type TimeFilter = "all" | "timestamp" | "1h" | "6h" | "24h" | "168h" | "720h"; - export const priorities = [ { label: "Info", @@ -84,14 +82,10 @@ export const DockerLogsId: React.FC = ({ containerId, serverId }) => { setLines(Number(e.target.value) || 1); }; - const handleSince = (value: string) => { - if (value === "timestamp") { - setShowTimestamp(!showTimestamp); - } else { - setRawLogs(""); - setFilteredLogs([]); - setSince(value); - } + const handleSince = (value: TimeFilter) => { + setRawLogs(""); + setFilteredLogs([]); + setSince(value); }; useEffect(() => { diff --git a/apps/dokploy/components/dashboard/docker/logs/since-logs-filter.tsx b/apps/dokploy/components/dashboard/docker/logs/since-logs-filter.tsx index 6cc8785b3..09dbaff89 100644 --- a/apps/dokploy/components/dashboard/docker/logs/since-logs-filter.tsx +++ b/apps/dokploy/components/dashboard/docker/logs/since-logs-filter.tsx @@ -17,9 +17,9 @@ import { cn } from "@/lib/utils"; import { CheckIcon } from "lucide-react"; import React from "react"; -type TimeFilter = "all" | "1h" | "6h" | "24h" | "168h" | "720h"; +export type TimeFilter = "all" | "1h" | "6h" | "24h" | "168h" | "720h"; -const timeRanges = [ +const timeRanges: Array<{ label: string; value: TimeFilter }> = [ { label: "All time", value: "all", @@ -44,7 +44,7 @@ const timeRanges = [ label: "Last 30 days", value: "720h", }, -]; +] as const; interface SinceLogsFilterProps { value: string;