Move Swagger entry into Help

This commit is contained in:
mmckeen
2026-04-28 15:57:21 +00:00
parent 9317a2bf7b
commit 5dfd88a1c7
3 changed files with 37 additions and 17 deletions
+31 -5
View File
@@ -134,11 +134,37 @@ export default function HelpPanel({ sandboxes }: { sandboxes: SandboxInventoryIt
<HealthAccordion sandboxes={sandboxes} />
<section className="panel p-8">
<p className="text-[10px] font-mono uppercase tracking-wider text-[var(--nvidia-green)]">Operator Guide</p>
<h1 className="mt-2 text-xl font-semibold uppercase tracking-wider text-[var(--foreground)]">Help</h1>
<p className="mt-2 max-w-3xl text-sm text-[var(--foreground-dim)]">
Quick reference for running sandboxes, moving files, preserving work, and cloning a prepared environment.
</p>
<div className="flex items-start justify-between gap-4 max-md:flex-col">
<div>
<p className="text-[10px] font-mono uppercase tracking-wider text-[var(--nvidia-green)]">Operator Guide</p>
<h1 className="mt-2 text-xl font-semibold uppercase tracking-wider text-[var(--foreground)]">Help</h1>
<p className="mt-2 max-w-3xl text-sm text-[var(--foreground-dim)]">
Quick reference for running sandboxes, moving files, preserving work, and cloning a prepared environment.
</p>
</div>
<a href="/swagger" target="_blank" rel="noreferrer" className="rounded-sm bg-[var(--nvidia-green)] px-4 py-2 text-xs font-mono uppercase tracking-wider text-black">
Open Swagger
</a>
</div>
</section>
<section className="panel p-5">
<div className="flex items-start justify-between gap-4 max-md:flex-col">
<div>
<h2 className="text-sm font-semibold uppercase tracking-wider text-[var(--foreground)]">API Reference</h2>
<p className="mt-2 max-w-3xl text-sm leading-6 text-[var(--foreground-dim)]">
Swagger opens the controller-node API reference in a separate page, including OpenAPI JSON, endpoint details, schemas, and example payloads.
</p>
</div>
<div className="flex shrink-0 gap-2 max-sm:w-full max-sm:flex-col">
<a href="/swagger" target="_blank" rel="noreferrer" className="action-button px-3 py-2 text-center">
Swagger Page
</a>
<a href="/api/openapi" target="_blank" rel="noreferrer" className="action-button px-3 py-2 text-center">
OpenAPI JSON
</a>
</div>
</div>
</section>
<section className="grid grid-cols-1 gap-4 lg:grid-cols-2">
-10
View File
@@ -317,16 +317,6 @@ export default function Sidebar({
<span className="text-sm max-lg:text-[11px]">Help</span>
</button>
<a
href="/swagger"
className="mt-1 flex w-full items-center gap-3 rounded px-3 py-2.5 text-[var(--foreground-dim)] transition-colors hover:bg-[var(--background-tertiary)] hover:text-[var(--foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--nvidia-green)] max-lg:mt-0 max-lg:min-w-24 max-lg:flex-col max-lg:justify-center max-lg:gap-1 max-lg:px-2 max-lg:py-2"
>
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path strokeLinecap="square" strokeLinejoin="miter" strokeWidth={2} d="M7 7h10M7 12h10M7 17h6M5 3h14a2 2 0 012 2v14a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2z" />
</svg>
<span className="text-sm max-lg:text-[11px]">Swagger</span>
</a>
<a
href="/setup-account"
className="mt-1 flex w-full items-center gap-3 rounded px-3 py-2.5 text-[var(--foreground-dim)] transition-colors hover:bg-[var(--background-tertiary)] hover:text-[var(--foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--nvidia-green)] max-lg:mt-0 max-lg:min-w-24 max-lg:flex-col max-lg:justify-center max-lg:gap-1 max-lg:px-2 max-lg:py-2"
+6 -2
View File
@@ -4,11 +4,12 @@ import path from 'node:path'
const root = process.cwd()
const [specSource, routeSource, pageSource, sidebarSource] = await Promise.all([
const [specSource, routeSource, pageSource, sidebarSource, helpSource] = await Promise.all([
readFile(path.join(root, 'app/lib/openapiSpec.ts'), 'utf8'),
readFile(path.join(root, 'app/api/openapi/route.ts'), 'utf8'),
readFile(path.join(root, 'app/swagger/page.tsx'), 'utf8'),
readFile(path.join(root, 'app/components/Sidebar.tsx'), 'utf8'),
readFile(path.join(root, 'app/components/HelpPanel.tsx'), 'utf8'),
])
assert.match(specSource, /openapi:\s*"3\.1\.0"/, 'OpenAPI spec must declare version 3.1.0')
@@ -21,6 +22,9 @@ assert.match(routeSource, /buildOpenApiSpec/, 'OpenAPI API route must return gen
assert.match(pageSource, /OpenAPI JSON/, 'Swagger page must link to the JSON spec')
assert.match(pageSource, /Endpoints/, 'Swagger page must render endpoint docs')
assert.match(pageSource, /Schemas/, 'Swagger page must render schema docs')
assert.match(sidebarSource, /href="\/swagger"/, 'sidebar must link to Swagger page')
assert.doesNotMatch(sidebarSource, /href="\/swagger"/, 'Swagger must not be a top-level sidebar item')
assert.match(helpSource, /API Reference/, 'Help must expose an API reference section')
assert.match(helpSource, /href="\/swagger"/, 'Help must link to the Swagger page')
assert.match(helpSource, /target="_blank"/, 'Help must open Swagger in a separate page')
console.log('swagger-openapi-check: PASS swagger/openapi assertions')