The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.
fix(dashboard): theme volume storage selector (#3214)
Lhfcws2fd412922041
diff --git a/apps/dashboard/README.md b/apps/dashboard/README.mdindex 617d4a6c6..97731bbc3 100644--- a/apps/dashboard/README.md+++ b/apps/dashboard/README.md@@ -145,10 +145,10 @@ See [Checkpoint controls and recovery](#checkpoint-controls-and-recovery) for re## Managed volumes-**Volumes → New Volume** selects Standard storage by default. Performance storage is offered only when the-API advertises `filestore_enabled`; unsupported deployments keep the option disabled. The API-assigns the underlying Filestore instance. Creation and Box failures retain the server reason plus non-sensitive-HTTP status, error code and Box ID when available.+**Volumes → New Volume** selects Standard storage by default in the shared themed selector. Performance storage+is labeled `Performance (Low-Latency IO) · Contact to apply` and offered only when the API advertises `filestore_enabled`;+unsupported deployments keep the option disabled. The API assigns the underlying Filestore instance. Creation and+Box failures retain the server reason plus non-sensitive HTTP status, error code and Box ID when available.## SSH accessdiff --git a/apps/dashboard/review-assets/new-volume-storage-select.html b/apps/dashboard/review-assets/new-volume-storage-select.htmlnew file mode 100644index 000000000..2b5ff7a2e--- /dev/null+++ b/apps/dashboard/review-assets/new-volume-storage-select.html@@ -0,0 +1,463 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="UTF-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>New Volume — themed storage selector</title>+ <style>+ :root {+ color-scheme: dark;+ font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;+ background: #070707;+ color: #fff;+ font-synthesis: none;+ }++ * {+ box-sizing: border-box;+ }++ body {+ min-width: 320px;+ min-height: 100vh;+ margin: 0;+ background:+ linear-gradient(rgb(255 255 255 / 2%) 1px, transparent 1px),+ linear-gradient(90deg, rgb(255 255 255 / 2%) 1px, transparent 1px),+ #090909;+ background-size: 48px 48px;+ }++ button,+ input {+ font: inherit;+ }++ button {+ color: inherit;+ }++ .backdrop {+ display: grid;+ min-height: 100vh;+ place-items: center;+ padding: 24px;+ background: rgb(0 0 0 / 66%);+ }++ .dialog {+ width: min(480px, 100%);+ overflow: visible;+ border: 1px solid #292929;+ background: #0d0d0d;+ box-shadow: 0 24px 64px -20px rgb(0 0 0 / 65%);+ }++ .dialog-header {+ display: flex;+ align-items: center;+ justify-content: space-between;+ border-bottom: 1px solid #292929;+ padding: 20px 24px;+ }++ h1 {+ margin: 0;+ font-size: 18px;+ font-weight: 600;+ letter-spacing: -0.02em;+ }++ .close {+ display: grid;+ width: 28px;+ height: 28px;+ cursor: pointer;+ border: 0;+ background: transparent;+ color: #9e9e9e;+ place-items: center;+ }++ .close:hover {+ color: #fff;+ }++ .dialog-body {+ padding: 24px;+ }++ .description,+ .note {+ color: #9e9e9e;+ font-size: 12px;+ line-height: 1.55;+ }++ .description {+ margin: 0 0 20px;+ }++ .field + .field {+ margin-top: 16px;+ }++ label {+ display: block;+ margin-bottom: 8px;+ font-size: 12px;+ font-weight: 500;+ }++ .input,+ .select-trigger {+ width: 100%;+ height: 40px;+ border: 1px solid #292929;+ border-radius: 0;+ background: #0d0d0d;+ box-shadow: inset 0 1px 2px rgb(0 0 0 / 24%);+ color: #fff;+ font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;+ font-size: 13px;+ }++ .input {+ padding: 0 12px;+ outline: none;+ }++ .input:focus-visible,+ .select-trigger:focus-visible {+ border-color: #666;+ outline: 2px solid rgb(0 176 240 / 20%);+ outline-offset: 0;+ }++ .select {+ position: relative;+ }++ .select-trigger {+ display: flex;+ cursor: pointer;+ align-items: center;+ justify-content: space-between;+ padding: 0 12px;+ text-align: left;+ }++ .select-trigger:hover {+ border-color: #3b3b3b;+ }++ .chevron {+ width: 16px;+ height: 16px;+ flex: none;+ color: #888;+ transition: transform 120ms ease;+ }++ .select-trigger[aria-expanded="true"] .chevron {+ transform: rotate(180deg);+ }++ .select-content {+ position: absolute;+ z-index: 10;+ top: calc(100% + 4px);+ right: 0;+ left: 0;+ padding: 4px;+ border: 1px solid #292929;+ background: #171717;+ box-shadow: 0 2px 4px rgb(0 0 0 / 20%), 0 8px 24px -8px rgb(0 0 0 / 50%);+ animation: enter 100ms ease-out;+ }++ .select-content[hidden] {+ display: none;+ }++ .option {+ position: relative;+ display: flex;+ width: 100%;+ min-height: 32px;+ cursor: default;+ align-items: center;+ border: 0;+ border-radius: 0;+ background: transparent;+ padding: 6px 8px 6px 32px;+ color: #fff;+ font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;+ font-size: 13px;+ text-align: left;+ white-space: nowrap;+ }++ .option:hover:not(:disabled),+ .option:focus-visible:not(:disabled) {+ background: #1f1f1f;+ outline: none;+ }++ .option:disabled {+ cursor: not-allowed;+ opacity: 0.38;+ }++ .check {+ position: absolute;+ left: 8px;+ display: none;+ width: 14px;+ height: 14px;+ }++ .option[aria-selected="true"] .check {+ display: block;+ }++ .note {+ min-height: 19px;+ margin: 12px 0 0;+ }++ .dialog-footer {+ display: flex;+ justify-content: flex-end;+ gap: 12px;+ border-top: 1px solid #292929;+ padding: 16px 24px;+ }++ .button {+ min-width: 84px;+ height: 36px;+ cursor: pointer;+ border: 1px solid #292929;+ border-radius: 0;+ background: transparent;+ padding: 0 16px;+ font-size: 13px;+ }++ .button:hover {+ background: #1a1a1a;+ }++ .button-primary {+ border-color: #fff;+ background: #fff;+ color: #0a0a0a;+ }++ .button-primary:hover {+ background: #e5e5e5;+ }++ .preview-state {+ position: fixed;+ top: 16px;+ right: 16px;+ display: flex;+ align-items: center;+ gap: 8px;+ color: #9e9e9e;+ font-size: 12px;+ }++ .preview-state input {+ accent-color: #00b0f0;+ }++ @keyframes enter {+ from {+ opacity: 0;+ transform: translateY(-3px) scale(0.98);+ }+ to {+ opacity: 1;+ transform: translateY(0) scale(1);+ }+ }++ @media (max-width: 560px) {+ .backdrop {+ padding: 16px;+ }++ .dialog-header,+ .dialog-body {+ padding-right: 20px;+ padding-left: 20px;+ }++ .option {+ white-space: normal;+ }++ .preview-state {+ display: none;+ }+ }+ </style>+ </head>+ <body>+ <label class="preview-state">+ <input id="performance-available" type="checkbox" />+ Performance available+ </label>+ <main class="backdrop">+ <section class="dialog" role="dialog" aria-modal="true" aria-labelledby="dialog-title">+ <header class="dialog-header">+ <h1 id="dialog-title">New Volume</h1>+ <button class="close" type="button" aria-label="Close">+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">+ <path d="m6 6 12 12M18 6 6 18" />+ </svg>+ </button>+ </header>+ <div class="dialog-body">+ <p class="description">+ Storage that outlives a box. Mount it into a box to read and write; the data stays once that box is gone,+ and another box can mount it later.+ </p>+ <div class="field">+ <label for="volume-name">Name</label>+ <input class="input" id="volume-name" value="subtitle-models" />+ </div>+ <div class="field">+ <label id="storage-label">Volume storage</label>+ <div class="select">+ <button+ class="select-trigger"+ id="storage-trigger"+ type="button"+ role="combobox"+ aria-labelledby="storage-label storage-value"+ aria-controls="storage-listbox"+ aria-expanded="false"+ >+ <span id="storage-value">Standard</span>+ <svg class="chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">+ <path d="m6 9 6 6 6-6" />+ </svg>+ </button>+ <div class="select-content" id="storage-listbox" role="listbox" aria-labelledby="storage-label" hidden>+ <button class="option" type="button" role="option" data-value="standard" aria-selected="true">+ <svg class="check" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">+ <path d="m5 12 4 4L19 6" />+ </svg>+ Standard+ </button>+ <button+ class="option"+ type="button"+ role="option"+ data-value="performance"+ aria-selected="false"+ disabled+ >+ <svg class="check" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">+ <path d="m5 12 4 4L19 6" />+ </svg>+ Performance (Low-Latency IO) · Contact to apply+ </button>+ </div>+ </div>+ <p class="note" id="storage-note">Performance storage is not configured on this deployment.</p>+ </div>+ </div>+ <footer class="dialog-footer">+ <button class="button" type="button">Cancel</button>+ <button class="button button-primary" type="button">Create</button>+ </footer>+ </section>+ </main>+ <script>+ const trigger = document.querySelector('#storage-trigger')+ const listbox = document.querySelector('#storage-listbox')+ const selectedText = document.querySelector('#storage-value')+ const availability = document.querySelector('#performance-available')+ const note = document.querySelector('#storage-note')+ const options = [...document.querySelectorAll('.option')]+ const performanceOption = document.querySelector('[data-value="performance"]')+ let selected = 'standard'++ function enabledOptions() {+ return options.filter((option) => !option.disabled)+ }++ function setOpen(open) {+ trigger.setAttribute('aria-expanded', String(open))+ listbox.hidden = !open+ if (open) {+ const current = options.find((option) => option.dataset.value === selected && !option.disabled)+ ;(current || enabledOptions()[0])?.focus()+ }+ }++ function updateNote() {+ if (!availability.checked) {+ note.textContent = 'Performance storage is not configured on this deployment.'+ } else if (selected === 'performance') {+ note.textContent = 'Used to mount this volume into a box. It is ready immediately after creation.'+ } else {+ note.textContent = 'Used to mount this volume into a box. It takes a few seconds to become ready.'+ }+ }++ function choose(option) {+ if (option.disabled) return+ selected = option.dataset.value+ selectedText.textContent = option.textContent.trim()+ options.forEach((item) => item.setAttribute('aria-selected', String(item === option)))+ updateNote()+ setOpen(false)+ trigger.focus()+ }++ trigger.addEventListener('click', () => setOpen(listbox.hidden))+ trigger.addEventListener('keydown', (event) => {+ if (['ArrowDown', 'ArrowUp', 'Enter', ' '].includes(event.key)) {+ event.preventDefault()+ setOpen(true)+ }+ })++ options.forEach((option) => {+ option.addEventListener('click', () => choose(option))+ option.addEventListener('keydown', (event) => {+ const enabled = enabledOptions()+ const index = enabled.indexOf(option)+ if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {+ event.preventDefault()+ const direction = event.key === 'ArrowDown' ? 1 : -1+ enabled[(index + direction + enabled.length) % enabled.length]?.focus()+ } else if (event.key === 'Enter' || event.key === ' ') {+ event.preventDefault()+ choose(option)+ } else if (event.key === 'Escape') {+ setOpen(false)+ trigger.focus()+ }+ })+ })++ availability.addEventListener('change', () => {+ performanceOption.disabled = !availability.checked+ updateNote()+ })++ document.addEventListener('pointerdown', (event) => {+ if (!event.target.closest('.select')) setOpen(false)+ })++ setOpen(true)+ </script>+ </body>+</html>diff --git a/apps/dashboard/src/pages/Volumes.test.tsx b/apps/dashboard/src/pages/Volumes.test.tsxindex efc7d9b59..f27a0631e 100644--- a/apps/dashboard/src/pages/Volumes.test.tsx+++ b/apps/dashboard/src/pages/Volumes.test.tsx@@ -135,12 +135,24 @@ async function submitWithEnter() {})}-function selectStorage(value: string) {- const select = document.querySelector<HTMLSelectElement>('[aria-label="Volume storage"]')!- act(() => {- Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype, 'value')!.set!.call(select, value)- select.dispatchEvent(new Event('change', { bubbles: true }))- })+function storageTrigger(): HTMLElement {+ return document.querySelector<HTMLElement>('[role="combobox"][aria-label="Volume storage"]')!+}++function selectedStorage(): string {+ return storageTrigger().textContent === 'Standard' ? 'standard' : 'performance'+}++async function selectStorage(value: string) {+ await act(async () =>+ storageTrigger().dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown', bubbles: true })),+ )+ const label = value === 'performance' ? 'Performance (Low-Latency IO) · Contact to apply' : 'Standard'+ const option = [...document.querySelectorAll<HTMLElement>('[role="option"]')].find(+ (item) => item.textContent === label,+ )!+ expect(option).toBeDefined()+ await act(async () => option.click())}describe('Volumes row action "New Box"', () => {@@ -411,6 +423,15 @@ describe('Volumes storage selection', () => {beforeEach(() => {vi.clearAllMocks()+ vi.stubGlobal(+ 'ResizeObserver',+ class {+ observe() {}+ unobserve() {}+ disconnect() {}+ },+ )+ HTMLElement.prototype.scrollIntoView = vi.fn()state.empty = falsestate.volumeState = 'ready'state.errorReason = undefined@@ -445,7 +466,7 @@ describe('Volumes storage selection', () => {it('defaults to standard storage and sends no implicit Filestore instance', async () => {renderPage()await act(async () => rowAction('New Volume')!.click())- expect(document.querySelector<HTMLSelectElement>('[aria-label="Volume storage"]')!.value).toBe('standard')+ expect(selectedStorage()).toBe('standard')inputText('Volume name', 'shared-data')await act(async () => rowAction('Create')!.click())@@ -453,11 +474,31 @@ describe('Volumes storage selection', () => {expect(toast.success).toHaveBeenCalledWith('Creating volume shared-data')})- it('keeps unconfigured Performance storage visible but disabled', () => {+ it('uses the themed storage selector and English latency copy', async () => {renderPage()- act(() => rowAction('New Volume')?.click())+ await act(async () => rowAction('New Volume')!.click())++ expect(document.querySelector('select[aria-label="Volume storage"]')).toBeNull()+ expect(storageTrigger().classList.contains('console-input-surface')).toBe(true)+ await act(async () =>+ storageTrigger().dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown', bubbles: true })),+ )++ expect(document.querySelector('.console-floating-surface[role="listbox"]')).not.toBeNull()+ expect(document.querySelector('[role="listbox"]')?.textContent).toContain('Performance (Low-Latency IO) · Contact to apply')+ })++ it('keeps unconfigured Performance storage visible but disabled', async () => {+ renderPage()+ await act(async () => rowAction('New Volume')!.click())+ await act(async () =>+ storageTrigger().dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown', bubbles: true })),+ )- expect(document.querySelector<HTMLOptionElement>('option[value="performance"]')!.disabled).toBe(true)+ const performanceOption = [...document.querySelectorAll<HTMLElement>('[role="option"]')].find(+ (item) => item.textContent === 'Performance (Low-Latency IO) · Contact to apply',+ )!+ expect(performanceOption.getAttribute('aria-disabled')).toBe('true')expect(document.body.textContent).toContain('Performance storage is not configured on this deployment.')})@@ -465,8 +506,8 @@ describe('Volumes storage selection', () => {state.capabilities = { object_storage_enabled: true, filestore_enabled: true }renderPage()await act(async () => rowAction('New Volume')!.click())- expect(document.querySelector<HTMLSelectElement>('[aria-label="Volume storage"]')!.value).toBe('standard')- selectStorage('performance')+ expect(selectedStorage()).toBe('standard')+ await selectStorage('performance')inputText('Volume name', 'nfs-data')await act(async () => rowAction('Create')!.click())@@ -483,7 +524,7 @@ describe('Volumes storage selection', () => {)renderPage()await act(async () => rowAction('New Volume')!.click())- selectStorage('performance')+ await selectStorage('performance')inputText('Volume name', 'nfs-data')await act(async () => rowAction('Create')!.click())@@ -498,7 +539,7 @@ describe('Volumes storage selection', () => {renderPage()await act(async () => rowAction('New Volume')!.click())- expect(document.querySelector<HTMLSelectElement>('[aria-label="Volume storage"]')!.value).toBe('performance')+ expect(selectedStorage()).toBe('performance')inputText('Volume name', 'nfs-data')await act(async () => rowAction('Create')!.click())expect(state.createdVolume).toEqual({ name: 'nfs-data', storageBackend: 'performance' })@@ -523,15 +564,15 @@ describe('Volumes storage selection', () => {expect(rowAction('Create')!.hasAttribute('disabled')).toBe(true)})- it('resets storage to the default each time the dialog opens', () => {+ it('resets storage to the default each time the dialog opens', async () => {state.capabilities = { object_storage_enabled: true, filestore_enabled: true }renderPage()act(() => rowAction('New Volume')?.click())- selectStorage('performance')+ await selectStorage('performance')act(() => rowAction('Cancel')?.click())act(() => rowAction('New Volume')?.click())- expect(document.querySelector<HTMLSelectElement>('[aria-label="Volume storage"]')!.value).toBe('standard')+ expect(selectedStorage()).toBe('standard')})it('keeps Standard available when an older config omits the new capability fields', async () => {diff --git a/apps/dashboard/src/pages/Volumes.tsx b/apps/dashboard/src/pages/Volumes.tsxindex 0b5a99da7..f4aa46440 100644--- a/apps/dashboard/src/pages/Volumes.tsx+++ b/apps/dashboard/src/pages/Volumes.tsx@@ -34,6 +34,7 @@ import {} from '@/components/ui/alert-dialog'import { Dialog, DialogTitle } from '@/components/ui/dialog'import { HardDrive, Plus, Trash } from '@/components/ui/icon'+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'import { useCreateVolumeMutation } from '@/hooks/mutations/useCreateVolumeMutation'import { useDeleteVolumeMutation } from '@/hooks/mutations/useDeleteVolumeMutation'import { queryKeys } from '@/hooks/queries/queryKeys'@@ -416,19 +417,22 @@ const Volumes: React.FC = () => {/><div className="mt-4"><div className="form-field-label">Volume storage</div>- <select+ <Selectvalue={selectedStorageBackend}- onChange={(event) => setNewStorageBackend(event.target.value as CreateVolumeStorageBackendEnum)}- aria-label="Volume storage"- className="form-field-input"+ onValueChange={(value) => setNewStorageBackend(value as CreateVolumeStorageBackendEnum)}>- <option value={CreateVolumeStorageBackendEnum.STANDARD} disabled={!objectStorageAvailable}>- Standard- </option>- <option value={CreateVolumeStorageBackendEnum.PERFORMANCE} disabled={!filestoreAvailable}>- Performance- </option>- </select>+ <SelectTrigger aria-label="Volume storage" className="form-field-input font-mono">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value={CreateVolumeStorageBackendEnum.STANDARD} disabled={!objectStorageAvailable}>+ Standard+ </SelectItem>+ <SelectItem value={CreateVolumeStorageBackendEnum.PERFORMANCE} disabled={!filestoreAvailable}>+ Performance (Low-Latency IO) · Contact to apply+ </SelectItem>+ </SelectContent>+ </Select></div>{storageCapabilitiesError ? (<ResourceErrorNotice