From 1c4414165d4aedbf6e28afab7a94c8fb7c053373 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Thu, 9 Jul 2026 02:47:12 -0600 Subject: [PATCH] feat: enhance container dashboard with new features - Added a "Ports" column to display container port information with sorting functionality. - Implemented a dropdown menu item to copy the Container ID to the clipboard with a success toast notification. - Introduced a state filter dropdown to filter containers by their current state, with options for all defined states. - Added a refresh button to allow manual refreshing of the container list. --- .../dashboard/docker/show/columns.tsx | 36 ++++++++- .../dashboard/docker/show/show-containers.tsx | 75 +++++++++++++++++-- 2 files changed, 102 insertions(+), 9 deletions(-) diff --git a/apps/dokploy/components/dashboard/docker/show/columns.tsx b/apps/dokploy/components/dashboard/docker/show/columns.tsx index fa06f4d70..4b108344e 100644 --- a/apps/dokploy/components/dashboard/docker/show/columns.tsx +++ b/apps/dokploy/components/dashboard/docker/show/columns.tsx @@ -1,10 +1,13 @@ import type { ColumnDef } from "@tanstack/react-table"; +import copy from "copy-to-clipboard"; import { ArrowUpDown, MoreHorizontal } from "lucide-react"; +import { toast } from "sonner"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { DropdownMenu, DropdownMenuContent, + DropdownMenuItem, DropdownMenuLabel, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; @@ -37,6 +40,7 @@ export const columns: ColumnDef[] = [ }, { accessorKey: "state", + filterFn: "equals", header: ({ column }) => { return ( + ); + }, + cell: ({ row }) => { + const value = row.getValue("ports") as string; + return ( +
+ {value} +
+ ); + }, + }, { id: "actions", enableHiding: false, @@ -115,6 +141,14 @@ export const columns: ColumnDef[] = [ Actions + { + copy(container.containerId); + toast.success("Container ID copied to clipboard"); + }} + > + Copy Container ID + { - const { data, isPending } = api.docker.getContainers.useQuery({ - serverId, - }); + const { data, isPending, refetch, isRefetching } = + api.docker.getContainers.useQuery( + { + serverId, + }, + { + refetchInterval: 10_000, + }, + ); const [sorting, setSorting] = React.useState([]); const [columnFilters, setColumnFilters] = React.useState( @@ -106,12 +129,48 @@ export const ShowContainers = ({ serverId }: Props) => { } className="md:max-w-sm" /> + + -