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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Register shared Button primitive governance
rcourtmanbbdd590a8249
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 884c6523de..d8cb970c69 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -163,6 +163,9 @@ work extends shared components instead of creating new local variants.134. `frontend-modern/src/utils/sourcePlatformOptions.ts`135. `frontend-modern/src/utils/sourcePlatforms.ts`136. `frontend-modern/src/utils/infrastructureOnboardingPresentation.ts`+137. `frontend-modern/src/components/shared/Button.tsx`+138. `frontend-modern/src/components/shared/buttonModel.ts`+139. `frontend-modern/src/components/shared/Button.test.tsx`## Shared Boundaries@@ -454,6 +457,18 @@ and status payloads. Those labels are summary context inside the same strip,not a replacement status card, CTA band, or page-local nested card.1. Add shared primitives in `frontend-modern/src/components/shared/`+ Standard command buttons and button-styled route actions belong to the+ shared `Button` primitive family. Feature pages may choose the action label,+ icon, route, click handler, and contextual layout, but secondary/primary/+ danger/outline/ghost button chrome, sizes, focus rings, disabled/loading+ behavior, and safe new-tab link behavior must come from `Button`,+ `ButtonLink`, and `buttonModel.ts`. Empty states, platform page notices,+ Patrol controls, settings panel actions, and other repeated command+ affordances must not copy local `inline-flex ... rounded-md ... bg-surface`+ Tailwind shells just because the page needs a one-off action. If a new+ surface needs a variant that the shared primitive does not expose, extend+ the primitive and registry guard rather than adding a page-local class+ string.Framed product table surfaces must consume the shared `TableCard` frame and`TableCardHeader` title/action band instead of composing page-local `Card`border, background, overflow, or table-title chrome. Feature owners may owndiff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.jsonindex 693581feda..684aedc522 100644--- a/frontend-modern/scripts/shared-template-registry.json+++ b/frontend-modern/scripts/shared-template-registry.json@@ -180,6 +180,27 @@"scripts/shared-template-audit.mjs"]},+ {+ "id": "button-command-shell",+ "category": "action-button",+ "summary": "Standard command buttons and button-styled route actions must compose Button or ButtonLink for shared variants, sizes, focus, disabled, loading, and safe-link behavior instead of recreating local Tailwind button shells.",+ "canonical": {+ "path": "src/components/shared/Button.tsx",+ "export": "Button"+ },+ "requiredConsumers": [+ { "path": "src/components/AI/Chat/ChatMessages.tsx" },+ { "path": "src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx" },+ { "path": "src/components/Settings/DataHandlingPanel.tsx" },+ { "path": "src/features/patrol/PatrolIntelligenceWorkspace.tsx" },+ { "path": "src/features/standalone/StandalonePageSurface.tsx" }+ ],+ "proof": [+ "src/components/shared/SharedPrimitives.guardrails.test.ts",+ "src/components/shared/Button.test.tsx",+ "scripts/shared-template-audit.mjs"+ ]+ },{"id": "form-select-shell","category": "form-control",@@ -200,8 +221,12 @@{ "path": "src/components/Settings/AIRuntimeControlsSection.tsx" },{ "path": "src/components/Settings/AgentProfilesPanel.tsx" },{ "path": "src/components/Settings/AuditLogPanel.tsx" },- { "path": "src/components/Settings/ConnectionEditor/CredentialSlots/AvailabilityTargetSlot.tsx" },- { "path": "src/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx" },+ {+ "path": "src/components/Settings/ConnectionEditor/CredentialSlots/AvailabilityTargetSlot.tsx"+ },+ {+ "path": "src/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx"+ },{ "path": "src/components/Settings/InfrastructureInstallerSection.tsx" },{ "path": "src/components/Settings/NodeModalMonitoringSection.tsx" },{ "path": "src/components/Settings/OrganizationAccessManagementSection.tsx" },@@ -1009,6 +1034,28 @@"src/components/shared/SharedPrimitives.guardrails.test.ts","scripts/shared-template-audit.mjs"]+ },+ {+ "id": "button-secondary-command-local-shell",+ "category": "action-button",+ "summary": "Product surfaces must not copy the standard secondary command-button shell; use Button for buttons and ButtonLink for route/link actions.",+ "canonical": {+ "path": "src/components/shared/buttonModel.ts",+ "export": "getButtonClass"+ },+ "scopes": ["src/components", "src/features", "src/pages"],+ "extensions": [".tsx"],+ "allPatterns": [+ "rounded-md border border-border bg-surface px-3 py-1.5 text-xs font-medium text-base-content"+ ],+ "legacyReason": "Retired migration debt. Standard secondary command buttons belong to the shared Button primitive family, including button-styled links.",+ "allowedPaths": [],+ "ignoredPaths": ["src/components/shared/Button.test.tsx"],+ "proof": [+ "src/components/shared/SharedPrimitives.guardrails.test.ts",+ "src/components/shared/Button.test.tsx",+ "scripts/shared-template-audit.mjs"+ ]}],"requiredPatternGuards": [diff --git a/frontend-modern/src/components/AI/Chat/ChatMessages.tsx b/frontend-modern/src/components/AI/Chat/ChatMessages.tsxindex 90a78d7808..e94343cc0b 100644--- a/frontend-modern/src/components/AI/Chat/ChatMessages.tsx+++ b/frontend-modern/src/components/AI/Chat/ChatMessages.tsx@@ -1,6 +1,7 @@import { Component, Show, For, createEffect, createMemo, createSignal } from 'solid-js';import { createStore, reconcile } from 'solid-js/store';import ArrowDownIcon from 'lucide-solid/icons/arrow-down';+import { Button } from '@/components/shared/Button';import { MessageItem } from './MessageItem';import type { ChatSession } from '@/api/aiChat';import type { QueuedFollowUp } from './hooks/useChat';@@ -317,15 +318,17 @@ export const ChatMessages: Component<ChatMessagesProps> = (props) => {<div ref={messagesEndRef} class="h-1" /></div><Show when={props.messages.length > 0 && !isPinnedToBottom()}>- <button+ <Buttontype="button"- class="absolute bottom-3 left-1/2 z-10 flex -translate-x-1/2 items-center gap-1.5 rounded-md border border-border bg-surface px-3 py-1.5 text-xs font-medium text-base-content shadow-lg transition-colors hover:bg-surface-alt focus:outline-none focus:ring-2 focus:ring-blue-500/40"+ variant="secondary"+ size="sm"+ class="absolute bottom-3 left-1/2 z-10 -translate-x-1/2 gap-1.5 px-3 shadow-lg hover:bg-surface-alt focus:ring-blue-500/40"onClick={jumpToLatest}aria-label="Jump to latest Assistant message"><ArrowDownIcon class="h-3.5 w-3.5" aria-hidden="true" /><span>Latest</span>- </button>+ </Button></Show></div>);diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsxindex c716fc7b6c..700fe06140 100644--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx@@ -1,5 +1,6 @@import { For, Show } from 'solid-js';import type { Component } from 'solid-js';+import { Button } from '@/components/shared/Button';import type { Resource } from '@/types/resource';import { formatRelativeTime } from '@/utils/format';import type { UseResourceDetailDrawerStateResult } from './useResourceDetailDrawerState';@@ -20,13 +21,15 @@ export const ResourceDetailDrawerDebugTab: Component<ResourceDetailDrawerDebugTa<div class="text-xs text-muted">Debug mode is enabled via localStorage (<code>pulse_debug_mode</code>).</div>- <button+ <Buttontype="button"+ variant="secondary"+ size="sm"+ class="px-3"onClick={drawer.handleCopyJson}- class="rounded-md border border-border bg-surface px-3 py-1.5 text-xs font-medium text-base-content transition-colors hover:bg-surface-hover">{drawer.copied() ? 'Copied' : 'Copy JSON'}- </button>+ </Button></div><div class="mt-3 space-y-4">diff --git a/frontend-modern/src/components/shared/Button.test.tsx b/frontend-modern/src/components/shared/Button.test.tsxnew file mode 100644index 0000000000..f139c8f0d6--- /dev/null+++ b/frontend-modern/src/components/shared/Button.test.tsx@@ -0,0 +1,91 @@+import { Route, Router } from '@solidjs/router';+import { cleanup, render, screen } from '@solidjs/testing-library';+import { afterEach, describe, expect, it, vi } from 'vitest';+import { Button, ButtonLink } from './Button';+import buttonSource from './Button.tsx?raw';+import buttonModelSource from './buttonModel.ts?raw';++describe('Button', () => {+ afterEach(() => {+ cleanup();+ window.history.replaceState({}, '', '/');+ });++ it('keeps shell styling in the shared model', () => {+ expect(buttonSource).toContain('getButtonClass');+ expect(buttonModelSource).toContain('export const BUTTON_VARIANT_CLASSES');+ expect(buttonModelSource).toContain(+ "secondary: 'border border-border bg-surface text-base-content shadow-sm hover:bg-surface-hover'",+ );+ expect(buttonModelSource).toContain('export const BUTTON_SIZE_CLASSES');+ });++ it('renders command buttons with the shared secondary shell', () => {+ const onClick = vi.fn();++ render(() => (+ <Button variant="secondary" size="sm" class="gap-2 px-3" onClick={onClick}>+ Add agent+ </Button>+ ));++ const button = screen.getByRole('button', { name: 'Add agent' });+ expect(button).toHaveAttribute('type', 'button');+ expect(button).toHaveClass('bg-surface');+ expect(button).toHaveClass('border-border');+ expect(button).toHaveClass('px-3');++ button.click();+ expect(onClick).toHaveBeenCalledTimes(1);+ });++ it('disables loading command buttons through the shared primitive', () => {+ render(() => (+ <Button variant="secondary" size="sm" isLoading>+ Refresh+ </Button>+ ));++ expect(screen.getByRole('button', { name: 'Refresh' })).toBeDisabled();+ });++ it('renders in-app button links through the router', () => {+ render(() => (+ <Router>+ <Route+ path="/"+ component={() => (+ <ButtonLink href="/standalone/availability" size="sm">+ View checks+ </ButtonLink>+ )}+ />+ </Router>+ ));++ const link = screen.getByRole('link', { name: 'View checks' });+ expect(link).toHaveAttribute('href', '/standalone/availability');+ expect(link).not.toHaveAttribute('target');+ expect(link).toHaveClass('bg-surface');+ });++ it('renders external or new-tab button links as safe native anchors', () => {+ render(() => (+ <Router>+ <Route+ path="/"+ component={() => (+ <ButtonLink href="https://example.com/docs" target="_blank" size="sm">+ Docs+ </ButtonLink>+ )}+ />+ </Router>+ ));++ const link = screen.getByRole('link', { name: 'Docs' });+ expect(link).toHaveAttribute('href', 'https://example.com/docs');+ expect(link).toHaveAttribute('target', '_blank');+ expect(link).toHaveAttribute('rel', 'noopener noreferrer');+ });+});diff --git a/frontend-modern/src/components/shared/Button.tsx b/frontend-modern/src/components/shared/Button.tsxindex 692b169408..de1c9d6190 100644--- a/frontend-modern/src/components/shared/Button.tsx+++ b/frontend-modern/src/components/shared/Button.tsx@@ -1,7 +1,6 @@-import { JSX, mergeProps, splitProps } from 'solid-js';--type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'ghost' | 'outline';-type ButtonSize = 'sm' | 'md' | 'lg' | 'icon';+import { A } from '@solidjs/router';+import { JSX, Show, mergeProps, splitProps } from 'solid-js';+import { getButtonClass, type ButtonSize, type ButtonVariant } from './buttonModel';export interface ButtonProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {variant?: ButtonVariant;@@ -10,20 +9,13 @@ export interface ButtonProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement>class?: string;}-const variantClasses: Record<ButtonVariant, string> = {- primary: 'bg-blue-600 text-white hover:bg-blue-700 border border-transparent shadow-sm',- secondary: 'bg-surface text-base-content hover:bg-surface-hover border border-border shadow-sm',- danger: 'bg-red-600 text-white hover:bg-red-700 border border-transparent shadow-sm',- ghost: 'bg-transparent text-base-content hover:bg-surface-hover border border-transparent',- outline: 'bg-transparent text-base-content border border-border hover:bg-surface-hover',-};--const sizeClasses: Record<ButtonSize, string> = {- sm: 'px-2.5 py-1.5 text-xs',- md: 'px-4 py-2 text-sm',- lg: 'px-6 py-3 text-base',- icon: 'p-2',-};+export interface ButtonLinkProps extends JSX.AnchorHTMLAttributes<HTMLAnchorElement> {+ href: string;+ variant?: ButtonVariant;+ size?: ButtonSize;+ class?: string;+ hardNavigation?: boolean;+}export function Button(props: ButtonProps) {const merged = mergeProps(@@ -39,12 +31,13 @@ export function Button(props: ButtonProps) {'disabled',]);- const baseClasses =- 'inline-flex items-center justify-center font-medium rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed';-return (<button- class={`${baseClasses} ${variantClasses[local.variant]} ${sizeClasses[local.size]} ${local.class || ''}`.trim()}+ class={getButtonClass({+ variant: local.variant,+ size: local.size,+ class: local.class,+ })}disabled={local.disabled || local.isLoading}{...rest}>@@ -75,4 +68,49 @@ export function Button(props: ButtonProps) {);}+export function ButtonLink(props: ButtonLinkProps) {+ const merged = mergeProps(+ { variant: 'secondary' as ButtonVariant, size: 'md' as ButtonSize },+ props,+ );+ const [local, rest] = splitProps(merged, [+ 'variant',+ 'size',+ 'class',+ 'children',+ 'href',+ 'hardNavigation',+ 'rel',+ 'target',+ ]);+ const className = () =>+ getButtonClass({+ variant: local.variant,+ size: local.size,+ class: local.class,+ });+ const useNativeAnchor = () =>+ Boolean(+ local.hardNavigation ||+ local.target === '_blank' ||+ /^(https?:|mailto:|tel:)/.test(local.href),+ );+ const rel = () => local.rel ?? (local.target === '_blank' ? 'noopener noreferrer' : undefined);++ return (+ <Show+ when={useNativeAnchor()}+ fallback={+ <A {...rest} href={local.href} class={className()}>+ {local.children}+ </A>+ }+ >+ <a {...rest} href={local.href} class={className()} target={local.target} rel={rel()}>+ {local.children}+ </a>+ </Show>+ );+}+export default Button;diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex ee0f240449..5d732d4cdd 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -3,8 +3,11 @@ import { join } from 'node:path';import { describe, expect, it } from 'vitest';import calloutCardSource from '@/components/shared/CalloutCard.tsx?raw';import assistantCommandHelpDialogSource from '@/components/AI/Chat/AssistantCommandHelpDialog.tsx?raw';+import chatMessagesSource from '@/components/AI/Chat/ChatMessages.tsx?raw';import aiChatSource from '@/components/AI/Chat/index.tsx?raw';import aiModelPickerSource from '@/components/shared/AIModelPicker.tsx?raw';+import buttonSource from '@/components/shared/Button.tsx?raw';+import buttonModelSource from '@/components/shared/buttonModel.ts?raw';import commandPaletteModalSource from '@/components/shared/CommandPaletteModal.tsx?raw';import commandPaletteModelSource from '@/components/shared/commandPaletteModel.ts?raw';import columnPickerSource from '@/components/shared/ColumnPicker.tsx?raw';@@ -159,11 +162,13 @@ import alertHistoryTableGroupRowSource from '@/features/alerts/AlertHistoryTableimport alertResourceTableDesktopSource from '@/components/Alerts/AlertResourceTableDesktop.tsx?raw';import aiCostDashboardSource from '@/components/AI/AICostDashboard.tsx?raw';import resourceDetailSummarySource from '@/components/Infrastructure/ResourceDetailSummary.tsx?raw';+import resourceDetailDrawerDebugTabSource from '@/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx?raw';import aiSettingsDialogsSource from '@/components/Settings/AISettingsDialogs.tsx?raw';import agentProfilesPanelSource from '@/components/Settings/AgentProfilesPanel.tsx?raw';import apiTokenManagerSource from '@/components/Settings/APITokenManager.tsx?raw';import diagnosticsResultsPanelSource from '@/components/Settings/DiagnosticsResultsPanel.tsx?raw';import dockerRuntimeSettingsCardSource from '@/components/Settings/DockerRuntimeSettingsCard.tsx?raw';+import dataHandlingPanelSource from '@/components/Settings/DataHandlingPanel.tsx?raw';import generalSettingsPanelSource from '@/components/Settings/GeneralSettingsPanel.tsx?raw';import organizationAccessMembersSectionSource from '@/components/Settings/OrganizationAccessMembersSection.tsx?raw';import organizationIncomingSharesSectionSource from '@/components/Settings/OrganizationIncomingSharesSection.tsx?raw';@@ -177,6 +182,7 @@ import infrastructureSourcePickerSource from '@/components/Settings/Infrastructuimport resourcePickerSource from '@/components/Settings/ResourcePicker.tsx?raw';import settingsPageShellSource from '@/components/Settings/SettingsPageShell.tsx?raw';import patrolIntelligenceHeaderSource from '@/features/patrol/PatrolIntelligenceHeader.tsx?raw';+import patrolIntelligenceWorkspaceSource from '@/features/patrol/PatrolIntelligenceWorkspace.tsx?raw';import filterBarSource from '@/components/shared/FilterBar/FilterBar.tsx?raw';import filterChipSource from '@/components/shared/FilterBar/FilterChip.tsx?raw';import addFilterMenuSource from '@/components/shared/FilterBar/AddFilterMenu.tsx?raw';@@ -228,16 +234,12 @@ describe('shared primitive guardrails', () => {allowedPaths?: string[];}>;};- const registeredRule = registry.rules?.find(- (rule) => rule.id === 'filter-button-group-shell',- );+ const registeredRule = registry.rules?.find((rule) => rule.id === 'filter-button-group-shell');const registeredGuard = registry.patternGuards?.find((guard) => guard.id === 'filter-button-group-local-segmented-control-styles',);- expect(registeredRule?.canonical?.path).toBe(- 'src/components/shared/FilterButtonGroup.tsx',- );+ expect(registeredRule?.canonical?.path).toBe('src/components/shared/FilterButtonGroup.tsx');expect(registeredRule?.canonical?.export).toBe('FilterButtonGroup');expect(registeredRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual(['src/components/Settings/GeneralSettingsPanel.tsx',@@ -254,11 +256,7 @@ describe('shared primitive guardrails', () => {]);expect(registeredGuard?.allowedPaths ?? []).toHaveLength(0);expect(registeredGuard?.scopes).toEqual(- expect.arrayContaining([- 'src/components/Settings',- 'src/features',- 'src/pages',- ]),+ expect.arrayContaining(['src/components/Settings', 'src/features', 'src/pages']),);expect(filterButtonGroupSource).toContain('useFilterButtonGroupState');@@ -517,16 +515,12 @@ describe('shared primitive guardrails', () => {allowedPaths?: string[];}>;};- const registeredRule = registry.rules?.find(- (rule) => rule.id === 'selection-card-group-shell',- );+ const registeredRule = registry.rules?.find((rule) => rule.id === 'selection-card-group-shell');const registeredGuard = registry.patternGuards?.find((guard) => guard.id === 'selection-card-group-local-active-card-styles',);- expect(registeredRule?.canonical?.path).toBe(- 'src/components/shared/SelectionCardGroup.tsx',- );+ expect(registeredRule?.canonical?.path).toBe('src/components/shared/SelectionCardGroup.tsx');expect(registeredRule?.canonical?.export).toBe('SelectionCardGroup');expect(registeredRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual(['src/components/Settings/AISettingsDialogs.tsx',@@ -535,20 +529,14 @@ describe('shared primitive guardrails', () => {expect(registeredGuard?.canonical?.path).toBe('src/components/shared/selectionCardGroupModel.ts',);- expect(registeredGuard?.canonical?.export).toBe(- 'getSelectionCardButtonClass',- );+ expect(registeredGuard?.canonical?.export).toBe('getSelectionCardButtonClass');expect(registeredGuard?.allPatterns).toEqual(['p-4 rounded-md border-2 transition-all text-left','p-3 rounded-md border-2 transition-all text-center',]);expect(registeredGuard?.allowedPaths ?? []).toHaveLength(0);expect(registeredGuard?.scopes).toEqual(- expect.arrayContaining([- 'src/components/Settings',- 'src/features',- 'src/pages',- ]),+ expect.arrayContaining(['src/components/Settings', 'src/features', 'src/pages']),);expect(selectionCardGroupSource).toContain('useSelectionCardGroupState');@@ -568,9 +556,7 @@ describe('shared primitive guardrails', () => {expect(selectionCardGroupModelSource).toContain('resolveSelectionCardTone');expect(selectionCardGroupModelSource).toContain('getSelectionCardButtonClass');expect(selectionCardGroupModelSource).toContain("compact: 'grid grid-cols-2 gap-2'");- expect(selectionCardGroupModelSource).toContain(- "detail: 'grid grid-cols-1 gap-3'",- );+ expect(selectionCardGroupModelSource).toContain("detail: 'grid grid-cols-1 gap-3'");expect(aiSettingsDialogsSource).toContain('SelectionCardGroup');expect(aiSettingsDialogsSource).toContain('variant="compact"');expect(aiSettingsDialogsSource).not.toContain(@@ -677,16 +663,12 @@ describe('shared primitive guardrails', () => {ignoredPaths?: string[];}>;};- const registeredRule = registry.rules?.find(- (rule) => rule.id === 'table-card-header-shell',- );+ const registeredRule = registry.rules?.find((rule) => rule.id === 'table-card-header-shell');const registeredGuard = registry.patternGuards?.find((guard) => guard.id === 'table-card-header-local-summary-header',);- expect(registeredRule?.canonical?.path).toBe(- 'src/components/shared/TableCardHeader.tsx',- );+ expect(registeredRule?.canonical?.path).toBe('src/components/shared/TableCardHeader.tsx');expect(registeredRule?.canonical?.export).toBe('TableCardHeader');expect(registeredRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual(['src/components/Infrastructure/UnifiedResourceHostTableCard.tsx',@@ -694,9 +676,7 @@ describe('shared primitive guardrails', () => {'src/components/Storage/StorageContentCard.tsx','src/features/platformPage/sharedPlatformPage.tsx',]);- expect(registeredGuard?.canonical?.path).toBe(- 'src/components/shared/TableCardHeader.tsx',- );+ expect(registeredGuard?.canonical?.path).toBe('src/components/shared/TableCardHeader.tsx');expect(registeredGuard?.canonical?.export).toBe('TableCardHeader');expect(registeredGuard?.allPatterns).toEqual(['SummaryTableCardHeader']);expect(registeredGuard?.allowedPaths ?? []).toHaveLength(0);@@ -741,16 +721,12 @@ describe('shared primitive guardrails', () => {ignoredPaths?: string[];}>;};- const registeredRule = registry.rules?.find(- (rule) => rule.id === 'table-card-frame-shell',- );+ const registeredRule = registry.rules?.find((rule) => rule.id === 'table-card-frame-shell');const registeredGuard = registry.patternGuards?.find((guard) => guard.id === 'table-card-frame-local-wrapper',);- expect(registeredRule?.canonical?.path).toBe(- 'src/components/shared/TableCard.tsx',- );+ expect(registeredRule?.canonical?.path).toBe('src/components/shared/TableCard.tsx');expect(registeredRule?.canonical?.export).toBe('TableCard');expect(registeredRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual(['src/components/Infrastructure/UnifiedResourceHostTableCard.tsx',@@ -1409,17 +1385,13 @@ describe('shared primitive guardrails', () => {(guard) => guard.id === 'status-indicator-badge-local-tone-helper',);- expect(registeredRule?.canonical?.path).toBe(- 'src/components/shared/StatusIndicatorBadge.tsx',- );+ expect(registeredRule?.canonical?.path).toBe('src/components/shared/StatusIndicatorBadge.tsx');expect(registeredRule?.canonical?.export).toBe('StatusIndicatorBadge');expect(registeredRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual(['src/components/Settings/AgentProfilesPanel.tsx','src/components/Settings/DiagnosticsResultsPanel.tsx',]);- expect(registeredGuard?.canonical?.path).toBe(- 'src/components/shared/StatusIndicatorBadge.tsx',- );+ expect(registeredGuard?.canonical?.path).toBe('src/components/shared/StatusIndicatorBadge.tsx');expect(registeredGuard?.canonical?.export).toBe('StatusIndicatorBadge');expect(registeredGuard?.allPatterns).toEqual(['getStatusIndicatorBadgeToneClasses(']);expect(registeredGuard?.scopes).toEqual(['src/components', 'src/features']);@@ -1513,6 +1485,69 @@ describe('shared primitive guardrails', () => {}});+ it('keeps standard command buttons on the shared Button primitive', () => {+ const registry = JSON.parse(sharedTemplateRegistrySource) as {+ rules?: Array<{+ id: string;+ canonical?: { path?: string; export?: string };+ requiredConsumers?: Array<{ path?: string }>;+ }>;+ patternGuards?: Array<{+ id: string;+ canonical?: { path?: string; export?: string };+ allPatterns?: string[];+ scopes?: string[];+ allowedPaths?: string[];+ ignoredPaths?: string[];+ }>;+ };+ const registeredRule = registry.rules?.find((rule) => rule.id === 'button-command-shell');+ const registeredGuard = registry.patternGuards?.find(+ (guard) => guard.id === 'button-secondary-command-local-shell',+ );++ expect(registeredRule?.canonical?.path).toBe('src/components/shared/Button.tsx');+ expect(registeredRule?.canonical?.export).toBe('Button');+ expect(registeredRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual([+ 'src/components/AI/Chat/ChatMessages.tsx',+ 'src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx',+ 'src/components/Settings/DataHandlingPanel.tsx',+ 'src/features/patrol/PatrolIntelligenceWorkspace.tsx',+ 'src/features/standalone/StandalonePageSurface.tsx',+ ]);+ expect(registeredGuard?.canonical?.path).toBe('src/components/shared/buttonModel.ts');+ expect(registeredGuard?.canonical?.export).toBe('getButtonClass');+ expect(registeredGuard?.allPatterns).toEqual([+ 'rounded-md border border-border bg-surface px-3 py-1.5 text-xs font-medium text-base-content',+ ]);+ expect(registeredGuard?.scopes).toEqual(['src/components', 'src/features', 'src/pages']);+ expect(registeredGuard?.allowedPaths ?? []).toHaveLength(0);+ expect(registeredGuard?.ignoredPaths).toEqual(['src/components/shared/Button.test.tsx']);++ expect(buttonSource).toContain('export function Button');+ expect(buttonSource).toContain('export function ButtonLink');+ expect(buttonSource).toContain('getButtonClass');+ expect(buttonModelSource).toContain('BUTTON_VARIANT_CLASSES');+ expect(buttonModelSource).toContain('BUTTON_SIZE_CLASSES');+ expect(chatMessagesSource).toContain('@/components/shared/Button');+ expect(chatMessagesSource).not.toContain(+ 'rounded-md border border-border bg-surface px-3 py-1.5 text-xs font-medium text-base-content',+ );+ expect(resourceDetailDrawerDebugTabSource).toContain('@/components/shared/Button');+ expect(resourceDetailDrawerDebugTabSource).not.toContain(+ 'rounded-md border border-border bg-surface px-3 py-1.5 text-xs font-medium text-base-content',+ );+ expect(dataHandlingPanelSource).toContain('@/components/shared/Button');+ expect(patrolIntelligenceWorkspaceSource).toContain('@/components/shared/Button');+ expect(patrolIntelligenceWorkspaceSource).not.toContain(+ 'rounded-md border border-border bg-surface px-3 py-1.5 text-xs font-medium text-base-content',+ );+ expect(standalonePageSurfaceSource).toContain('ButtonLink');+ expect(standalonePageSurfaceSource).not.toContain(+ 'rounded-md border border-border bg-surface px-3 py-1.5 text-xs font-medium text-base-content',+ );+ });+it('keeps discovery readiness badges presentation-only and accessible', () => {expect(discoveryReadinessBadgeSource).toContain("import type { DiscoveryReadinessPresentation } from '@/utils/resourceDiscoveryReadiness'",@@ -1854,10 +1889,7 @@ describe('shared primitive guardrails', () => {'src/features/platformPage/sharedPlatformPage.tsx',);expect(registeredGuard?.canonical?.export).toBe('PlatformTableLoadingState');- expect(registeredGuard?.allPatterns).toEqual([- 'role="status"',- 'px-3 py-2 text-xs text-muted',- ]);+ expect(registeredGuard?.allPatterns).toEqual(['role="status"', 'px-3 py-2 text-xs text-muted']);expect(registeredGuard?.allowedPaths ?? []).toHaveLength(0);expect(registeredGuard?.scopes).toEqual(expect.arrayContaining([diff --git a/frontend-modern/src/components/shared/buttonModel.ts b/frontend-modern/src/components/shared/buttonModel.tsnew file mode 100644index 0000000000..ddd3a4c435--- /dev/null+++ b/frontend-modern/src/components/shared/buttonModel.ts@@ -0,0 +1,36 @@+export type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'ghost' | 'outline';+export type ButtonSize = 'sm' | 'md' | 'lg' | 'icon';++export const BUTTON_BASE_CLASS =+ 'inline-flex items-center justify-center rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed';++export const BUTTON_VARIANT_CLASSES: Record<ButtonVariant, string> = {+ primary: 'border border-transparent bg-blue-600 text-white shadow-sm hover:bg-blue-700',+ secondary: 'border border-border bg-surface text-base-content shadow-sm hover:bg-surface-hover',+ danger: 'border border-transparent bg-red-600 text-white shadow-sm hover:bg-red-700',+ ghost: 'border border-transparent bg-transparent text-base-content hover:bg-surface-hover',+ outline: 'border border-border bg-transparent text-base-content hover:bg-surface-hover',+};++export const BUTTON_SIZE_CLASSES: Record<ButtonSize, string> = {+ sm: 'px-2.5 py-1.5 text-xs',+ md: 'px-4 py-2 text-sm',+ lg: 'px-6 py-3 text-base',+ icon: 'p-2',+};++export type ButtonClassOptions = {+ variant?: ButtonVariant;+ size?: ButtonSize;+ class?: string;+};++export const getButtonClass = (options: ButtonClassOptions = {}): string =>+ [+ BUTTON_BASE_CLASS,+ BUTTON_VARIANT_CLASSES[options.variant ?? 'secondary'],+ BUTTON_SIZE_CLASSES[options.size ?? 'md'],+ options.class,+ ]+ .filter(Boolean)+ .join(' ');diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsxindex fb29ecbe61..1e14505c84 100644--- a/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx@@ -7,6 +7,7 @@ import { formatTriggerReason } from '@/utils/patrolFormat';import { ResourcePolicySummary } from '@/components/Infrastructure/ResourcePolicySummary';import { ResourceCorrelationSummary } from '@/components/Infrastructure/ResourceCorrelationSummary';import { ResourceChangeSummary } from '@/components/Infrastructure/ResourceChangeSummary';+import { Button } from '@/components/shared/Button';import {getPatrolSupportingContextCorrelationSummary,getPatrolSupportingContextToggleLabel,@@ -147,13 +148,15 @@ export function PatrolIntelligenceWorkspace(props: { state: PatrolIntelligenceSt</Show></div>- <button+ <Buttontype="button"+ variant="secondary"+ size="sm"+ class="px-3"onClick={() => state.setShowInvestigationContext((value) => !value)}- class="inline-flex items-center rounded-md border border-border bg-surface px-3 py-1.5 text-xs font-medium text-base-content transition-colors hover:bg-surface-hover">{getPatrolSupportingContextToggleLabel(state.showInvestigationContext())}- </button>+ </Button></div><Show when={state.showInvestigationContext()}>diff --git a/frontend-modern/src/features/standalone/StandalonePageSurface.tsx b/frontend-modern/src/features/standalone/StandalonePageSurface.tsxindex 60d2eba90e..47cd51cc88 100644--- a/frontend-modern/src/features/standalone/StandalonePageSurface.tsx+++ b/frontend-modern/src/features/standalone/StandalonePageSurface.tsx@@ -1,8 +1,9 @@import { Show, createEffect, createMemo, createSignal } from 'solid-js';-import { A, useLocation, useNavigate } from '@solidjs/router';+import { useLocation, useNavigate } from '@solidjs/router';import ActivityIcon from 'lucide-solid/icons/activity';import ServerIcon from 'lucide-solid/icons/server';import SettingsIcon from 'lucide-solid/icons/settings';+import { Button, ButtonLink } from '@/components/shared/Button';import {buildInfrastructureAgentUpdatesPath,buildInfrastructureOnboardingPath,@@ -34,8 +35,6 @@ type StandaloneTabId = (typeof STANDALONE_TAB_SPECS)[number]['id'];const machineIcon = () => <ServerIcon class="h-6 w-6 text-slate-400" />;const availabilityIcon = () => <ActivityIcon class="h-6 w-6 text-slate-400" />;-const overviewActionClass =- 'inline-flex items-center gap-2 rounded-md border border-border bg-surface px-3 py-1.5 text-xs font-medium text-base-content shadow-sm hover:bg-slate-50';const resolveStandaloneTab = (pathname: string): StandaloneTabId =>pathname.replace(/\/+$/, '') === buildStandalonePath('availability')@@ -141,18 +140,25 @@ export function StandalonePageSurface() {description="Install Pulse Agent on servers, laptops, and desktops for CPU, memory, disk, and network telemetry. Agentless reachability checks live in Availability checks."actions={<div class="flex flex-wrap items-center justify-center gap-2">- <button+ <Buttontype="button"+ variant="secondary"+ size="sm"+ class="gap-2 px-3"onClick={() => navigate(buildInfrastructureOnboardingPath('pick'))}- class="inline-flex items-center gap-2 rounded-md border border-border bg-surface px-3 py-1.5 text-xs font-medium text-base-content shadow-sm hover:bg-slate-50"><SettingsIcon class="h-3.5 w-3.5" />Add agent- </button>- <A href={buildStandalonePath('availability')} class={overviewActionClass}>+ </Button>+ <ButtonLink+ href={buildStandalonePath('availability')}+ variant="secondary"+ size="sm"+ class="gap-2 px-3"+ ><ActivityIcon class="h-3.5 w-3.5" />View checks- </A>+ </ButtonLink></div>}/>@@ -177,21 +183,25 @@ export function StandalonePageSurface() {description="Availability checks, including ICMP checks for computers, stay in the Availability checks tab. Install Pulse Agent when you need full machine telemetry."actions={<div class="flex flex-wrap items-center justify-center gap-2">- <button+ <Buttontype="button"+ variant="secondary"+ size="sm"+ class="gap-2 px-3"onClick={() => navigate(buildInfrastructureOnboardingPath('pick'))}- class={overviewActionClass}><SettingsIcon class="h-3.5 w-3.5" />Add agent- </button>- <A+ </Button>+ <ButtonLinkhref={buildStandalonePath('availability')}- class={overviewActionClass}+ variant="secondary"+ size="sm"+ class="gap-2 px-3"><ActivityIcon class="h-3.5 w-3.5" />View checks- </A>+ </ButtonLink></div>}/>