Skip to content

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

TypeScript

feat(control-ui): add registry-connect discoverability banner and header button

Jose Ramirez6072058068b4
diff --git a/control-ui/components/RegistryCatalog.tsx b/control-ui/components/RegistryCatalog.tsx
index 219e554af..752cde105 100644
--- a/control-ui/components/RegistryCatalog.tsx
+++ b/control-ui/components/RegistryCatalog.tsx
@@ -11,9 +11,11 @@ import { TablePanelHeader } from '@components/TablePanelHeader'
import { useToast } from '@components/Toast'
import { IconPencil, IconX } from '@components/icons'
import {
+ type RegistryConnectionState,
type RegistryEntry,
deleteRegistryEntry,
getRegistryCatalog,
+ getRegistryConnection,
installRecipeFromRegistry,
} from '../lib/api'
import { trustBgColor, trustColor } from '../lib/trustLevel'
@@ -56,6 +58,17 @@ export default function RegistryCatalog() {
const [installingRecipeKey, setInstallingRecipeKey] = useState('')
const [installError, setInstallError] = useState('')
+ // Registry-connect discoverability: an independent, best-effort fetch that
+ // derives whether this deployment is self-hosted and (if so) its connection
+ // state, so the Marketplace can surface a "Connect" entry point. Initial
+ // mode is 'unknown' (fail-open) so the header button isn't hidden while the
+ // request is in flight or if it errors for a reason other than the
+ // deployment being managed.
+ const [connectionMode, setConnectionMode] = useState<'self-hosted' | 'managed' | 'unknown'>(
+ 'unknown'
+ )
+ const [connectionState, setConnectionState] = useState<RegistryConnectionState | null>(null)
+
// Filters
const [search, setSearch] = useState('')
const [typeFilter, setTypeFilter] = useState<string>('all')
@@ -108,8 +121,25 @@ export default function RegistryCatalog() {
useEffect(() => {
loadData()
+ loadConnectionMode()
}, [])
+ async function loadConnectionMode() {
+ // Independent of the catalog browse: a browse failure must not hide the
+ // connect entry point (see the error early-return below). Fail-open — any
+ // non-managed outcome keeps the entry point available.
+ try {
+ const status = await getRegistryConnection()
+ setConnectionMode('self-hosted')
+ setConnectionState(status.state)
+ } catch (err) {
+ setConnectionMode(
+ (err as { code?: unknown }).code === 'not_self_hosted' ? 'managed' : 'unknown'
+ )
+ setConnectionState(null)
+ }
+ }
+
async function loadData() {
setLoading(true)
setError(null)
@@ -165,11 +195,35 @@ export default function RegistryCatalog() {
return false
}
+ const showConnectBanner =
+ connectionMode === 'self-hosted' &&
+ (connectionState === 'disconnected' || connectionState === 'rejected')
+ // Computed once, rendered in BOTH the error early-return and the normal branch
+ // so the connect prompt survives a catalog browse failure (DRY).
+ const connectBanner = showConnectBanner ? (
+ <div className="cu-banner cu-banner--info" role="status">
+ <span>
+ This deployment isn&apos;t connected to a registry. Connect it to publish and install
+ connectors and plugins.
+ </span>
+ <button
+ type="button"
+ className="cu-btn cu-btn--primary cu-btn--sm"
+ onClick={() => router.push('/registry/connect')}
+ >
+ Connect to registry
+ </button>
+ </div>
+ ) : null
+
if (error) {
return (
- <div className="cu-card cu-card--viewport-fill" style={{ marginBottom: '1.25rem' }}>
- <div className="cu-card__body">
- <div className="cu-banner cu-banner--error">Error: {error}</div>
+ <div className="cu-registry-layout">
+ {connectBanner}
+ <div className="cu-card cu-card--viewport-fill" style={{ marginBottom: '1.25rem' }}>
+ <div className="cu-card__body">
+ <div className="cu-banner cu-banner--error">Error: {error}</div>
+ </div>
</div>
</div>
)
@@ -190,6 +244,7 @@ export default function RegistryCatalog() {
</button>
</div>
) : null}
+ {connectBanner}
<div className="cu-card cu-card--viewport-fill" style={{ marginBottom: '1.25rem' }}>
<TablePanelHeader
title={
@@ -241,6 +296,16 @@ export default function RegistryCatalog() {
{filtered.length} of {entries.length} entries
</span>
) : null}
+ {connectionMode !== 'managed' ? (
+ <button
+ type="button"
+ className="cu-btn cu-btn--ghost cu-btn--sm"
+ onClick={() => router.push('/registry/connect')}
+ disabled={isInitialLoad}
+ >
+ Connect
+ </button>
+ ) : null}
<button
type="button"
className="cu-btn cu-btn--primary cu-btn--sm"
diff --git a/control-ui/components/__tests__/RegistryCatalog.test.tsx b/control-ui/components/__tests__/RegistryCatalog.test.tsx
index dec4c7c1b..6c43ee2a4 100644
--- a/control-ui/components/__tests__/RegistryCatalog.test.tsx
+++ b/control-ui/components/__tests__/RegistryCatalog.test.tsx
@@ -1,5 +1,5 @@
import type { ReactNode } from 'react'
-import { afterEach, describe, expect, it, vi } from 'vitest'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { cleanup, fireEvent, render as rtlRender, screen, waitFor } from '@testing-library/react'
import * as api from '../../lib/api'
import type { RegistryEntry, RegistryInstalledState } from '../../lib/api'
@@ -9,6 +9,7 @@ import { ToastProvider } from '../Toast'
// vi.mock is hoisted before imports, factory runs lazily
vi.mock('../../lib/api', () => ({
getRegistryCatalog: vi.fn(),
+ getRegistryConnection: vi.fn(),
deleteRegistryEntry: vi.fn(),
installRecipeFromRegistry: vi.fn(),
}))
@@ -100,6 +101,15 @@ function mockApiSuccess(
})
}
+beforeEach(() => {
+ // Default: managed deployment (no self-hosted connect surface) so the large
+ // pre-existing catalog suite is undisturbed. Connect-discoverability tests
+ // below override this per case.
+ vi.mocked(api.getRegistryConnection).mockRejectedValue(
+ Object.assign(new Error('409 not_self_hosted'), { code: 'not_self_hosted' })
+ )
+})
+
afterEach(() => {
cleanup()
vi.clearAllMocks()
@@ -900,3 +910,79 @@ describe('RegistryCatalog - developer row actions (Edit, Remove)', () => {
expect(screen.getByRole('dialog')).toBeInTheDocument()
})
})
+
+describe('RegistryCatalog - connect discoverability (Fix 1)', () => {
+ it('self-hosted + disconnected → shows connect banner and header Connect button; both route to connect', async () => {
+ mockApiSuccess()
+ vi.mocked(api.getRegistryConnection).mockResolvedValue({ state: 'disconnected' })
+ render(<RegistryCatalog />)
+ await waitFor(() => expect(screen.getByText('brave-search')).toBeInTheDocument())
+
+ expect(
+ screen.getByText(/This deployment isn't connected to a registry/i)
+ ).toBeInTheDocument()
+
+ fireEvent.click(screen.getByRole('button', { name: 'Connect to registry' }))
+ expect(mockPush).toHaveBeenCalledWith('/registry/connect')
+
+ mockPush.mockClear()
+ fireEvent.click(screen.getByRole('button', { name: 'Connect' }))
+ expect(mockPush).toHaveBeenCalledWith('/registry/connect')
+ })
+
+ it('self-hosted + connected → no banner, header Connect button present', async () => {
+ mockApiSuccess()
+ vi.mocked(api.getRegistryConnection).mockResolvedValue({ state: 'connected' })
+ render(<RegistryCatalog />)
+ await waitFor(() => expect(screen.getByText('brave-search')).toBeInTheDocument())
+
+ expect(screen.getByRole('button', { name: 'Connect' })).toBeInTheDocument()
+ expect(screen.queryByText(/This deployment isn't connected/i)).not.toBeInTheDocument()
+ })
+
+ it('managed deployment (not_self_hosted) → no banner and no header Connect button', async () => {
+ mockApiSuccess()
+ vi.mocked(api.getRegistryConnection).mockRejectedValue(
+ Object.assign(new Error('409 not_self_hosted'), { code: 'not_self_hosted' })
+ )
+ render(<RegistryCatalog />)
+ await waitFor(() => expect(screen.getByText('brave-search')).toBeInTheDocument())
+
+ // The connection fetch resolves mode → managed, hiding the button.
+ await waitFor(() =>
+ expect(screen.queryByRole('button', { name: 'Connect' })).not.toBeInTheDocument()
+ )
+ expect(screen.queryByText(/This deployment isn't connected/i)).not.toBeInTheDocument()
+ })
+
+ it('unknown connection error → header Connect button present (fail-open), no banner', async () => {
+ mockApiSuccess()
+ vi.mocked(api.getRegistryConnection).mockRejectedValue(new Error('500 Internal Server Error'))
+ render(<RegistryCatalog />)
+ await waitFor(() => expect(screen.getByText('brave-search')).toBeInTheDocument())
+
+ expect(screen.getByRole('button', { name: 'Connect' })).toBeInTheDocument()
+ expect(screen.queryByText(/This deployment isn't connected/i)).not.toBeInTheDocument()
+ })
+
+ it('catalog load error + self-hosted disconnected → connect banner rendered alongside the error banner', async () => {
+ vi.mocked(api.getRegistryCatalog).mockRejectedValue(
+ new Error('The registry is currently unavailable. Check the connection and try again.')
+ )
+ vi.mocked(api.getRegistryConnection).mockResolvedValue({ state: 'disconnected' })
+ render(<RegistryCatalog />)
+
+ await waitFor(() =>
+ expect(screen.getByText(/This deployment isn't connected to a registry/i)).toBeInTheDocument()
+ )
+ expect(
+ screen.getByText(
+ 'Error: The registry is currently unavailable. Check the connection and try again.'
+ )
+ ).toBeInTheDocument()
+
+ // The banner CTA still routes to the connect flow even inside the error branch.
+ fireEvent.click(screen.getByRole('button', { name: 'Connect to registry' }))
+ expect(mockPush).toHaveBeenCalledWith('/registry/connect')
+ })
+})