Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Cover safety-notice actions through their consuming surfaces

pulse-triage[bot]9bffac048b42
diff --git a/frontend-modern/browser-tests/build-inline-notice-access.mjs b/frontend-modern/browser-tests/build-inline-notice-access.mjs
new file mode 100644
index 0000000000..d2366f25d6
--- /dev/null
+++ b/frontend-modern/browser-tests/build-inline-notice-access.mjs
@@ -0,0 +1,65 @@
+// Prepare a static production-component preview before bounded browser use.
+// This is not the production build or browser proof. All served bytes and
+// Tailwind inputs are bound; no compiler runs in the browser process tree.
+import { build } from 'vite';
+import solid from 'vite-plugin-solid';
+import tailwindcss from '@tailwindcss/vite';
+import { stop } from 'esbuild';
+import fs from 'node:fs';
+import path from 'node:path';
+import crypto from 'node:crypto';
+import { execFileSync } from 'node:child_process';
+import { fileURLToPath } from 'node:url';
+import sourceIdentity from './publication-fixture-source.cjs';
+
+const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
+const variant = process.argv[2];
+if (!['parent', 'final'].includes(variant)) throw new Error('Expected parent or final');
+const outDir = path.resolve(root, `../tmp/inline-notice-access/${variant}-static`);
+const hash = (bytes) => crypto.createHash('sha256').update(bytes).digest('hex');
+const binding = {
+ ...sourceIdentity.publicationSourceIdentity(process.argv.slice(3), () =>
+ execFileSync('git', ['rev-parse', 'HEAD'], { cwd: root, encoding: 'utf8' }),
+ ),
+ variant, graph: hash(fs.readFileSync(path.join(root, 'package-lock.json'))), sources: {}, artifacts: {},
+};
+try {
+ await build({
+ root, base: '/', configFile: false, publicDir: false,
+ plugins: [{
+ name: 'notice-action-source-binding', generateBundle() {
+ for (const id of this.getModuleIds()) {
+ const file = id.split('?')[0];
+ if (file.startsWith(root + '/') && !file.includes('/node_modules/') && fs.existsSync(file) && fs.statSync(file).isFile())
+ binding.sources[path.relative(root, file)] = hash(fs.readFileSync(file));
+ }
+ for (const file of ['src/components/shared/InlineNotice.tsx', 'src/components/Workloads/GuestDrawer.tsx', 'src/components/Infrastructure/ResourceDetailDrawer.tsx', 'src/components/Settings/RolesPanel.tsx', 'src/components/Settings/UserAssignmentsPanel.tsx', 'src/pages/Docs.tsx'])
+ if (!binding.sources[file]) throw new Error(`Required consumer not compiled: ${file}`);
+ },
+ }, tailwindcss(), solid()],
+ resolve: { alias: { '@': path.join(root, 'src') }, conditions: ['import', 'browser', 'default'] },
+ build: { target: 'esnext', outDir, emptyOutDir: true, rollupOptions: { input: path.join(root, 'browser-tests/inline-notice-access.html') } },
+ });
+ const bind = (directory) => {
+ for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
+ const file = path.join(directory, entry.name);
+ if (entry.isDirectory()) bind(file);
+ else if (/\.(css|js|jsx|ts|tsx|html|mjs|cjs)$/.test(file)) binding.sources[path.relative(root, file)] = hash(fs.readFileSync(file));
+ }
+ };
+ bind(path.join(root, 'src')); bind(path.join(root, 'browser-tests'));
+ for (const file of ['index.html', 'package.json', 'package-lock.json', 'tsconfig.json', 'public/docs/VM_DISK_MONITORING.md'])
+ binding.sources[file] = hash(fs.readFileSync(path.join(root, file)));
+ fs.mkdirSync(path.join(outDir, 'docs'), { recursive: true });
+ fs.copyFileSync(path.join(root, 'public/docs/VM_DISK_MONITORING.md'), path.join(outDir, 'docs/VM_DISK_MONITORING.md'));
+ const artifacts = (directory) => {
+ for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
+ const file = path.join(directory, entry.name);
+ if (entry.isDirectory()) artifacts(file);
+ else binding.artifacts[path.relative(outDir, file)] = hash(fs.readFileSync(file));
+ }
+ };
+ artifacts(outDir);
+ fs.writeFileSync(path.join(outDir, 'binding.json'), JSON.stringify(binding, null, 2) + '\n');
+ console.log(JSON.stringify({ variant, source: binding.source_sha, source_inputs: Object.keys(binding.sources).length, artifacts: Object.keys(binding.artifacts).length }));
+} finally { stop(); }
diff --git a/frontend-modern/browser-tests/inline-notice-access.cjs b/frontend-modern/browser-tests/inline-notice-access.cjs
new file mode 100644
index 0000000000..2c43acfb5f
--- /dev/null
+++ b/frontend-modern/browser-tests/inline-notice-access.cjs
@@ -0,0 +1,249 @@
+// Same consuming journey before and after the action-only repair. The parent
+// mode reports unmet accessibility criteria, not a passing repair proof.
+const fs = require('node:fs');
+const path = require('node:path');
+const http = require('node:http');
+const crypto = require('node:crypto');
+const assert = require('node:assert/strict');
+const { chromium, webkit } = require('playwright');
+const root = '/workspace';
+const frontend = root + '/frontend-modern';
+const origin = 'http://127.0.0.1:5326';
+const hash = (bytes) => crypto.createHash('sha256').update(bytes).digest('hex');
+
+async function presentation(action) {
+ return action.evaluate((element) => {
+ const rgba = (colour) => {
+ const values = colour.match(/[\d.]+/g).map(Number);
+ return [...values.slice(0, 3), values[3] ?? 1];
+ };
+ const luminance = (colour) => {
+ const rgb = colour.slice(0, 3).map((channel) => {
+ const value = channel / 255;
+ return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
+ });
+ return rgb[0] * 0.2126 + rgb[1] * 0.7152 + rgb[2] * 0.0722;
+ };
+ const contrast = (a, b) => {
+ const values = [luminance(a), luminance(b)].sort((x, y) => y - x);
+ return (values[0] + 0.05) / (values[1] + 0.05);
+ };
+ const backgrounds = [];
+ for (let node = element; node; node = node.parentElement) {
+ const background = rgba(getComputedStyle(node).backgroundColor);
+ backgrounds.push(background);
+ if (background[3] === 1) break;
+ }
+ const background = backgrounds.reverse().reduce((base, layer) =>
+ layer.slice(0, 3).map((value, index) => value * layer[3] + base[index] * (1 - layer[3])),
+ [255, 255, 255]);
+ const style = getComputedStyle(element), bounds = element.getBoundingClientRect();
+ return {
+ width: bounds.width, height: bounds.height, top: bounds.top, bottom: bounds.bottom,
+ viewport_height: window.innerHeight, focused: element === document.activeElement,
+ focus_visible: element.matches(':focus-visible'), outline_style: style.outlineStyle,
+ outline_width: style.outlineWidth, outline_offset: style.outlineOffset,
+ colour: style.color, outline_colour: style.outlineColor, background,
+ text_contrast: contrast(rgba(style.color), background),
+ outline_contrast: contrast(rgba(style.outlineColor), background),
+ underlined: style.textDecorationLine.includes('underline'),
+ document_width: document.documentElement.clientWidth,
+ document_scroll: document.documentElement.scrollWidth,
+ client_width: element.clientWidth, scroll_width: element.scrollWidth,
+ };
+ });
+}
+
+async function run(variant) {
+ assert(['parent', 'final'].includes(variant));
+ const output = root + '/tmp/inline-notice-access/' + variant + '-browser';
+ const compiled = root + '/tmp/inline-notice-access/' + variant + '-static';
+ fs.mkdirSync(output, { recursive: true });
+ const binding = JSON.parse(fs.readFileSync(compiled + '/binding.json'));
+ assert.equal(binding.variant, variant);
+ const result = {
+ result: 'incomplete', variant, source: binding.source_sha, binding,
+ driver_sha256: hash(fs.readFileSync(__filename)),
+ playwright: require('playwright/package.json').version, cases: [], captures: [], served: {},
+ cleanup: { browser: false, server: false },
+ limits: 'Synthetic canonical observations and API replies through actual producer/drawers/recovery panels/Docs. No guest, backup, diagnostic, native recovery, deployed access, release or reporter acceptance.',
+ };
+ let server, browser;
+ try {
+ assert.match(result.source, /^[a-f0-9]{40}$/);
+ assert.equal(result.playwright, JSON.parse(fs.readFileSync(root + '/tests/integration/package-lock.json')).packages['node_modules/@playwright/test'].version);
+ for (const [file, digest] of Object.entries(binding.sources))
+ assert.equal(hash(fs.readFileSync(frontend + '/' + file)), digest, file);
+ const docHash = hash(fs.readFileSync(root + '/docs/VM_DISK_MONITORING.md'));
+ assert.equal(binding.artifacts['docs/VM_DISK_MONITORING.md'], docHash);
+ result.doc_sha256 = docHash;
+ const assets = new Map();
+ for (const [file, digest] of Object.entries(binding.artifacts)) {
+ const bytes = fs.readFileSync(compiled + '/' + file);
+ assert.equal(hash(bytes), digest, file);
+ assets.set('/' + file, bytes);
+ }
+ server = http.createServer((request, response) => {
+ if (!['GET', 'HEAD'].includes(request.method)) { response.writeHead(405); return response.end(); }
+ let pathname = new URL(request.url, origin).pathname;
+ if (['/', '/recovery-fixture', '/docs/VM_DISK_MONITORING'].includes(pathname)) pathname = '/browser-tests/inline-notice-access.html';
+ const bytes = assets.get(pathname);
+ if (!bytes) { response.writeHead(404); return response.end(); }
+ result.served[pathname] = hash(bytes);
+ response.setHeader('Content-Type', { '.html': 'text/html', '.js': 'text/javascript', '.css': 'text/css', '.md': 'text/markdown; charset=utf-8' }[path.extname(pathname)] || 'application/octet-stream');
+ response.setHeader('Cache-Control', 'no-store');
+ response.setHeader('Content-Length', bytes.length);
+ response.end(request.method === 'HEAD' ? undefined : bytes);
+ });
+ await new Promise((resolve, reject) => { server.once('error', reject); server.listen(5326, '127.0.0.1', resolve); });
+
+ for (const [engine, width, theme] of [
+ [chromium, 1365, 'light'], [chromium, 1365, 'dark'],
+ [webkit, 390, 'light'], [webkit, 390, 'dark'],
+ ]) {
+ const name = `${engine === chromium ? 'chromium' : 'webkit'}-${width}-${theme}`;
+ browser = await engine.launch(engine === chromium ? { headless: true, channel: 'chromium', args: ['--no-sandbox'] } : { headless: true });
+ const context = await browser.newContext({ viewport: { width, height: 900 }, isMobile: width < 768, hasTouch: width < 768, colorScheme: theme, locale: 'en-GB', reducedMotion: 'reduce' });
+ await context.addInitScript((theme) => {
+ window.__noticeInputs = [];
+ document.addEventListener('click', (event) => window.__noticeInputs.push({ trusted: event.isTrusted, label: event.target.closest('a,button')?.textContent }), true);
+ document.addEventListener('DOMContentLoaded', () => document.documentElement.classList.toggle('dark', theme === 'dark'));
+ }, theme);
+ const record = { name, browser: browser.version(), width, theme, requests: [], errors: [], actions: [], criteria: [] };
+ result.cases.push(record);
+ const page = await context.newPage();
+ page.setDefaultTimeout(10000);
+ page.on('pageerror', (error) => record.errors.push(error.message));
+ const readErrors = { roles: true, users: true };
+ await page.route('**/*', (route) => {
+ const request = route.request(), url = new URL(request.url());
+ record.requests.push({ method: request.method(), path: url.pathname, external: url.origin !== origin });
+ assert.equal(url.origin, origin, 'no external requests');
+ assert.equal(request.method(), 'GET', 'no mutations');
+ assert(!/\/(?:diagnostics|run-command|guest-agent|qemu)(?:\/|$)/.test(url.pathname), 'no live probes');
+ if (!url.pathname.startsWith('/api/')) return route.continue();
+ if (url.pathname === '/api/admin/roles') return readErrors.roles
+ ? route.fulfill({ status: 503, json: { error: 'Synthetic read unavailable' } })
+ : route.fulfill({ json: [{ id: 'observer', name: 'Fixture observer', description: 'Read-only fixture', permissions: [], isBuiltIn: true }] });
+ if (url.pathname === '/api/admin/users') return readErrors.users
+ ? route.fulfill({ status: 503, json: { error: 'Synthetic read unavailable' } })
+ : route.fulfill({ json: [{ username: 'fixture-operator', displayName: 'Fixture operator', roleIds: ['observer'] }] });
+ if (url.pathname === '/api/license/runtime-capabilities') return route.fulfill({ json: { capabilities: ['rbac'], limits: [], hosted_mode: false, max_history_days: 7, runtime: { build: 'pro' }, blocked_capabilities: [] } });
+ return route.fulfill({ json: { success: true, data: [], alerts: [], anomalies: [], config: null } });
+ });
+
+ const capture = async (file, fullPage = false) => {
+ await page.screenshot({ path: output + '/' + file, fullPage });
+ result.captures.push({ file, sha256: hash(fs.readFileSync(output + '/' + file)) });
+ };
+ const inspectAction = async (action, label) => {
+ // Traverse backwards then forwards using native keyboard input rather
+ // than treating programmatic focus as evidence of tab navigation.
+ await action.focus(); await page.keyboard.press('Shift+Tab'); await page.keyboard.press('Tab');
+ await action.evaluate((element) => element.scrollIntoView({ block: 'center' }));
+ await page.evaluate(async () => { await document.fonts.ready; await new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve))); });
+ const metrics = await presentation(action);
+ assert.equal(metrics.focused, true, `${label} tab focus`);
+ assert.equal(metrics.focus_visible, true, `${label} focus visible`);
+ assert.ok(metrics.text_contrast >= 4.5, `${label} text contrast`);
+ assert.ok(metrics.document_scroll <= metrics.document_width + 1, `${label} document overflow`);
+ assert.ok(metrics.scroll_width <= metrics.client_width + 1, `${label} action overflow`);
+ const criteria = {
+ label, phone_target: width >= 768 || (metrics.height >= 44 && metrics.width >= 44),
+ compact_desktop: width < 768 || metrics.height === 16,
+ persistent_underline: metrics.underlined,
+ explicit_focus: metrics.outline_style === 'solid' && metrics.outline_width === '2px' && metrics.outline_offset === '2px' && metrics.outline_contrast >= 3,
+ };
+ record.actions.push({ label, ...metrics }); record.criteria.push(criteria);
+ if (variant === 'final') for (const [key, value] of Object.entries(criteria)) if (key !== 'label') assert.equal(value, true, `${label}: ${key}`);
+ return metrics;
+ };
+ const openGuest = async () => {
+ await page.goto(origin, { waitUntil: 'domcontentloaded' });
+ await page.waitForFunction(() => window.__noticeAccess?.evidence().projected);
+ const row = page.locator('[data-guest-id="fixture:pve1:101"] [data-row-action]').first();
+ if (width < 768) await page.getByText('safety-guest', { exact: true }).first().tap();
+ else { await row.focus(); await page.keyboard.press('Enter'); }
+ await page.getByRole('region', { name: 'Workload drawer', exact: true }).waitFor();
+ record.producer = await page.evaluate(() => window.__noticeAccess.evidence());
+ assert.equal(record.producer.projected.diskStatusReason, 'prev-vm-locked');
+ assert.equal(record.producer.projected.lock, 'backup');
+ };
+
+ for (const [region, testId] of [['Workload drawer', 'guest-read-precaution'], ['Canonical drawer', 'resource-guest-read-precaution']]) {
+ await openGuest();
+ const drawer = page.getByRole('region', { name: region, exact: true });
+ const notice = drawer.getByTestId(testId);
+ assert.match(await notice.innerText(), /An OK backup or a running VM does not prove thaw/);
+ assert.match(await notice.innerText(), /Confirm thaw and writes to the filesystems covered/);
+ for (const tab of ['History', 'Manage', 'Overview']) {
+ const button = drawer.getByRole('tab', { name: tab, exact: true });
+ if (width < 768) await button.tap(); else { await button.focus(); await page.keyboard.press('Enter'); }
+ assert.equal(await notice.isVisible(), true, `${region} notice across tabs`);
+ }
+ const action = notice.getByRole('link', { name: 'Backup safety guidance' });
+ assert.equal(await action.getAttribute('href'), '/docs/VM_DISK_MONITORING');
+ await page.evaluate(() => window.__noticeAccess.reason('prev-agent-cooldown'));
+ assert.match(await notice.innerText(), /cooldown/);
+ assert.equal(await action.getAttribute('href'), '/docs/VM_DISK_MONITORING');
+ await page.evaluate(() => window.__noticeAccess.reason('prev-vm-locked'));
+ const metrics = await inspectAction(action, region);
+ assert.ok(metrics.top >= 4 && metrics.bottom <= metrics.viewport_height - 4, 'whole focus target in capture');
+ await capture(`${name}-${region === 'Workload drawer' ? 'workload' : 'canonical'}-focus.png`);
+ if (width < 768) await action.tap({ position: { x: 6, y: 4 } });
+ else await page.keyboard.press('Enter');
+ await page.locator('article').waitFor();
+ assert.equal(new URL(page.url()).pathname, '/docs/VM_DISK_MONITORING');
+ assert.match(await page.locator('article').innerText(), /every\s+filesystem covered by the backup/);
+ // Native browser bytes bind the fetched consumer document, rather
+ // than trusting text or a lossy Playwright response.body projection.
+ const digest = await page.evaluate(async () => {
+ const bytes = await (await fetch('/docs/VM_DISK_MONITORING.md')).arrayBuffer();
+ return Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256', bytes))).map((value) => value.toString(16).padStart(2, '0')).join('');
+ });
+ assert.equal(digest, docHash);
+ record[region + ' guidance'] = { url: page.url(), native_document_sha256: digest };
+ }
+
+ await page.goto(origin + '/recovery-fixture', { waitUntil: 'domcontentloaded' });
+ const roles = page.getByRole('region', { name: 'Roles recovery', exact: true });
+ const users = page.getByRole('region', { name: 'User access recovery', exact: true });
+ await roles.getByRole('button', { name: 'Retry', exact: true }).waitFor();
+ await users.getByRole('button', { name: 'Retry', exact: true }).waitFor();
+ for (const [panel, key] of [[roles, 'roles'], [users, 'users']]) {
+ const action = panel.getByRole('button', { name: 'Retry', exact: true });
+ await inspectAction(action, key + ' retry');
+ if (key === 'roles') await capture(`${name}-recovery.png`, true);
+ const before = record.requests.filter((request) => request.path === '/api/admin/' + key).length;
+ readErrors[key] = false;
+ if (width < 768) await action.tap({ position: { x: 6, y: 4 } }); else await page.keyboard.press('Enter');
+ await panel.getByText(key === 'roles' ? 'Fixture observer' : 'Fixture operator', { exact: true }).waitFor();
+ assert.equal(await panel.getByRole('button', { name: 'Retry', exact: true }).count(), 0);
+ const after = record.requests.filter((request) => request.path === '/api/admin/' + key).length;
+ assert.equal(after - before, 1, 'one recovery read per activation');
+ record[key + '_retry'] = { before, after, result: 'loaded exact synthetic data; no access mutations' };
+ }
+ for (const tone of ['warning', 'danger', 'info', 'success']) {
+ const action = page.getByTestId('tone-' + tone).getByRole('link');
+ const metrics = await inspectAction(action, tone + ' long action');
+ assert.ok(width > 768 || metrics.height > 16, 'long phone label wraps');
+ // Long labels legitimately occupy more than one line on a phone;
+ // desktop labels stay one compact line in this production-size card.
+ }
+ record.inputs = await page.evaluate(() => window.__noticeInputs);
+ assert(record.inputs.some((event) => event.trusted && event.label?.includes('Retry')));
+ assert.deepEqual(record.errors, []);
+ await context.close(); await browser.close(); browser = null;
+ }
+ result.result = variant === 'parent' ? 'observed-parent-controls' : 'passed';
+ result.verified_at = new Date().toISOString();
+ } catch (error) { result.error = String(error.stack || error); throw error; }
+ finally {
+ if (browser) await browser.close(); result.cleanup.browser = true;
+ if (server) await new Promise((resolve, reject) => { server.close((error) => error ? reject(error) : resolve()); server.closeAllConnections(); });
+ result.cleanup.server = true;
+ fs.writeFileSync(output + '/result.json', JSON.stringify(result, null, 2) + '\n');
+ }
+}
+module.exports = { run };
+if (require.main === module) run('final').catch((error) => { console.error(error); process.exitCode = 1; });
diff --git a/frontend-modern/browser-tests/inline-notice-access.html b/frontend-modern/browser-tests/inline-notice-access.html
new file mode 100644
index 0000000000..98f5c4f003
--- /dev/null
+++ b/frontend-modern/browser-tests/inline-notice-access.html
@@ -0,0 +1,12 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Safety notice action access</title>
+ </head>
+ <body>
+ <div id="root"></div>
+ <script type="module" src="./inline-notice-access.tsx"></script>
+ </body>
+</html>
diff --git a/frontend-modern/browser-tests/inline-notice-access.tsx b/frontend-modern/browser-tests/inline-notice-access.tsx
new file mode 100644
index 0000000000..a6db3daa01
--- /dev/null
+++ b/frontend-modern/browser-tests/inline-notice-access.tsx
@@ -0,0 +1,82 @@
+// The canonical producer, both production drawers, recovery panels and Docs
+// renderer. Observations and GET replies are synthetic; no guest operation.
+import { createSignal, For, Show } from 'solid-js';
+import { render } from 'solid-js/web';
+import { Router, Route } from '@solidjs/router';
+import { DarkModeContext } from '../src/contexts/appRuntime';
+import { useWorkloads } from '../src/hooks/useWorkloads';
+import { GuestRow } from '../src/components/Workloads/GuestRow';
+import { GuestDrawer } from '../src/components/Workloads/GuestDrawer';
+import { ResourceDetailDrawer } from '../src/components/Infrastructure/ResourceDetailDrawer';
+import { RolesPanel } from '../src/components/Settings/RolesPanel';
+import { UserAssignmentsPanel } from '../src/components/Settings/UserAssignmentsPanel';
+import { InlineNotice, type InlineNoticeTone } from '../src/components/shared/InlineNotice';
+import Docs from '../src/pages/Docs';
+import type { Resource } from '../src/types/resource';
+import '../src/index.css';
+
+const resource: Resource = {
+ id: 'fixture:pve1:101', type: 'vm', name: 'safety-guest', displayName: 'safety-guest',
+ platformId: 'fixture', platformType: 'proxmox-pve', platformScopes: ['proxmox-pve'],
+ sourceType: 'api', sources: ['proxmox'], status: 'online', lastSeen: 1791885600000,
+ cpu: { current: 10 }, memory: { current: 25, total: 4 * 1024 ** 3, used: 1024 ** 3 },
+ disk: { current: 50, used: 5 * 1024 ** 3, total: 10 * 1024 ** 3 },
+ proxmox: {
+ vmid: 101, nodeName: 'pve1', instance: 'fixture', runtimeStatus: 'running',
+ guestAgentStatus: 'deferred', diskStatusReason: 'prev-vm-locked', lock: 'backup',
+ disks: [{ mountpoint: '/data', filesystem: 'ext4', total: 10 * 1024 ** 3, used: 5 * 1024 ** 3 }],
+ },
+};
+
+function GuestFixture() {
+ const [snapshot, setSnapshot] = createSignal<Resource[]>([resource]);
+ const state = useWorkloads(() => true, { resourceSnapshot: snapshot });
+ const guest = () => state.workloads()[0];
+ const [open, setOpen] = createSignal(false);
+ (window as any).__noticeAccess = {
+ evidence: () => ({ canonical: snapshot()[0], projected: guest() }),
+ reason: (reason: string) => setSnapshot((previous) => [{
+ ...previous[0], proxmox: { ...previous[0].proxmox, diskStatusReason: reason, lock: reason.includes('locked') ? 'backup' : '' },
+ }]),
+ };
+ return (
+ <main class="mx-auto min-h-screen max-w-4xl space-y-3 bg-surface p-3 text-base-content">
+ <h1>Safety notice action access</h1>
+ <p class="text-xs text-muted">Synthetic observations; no guest checks or backup actions.</p>
+ <Show when={guest()}>
+ <table class="w-full table-fixed"><tbody>
+ <GuestRow guest={guest()} visibleColumnIds={['name', 'disk']} isExpanded={open()}
+ workloadTableLayoutMode={window.innerWidth <= 768 ? 'phone' : 'wide'}
+ onClick={() => setOpen(!open())} />
+ </tbody></table>
+ <Show when={open()}>
+ <section aria-label="Workload drawer"><GuestDrawer guest={guest()} onClose={() => setOpen(false)} /></section>
+ <section aria-label="Canonical drawer"><ResourceDetailDrawer resource={snapshot()[0]} presentation="table-row" /></section>
+ </Show>
+ </Show>
+ </main>
+ );
+}
+
+function RecoveryFixture() {
+ return <main class="mx-auto min-h-screen max-w-4xl space-y-3 bg-surface p-3 text-base-content">
+ <h1>Notice recovery controls</h1>
+ <p class="text-xs text-muted">Synthetic read failures; no access settings are changed.</p>
+ <section aria-label="Roles recovery"><RolesPanel /></section>
+ <section aria-label="User access recovery"><UserAssignmentsPanel /></section>
+ <For each={['warning', 'danger', 'info', 'success'] as InlineNoticeTone[]}>
+ {(tone) => <InlineNotice tone={tone} data-testid={`tone-${tone}`} actionHref="/docs/VM_DISK_MONITORING"
+ actionLabel="Read the safety guidance before changing a guest's monitoring configuration">
+ Wrapping and focus contrast control.
+ </InlineNotice>}
+ </For>
+ </main>;
+}
+
+render(() => <DarkModeContext.Provider value={() => document.documentElement.classList.contains('dark')}>
+ <Router>
+ <Route path="/docs/*docPath" component={Docs} />
+ <Route path="/recovery-fixture" component={RecoveryFixture} />
+ <Route path="*" component={GuestFixture} />
+ </Router>
+</DarkModeContext.Provider>, document.getElementById('root')!);
diff --git a/frontend-modern/src/components/shared/InlineNotice.test.tsx b/frontend-modern/src/components/shared/InlineNotice.test.tsx
index e27db1c06a..10191d1c24 100644
--- a/frontend-modern/src/components/shared/InlineNotice.test.tsx
+++ b/frontend-modern/src/components/shared/InlineNotice.test.tsx
@@ -1,6 +1,6 @@
import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
import { afterEach, describe, expect, it, vi } from 'vitest';
-import { InlineNotice } from './InlineNotice';
+import { InlineNotice, type InlineNoticeTone } from './InlineNotice';
describe('InlineNotice', () => {
afterEach(() => {
@@ -81,4 +81,35 @@ describe('InlineNotice', () => {
expect(onAction).toHaveBeenCalledOnce();
expect(onDismiss).toHaveBeenCalledOnce();
});
+
+ it.each(['warning', 'danger', 'info', 'success'] as InlineNoticeTone[])(
+ 'keeps %s links and callback actions touch-sized and keyboard-visible',
+ (tone) => {
+ const onAction = vi.fn();
+ render(() => (
+ <>
+ <InlineNotice tone={tone} actionHref="/docs/VM_DISK_MONITORING" actionLabel="Read guidance">
+ Reading is deferred.
+ </InlineNotice>
+ <InlineNotice tone={tone} layout="banner" actionLabel="Retry" actionOnClick={onAction}>
+ Reading could not be loaded.
+ </InlineNotice>
+ </>
+ ));
+
+ const link = screen.getByRole('link', { name: 'Read guidance' });
+ const button = screen.getByRole('button', { name: 'Retry' });
+ for (const action of [link, button]) {
+ // The real CSS geometry and colours are checked through both guest
+ // drawers and the RBAC recovery consumers in the browser fixture.
+ expect(action).toHaveClass('min-h-11', 'min-w-11', 'sm:min-h-0', 'sm:min-w-0');
+ expect(action).toHaveClass('underline', 'focus-visible:outline-2');
+ expect(action).toHaveClass('focus-visible:outline-offset-2', 'focus-visible:outline-current');
+ }
+ expect(link).toHaveAttribute('href', '/docs/VM_DISK_MONITORING');
+ expect(button).toHaveAttribute('type', 'button');
+ fireEvent.click(button);
+ expect(onAction).toHaveBeenCalledOnce();
+ },
+ );
});