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.

Canonicalize compact settings row actions

rcourtmance2cc8948b2a
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index c57c7106ea..d616ee3d87 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -463,11 +463,12 @@ not a replacement status card, CTA band, or page-local nested card.
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, infrastructure setup controls, 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. The shared `mdCompact` size owns the common settings/action
- `px-3 py-2 text-sm` shape. If a new
+ Patrol controls, settings panel actions, infrastructure setup controls,
+ compact row actions, and other repeated command affordances must not copy
+ local `inline-flex ... rounded-md ...` Tailwind shells just because the page
+ needs a one-off action. The shared `mdCompact` size owns the common
+ settings/action `px-3 py-2 text-sm` shape, and the shared `xs` size owns the
+ compact settings row-action `px-2.5 py-1 text-xs` shape. 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.
diff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.json
index 63a3fb299f..f307d0c432 100644
--- a/frontend-modern/scripts/shared-template-registry.json
+++ b/frontend-modern/scripts/shared-template-registry.json
@@ -193,9 +193,11 @@
{ "path": "src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx" },
{ "path": "src/components/Settings/AgentProfilesPanel.tsx" },
{ "path": "src/components/Settings/AvailabilitySettingsPanel.tsx" },
+ { "path": "src/components/Settings/ConnectionEditor/ConnectionEditor.tsx" },
{ "path": "src/components/Settings/DataHandlingPanel.tsx" },
{ "path": "src/components/Settings/InfrastructureInstallerSection.tsx" },
{ "path": "src/components/Settings/InfrastructureSourceManager.tsx" },
+ { "path": "src/components/Settings/InfrastructureWorkspace.tsx" },
{ "path": "src/features/patrol/PatrolIntelligenceWorkspace.tsx" },
{ "path": "src/features/standalone/StandalonePageSurface.tsx" }
],
@@ -1082,6 +1084,28 @@
"src/components/shared/Button.test.tsx",
"scripts/shared-template-audit.mjs"
]
+ },
+ {
+ "id": "button-outline-settings-row-action-local-shell",
+ "category": "action-button",
+ "summary": "Settings row and inline actions must not copy the compact bordered px-2.5 py-1 action shell; use Button or ButtonLink with the outline variant and xs size.",
+ "canonical": {
+ "path": "src/components/shared/buttonModel.ts",
+ "export": "getButtonClass"
+ },
+ "scopes": ["src/components/Settings", "src/features", "src/pages"],
+ "extensions": [".tsx"],
+ "allPatterns": [
+ "rounded-md border border-border px-2.5 py-1 text-xs font-medium text-base-content"
+ ],
+ "legacyReason": "Retired migration debt. Compact settings row actions belong to the shared Button primitive family.",
+ "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/Settings/AvailabilitySettingsPanel.tsx b/frontend-modern/src/components/Settings/AvailabilitySettingsPanel.tsx
index d9e6b72c96..a4c2376f3d 100644
--- a/frontend-modern/src/components/Settings/AvailabilitySettingsPanel.tsx
+++ b/frontend-modern/src/components/Settings/AvailabilitySettingsPanel.tsx
@@ -34,8 +34,6 @@ import {
shouldOpenAvailabilityTargetAddDialog,
} from './availabilitySettingsModel';
-const rowActionButtonClass =
- 'inline-flex min-h-8 items-center justify-center rounded-md border border-border px-2.5 py-1 text-xs font-medium text-base-content transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-60';
const closeButtonClass =
'inline-flex h-9 w-9 items-center justify-center rounded-md border border-border text-base-content transition-colors hover:bg-surface-hover';
@@ -292,32 +290,38 @@ export const AvailabilitySettingsPanel: Component = () => {
</div>
</div>
<div class="flex flex-wrap items-center gap-2 md:justify-end">
- <button
+ <Button
type="button"
+ variant="outline"
+ size="xs"
+ class="min-h-8"
onClick={() => void testTarget(target)}
disabled={pending()}
- class={rowActionButtonClass}
>
{pending() ? 'Testing...' : 'Test'}
- </button>
- <button
+ </Button>
+ <Button
type="button"
+ variant="outline"
+ size="xs"
+ class="min-h-8"
onClick={() => void toggleTarget(target)}
disabled={pending()}
- class={rowActionButtonClass}
>
{target.enabled ? 'Pause' : 'Resume'}
- </button>
- <button
+ </Button>
+ <Button
type="button"
+ variant="outline"
+ size="xs"
+ class="min-h-8"
onClick={() => {
setDeleteConfirmingId(null);
setDialog({ mode: 'edit', target });
}}
- class={rowActionButtonClass}
>
Manage
- </button>
+ </Button>
</div>
</div>
);
diff --git a/frontend-modern/src/components/Settings/ConnectionEditor/ConnectionEditor.tsx b/frontend-modern/src/components/Settings/ConnectionEditor/ConnectionEditor.tsx
index ed80ed4cec..a0bcbaba72 100644
--- a/frontend-modern/src/components/Settings/ConnectionEditor/ConnectionEditor.tsx
+++ b/frontend-modern/src/components/Settings/ConnectionEditor/ConnectionEditor.tsx
@@ -10,6 +10,7 @@ import {
getInfrastructureAgentHostProfileSupportText,
getInfrastructureAutoDetectLabels,
} from '@/utils/infrastructureOnboardingPresentation';
+import { Button } from '@/components/shared/Button';
export type ConnectionEditorMode = 'add' | 'edit';
@@ -157,13 +158,14 @@ export const ConnectionEditor: Component<ConnectionEditorProps> = (props) => {
</Show>
</div>
<Show when={(props.mode ?? 'add') === 'add'}>
- <button
+ <Button
type="button"
+ variant="outline"
+ size="xs"
onClick={reopenProbe}
- class="inline-flex items-center rounded-md border border-border px-2.5 py-1 text-xs font-medium text-base-content transition-colors hover:bg-surface-hover"
>
← Back to API probe
- </button>
+ </Button>
</Show>
</div>
</Show>
@@ -176,13 +178,14 @@ export const ConnectionEditor: Component<ConnectionEditorProps> = (props) => {
}
>
<div class="border-b border-border bg-surface-alt px-4 py-2">
- <button
+ <Button
type="button"
+ variant="outline"
+ size="xs"
onClick={props.onBackToCatalog}
- class="inline-flex items-center rounded-md border border-border px-2.5 py-1 text-xs font-medium text-base-content transition-colors hover:bg-surface-hover"
>
← Back to source types
- </button>
+ </Button>
</div>
</Show>
diff --git a/frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx b/frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx
index 3b2d43646d..a5692cfe65 100644
--- a/frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx
+++ b/frontend-modern/src/components/Settings/InfrastructureSourceManager.tsx
@@ -59,8 +59,6 @@ interface InfrastructureSourceManagerProps {
onReviewDiscoveredSource?: (server: DiscoveredServer) => void;
}
-const inlineButtonClass =
- 'inline-flex min-w-[4.5rem] items-center justify-center rounded-md border border-border px-2.5 py-1 text-xs font-medium text-base-content transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-60';
// Per-section 'Add' shortcuts are demoted to ghost text buttons so the
// primary '+ Add infrastructure' CTA at the top of the page stays visually
// dominant. They retain the 1-click shortcut for users adding another node
@@ -1014,13 +1012,15 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
<Plus class="h-3.5 w-3.5" />
</button>
</Show>
- <button
+ <Button
type="button"
+ variant="outline"
+ size="xs"
+ class="min-w-[4.5rem]"
onClick={() => props.onOpenConnection?.(row)}
- class={inlineButtonClass}
>
Manage
- </button>
+ </Button>
</div>
</Show>
</TableCell>
@@ -1264,15 +1264,17 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
<span class="text-xs text-muted">Read only</span>
}
>
- <button
+ <Button
type="button"
+ variant="outline"
+ size="xs"
+ class="min-w-[4.5rem]"
onClick={() =>
props.onReviewDiscoveredSource?.(server)
}
- class={inlineButtonClass}
>
Review
- </button>
+ </Button>
</Show>
</TableCell>
</Show>
@@ -1504,13 +1506,15 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
</span>
</div>
<Show when={!props.readOnly && rowInteractive(row)}>
- <button
+ <Button
type="button"
+ variant="outline"
+ size="xs"
+ class="min-w-[4.5rem] flex-shrink-0"
onClick={() => props.onOpenConnection?.(row)}
- class={`${inlineButtonClass} flex-shrink-0`}
>
Manage
- </button>
+ </Button>
</Show>
</div>
<Show when={row.problem}>
@@ -1582,13 +1586,15 @@ export const InfrastructureSourceManager: Component<InfrastructureSourceManagerP
</span>
</div>
<Show when={!props.readOnly && props.onReviewDiscoveredSource}>
- <button
+ <Button
type="button"
+ variant="outline"
+ size="xs"
+ class="min-w-[4.5rem] flex-shrink-0"
onClick={() => props.onReviewDiscoveredSource?.(server)}
- class={`${inlineButtonClass} flex-shrink-0`}
>
Review
- </button>
+ </Button>
</Show>
</footer>
</article>
diff --git a/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx b/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
index d7bb536803..7d25561751 100644
--- a/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
+++ b/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
@@ -7,6 +7,7 @@ import { copyToClipboard } from '@/utils/clipboard';
import { notificationStore } from '@/stores/notifications';
import { updateStore } from '@/stores/updates';
import { Dialog } from '@/components/shared/Dialog';
+import { Button } from '@/components/shared/Button';
import { AgentProfilesPanel } from './AgentProfilesPanel';
import { ConnectionEditor } from './ConnectionEditor/ConnectionEditor';
import { NodeCredentialSlot } from './ConnectionEditor/CredentialSlots/NodeCredentialSlot';
@@ -360,13 +361,14 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
<div class="space-y-4">
<Show when={runtimeCapabilitiesLoaded() && hasFeature('agent_profiles')}>
<div class="flex items-center justify-end">
- <button
+ <Button
type="button"
+ variant="outline"
+ size="xs"
onClick={() => setShowAgentProfiles((value) => !value)}
- class="inline-flex items-center rounded-md border border-border px-2.5 py-1 text-xs font-medium text-base-content transition-colors hover:bg-surface-hover"
>
{showAgentProfiles() ? 'Hide agent profiles' : 'Manage agent profiles'}
- </button>
+ </Button>
</div>
</Show>
<Show when={showAgentProfiles()}>
diff --git a/frontend-modern/src/components/shared/Button.test.tsx b/frontend-modern/src/components/shared/Button.test.tsx
index 185134ba2c..63456a52a1 100644
--- a/frontend-modern/src/components/shared/Button.test.tsx
+++ b/frontend-modern/src/components/shared/Button.test.tsx
@@ -18,6 +18,7 @@ describe('Button', () => {
"secondary: 'border border-border bg-surface text-base-content shadow-sm hover:bg-surface-hover'",
);
expect(buttonModelSource).toContain('export const BUTTON_SIZE_CLASSES');
+ expect(buttonModelSource).toContain("xs: 'px-2.5 py-1 text-xs'");
expect(buttonModelSource).toContain("mdCompact: 'px-3 py-2 text-sm'");
});
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 4a121a550e..4680a8d7eb 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -107,6 +107,7 @@ import thresholdsTableDockerIgnoredPrefixesSectionSource from '@/components/Aler
import webhookConfigFormSource from '@/components/Alerts/WebhookConfigForm.tsx?raw';
import reportMergeModalSource from '@/components/Infrastructure/ReportMergeModal.tsx?raw';
import availabilitySettingsPanelSource from '@/components/Settings/AvailabilitySettingsPanel.tsx?raw';
+import connectionEditorSource from '@/components/Settings/ConnectionEditor/ConnectionEditor.tsx?raw';
import selfHostedCommercialRecoverySectionSource from '@/components/Settings/SelfHostedCommercialRecoverySection.tsx?raw';
import suggestProfileModalSource from '@/components/Settings/SuggestProfileModal.tsx?raw';
import alertAppriseDestinationsSectionSource from '@/features/alerts/AlertAppriseDestinationsSection.tsx?raw';
@@ -172,6 +173,7 @@ import dockerRuntimeSettingsCardSource from '@/components/Settings/DockerRuntime
import dataHandlingPanelSource from '@/components/Settings/DataHandlingPanel.tsx?raw';
import generalSettingsPanelSource from '@/components/Settings/GeneralSettingsPanel.tsx?raw';
import infrastructureInstallerSectionSource from '@/components/Settings/InfrastructureInstallerSection.tsx?raw';
+import infrastructureWorkspaceSource from '@/components/Settings/InfrastructureWorkspace.tsx?raw';
import organizationAccessMembersSectionSource from '@/components/Settings/OrganizationAccessMembersSection.tsx?raw';
import organizationIncomingSharesSectionSource from '@/components/Settings/OrganizationIncomingSharesSection.tsx?raw';
import organizationOutgoingSharesSectionSource from '@/components/Settings/OrganizationOutgoingSharesSection.tsx?raw';
@@ -1510,6 +1512,9 @@ describe('shared primitive guardrails', () => {
const settingsActionGuard = registry.patternGuards?.find(
(guard) => guard.id === 'button-secondary-settings-action-local-shell',
);
+ const settingsRowActionGuard = registry.patternGuards?.find(
+ (guard) => guard.id === 'button-outline-settings-row-action-local-shell',
+ );
expect(registeredRule?.canonical?.path).toBe('src/components/shared/Button.tsx');
expect(registeredRule?.canonical?.export).toBe('Button');
@@ -1518,9 +1523,11 @@ describe('shared primitive guardrails', () => {
'src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx',
'src/components/Settings/AgentProfilesPanel.tsx',
'src/components/Settings/AvailabilitySettingsPanel.tsx',
+ 'src/components/Settings/ConnectionEditor/ConnectionEditor.tsx',
'src/components/Settings/DataHandlingPanel.tsx',
'src/components/Settings/InfrastructureInstallerSection.tsx',
'src/components/Settings/InfrastructureSourceManager.tsx',
+ 'src/components/Settings/InfrastructureWorkspace.tsx',
'src/features/patrol/PatrolIntelligenceWorkspace.tsx',
'src/features/standalone/StandalonePageSurface.tsx',
]);
@@ -1544,6 +1551,18 @@ describe('shared primitive guardrails', () => {
]);
expect(settingsActionGuard?.allowedPaths ?? []).toHaveLength(0);
expect(settingsActionGuard?.ignoredPaths).toEqual(['src/components/shared/Button.test.tsx']);
+ expect(settingsRowActionGuard?.canonical?.path).toBe('src/components/shared/buttonModel.ts');
+ expect(settingsRowActionGuard?.canonical?.export).toBe('getButtonClass');
+ expect(settingsRowActionGuard?.allPatterns).toEqual([
+ 'rounded-md border border-border px-2.5 py-1 text-xs font-medium text-base-content',
+ ]);
+ expect(settingsRowActionGuard?.scopes).toEqual([
+ 'src/components/Settings',
+ 'src/features',
+ 'src/pages',
+ ]);
+ expect(settingsRowActionGuard?.allowedPaths ?? []).toHaveLength(0);
+ expect(settingsRowActionGuard?.ignoredPaths).toEqual(['src/components/shared/Button.test.tsx']);
expect(buttonSource).toContain('export function Button');
expect(buttonSource).toContain('export function ButtonLink');
@@ -1566,6 +1585,13 @@ describe('shared primitive guardrails', () => {
expect(availabilitySettingsPanelSource).not.toContain(
'rounded-md border border-border bg-surface px-3 py-2 text-sm font-medium text-base-content',
);
+ expect(availabilitySettingsPanelSource).not.toContain(
+ 'rounded-md border border-border px-2.5 py-1 text-xs font-medium text-base-content',
+ );
+ expect(connectionEditorSource).toContain('@/components/shared/Button');
+ expect(connectionEditorSource).not.toContain(
+ 'rounded-md border border-border px-2.5 py-1 text-xs font-medium text-base-content',
+ );
expect(dataHandlingPanelSource).toContain('@/components/shared/Button');
expect(dataHandlingPanelSource).toContain('ButtonLink');
expect(dataHandlingPanelSource).not.toContain(
@@ -1579,6 +1605,13 @@ describe('shared primitive guardrails', () => {
expect(infrastructureSourceManagerSource).not.toContain(
'rounded-md border border-border bg-surface px-3 py-2 text-sm font-medium text-base-content',
);
+ expect(infrastructureSourceManagerSource).not.toContain(
+ 'rounded-md border border-border px-2.5 py-1 text-xs font-medium text-base-content',
+ );
+ expect(infrastructureWorkspaceSource).toContain('@/components/shared/Button');
+ expect(infrastructureWorkspaceSource).not.toContain(
+ 'rounded-md border border-border px-2.5 py-1 text-xs font-medium text-base-content',
+ );
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',
diff --git a/frontend-modern/src/components/shared/buttonModel.ts b/frontend-modern/src/components/shared/buttonModel.ts
index df3a16b231..bda066c0a9 100644
--- a/frontend-modern/src/components/shared/buttonModel.ts
+++ b/frontend-modern/src/components/shared/buttonModel.ts
@@ -1,5 +1,5 @@
export type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'ghost' | 'outline';
-export type ButtonSize = 'sm' | 'mdCompact' | 'md' | 'lg' | 'icon';
+export type ButtonSize = 'xs' | 'sm' | 'mdCompact' | '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';
@@ -13,6 +13,7 @@ export const BUTTON_VARIANT_CLASSES: Record<ButtonVariant, string> = {
};
export const BUTTON_SIZE_CLASSES: Record<ButtonSize, string> = {
+ xs: 'px-2.5 py-1 text-xs',
sm: 'px-2.5 py-1.5 text-xs',
mdCompact: 'px-3 py-2 text-sm',
md: 'px-4 py-2 text-sm',