From c6c259f926cac18947c84daad70a5695ecb9ca4b Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Tue, 11 Aug 2026 02:01:21 -0600 Subject: [PATCH] refactor: add icon support for deployments and services in UI components --- .../deployments/show-deployments-table.tsx | 17 ++++++++++--- .../components/shared/advance-breadcrumb.tsx | 25 +++++++++++++++---- packages/server/src/services/deployment.ts | 4 +-- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/apps/dokploy/components/dashboard/deployments/show-deployments-table.tsx b/apps/dokploy/components/dashboard/deployments/show-deployments-table.tsx index 770d4efd0..11ffae7d0 100644 --- a/apps/dokploy/components/dashboard/deployments/show-deployments-table.tsx +++ b/apps/dokploy/components/dashboard/deployments/show-deployments-table.tsx @@ -14,10 +14,11 @@ import { import type { inferRouterOutputs } from "@trpc/server"; import { ArrowUpDown, - Boxes, ChevronLeft, ChevronRight, + CircuitBoard, ExternalLink, + GlobeIcon, Loader2, Rocket, Server, @@ -71,6 +72,7 @@ function getServiceInfo(d: DeploymentRow) { return { type: "Application" as const, name: app.name, + icon: app.icon, projectId: app.environment.project.projectId, environmentId: app.environment.environmentId, projectName: app.environment.project.name, @@ -83,6 +85,7 @@ function getServiceInfo(d: DeploymentRow) { return { type: "Compose" as const, name: comp.name, + icon: comp.icon, projectId: comp.environment.project.projectId, environmentId: comp.environment.environmentId, projectName: comp.environment.project.name, @@ -175,10 +178,16 @@ export function ShowDeploymentsTable() { if (!info) return —; return (
- {info.type === "Application" ? ( - + {info.icon ? ( + {info.name} + ) : info.type === "Application" ? ( + ) : ( - + )}
{info.name} diff --git a/apps/dokploy/components/shared/advance-breadcrumb.tsx b/apps/dokploy/components/shared/advance-breadcrumb.tsx index cd1682e1c..06e4e618c 100644 --- a/apps/dokploy/components/shared/advance-breadcrumb.tsx +++ b/apps/dokploy/components/shared/advance-breadcrumb.tsx @@ -45,10 +45,12 @@ type ServiceItem = { id: string; name: string; type: ServiceType; + icon: string | null; }; type NamedService = { name: string; + icon?: string | null; }; type EnvironmentServiceCollections = { @@ -116,8 +118,20 @@ const getStringQueryParam = (value: string | string[] | undefined) => const includesSearch = (value: string | null | undefined, search: string) => value?.toLowerCase().includes(search.toLowerCase()) ?? false; -const getServiceIcon = (type: ServiceType, className = "size-4") => { - const Icon = SERVICE_ICONS[type]; +const getServiceIcon = ( + service: Pick, + className = "size-4", +) => { + if (service.icon) { + return ( + + ); + } + const Icon = SERVICE_ICONS[service.type]; return ; }; @@ -127,7 +141,7 @@ const countEnvironmentServices = (environment: ServiceCollections): number => 0, ); -const mapServices = ( +const mapServices = ( items: readonly T[], getId: (item: T) => string, type: ServiceType, @@ -136,6 +150,7 @@ const mapServices = ( id: getId(item), name: item.name, type, + icon: item.icon ?? null, })); const extractServicesFromEnvironment = ( @@ -550,7 +565,7 @@ export const AdvanceBreadcrumb = () => { aria-expanded={serviceOpen} className="h-auto px-2 py-1.5 hover:bg-accent gap-2" > - {getServiceIcon(currentService.type)} + {getServiceIcon(currentService)} {currentService.name} @@ -589,7 +604,7 @@ export const AdvanceBreadcrumb = () => { >
- {getServiceIcon(service.type)} + {getServiceIcon(service)}
diff --git a/packages/server/src/services/deployment.ts b/packages/server/src/services/deployment.ts index b78e6c203..18577a861 100644 --- a/packages/server/src/services/deployment.ts +++ b/packages/server/src/services/deployment.ts @@ -802,7 +802,7 @@ export const findAllDeploymentsByComposeId = async (composeId: string) => { const centralizedDeploymentsWith = { application: { - columns: { applicationId: true, name: true, appName: true }, + columns: { applicationId: true, name: true, appName: true, icon: true }, with: { environment: { columns: { environmentId: true, name: true }, @@ -821,7 +821,7 @@ const centralizedDeploymentsWith = { }, }, compose: { - columns: { composeId: true, name: true, appName: true }, + columns: { composeId: true, name: true, appName: true, icon: true }, with: { environment: { columns: { environmentId: true, name: true },