From 19197ea9fa00b6eccbbf3f6c2a5397425edf509a Mon Sep 17 00:00:00 2001 From: ypratama Date: Wed, 2 Sep 2026 17:10:43 +0700 Subject: [PATCH] Feat: Add Edit Label button to Agent Actions --- src/app/(dashboard)/agents/columns.tsx | 13 +++++++++++- src/app/(dashboard)/agents/page.tsx | 2 ++ src/app/(dashboard)/agents/useAgentsData.ts | 22 ++++++++++++++++++++- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/app/(dashboard)/agents/columns.tsx b/src/app/(dashboard)/agents/columns.tsx index 35456d8..0ce1803 100644 --- a/src/app/(dashboard)/agents/columns.tsx +++ b/src/app/(dashboard)/agents/columns.tsx @@ -4,7 +4,7 @@ import { Column } from "@/components/ui/DataTable"; import { Agent } from "@/lib/actions/agentsCore"; import { Badge } from "@/components/ui/Badge"; import { resolveAgentLabel, type ManagedUser } from "@/lib/admin-api"; -import { Loader2, Trash2, CheckCircle2, XCircle, ChevronRight, UserCog, Eye, MapPin, Network } from "lucide-react"; +import { Loader2, Trash2, CheckCircle2, XCircle, ChevronRight, UserCog, Eye, MapPin, Network, Edit2 } from "lucide-react"; interface GetColumnsProps { role: string | null; @@ -18,6 +18,7 @@ interface GetColumnsProps { handleViewAs: (uuid: string, label: string) => void; openDelete: (agent: Agent) => void; handleEditLocation?: (agentUuid: string, agentLabel: string) => void; + handleEditLabel?: (agentUuid: string, currentLabel: string) => void; handleEditSubnet?: (agentUuid: string, agentLabel: string) => void; /** Set of agent UUIDs that already have a location saved */ locationUuids?: Set; @@ -35,6 +36,7 @@ export function getAgentColumns({ handleViewAs, openDelete, handleEditLocation, + handleEditLabel, handleEditSubnet, locationUuids = new Set(), }: GetColumnsProps): Column[] { @@ -128,6 +130,15 @@ export function getAgentColumns({ {(role === 'SUPER_ADMIN' || role === 'TENANT_ADMIN') && ( <> + {handleEditLabel && ( + + )}