Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

adapt(control-ui): re-apply agent display name to dev's rewritten HostTable

Diego Zacarias023c2da4b6b1
diff --git a/control-ui/components/HostTable.tsx b/control-ui/components/HostTable.tsx
index 274a75997..ffbc9455e 100644
--- a/control-ui/components/HostTable.tsx
+++ b/control-ui/components/HostTable.tsx
@@ -115,15 +115,20 @@ export function HostTable({
items.map(i => {
const namespace = i.metadata?.namespace || 'default'
const name = i.metadata?.name || 'unknown'
+ // The visible name is the editable spec.host; the slug (metadata.name)
+ // stays as secondary identity. Empty-after-trim falls back to the slug
+ // (legacy Hosts, mirrors accessReconciliation), never a blank label.
+ const displayName =
+ String((i.spec as { host?: string } | undefined)?.host || '').trim() || name
const key = `${namespace}/${name}`
- return { key, namespace, name, item: i }
+ return { key, namespace, name, displayName, item: i }
}),
[items]
)
const normalizedSearch = searchQuery.trim().toLowerCase()
const filteredRows = useMemo(() => {
if (!normalizedSearch) return rows
- return rows.filter(({ name, namespace, item }) => {
+ return rows.filter(({ name, displayName, namespace, item }) => {
const spec = item.spec || {}
const lifecycle = getHostLifecycleInfo(item)
const contextRef = String(spec.contextRef || '').trim()
@@ -131,6 +136,7 @@ export function HostTable({
const providerLabels = providers.map(id => getProviderLabel(id)).join(' ')
return [
name,
+ displayName,
namespace,
lifecycle.label,
lifecycle.state,
@@ -207,7 +213,7 @@ export function HostTable({
<TableHeaderRow columns={HOST_COLUMNS} />
</thead>
<tbody>
- {filteredRows.map(({ key, namespace, name, item }) => {
+ {filteredRows.map(({ key, namespace, name, displayName, item }) => {
const rawContext = String(item.spec?.contextRef || '').trim()
const contextRef = rawContext || '-'
const contextClickable = Boolean(rawContext)
@@ -229,7 +235,10 @@ export function HostTable({
aria-label={`Open agent ${name}`}
>
<td>
- <span className="cu-expandable-row__name">{name}</span>
+ <span className="cu-expandable-row__name">{displayName}</span>
+ {displayName !== name ? (
+ <div className="cu-table__cell-subtle">{name}</div>
+ ) : null}
</td>
<td>
<HostLifecycleBadge lifecycle={lifecycle} />
diff --git a/control-ui/components/__tests__/HostTable.test.tsx b/control-ui/components/__tests__/HostTable.test.tsx
index ce2d42088..0deaea959 100644
--- a/control-ui/components/__tests__/HostTable.test.tsx
+++ b/control-ui/components/__tests__/HostTable.test.tsx
@@ -224,3 +224,63 @@ describe('HostTable providers column rendering', () => {
expect(within(row).getByText('-')).toBeInTheDocument()
})
})
+
+// UT-9 — the row shows the editable display name (spec.host) as the primary
+// label, with the immutable identifier (metadata.name / slug) as visible
+// secondary text; the search haystack matches BOTH.
+describe('HostTable display name column (UT-9)', () => {
+ function makeDisplayHost(name: string, displayName: string): HostItem {
+ return {
+ metadata: { name, namespace: 'mcp-host' },
+ spec: {
+ host: displayName,
+ contextRef: 'context1',
+ model: { provider: 'zai', name: 'glm-5.1' },
+ },
+ }
+ }
+
+ it('renders the display name as primary and the slug as secondary', () => {
+ renderHostTable([makeDisplayHost('prod-x', 'Prod X')])
+
+ const row = screen.getByLabelText('Open agent prod-x')
+ expect(within(row).getByText('Prod X')).toBeInTheDocument()
+ expect(within(row).getByText('prod-x')).toBeInTheDocument()
+ })
+
+ it('falls back to the slug as the primary label when spec.host is blank', () => {
+ renderHostTable([makeDisplayHost('prod-x', ' ')])
+
+ const row = screen.getByLabelText('Open agent prod-x')
+ // Only the slug renders — no separate secondary line duplicating it.
+ expect(within(row).getAllByText('prod-x')).toHaveLength(1)
+ })
+
+ it('filters rows by the display name', () => {
+ renderHostTable([
+ makeDisplayHost('prod-x', 'Prod X'),
+ makeDisplayHost('sales-agent', 'Sales Agent'),
+ ])
+
+ fireEvent.change(screen.getByRole('searchbox', { name: 'Search agents' }), {
+ target: { value: 'Prod' },
+ })
+
+ expect(screen.getByText('Prod X')).toBeInTheDocument()
+ expect(screen.queryByText('Sales Agent')).not.toBeInTheDocument()
+ })
+
+ it('filters rows by the slug identifier', () => {
+ renderHostTable([
+ makeDisplayHost('prod-x', 'Prod X'),
+ makeDisplayHost('sales-agent', 'Sales Agent'),
+ ])
+
+ fireEvent.change(screen.getByRole('searchbox', { name: 'Search agents' }), {
+ target: { value: 'sales-agent' },
+ })
+
+ expect(screen.getByText('Sales Agent')).toBeInTheDocument()
+ expect(screen.queryByText('Prod X')).not.toBeInTheDocument()
+ })
+})