Add MCP broker access controls
This commit is contained in:
+36
-16
@@ -3,7 +3,7 @@
|
||||
interface SidebarProps {
|
||||
sandboxesRunning: number
|
||||
sandboxesTotal: number
|
||||
activeView: 'settings' | 'sandboxes' | 'help' | 'wizards'
|
||||
activeView: 'settings' | 'sandboxes' | 'help' | 'wizards' | 'mcp'
|
||||
isCreateMode: boolean
|
||||
isDestroyMode: boolean
|
||||
onSandboxesClick: () => void
|
||||
@@ -11,6 +11,7 @@ interface SidebarProps {
|
||||
onDestroyClick: () => void
|
||||
onTerminalClick: () => void
|
||||
onSettingsClick: () => void
|
||||
onMcpClick: () => void
|
||||
onWizardsClick: () => void
|
||||
onHelpClick: () => void
|
||||
onExitMode: () => void
|
||||
@@ -29,18 +30,19 @@ export default function Sidebar({
|
||||
onDestroyClick,
|
||||
onTerminalClick,
|
||||
onSettingsClick,
|
||||
onMcpClick,
|
||||
onWizardsClick,
|
||||
onHelpClick,
|
||||
onExitMode,
|
||||
onLogout,
|
||||
terminalDisabled = false,
|
||||
}: SidebarProps) {
|
||||
const navItemClass = (active = false, danger = false) => `w-full flex items-center gap-3 px-3 py-2.5 rounded transition-colors ${
|
||||
const navItemClass = (active = false, danger = false) => `w-full flex items-center gap-3 rounded px-3 py-2.5 text-left transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--nvidia-green)] 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 ${
|
||||
active
|
||||
? danger
|
||||
? 'bg-[var(--status-stopped)] text-white shadow-[0_10px_28px_rgba(220,38,38,0.18)]'
|
||||
: 'bg-[var(--nvidia-green)] text-black shadow-[0_10px_28px_rgba(118,185,0,0.18)]'
|
||||
: 'hover:bg-[var(--background-tertiary)] text-[var(--foreground-dim)] hover:text-[var(--foreground)]'
|
||||
: 'text-[var(--foreground-dim)] hover:bg-[var(--background-tertiary)] hover:text-[var(--foreground)]'
|
||||
}`
|
||||
|
||||
return (
|
||||
@@ -62,98 +64,116 @@ export default function Sidebar({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<nav className="flex-1 p-2 max-lg:grid max-lg:grid-cols-4 max-lg:gap-1 max-lg:overflow-x-auto">
|
||||
<nav className="flex-1 p-2 max-lg:flex max-lg:gap-1 max-lg:overflow-x-auto max-lg:[scrollbar-width:none]">
|
||||
<button
|
||||
onClick={onSandboxesClick}
|
||||
className={navItemClass(activeView === 'sandboxes' && !isCreateMode && !isDestroyMode)}
|
||||
aria-current={activeView === 'sandboxes' && !isCreateMode && !isDestroyMode ? 'page' : undefined}
|
||||
>
|
||||
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="square" strokeLinejoin="miter" strokeWidth={2} d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" />
|
||||
</svg>
|
||||
<span className="text-sm">Sandboxes</span>
|
||||
<span className="text-sm max-lg:text-[11px]">Sandboxes</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={onCreateClick}
|
||||
className={`mt-1 max-lg:mt-0 ${navItemClass(isCreateMode)}`}
|
||||
aria-pressed={isCreateMode}
|
||||
>
|
||||
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="square" strokeLinejoin="miter" strokeWidth={2} d="M12 4v16m8-8H4" />
|
||||
</svg>
|
||||
<span className="text-sm">Create Sandbox</span>
|
||||
<span className="text-sm max-lg:text-[11px] max-lg:leading-tight">Create</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={onDestroyClick}
|
||||
className={`mt-1 max-lg:mt-0 ${navItemClass(isDestroyMode, true)}`}
|
||||
aria-pressed={isDestroyMode}
|
||||
>
|
||||
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="square" strokeLinejoin="miter" strokeWidth={2} d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6M4 7h16" />
|
||||
</svg>
|
||||
<span className="text-sm">Destroy Sandbox</span>
|
||||
<span className="text-sm max-lg:text-[11px] max-lg:leading-tight">Destroy</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={onTerminalClick}
|
||||
disabled={terminalDisabled}
|
||||
className="mt-1 max-lg:mt-0 w-full flex items-center gap-3 px-3 py-2.5 rounded transition-colors hover:bg-[var(--background-tertiary)] text-[var(--foreground-dim)] hover:text-[var(--foreground)] disabled:opacity-40 disabled:cursor-not-allowed"
|
||||
title={terminalDisabled ? 'Select a sandbox to open the operator terminal' : 'Open operator terminal'}
|
||||
className="mt-1 flex w-full items-center gap-3 rounded px-3 py-2.5 text-[var(--foreground-dim)] transition-all hover:bg-[var(--background-tertiary)] hover:text-[var(--foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--nvidia-green)] disabled:cursor-not-allowed disabled:opacity-40 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">
|
||||
<path strokeLinecap="square" strokeLinejoin="miter" strokeWidth={2} d="M4 17l6-6-6-6m8 14h8" />
|
||||
</svg>
|
||||
<span className="text-sm">Operator Terminal</span>
|
||||
<span className="text-sm max-lg:text-[11px] max-lg:leading-tight">Terminal</span>
|
||||
</button>
|
||||
|
||||
{(isCreateMode || isDestroyMode) && (
|
||||
<button
|
||||
onClick={onExitMode}
|
||||
className="mt-1 w-full flex items-center gap-3 px-3 py-2.5 rounded bg-[var(--background-tertiary)] text-[var(--foreground-dim)] hover:bg-[var(--background-panel)] transition-colors max-lg:col-span-2"
|
||||
className="mt-1 flex w-full items-center gap-3 rounded bg-[var(--background-tertiary)] px-3 py-2.5 text-[var(--foreground-dim)] transition-colors hover:bg-[var(--background-panel)] 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">
|
||||
<path strokeLinecap="square" strokeLinejoin="miter" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
<span className="text-sm">Cancel</span>
|
||||
<span className="text-sm max-lg:text-[11px]">Cancel</span>
|
||||
</button>
|
||||
)}
|
||||
|
||||
<button
|
||||
onClick={onSettingsClick}
|
||||
className={`mt-4 max-lg:mt-0 ${navItemClass(activeView === 'settings')}`}
|
||||
aria-current={activeView === 'settings' ? 'page' : undefined}
|
||||
>
|
||||
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="square" strokeLinejoin="miter" strokeWidth={2} d="M12 6v6l4 2m5-2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
<span className="text-sm">Inference Endpoints</span>
|
||||
<span className="text-sm max-lg:text-[11px] max-lg:leading-tight">Inference</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={onWizardsClick}
|
||||
className={`mt-1 max-lg:mt-0 ${navItemClass(activeView === 'wizards')}`}
|
||||
aria-current={activeView === 'wizards' ? 'page' : undefined}
|
||||
>
|
||||
<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="M12 3l2.2 4.8L19 10l-4.8 2.2L12 17l-2.2-4.8L5 10l4.8-2.2L12 3zm6 12l.9 2.1L21 18l-2.1.9L18 21l-.9-2.1L15 18l2.1-.9L18 15z" />
|
||||
</svg>
|
||||
<span className="text-sm">Wizards</span>
|
||||
<span className="text-sm max-lg:text-[11px]">Wizards</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={onMcpClick}
|
||||
className={`mt-1 max-lg:mt-0 ${navItemClass(activeView === 'mcp')}`}
|
||||
aria-current={activeView === 'mcp' ? 'page' : undefined}
|
||||
>
|
||||
<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 8h10M7 16h10M9 4h6a2 2 0 012 2v12a2 2 0 01-2 2H9a2 2 0 01-2-2V6a2 2 0 012-2z" />
|
||||
</svg>
|
||||
<span className="text-sm max-lg:text-[11px]">MCP</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
onClick={onHelpClick}
|
||||
className={`mt-1 max-lg:mt-0 ${navItemClass(activeView === 'help')}`}
|
||||
aria-current={activeView === 'help' ? 'page' : undefined}
|
||||
>
|
||||
<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="M9.09 9a3 3 0 115.82 1c-.64.85-1.91 1.26-2.41 2.32V13m-.5 4h.01M12 3a9 9 0 100 18 9 9 0 000-18z" />
|
||||
</svg>
|
||||
<span className="text-sm">Help</span>
|
||||
<span className="text-sm max-lg:text-[11px]">Help</span>
|
||||
</button>
|
||||
|
||||
<a
|
||||
href="/setup-account"
|
||||
className="mt-1 max-lg:mt-0 w-full flex items-center gap-3 px-3 py-2.5 rounded transition-colors hover:bg-[var(--background-tertiary)] text-[var(--foreground-dim)] hover:text-[var(--foreground)]"
|
||||
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="M12 12a4 4 0 100-8 4 4 0 000 8zm-7 9a7 7 0 0114 0" />
|
||||
</svg>
|
||||
<span className="text-sm">Setup Account</span>
|
||||
<span className="text-sm max-lg:text-[11px] max-lg:leading-tight">Account</span>
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user