diff --git a/ui/src/pages/Dashboard/Dashboard.tsx b/ui/src/pages/Dashboard/Dashboard.tsx index 58bbe14f..3342ed01 100644 --- a/ui/src/pages/Dashboard/Dashboard.tsx +++ b/ui/src/pages/Dashboard/Dashboard.tsx @@ -54,9 +54,15 @@ function durationClass(ms: number, status: string): string { return styles.durBreach } -// ─── Table columns (base, without inspect action) ──────────────────────────── +function shortAgentName(name: string): string { + const parts = name.split('-') + if (parts.length >= 3) return parts.slice(-2).join('-') + return name +} -function buildBaseColumns(): Column[] { +// ─── Table columns ──────────────────────────────────────────────────────────── + +function buildColumns(hasAttributes: boolean): Column[] { return [ { key: 'status', @@ -87,10 +93,10 @@ function buildBaseColumns(): Column[] { {row.applicationId ?? ''} ), }, - { - key: 'attributes', + ...(hasAttributes ? [{ + key: 'attributes' as const, header: 'Attributes', - render: (_, row) => { + render: (_: unknown, row: Row) => { const attrs = row.attributes; if (!attrs || Object.keys(attrs).length === 0) return ; const entries = Object.entries(attrs); @@ -107,7 +113,7 @@ function buildBaseColumns(): Column[] { ); }, - }, + }] : []), { key: 'executionId', header: 'Exchange ID', @@ -150,7 +156,7 @@ function buildBaseColumns(): Column[] { render: (_: unknown, row: Row) => ( - {row.instanceId} + {shortAgentName(row.instanceId)} ), }, @@ -223,7 +229,8 @@ export default function Dashboard({ onExchangeSelect, activeExchangeId }: Dashbo ) // ─── Table columns ────────────────────────────────────────────────────── - const columns: Column[] = useMemo(() => buildBaseColumns(), []) + const hasAttributes = rows.some(r => r.attributes && Object.keys(r.attributes).length > 0) + const columns: Column[] = useMemo(() => buildColumns(hasAttributes), [hasAttributes]) // ─── Row click → navigate to diagram view ────────────────────────────────