Skip to content

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

TypeScript

fix(control-ui): flatten marketplace org tabs

Josué30a2afffa597
diff --git a/control-ui/components/MarketplaceOrgArea/index.tsx b/control-ui/components/MarketplaceOrgArea/index.tsx
index 5ad2e7d69..72e500989 100644
--- a/control-ui/components/MarketplaceOrgArea/index.tsx
+++ b/control-ui/components/MarketplaceOrgArea/index.tsx
@@ -1,5 +1,6 @@
'use client'
+import { useState } from 'react'
import { CONTROL_ROUTES } from '@constants/routes'
import { useInboundGrants } from '../../lib/hooks/useInboundGrants'
import { useRegistryCapability } from '../../lib/hooks/useRegistryCapability'
@@ -9,21 +10,19 @@ import { OwnedEntries } from '../PublisherView/OwnedEntries'
import { RetryBanner } from '../PublisherView/RetryBanner'
import RegistryApiKeysPanel from '../RegistryApiKeysPanel'
import RegistryConnectPanel from '../RegistryConnectPanel'
+import { SectionSearchInput } from '../SectionSearchInput'
import { IconStore } from '../Sidebar/icons'
-import { TabBar } from '../TabBar'
import { TablePanelHeader } from '../TablePanelHeader'
+import { IconRefresh } from '../icons'
+import { Button } from '../ui'
export type OrgAreaTab = 'entries' | 'images' | 'credentials' | 'connection'
-const SUB_TABS: { value: OrgAreaTab; href: string; label: string }[] = [
- { value: 'credentials', href: CONTROL_ROUTES.marketplace.orgCredentials, label: 'API Keys' },
- { value: 'entries', href: CONTROL_ROUTES.marketplace.orgEntries, label: 'Entries' },
- { value: 'images', href: CONTROL_ROUTES.marketplace.orgImages, label: 'Images' },
- // Connection sub-tab hidden for now: once connected it only shows a static,
- // non-actionable status. Claiming still lives at the standalone connect page,
- // and Phase 3 replaces it with an inline claim. Restore to bring it back.
- // { value: 'connection', href: CONTROL_ROUTES.marketplace.orgConnection, label: 'Connection' },
-]
+type SearchableOrgAreaTab = Exclude<OrgAreaTab, 'connection'>
+
+function isSearchableTab(tab: OrgAreaTab): tab is SearchableOrgAreaTab {
+ return tab === 'credentials' || tab === 'entries' || tab === 'images'
+}
function NotClaimed({ action }: { action: string }) {
return (
@@ -47,12 +46,54 @@ function NotClaimed({ action }: { action: string }) {
export function MarketplaceOrgArea({ activeTab }: { activeTab: OrgAreaTab }) {
const { capability, loading, error, reload } = useRegistryCapability()
const inbound = useInboundGrants()
+ const [searchByTab, setSearchByTab] = useState<Record<SearchableOrgAreaTab, string>>({
+ credentials: '',
+ entries: '',
+ images: '',
+ })
+ const [refreshSignalByTab, setRefreshSignalByTab] = useState<
+ Record<SearchableOrgAreaTab, number>
+ >({
+ credentials: 0,
+ entries: 0,
+ images: 0,
+ })
+ const [apiKeyCreateSignal, setApiKeyCreateSignal] = useState(0)
+ const [apiKeysCanCreate, setApiKeysCanCreate] = useState(false)
const orgScope = capability?.scope ?? null
+ const orgLabel = orgScope ?? (capability?.orgName ? `@${capability.orgName}` : 'This deployment')
const canManageOrg = capability?.canManageOrg === true
// Cross-org sharing availability, mirrored from the inbound-grants probe.
const canShare = inbound.status === 'available' || inbound.status === 'error'
const sharingUnavailable = inbound.status === 'unavailable'
+ const activeSearch = isSearchableTab(activeTab) ? searchByTab[activeTab] : ''
+ const activeLabel =
+ activeTab === 'credentials'
+ ? 'API keys'
+ : activeTab === 'entries'
+ ? 'entries'
+ : activeTab === 'images'
+ ? 'images'
+ : 'connection'
+ const activeDescription =
+ activeTab === 'credentials'
+ ? `${orgLabel} API keys. Create and revoke registry keys for CI, scripts, and image publishing.`
+ : activeTab === 'entries'
+ ? `${orgLabel} entries. Review and manage registry entries published by this deployment.`
+ : activeTab === 'images'
+ ? `${orgLabel} images. Review container images pushed by this deployment.`
+ : `${orgLabel} registry connection. Review the deployment registry connection.`
+
+ function setActiveSearch(value: string) {
+ if (!isSearchableTab(activeTab)) return
+ setSearchByTab(current => ({ ...current, [activeTab]: value }))
+ }
+
+ function refreshActiveTab() {
+ if (!isSearchableTab(activeTab)) return
+ setRefreshSignalByTab(current => ({ ...current, [activeTab]: current[activeTab] + 1 }))
+ }
return (
<section>
@@ -64,57 +105,117 @@ export function MarketplaceOrgArea({ activeTab }: { activeTab: OrgAreaTab }) {
Marketplace
</>
}
- subtitle="Everything your org owns on the registry"
+ subtitle={activeDescription}
+ actionsClassName="cu-registry-toolbar"
+ search={
+ isSearchableTab(activeTab) ? (
+ <SectionSearchInput
+ value={activeSearch}
+ onChange={setActiveSearch}
+ placeholder={`Search ${activeLabel}`}
+ ariaLabel={`Search ${activeLabel}`}
+ disabled={loading && !orgScope}
+ />
+ ) : undefined
+ }
+ refreshAction={
+ isSearchableTab(activeTab) ? (
+ <button
+ type="button"
+ className="cu-btn cu-btn--icon cu-btn--toolbar"
+ onClick={refreshActiveTab}
+ aria-label={`Reload ${activeLabel}`}
+ >
+ <IconRefresh width={18} height={18} />
+ </button>
+ ) : undefined
+ }
+ primaryAction={
+ activeTab === 'credentials' ? (
+ <Button
+ type="button"
+ variant="primary"
+ size="sm"
+ onClick={() => setApiKeyCreateSignal(signal => signal + 1)}
+ disabled={!apiKeysCanCreate}
+ >
+ + Create key
+ </Button>
+ ) : undefined
+ }
/>
- <MarketplaceTabs active="org" />
- <div className="cu-card__body">
- <TabBar<OrgAreaTab>
- ariaLabel="Organization sections"
- activeValue={activeTab}
- className="cu-tabs--flush-top"
- options={SUB_TABS}
- />
+ <MarketplaceTabs active={isSearchableTab(activeTab) ? activeTab : 'credentials'} />
- {/* Entries is a publishing surface, so it follows the publishing-UI
- toggle (canManageOrg). Credentials and Connection do NOT — turning
- publishing off must not remove API keys or the connection status
- (design spec §6). The Credentials tab is the single registry-key
- surface (self-gating); a registry:publish key doubles as the Docker
- push credential, surfaced in the key's reveal dialog. */}
- {activeTab === 'entries' ? (
- loading ? (
+ {/* Entries is a publishing surface, so it follows the publishing-UI
+ toggle (canManageOrg). Credentials do NOT — turning publishing off
+ must not remove API keys (design spec §6). The Credentials tab is
+ the single registry-key surface (self-gating); a registry:publish
+ key doubles as the Docker push credential, surfaced in the key's
+ reveal dialog. */}
+ {activeTab === 'entries' ? (
+ loading ? (
+ <div className="cu-card__body">
<p>Loading…</p>
- ) : error ? (
- // A transient capability-probe failure must NOT be read as an
- // unclaimed org — that would falsely prompt a re-claim. Offer Retry.
+ </div>
+ ) : error ? (
+ // A transient capability-probe failure must NOT be read as an
+ // unclaimed org — that would falsely prompt a re-claim. Offer Retry.
+ <div className="cu-card__body">
<RetryBanner message="Couldn’t load your organization." onRetry={reload} />
- ) : canManageOrg && orgScope ? (
- <OwnedEntries
- orgScope={orgScope}
- canShare={canShare}
- sharingUnavailable={sharingUnavailable}
- />
- ) : (
+ </div>
+ ) : canManageOrg && orgScope ? (
+ <OwnedEntries
+ orgScope={orgScope}
+ canShare={canShare}
+ sharingUnavailable={sharingUnavailable}
+ embedded
+ hideHeader
+ search={searchByTab.entries}
+ refreshSignal={refreshSignalByTab.entries}
+ />
+ ) : (
+ <div className="cu-card__body">
<NotClaimed action="publish and manage entries" />
- )
- ) : null}
+ </div>
+ )
+ ) : null}
- {activeTab === 'images' ? (
- loading ? (
+ {activeTab === 'images' ? (
+ loading ? (
+ <div className="cu-card__body">
<p>Loading…</p>
- ) : error ? (
+ </div>
+ ) : error ? (
+ <div className="cu-card__body">
<RetryBanner message="Couldn’t load your organization." onRetry={reload} />
- ) : canManageOrg && orgScope ? (
- <MarketplaceOrgImages orgScope={orgScope} />
- ) : (
+ </div>
+ ) : canManageOrg && orgScope ? (
+ <MarketplaceOrgImages
+ orgScope={orgScope}
+ embedded
+ hideHeader
+ search={searchByTab.images}
+ refreshSignal={refreshSignalByTab.images}
+ />
+ ) : (
+ <div className="cu-card__body">
<NotClaimed action="push and manage images" />
- )
- ) : null}
+ </div>
+ )
+ ) : null}
- {activeTab === 'credentials' ? <RegistryApiKeysPanel embedded /> : null}
+ {activeTab === 'credentials' ? (
+ <RegistryApiKeysPanel
+ embedded
+ hideHeader
+ search={searchByTab.credentials}
+ refreshSignal={refreshSignalByTab.credentials}
+ createSignal={apiKeyCreateSignal}
+ onCreateAvailabilityChange={setApiKeysCanCreate}
+ />
+ ) : null}
- {activeTab === 'connection' ? <RegistryConnectPanel /> : null}
- </div>
+ {activeTab === 'connection' ? <RegistryConnectPanel /> : null}
</div>
</section>
)
diff --git a/control-ui/components/MarketplaceOrgImages/index.tsx b/control-ui/components/MarketplaceOrgImages/index.tsx
index 17c2b81a5..0d1f41ebd 100644
--- a/control-ui/components/MarketplaceOrgImages/index.tsx
+++ b/control-ui/components/MarketplaceOrgImages/index.tsx
@@ -31,7 +31,19 @@ type View =
* the registry exposes the listing endpoint, this shows an "unavailable" notice
* rather than failing.
*/
-export function MarketplaceOrgImages({ orgScope }: { orgScope: string }) {
+export function MarketplaceOrgImages({
+ orgScope,
+ embedded = false,
+ hideHeader = false,
+ search = '',
+ refreshSignal = 0,
+}: {
+ orgScope: string
+ embedded?: boolean
+ hideHeader?: boolean
+ search?: string
+ refreshSignal?: number
+}) {
const [view, setView] = useState<View>({ kind: 'loading' })
const load = useCallback(async () => {
@@ -51,6 +63,10 @@ export function MarketplaceOrgImages({ orgScope }: { orgScope: string }) {
void load()
}, [load])
+ useEffect(() => {
+ if (refreshSignal > 0) void load()
+ }, [load, refreshSignal])
+
const namespace = dockerNamespace(orgScope)
// One row per (image, tag). The registry lists repos without tags today, so a
@@ -63,8 +79,15 @@ export function MarketplaceOrgImages({ orgScope }: { orgScope: string }) {
: [{ name: img.name, tag: '<tag>' }]
)
: []
+ const normalizedSearch = search.trim().toLowerCase()
+ const visibleRows = rows.filter(row =>
+ [row.name, row.tag, buildImageCoordinate(DEFAULT_REGISTRY_HOST, orgScope, row.name, row.tag)]
+ .join(' ')
+ .toLowerCase()
+ .includes(normalizedSearch)
+ )
const imageSort = useTableSort<(typeof rows)[number], 'image' | 'tag' | 'coordinate'>({
- rows,
+ rows: visibleRows,
defaultKey: 'image',
identity: row => `${row.name}:${row.tag}`,
accessors: {
@@ -79,9 +102,9 @@ export function MarketplaceOrgImages({ orgScope }: { orgScope: string }) {
onSort: () => imageSort.sortBy(column.key as 'image' | 'tag' | 'coordinate'),
}))
- return (
- <section>
- <div className="cu-card cu-card--viewport-fill">
+ const content = (
+ <>
+ {hideHeader ? null : (
<TablePanelHeader
title="Images"
subtitle={
@@ -98,43 +121,52 @@ export function MarketplaceOrgImages({ orgScope }: { orgScope: string }) {
</>
}
/>
- <div className="cu-card__body">
- <div className="eft-table-viewport cu-table-wrap">
- <DataTable className="eft-table cu-table">
- <thead>
- <TableHeaderRow columns={columns} />
- </thead>
- <tbody>
- {view.kind === 'loading' ? (
- <TableStateRow
- colSpan={columns.length}
- kind="loading"
- message="Loading images…"
- />
- ) : view.kind === 'error' ? (
- <TableStateRow
- action={
- <button
- type="button"
- className="cu-btn cu-btn--ghost cu-btn--sm"
- onClick={() => void load()}
- >
- Retry
- </button>
- }
- colSpan={columns.length}
- kind="error"
- message="Could not load your images."
- />
- ) : view.kind === 'unavailable' ? (
- <TableStateRow
- colSpan={columns.length}
- message="Image listing isn’t available on this registry yet. Your pushed images still work, and the list will appear here once the registry exposes it."
- />
- ) : rows.length === 0 ? (
- <TableStateRow
- colSpan={columns.length}
- message={
+ )}
+ <div className="cu-card__body">
+ {hideHeader ? (
+ <p className="cu-muted-note">
+ Your connectors and plugins push container images to{' '}
+ <code>
+ {DEFAULT_REGISTRY_HOST}/{namespace}/
+ </code>
+ .
+ </p>
+ ) : null}
+ <div className="eft-table-viewport cu-table-wrap">
+ <DataTable className="eft-table cu-table">
+ <thead>
+ <TableHeaderRow columns={columns} />
+ </thead>
+ <tbody>
+ {view.kind === 'loading' ? (
+ <TableStateRow colSpan={columns.length} kind="loading" message="Loading images…" />
+ ) : view.kind === 'error' ? (
+ <TableStateRow
+ action={
+ <button
+ type="button"
+ className="cu-btn cu-btn--ghost cu-btn--sm"
+ onClick={() => void load()}
+ >
+ Retry
+ </button>
+ }
+ colSpan={columns.length}
+ kind="error"
+ message="Could not load your images."
+ />
+ ) : view.kind === 'unavailable' ? (
+ <TableStateRow
+ colSpan={columns.length}
+ message="Image listing isn’t available on this registry yet. Your pushed images still work, and the list will appear here once the registry exposes it."
+ />
+ ) : visibleRows.length === 0 ? (
+ <TableStateRow
+ colSpan={columns.length}
+ message={
+ normalizedSearch ? (
+ 'No images match this search.'
+ ) : (
<>
No images yet. Push a connector or plugin image under{' '}
<code>
@@ -142,34 +174,40 @@ export function MarketplaceOrgImages({ orgScope }: { orgScope: string }) {
</code>{' '}
and it appears here.
</>
- }
- />
- ) : (
- imageSort.sortedRows.map(r => (
- <tr key={`${r.name}:${r.tag}`}>
- <td>
- <code>{r.name}</code>
- </td>
- <td>{r.tag}</td>
- <td>
- <code>
- {buildImageCoordinate(DEFAULT_REGISTRY_HOST, orgScope, r.name, r.tag)}
- </code>
- </td>
- </tr>
- ))
- )}
- </tbody>
- </DataTable>
- </div>
- {view.kind === 'ready' && rows.length > 0 ? (
- <p className="cu-muted-note cu-muted-note--spaced">
- A push can still be rejected if the credential lacks publish permission or the org has
- reached its image quota — those surface at push time.
- </p>
- ) : null}
+ )
+ }
+ />
+ ) : (
+ imageSort.sortedRows.map(r => (
+ <tr key={`${r.name}:${r.tag}`}>
+ <td>
+ <code>{r.name}</code>
+ </td>
+ <td>{r.tag}</td>
+ <td>
+ <code>
+ {buildImageCoordinate(DEFAULT_REGISTRY_HOST, orgScope, r.name, r.tag)}
+ </code>
+ </td>
+ </tr>
+ ))
+ )}
+ </tbody>
+ </DataTable>
</div>
+ {view.kind === 'ready' && rows.length > 0 ? (
+ <p className="cu-muted-note cu-muted-note--spaced">
+ A push can still be rejected if the credential lacks publish permission or the org has
+ reached its image quota — those surface at push time.
+ </p>
+ ) : null}
</div>
+ </>
+ )
+
+ return (
+ <section>
+ {embedded ? content : <div className="cu-card cu-card--viewport-fill">{content}</div>}
</section>
)
}
diff --git a/control-ui/components/MarketplaceTabs.tsx b/control-ui/components/MarketplaceTabs.tsx
index 8f8e2254d..eb03c2d63 100644
--- a/control-ui/components/MarketplaceTabs.tsx
+++ b/control-ui/components/MarketplaceTabs.tsx
@@ -1,27 +1,15 @@
'use client'
import { CONTROL_ROUTES } from '@constants/routes'
-import { useRegistryCapability } from '../lib/hooks/useRegistryCapability'
import { TabBar } from './TabBar'
-export type MarketplaceSection = 'connectors' | 'org'
+export type MarketplaceSection = 'connectors' | 'credentials' | 'entries' | 'images'
/**
- * Top-level Marketplace navigation (design spec §4): browse (Connectors) and
- * own (the org-named tab). The org tab is labelled with the organization name,
- * or "Your org" before the deployment is claimed — a single element that
- * answers "who are we on the registry".
+ * Top-level Marketplace navigation (design spec §4): browse registry
+ * connectors and manage the deployment-owned registry surfaces as peer tabs.
*/
export function MarketplaceTabs({ active }: { active: MarketplaceSection }) {
- const { capability, loading } = useRegistryCapability()
- // Avoid flashing the misleading "Your org" (which reads as unclaimed) before
- // the identity resolves; show a neutral label while loading instead.
- const orgLabel = capability?.orgName
- ? `@${capability.orgName}`
- : loading
- ? 'Organization'
- : 'Your org'
-
return (
<TabBar<MarketplaceSection>
ariaLabel="Marketplace sections"
@@ -34,9 +22,19 @@ export function MarketplaceTabs({ active }: { active: MarketplaceSection }) {
label: 'Connectors',
},
{
- value: 'org',
+ value: 'credentials',
href: CONTROL_ROUTES.marketplace.orgCredentials,
- label: orgLabel,
+ label: 'API Keys',
+ },
+ {
+ value: 'entries',
+ href: CONTROL_ROUTES.marketplace.orgEntries,
+ label: 'Entries',
+ },
+ {
+ value: 'images',
+ href: CONTROL_ROUTES.marketplace.orgImages,
+ label: 'Images',
},
]}
/>
diff --git a/control-ui/components/PublisherView/OwnedEntries.tsx b/control-ui/components/PublisherView/OwnedEntries.tsx
index cde168269..2f3910946 100644
--- a/control-ui/components/PublisherView/OwnedEntries.tsx
+++ b/control-ui/components/PublisherView/OwnedEntries.tsx
@@ -79,10 +79,18 @@ export function OwnedEntries({
orgScope,
canShare = true,
sharingUnavailable = false,
+ embedded = false,
+ hideHeader = false,
+ search = '',
+ refreshSignal = 0,
}: {
orgScope: string
canShare?: boolean
sharingUnavailable?: boolean
+ embedded?: boolean
+ hideHeader?: boolean
+ search?: string
+ refreshSignal?: number
}) {
const router = useRouter()
const searchParams = useSearchParams()
@@ -126,6 +134,10 @@ export function OwnedEntries({
void load()
}, [load])
+ useEffect(() => {
+ if (refreshSignal > 0) void load()
+ }, [load, refreshSignal])
+
const handleRemove = useCallback(
async (e: OwnedRegistryEntry) => {
const ok = await confirm({
@@ -162,9 +174,24 @@ export function OwnedEntries({
// instead of an empty one.
const typeFilter = searchParams?.get('type') ?? null
const activeTypeLabel = typeFilter ? MARKETPLACE_ENTRY_TYPE_LABELS[typeFilter] : undefined
+ const normalizedSearch = search.trim().toLowerCase()
const visibleEntries = useMemo(
- () => (activeTypeLabel ? entries.filter(e => ownedEntryKind(e) === typeFilter) : entries),
- [entries, typeFilter, activeTypeLabel]
+ () =>
+ (activeTypeLabel ? entries.filter(e => ownedEntryKind(e) === typeFilter) : entries).filter(
+ entry =>
+ [
+ entry.name,
+ entryTypeLabel(entry),
+ entry.version,
+ entry.visibility,
+ entry.status,
+ entry.entryType ?? entry.entry_type ?? '',
+ ]
+ .join(' ')
+ .toLowerCase()
+ .includes(normalizedSearch)
+ ),
+ [entries, typeFilter, activeTypeLabel, normalizedSearch]
)
// Deliberately org-wide, not `visibleEntries`: the notice describes what
@@ -205,9 +232,9 @@ export function OwnedEntries({
})
}, [entrySort.direction, entrySort.key, entrySort.sortedRows])
- return (
- <section>
- <div className="cu-card cu-card--viewport-fill">
+ const content = (
+ <>
+ {hideHeader ? null : (
<TablePanelHeader
title="Published entries"
subtitle={
@@ -216,143 +243,157 @@ export function OwnedEntries({
: undefined
}
/>
- <div className="cu-card__body">
- {!loading && !error && activeTypeLabel ? (
- <p className="cu-banner cu-banner--info">
- Showing {activeTypeLabel.toLowerCase()} only.{' '}
- <button
- type="button"
- className="cu-link"
- onClick={() => router.replace(CONTROL_ROUTES.marketplace.orgEntries)}
- >
- Show all entries
- </button>
- </p>
- ) : null}
- <div className="eft-table-viewport cu-table-wrap">
- <DataTable className="eft-table cu-table">
- <thead>
- <TableHeaderRow columns={columns} />
- </thead>
- <tbody>
- {loading ? (
- <TableStateRow
- colSpan={columns.length}
- kind="loading"
- message="Loading published entries…"
- />
- ) : error ? (
- <TableStateRow
- action={
- <button
- type="button"
- className="cu-btn cu-btn--ghost cu-btn--sm"
- onClick={() => void load()}
- >
- Retry
- </button>
- }
- colSpan={columns.length}
- kind="error"
- message="Could not load your published entries."
- />
- ) : visibleEntries.length === 0 ? (
- <TableStateRow
- colSpan={columns.length}
- message={
- entries.length === 0
+ )}
+ <div className="cu-card__body">
+ {hideHeader && sharingUnavailable && hasPrivateEntries ? (
+ <p className="cu-muted-note">
+ Cross-org sharing isn’t available on this deployment, so private entries stay visible
+ only to your org.
+ </p>
+ ) : null}
+ {!loading && !error && activeTypeLabel ? (
+ <p className="cu-banner cu-banner--info">
+ Showing {activeTypeLabel.toLowerCase()} only.{' '}
+ <button
+ type="button"
+ className="cu-link"
+ onClick={() => router.replace(CONTROL_ROUTES.marketplace.orgEntries)}
+ >
+ Show all entries
+ </button>
+ </p>
+ ) : null}
+ <div className="eft-table-viewport cu-table-wrap">
+ <DataTable className="eft-table cu-table">
+ <thead>
+ <TableHeaderRow columns={columns} />
+ </thead>
+ <tbody>
+ {loading ? (
+ <TableStateRow
+ colSpan={columns.length}
+ kind="loading"
+ message="Loading published entries…"
+ />
+ ) : error ? (
+ <TableStateRow
+ action={
+ <button
+ type="button"
+ className="cu-btn cu-btn--ghost cu-btn--sm"
+ onClick={() => void load()}
+ >
+ Retry
+ </button>
+ }
+ colSpan={columns.length}
+ kind="error"
+ message="Could not load your published entries."
+ />
+ ) : visibleEntries.length === 0 ? (
+ <TableStateRow
+ colSpan={columns.length}
+ message={
+ normalizedSearch
+ ? 'No entries match this search.'
+ : entries.length === 0
? 'You haven’t published any registry entries yet.'
: `No ${activeTypeLabel?.toLowerCase() ?? 'entries'} published yet.`
- }
- />
- ) : (
- sortedEntries.map(e => {
- const isPrivate = e.visibility === 'private'
- const detailRoute = CONTROL_ROUTES.marketplace.entry(e.name, e.version)
- const rowActions: RowActionMenuItem[] = [
- {
- key: 'view',
- label: 'View details',
- onClick: () => router.push(detailRoute),
- },
- ...(isInstalled(e)
- ? [
- {
- key: 'installed',
- label: 'Installed',
- disabled: true,
- onClick: () => undefined,
- },
- ]
- : [
- {
- key: 'install',
- label: 'Install',
- onClick: () =>
- router.push(
- CONTROL_ROUTES.marketplace.install({
- entry: e.name,
- version: e.version,
- })
- ),
- },
- ]),
- ...(isPrivate && canShare
- ? [
- {
- key: 'share',
- label: 'Share access',
- onClick: () =>
- setGrantTarget({
- entryName: e.name,
- opener: document.activeElement as HTMLButtonElement,
- }),
- },
- ]
- : []),
- {
- key: 'edit',
- label: 'Edit',
- onClick: () =>
- router.push(CONTROL_ROUTES.marketplace.editEntry(e.name, e.version)),
- },
- {
- key: 'remove',
- label: 'Remove from Marketplace',
- danger: true,
- onClick: () => void handleRemove(e),
- },
- ]
- return (
- <TableRow key={entryKey(e)} onNavigate={() => router.push(detailRoute)}>
- <td>
- <code>{e.name}</code>
- </td>
- <td>{entryTypeLabel(e)}</td>
- <td>{e.version}</td>
- <td>
- <span
- className={`cu-registry-chip cu-registry-chip--visibility-${e.visibility}`}
- >
- {e.visibility}
- </span>
- </td>
- <td>{e.status}</td>
- <td className="cu-table__cell-actions">
- <RowActionsMenu
- ariaLabel={`Actions for ${e.name} v${e.version}`}
- actions={rowActions}
- />
- </td>
- </TableRow>
- )
- })
- )}
- </tbody>
- </DataTable>
- </div>
+ }
+ />
+ ) : (
+ sortedEntries.map(e => {
+ const isPrivate = e.visibility === 'private'
+ const detailRoute = CONTROL_ROUTES.marketplace.entry(e.name, e.version)
+ const rowActions: RowActionMenuItem[] = [
+ {
+ key: 'view',
+ label: 'View details',
+ onClick: () => router.push(detailRoute),
+ },
+ ...(isInstalled(e)
+ ? [
+ {
+ key: 'installed',
+ label: 'Installed',
+ disabled: true,
+ onClick: () => undefined,
+ },
+ ]
+ : [
+ {
+ key: 'install',
+ label: 'Install',
+ onClick: () =>
+ router.push(
+ CONTROL_ROUTES.marketplace.install({
+ entry: e.name,
+ version: e.version,
+ })
+ ),
+ },
+ ]),
+ ...(isPrivate && canShare
+ ? [
+ {
+ key: 'share',
+ label: 'Share access',
+ onClick: () =>
+ setGrantTarget({
+ entryName: e.name,
+ opener: document.activeElement as HTMLButtonElement,
+ }),
+ },
+ ]
+ : []),
+ {
+ key: 'edit',
+ label: 'Edit',
+ onClick: () =>
+ router.push(CONTROL_ROUTES.marketplace.editEntry(e.name, e.version)),
+ },
+ {
+ key: 'remove',
+ label: 'Remove from Marketplace',
+ danger: true,
+ onClick: () => void handleRemove(e),
+ },
+ ]
+ return (
+ <TableRow key={entryKey(e)} onNavigate={() => router.push(detailRoute)}>
+ <td>
+ <code>{e.name}</code>
+ </td>
+ <td>{entryTypeLabel(e)}</td>
+ <td>{e.version}</td>
+ <td>
+ <span
+ className={`cu-registry-chip cu-registry-chip--visibility-${e.visibility}`}
+ >
+ {e.visibility}
+ </span>
+ </td>
+ <td>{e.status}</td>
+ <td className="cu-table__cell-actions">
+ <RowActionsMenu
+ ariaLabel={`Actions for ${e.name} v${e.version}`}
+ actions={rowActions}
+ />
+ </td>
+ </TableRow>
+ )
+ })
+ )}
+ </tbody>
+ </DataTable>
</div>
</div>
+ </>
+ )
+
+ return (
+ <section>
+ {embedded ? content : <div className="cu-card cu-card--viewport-fill">{content}</div>}
{grantTarget ? (
<GrantAccessModal
entryName={grantTarget.entryName}
diff --git a/control-ui/components/RegistryApiKeysPanel.tsx b/control-ui/components/RegistryApiKeysPanel.tsx
index e4c97c089..434155a66 100644
--- a/control-ui/components/RegistryApiKeysPanel.tsx
+++ b/control-ui/components/RegistryApiKeysPanel.tsx
@@ -1,6 +1,6 @@
'use client'
-import { useCallback, useEffect, useState } from 'react'
+import { useCallback, useEffect, useMemo, useState } from 'react'
import Link from 'next/link'
import { DataTable, TableStateRow, useTableSort } from '@clerum/frontend-components'
import { CONTROL_ROUTES } from '@constants/routes'
@@ -54,12 +54,40 @@ function fmtExpiry(v: string | null): string {
return d.getTime() < Date.now() ? `Expired ${d.toLocaleDateString()}` : d.toLocaleString()
}
-export default function RegistryApiKeysPanel({ embedded = false }: RegistryApiKeysPanelProps) {
+export default function RegistryApiKeysPanel({
+ embedded = false,
+ hideHeader = false,
+ search = '',
+ refreshSignal = 0,
+ createSignal = 0,
+ onCreateAvailabilityChange,
+}: RegistryApiKeysPanelProps) {
const { showToast } = useToast()
const { confirm, confirmDialog } = useConfirmDialog()
const [view, setView] = useState<View>({ kind: 'loading' })
const [creating, setCreating] = useState(false)
const [revealed, setRevealed] = useState<CreatedRegistryApiKey | null>(null)
+ const normalizedSearch = search.trim().toLowerCase()
+ const visibleKeys = useMemo(
+ () =>
+ view.kind === 'ready'
+ ? view.keys.filter(key =>
+ [
+ key.key_prefix,
+ key.description,
+ key.scopes.join(' '),
+ key.created_by_username,
+ key.created_at,
+ key.expires_at ?? '',
+ key.last_used_at ?? '',
+ ]
+ .join(' ')
+ .toLowerCase()
+ .includes(normalizedSearch)
+ )
+ : [],
+ [normalizedSearch, view]
+ )
// The auth-disabled view needs mode-specific copy: self-hosted fixes it by
// connecting, managed fixes it via CLERUM_REGISTRY_AUTH_ENABLED (no connect
// flow exists there). Same best-effort detection RegistryCatalog uses for its
@@ -74,7 +102,7 @@ export default function RegistryApiKeysPanel({ embedded = false }: RegistryApiKe
RegistryApiKey,
'prefix' | 'description' | 'scopes' | 'created_by' | 'created' | 'expires' | 'last_used'
>({
- rows: view.kind === 'ready' ? view.keys : [],
+ rows: visibleKeys,
defaultKey: 'created',
defaultDirection: 'desc',
identity: key => key.id,
@@ -140,6 +168,18 @@ export default function RegistryApiKeysPanel({ embedded = false }: RegistryApiKe
void loadConnectionMode()
}, [load, loadConnectionMode])
+ useEffect(() => {
+ if (refreshSignal > 0) void load()
+ }, [load, refreshSignal])
+
+ useEffect(() => {
+ if (createSignal > 0 && view.kind === 'ready') setCreating(true)
+ }, [createSignal, view.kind])
+
+ useEffect(() => {
+ onCreateAvailabilityChange?.(view.kind === 'ready')
+ }, [onCreateAvailabilityChange, view.kind])
+
async function handleCreate(input: CreateRegistryApiKeyInput) {
const created: CreatedRegistryApiKey = await createRegistryApiKey(input)
setCreating(false)
@@ -175,16 +215,18 @@ export default function RegistryApiKeysPanel({ embedded = false }: RegistryApiKe
const content = (
<>
- <TablePanelHeader
- title={`API keys${isReady ? ` for @${(view as { org: string }).org}` : ''}`}
- primaryAction={
- isReady ? (
- <Button type="button" variant="primary" size="sm" onClick={() => setCreating(true)}>
- + Create key
- </Button>
- ) : null
- }
- />
+ {hideHeader ? null : (
+ <TablePanelHeader
+ title={`API keys${isReady ? ` for @${(view as { org: string }).org}` : ''}`}
+ primaryAction={
+ isReady ? (
+ <Button type="button" variant="primary" size="sm" onClick={() => setCreating(true)}>
+ + Create key
+ </Button>
+ ) : null
+ }
+ />
+ )}
<div className="cu-card__body">
{view.kind === 'not-owner' ? (
@@ -245,10 +287,14 @@ export default function RegistryApiKeysPanel({ embedded = false }: RegistryApiKe
kind="error"
message="Could not load API keys."
/>
- ) : view.keys.length === 0 ? (
+ ) : visibleKeys.length === 0 ? (
<TableStateRow
colSpan={columns.length}
- message={`No API keys yet. Create one to publish to @${view.org} from CI or scripts.`}
+ message={
+ normalizedSearch
+ ? 'No API keys match this search.'
+ : `No API keys yet. Create one to publish to @${view.org} from CI or scripts.`
+ }
/>
) : (
keySort.sortedRows.map(k => (
diff --git a/control-ui/components/RegistryApiKeysPanel.types.ts b/control-ui/components/RegistryApiKeysPanel.types.ts
index 9c818e923..b851ba07c 100644
--- a/control-ui/components/RegistryApiKeysPanel.types.ts
+++ b/control-ui/components/RegistryApiKeysPanel.types.ts
@@ -5,4 +5,9 @@ export type RegistryApiKeysPanelProps = {
* double border on the Marketplace org area.
*/
embedded?: boolean
+ hideHeader?: boolean
+ search?: string
+ refreshSignal?: number
+ createSignal?: number
+ onCreateAvailabilityChange?: (available: boolean) => void
}
diff --git a/control-ui/components/__tests__/MarketplaceTabs.test.tsx b/control-ui/components/__tests__/MarketplaceTabs.test.tsx
new file mode 100644
index 000000000..a7ae603c8
--- /dev/null
+++ b/control-ui/components/__tests__/MarketplaceTabs.test.tsx
@@ -0,0 +1,28 @@
+import { describe, expect, it } from 'vitest'
+import { render, screen, within } from '@testing-library/react'
+import { MarketplaceTabs } from '../MarketplaceTabs'
+
+describe('MarketplaceTabs', () => {
+ it('flattens org-owned surfaces into top-level marketplace tabs', () => {
+ render(<MarketplaceTabs active="credentials" />)
+
+ const tabs = screen.getByRole('tablist', { name: 'Marketplace sections' })
+ expect(within(tabs).getByRole('tab', { name: 'Connectors' })).toHaveAttribute(
+ 'href',
+ '/marketplace/connectors'
+ )
+ expect(within(tabs).getByRole('tab', { name: 'API Keys' })).toHaveAttribute(
+ 'href',
+ '/marketplace/org/credentials'
+ )
+ expect(within(tabs).getByRole('tab', { name: 'Entries' })).toHaveAttribute(
+ 'href',
+ '/marketplace/org/entries'
+ )
+ expect(within(tabs).getByRole('tab', { name: 'Images' })).toHaveAttribute(
+ 'href',
+ '/marketplace/org/images'
+ )
+ expect(within(tabs).queryByRole('tab', { name: /^@/ })).toBeNull()
+ })
+})
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 6d348f19a..6a7c4bbee 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.519",
+ "version": "0.1.520",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.519",
+ "version": "0.1.520",
"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 92689fd06..d8da7e655 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.519",
+ "version": "0.1.520",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/docs/agents/frontend-style-rules.md b/docs/agents/frontend-style-rules.md
index 601a75f09..c3f7de0a0 100644
--- a/docs/agents/frontend-style-rules.md
+++ b/docs/agents/frontend-style-rules.md
@@ -100,7 +100,9 @@ application guidance that must be combined with this shared document.
tertiary/ghost page-action variants. Place route-backed tabs below the page
identity and toolbar, and flatten category-wrapper plus child-list double
tabs into sibling destinations when no information-architecture decision is
- required.
+ required. Do not keep an org, deploy, or category wrapper tab solely to hold
+ another row of list tabs; put that scope in the active tab description
+ instead.
- Fill the available content width. Keep fixed widths for genuinely compact
numeric, status, selection, icon, and action cells; allow ordinary text
columns to size flexibly. Put secondary metadata such as descriptions,