Skip to content

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

TypeScript

fix(control-ui): show empty connector count details

Josué6eeadcb53095
diff --git a/control-ui/components/HostTable.tsx b/control-ui/components/HostTable.tsx
index 9ab8c40af..5b8bf6788 100644
--- a/control-ui/components/HostTable.tsx
+++ b/control-ui/components/HostTable.tsx
@@ -62,23 +62,6 @@ function ContextMcpHoverCard({
const hasServers = servers.length > 0
const cardId = `ctx-mcp-${contextRef}`
- const trigger = (
- <button
- type="button"
- className="cu-link cu-host-context-count"
- onClick={e => {
- e.stopPropagation()
- onOpenContext(contextRef)
- }}
- onKeyDown={e => e.stopPropagation()}
- aria-describedby={hasServers && open ? cardId : undefined}
- >
- {servers.length}
- </button>
- )
-
- if (!hasServers) return trigger
-
return (
<span
className="cu-host-context-hover"
@@ -87,20 +70,35 @@ function ContextMcpHoverCard({
onFocus={() => setOpen(true)}
onBlur={() => setOpen(false)}
>
- {trigger}
+ <button
+ type="button"
+ className="cu-link cu-host-context-count"
+ onClick={e => {
+ e.stopPropagation()
+ onOpenContext(contextRef)
+ }}
+ onKeyDown={e => e.stopPropagation()}
+ aria-describedby={open ? cardId : undefined}
+ >
+ {servers.length}
+ </button>
{open ? (
<div role="tooltip" id={cardId} className="cu-agent-context-mcp-summary">
<div className="cu-agent-context-mcp-summary__head">
<span>{contextRef}</span>
<span>{servers.length}</span>
</div>
- <ul className="cu-agent-context-mcp-summary__list">
- {servers.map(server => (
- <li key={server} title={server}>
- {server}
- </li>
- ))}
- </ul>
+ {hasServers ? (
+ <ul className="cu-agent-context-mcp-summary__list">
+ {servers.map(server => (
+ <li key={server} title={server}>
+ {server}
+ </li>
+ ))}
+ </ul>
+ ) : (
+ <p className="cu-agent-context-mcp-summary__empty">No connectors</p>
+ )}
</div>
) : null}
</span>
@@ -258,8 +256,6 @@ export function HostTable({
const rawContext = String(item.spec?.contextRef || '').trim()
const contextRef = rawContext || '-'
const contextServers = contextsByRef?.[rawContext]
- const contextClickable =
- Boolean(rawContext) && Array.isArray(contextServers) && contextServers.length > 0
const providers = collectProviderIds(item.spec || {})
const openAgent = () => onOpen({ namespace, name })
return (
@@ -274,14 +270,12 @@ export function HostTable({
</td>
<td className="cu-table__cell-subtle">{name}</td>
<td>
- {contextClickable ? (
+ {rawContext ? (
<ContextMcpHoverCard
contextRef={contextRef}
- mcpServers={contextServers}
+ mcpServers={contextServers ?? []}
onOpenContext={onOpenContext}
/>
- ) : rawContext ? (
- <span className="cu-table__cell-muted">0</span>
) : (
<span className="cu-table__cell-muted">—</span>
)}
diff --git a/control-ui/components/__tests__/HostTable.test.tsx b/control-ui/components/__tests__/HostTable.test.tsx
index 5360281e6..23808bf9e 100644
--- a/control-ui/components/__tests__/HostTable.test.tsx
+++ b/control-ui/components/__tests__/HostTable.test.tsx
@@ -277,22 +277,24 @@ describe('HostTable context MCP hover card', () => {
expect(within(row).queryByRole('tooltip')).not.toBeInTheDocument()
})
- it('renders the bare count without a tooltip when the context has no MCP servers', () => {
+ it('shows an empty connector tooltip when the context has no MCP servers', () => {
renderHostTable([hostWithContext('chatllm', 'context1')], {
context1: [],
})
const row = screen.getByLabelText('Open agent chatllm')
- expect(within(row).queryByRole('tooltip')).not.toBeInTheDocument()
- expect(within(row).getByText('0')).toBeInTheDocument()
+ const count = within(row).getByRole('button', { name: '0' })
+ fireEvent.mouseEnter(count)
+ expect(screen.getByRole('tooltip')).toHaveTextContent('No connectors')
})
- it('renders a plain 0 when the context map is missing', () => {
+ it('keeps the zero count aligned when the context map is missing', () => {
renderHostTable([hostWithContext('chatllm', 'context1')])
const row = screen.getByLabelText('Open agent chatllm')
- expect(within(row).getByText('0')).toBeInTheDocument()
- expect(within(row).queryByRole('tooltip')).not.toBeInTheDocument()
+ const count = within(row).getByRole('button', { name: '0' })
+ fireEvent.focus(count)
+ expect(screen.getByRole('tooltip')).toHaveTextContent('No connectors')
})
})
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index a1e37e9fa..7a0a35099 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.516",
+ "version": "0.1.517",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.516",
+ "version": "0.1.517",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/frontend-components": "file:../packages/frontend-components",
diff --git a/control-ui/package.json b/control-ui/package.json
index ee661c445..a0990a217 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.516",
+ "version": "0.1.517",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",