import { useState } from 'react' import type { BaoClient } from '../../api/bao' import { engineFor } from '../../api/engines/registry' import type { Mount } from '../../api/secrets' import { ConfigPanel } from './ConfigPanel' import { LeasesPanel } from './LeasesPanel' import { RolesPanel } from './RolesPanel' type Tab = 'roles' | 'config' | 'leases' /** Roles, Config and Leases for a dynamic secrets engine. */ export function EngineView({ client, mount }: { client: BaoClient; mount: Mount }) { const engine = engineFor(mount.type) const [tab, setTab] = useState('roles') const tabs: { id: Tab; label: string }[] = [{ id: 'roles', label: 'Roles' }] if (engine.configs.length > 0) tabs.push({ id: 'config', label: 'Config' }) tabs.push({ id: 'leases', label: 'Leases' }) const current = tabs.some((t) => t.id === tab) ? tab : 'roles' return (

{engine.label} ยท {mount.path}

{tabs.length > 1 && (
{tabs.map((t) => ( ))}
)} {current === 'roles' && } {current === 'leases' && } {current === 'config' && }
) }