fix: hide empty attributes column, standardize status labels, truncate agent names

- Attributes column is now hidden when no exchanges in the current view
  have attributes; shown conditionally via hasAttributes check on rows
- Status labels already standardized via statusLabel() in ExchangeHeader
- Agent names truncated to last two hyphen-separated segments via
  shortAgentName(); full name preserved as tooltip title

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-09 18:36:06 +02:00
parent eadcd160a3
commit 3d910af491

View File

@@ -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<Row>[] {
// ─── Table columns ────────────────────────────────────────────────────────────
function buildColumns(hasAttributes: boolean): Column<Row>[] {
return [
{
key: 'status',
@@ -87,10 +93,10 @@ function buildBaseColumns(): Column<Row>[] {
<span className={styles.appName}>{row.applicationId ?? ''}</span>
),
},
{
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 <span className={styles.muted}></span>;
const entries = Object.entries(attrs);
@@ -107,7 +113,7 @@ function buildBaseColumns(): Column<Row>[] {
</div>
);
},
},
}] : []),
{
key: 'executionId',
header: 'Exchange ID',
@@ -150,7 +156,7 @@ function buildBaseColumns(): Column<Row>[] {
render: (_: unknown, row: Row) => (
<span className={styles.agentBadge}>
<span className={styles.agentDot} />
{row.instanceId}
<span title={row.instanceId}>{shortAgentName(row.instanceId)}</span>
</span>
),
},
@@ -223,7 +229,8 @@ export default function Dashboard({ onExchangeSelect, activeExchangeId }: Dashbo
)
// ─── Table columns ──────────────────────────────────────────────────────
const columns: Column<Row>[] = useMemo(() => buildBaseColumns(), [])
const hasAttributes = rows.some(r => r.attributes && Object.keys(r.attributes).length > 0)
const columns: Column<Row>[] = useMemo(() => buildColumns(hasAttributes), [hasAttributes])
// ─── Row click → navigate to diagram view ────────────────────────────────