Gate telemetry bar behind Help setting
This commit is contained in:
@@ -256,7 +256,17 @@ function McpHealthAccordion() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function HelpPanel({ sandboxes }: { sandboxes: SandboxInventoryItem[] }) {
|
type HelpPanelProps = {
|
||||||
|
sandboxes: SandboxInventoryItem[]
|
||||||
|
telemetryBarEnabled: boolean
|
||||||
|
onTelemetryBarEnabledChange: (enabled: boolean) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function HelpPanel({
|
||||||
|
sandboxes,
|
||||||
|
telemetryBarEnabled,
|
||||||
|
onTelemetryBarEnabledChange,
|
||||||
|
}: HelpPanelProps) {
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<HealthAccordion sandboxes={sandboxes} />
|
<HealthAccordion sandboxes={sandboxes} />
|
||||||
@@ -329,6 +339,25 @@ export default function HelpPanel({ sandboxes }: { sandboxes: SandboxInventoryIt
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<ActivityPanel />
|
<ActivityPanel />
|
||||||
|
|
||||||
|
<section className="panel p-5">
|
||||||
|
<label className="flex items-start gap-3">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={telemetryBarEnabled}
|
||||||
|
onChange={(event) => onTelemetryBarEnabledChange(event.target.checked)}
|
||||||
|
className="mt-0.5 h-4 w-4 accent-[var(--nvidia-green)]"
|
||||||
|
/>
|
||||||
|
<span>
|
||||||
|
<span className="block text-xs font-mono uppercase tracking-wider text-[var(--foreground)]">
|
||||||
|
Enable Telemetry Bar - EXPERIMENTAL
|
||||||
|
</span>
|
||||||
|
<span className="mt-1 block text-xs leading-5 text-[var(--foreground-dim)]">
|
||||||
|
The telemetry bar is setup for vLLM tokens per second and does not currently work with other endpoints.
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-2
@@ -17,12 +17,15 @@ import {
|
|||||||
updateDashboardSessionSelection,
|
updateDashboardSessionSelection,
|
||||||
} from './lib/dashboardSession'
|
} from './lib/dashboardSession'
|
||||||
|
|
||||||
|
const TELEMETRY_BAR_ENABLED_KEY = 'openshell-control.telemetry-bar-enabled'
|
||||||
|
|
||||||
export default function Dashboard() {
|
export default function Dashboard() {
|
||||||
const [theme, setTheme] = useState<'light' | 'dark'>('dark')
|
const [theme, setTheme] = useState<'light' | 'dark'>('dark')
|
||||||
const [dashboardSession, setDashboardSession] = useState(() => createHydrationSafeDashboardSessionState())
|
const [dashboardSession, setDashboardSession] = useState(() => createHydrationSafeDashboardSessionState())
|
||||||
const [isCreateMode, setIsCreateMode] = useState(false)
|
const [isCreateMode, setIsCreateMode] = useState(false)
|
||||||
const [isDestroyMode, setIsDestroyMode] = useState(false)
|
const [isDestroyMode, setIsDestroyMode] = useState(false)
|
||||||
const [activeView, setActiveView] = useState<'settings' | 'sandboxes' | 'help' | 'wizards' | 'mcp'>('sandboxes')
|
const [activeView, setActiveView] = useState<'settings' | 'sandboxes' | 'help' | 'wizards' | 'mcp'>('sandboxes')
|
||||||
|
const [telemetryBarEnabled, setTelemetryBarEnabled] = useState(false)
|
||||||
const [deletingSandboxId, setDeletingSandboxId] = useState<string | null>(null)
|
const [deletingSandboxId, setDeletingSandboxId] = useState<string | null>(null)
|
||||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false)
|
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false)
|
||||||
const [lifecycleMessage, setLifecycleMessage] = useState<string | null>(null)
|
const [lifecycleMessage, setLifecycleMessage] = useState<string | null>(null)
|
||||||
@@ -34,6 +37,7 @@ export default function Dashboard() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setDashboardSession(loadDashboardSessionState())
|
setDashboardSession(loadDashboardSessionState())
|
||||||
|
setTelemetryBarEnabled(window.localStorage.getItem(TELEMETRY_BAR_ENABLED_KEY) === 'true')
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -57,6 +61,11 @@ export default function Dashboard() {
|
|||||||
setTheme(theme === 'light' ? 'dark' : 'light')
|
setTheme(theme === 'light' ? 'dark' : 'light')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleTelemetryBarEnabledChange = (enabled: boolean) => {
|
||||||
|
setTelemetryBarEnabled(enabled)
|
||||||
|
window.localStorage.setItem(TELEMETRY_BAR_ENABLED_KEY, enabled ? 'true' : 'false')
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!inventoryEnabled || loading || isCreateMode || isDestroyMode) return
|
if (!inventoryEnabled || loading || isCreateMode || isDestroyMode) return
|
||||||
if (sandboxes.length === 0) {
|
if (sandboxes.length === 0) {
|
||||||
@@ -238,7 +247,7 @@ export default function Dashboard() {
|
|||||||
<main className="ml-64 min-h-screen transition-all duration-300 max-lg:ml-0 max-lg:pb-28">
|
<main className="ml-64 min-h-screen transition-all duration-300 max-lg:ml-0 max-lg:pb-28">
|
||||||
<div>
|
<div>
|
||||||
<div className="mx-auto max-w-7xl p-8 max-sm:p-4">
|
<div className="mx-auto max-w-7xl p-8 max-sm:p-4">
|
||||||
<LiveTelemetryBar />
|
{telemetryBarEnabled && <LiveTelemetryBar />}
|
||||||
{activeView === 'settings' ? (
|
{activeView === 'settings' ? (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<div className="panel p-8">
|
<div className="panel p-8">
|
||||||
@@ -263,7 +272,11 @@ export default function Dashboard() {
|
|||||||
<InferenceEndpointPanel />
|
<InferenceEndpointPanel />
|
||||||
</div>
|
</div>
|
||||||
) : activeView === 'help' ? (
|
) : activeView === 'help' ? (
|
||||||
<HelpPanel sandboxes={sandboxes} />
|
<HelpPanel
|
||||||
|
sandboxes={sandboxes}
|
||||||
|
telemetryBarEnabled={telemetryBarEnabled}
|
||||||
|
onTelemetryBarEnabledChange={handleTelemetryBarEnabledChange}
|
||||||
|
/>
|
||||||
) : activeView === 'mcp' ? (
|
) : activeView === 'mcp' ? (
|
||||||
<McpConfigurationPanel sandboxes={sandboxes} />
|
<McpConfigurationPanel sandboxes={sandboxes} />
|
||||||
) : activeView === 'wizards' ? (
|
) : activeView === 'wizards' ? (
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import assert from 'node:assert/strict'
|
||||||
|
import { readFile } from 'node:fs/promises'
|
||||||
|
import path from 'node:path'
|
||||||
|
|
||||||
|
const root = process.cwd()
|
||||||
|
const pagePath = path.join(root, 'app/page.tsx')
|
||||||
|
const helpPanelPath = path.join(root, 'app/components/HelpPanel.tsx')
|
||||||
|
|
||||||
|
const [pageSource, helpPanelSource] = await Promise.all([
|
||||||
|
readFile(pagePath, 'utf8'),
|
||||||
|
readFile(helpPanelPath, 'utf8'),
|
||||||
|
])
|
||||||
|
|
||||||
|
assert.match(pageSource, /useState\(false\)/, 'telemetry bar must be disabled by default')
|
||||||
|
assert.match(pageSource, /TELEMETRY_BAR_ENABLED_KEY/, 'telemetry bar preference must have a persistent storage key')
|
||||||
|
assert.match(pageSource, /telemetryBarEnabled && <LiveTelemetryBar \/>/, 'live telemetry bar must only mount when enabled')
|
||||||
|
assert.match(pageSource, /localStorage\.setItem\(TELEMETRY_BAR_ENABLED_KEY/, 'telemetry bar preference must persist when toggled')
|
||||||
|
assert.match(helpPanelSource, /Enable Telemetry Bar - EXPERIMENTAL/, 'Help must expose the requested telemetry bar checkbox label')
|
||||||
|
assert.match(helpPanelSource, /The telemetry bar is setup for vLLM tokens per second and does not currently work with other endpoints\./, 'Help must include the requested experimental caveat')
|
||||||
|
assert.match(helpPanelSource, /type="checkbox"[\s\S]*checked=\{telemetryBarEnabled\}/, 'Help checkbox must reflect telemetry bar enabled state')
|
||||||
|
|
||||||
|
console.log('telemetry bar toggle checks passed')
|
||||||
Reference in New Issue
Block a user