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 settings action buttons

rcourtmanefdf6acd1374
diff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.json
index 37607caf94..f2c5d19236 100644
--- a/frontend-modern/scripts/shared-template-registry.json
+++ b/frontend-modern/scripts/shared-template-registry.json
@@ -193,7 +193,17 @@
{ "path": "src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx" },
{ "path": "src/components/Settings/AgentProfilesPanel.tsx" },
{ "path": "src/components/Settings/AvailabilitySettingsPanel.tsx" },
+ { "path": "src/components/Settings/ConnectionEditor/AddressProbeStep.tsx" },
{ "path": "src/components/Settings/ConnectionEditor/ConnectionEditor.tsx" },
+ {
+ "path": "src/components/Settings/ConnectionEditor/CredentialSlots/AvailabilityTargetSlot.tsx"
+ },
+ {
+ "path": "src/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx"
+ },
+ {
+ "path": "src/components/Settings/ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsx"
+ },
{ "path": "src/components/Settings/CopyCommandBlock.tsx" },
{ "path": "src/components/Settings/DataHandlingPanel.tsx" },
{ "path": "src/components/Settings/InfrastructureAgentUpdatesDialog.tsx" },
@@ -1112,6 +1122,94 @@
"scripts/shared-template-audit.mjs"
]
},
+ {
+ "id": "button-outline-settings-action-local-shell",
+ "category": "action-button",
+ "summary": "Settings and infrastructure surfaces must not copy the bordered px-3 py-2 action-button shell; use Button or ButtonLink with the outline variant and settingsAction 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-3 py-2 text-sm font-medium text-base-content"
+ ],
+ "legacyReason": "Retired migration debt. Standard bordered settings 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"
+ ]
+ },
+ {
+ "id": "button-primary-settings-action-local-shell",
+ "category": "action-button",
+ "summary": "Settings and infrastructure surfaces must not copy the blue px-3 py-2 primary action-button shell; use Button with the primary variant and settingsAction size.",
+ "canonical": {
+ "path": "src/components/shared/buttonModel.ts",
+ "export": "getButtonClass"
+ },
+ "scopes": ["src/components/Settings", "src/features", "src/pages"],
+ "extensions": [".tsx"],
+ "allPatterns": [
+ "rounded-md bg-blue-600 px-3 py-2 text-sm font-medium text-white"
+ ],
+ "legacyReason": "Retired migration debt. Primary settings 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"
+ ]
+ },
+ {
+ "id": "button-danger-settings-action-local-shell",
+ "category": "action-button",
+ "summary": "Settings and infrastructure surfaces must not copy the rose px-3 py-2 destructive action-button shell; use Button with the danger variant and settingsAction size.",
+ "canonical": {
+ "path": "src/components/shared/buttonModel.ts",
+ "export": "getButtonClass"
+ },
+ "scopes": ["src/components/Settings", "src/features", "src/pages"],
+ "extensions": [".tsx"],
+ "allPatterns": [
+ "rounded-md bg-rose-600 px-3 py-2 text-sm font-medium text-white"
+ ],
+ "legacyReason": "Retired migration debt. Confirmed destructive settings 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"
+ ]
+ },
+ {
+ "id": "button-danger-outline-settings-action-local-shell",
+ "category": "action-button",
+ "summary": "Settings and infrastructure surfaces must not copy the rose outlined px-3 py-2 destructive action-button shell; use Button with the dangerOutline variant and settingsAction 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-rose-300 px-3 py-2 text-sm font-medium text-rose-700"
+ ],
+ "legacyReason": "Retired migration debt. Unconfirmed destructive settings 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"
+ ]
+ },
{
"id": "button-outline-settings-row-action-local-shell",
"category": "action-button",
diff --git a/frontend-modern/src/components/Settings/ConnectionEditor/AddressProbeStep.tsx b/frontend-modern/src/components/Settings/ConnectionEditor/AddressProbeStep.tsx
index ea07268656..c27b733502 100644
--- a/frontend-modern/src/components/Settings/ConnectionEditor/AddressProbeStep.tsx
+++ b/frontend-modern/src/components/Settings/ConnectionEditor/AddressProbeStep.tsx
@@ -1,5 +1,6 @@
import { Component, For, Show } from 'solid-js';
import type { ProbeCandidate } from '@/api/connections';
+import { Button } from '@/components/shared/Button';
import { formControl, formField, formHelpText, formLabel } from '@/components/shared/Form';
import { formatConnectionErrorMessage } from '@/utils/connectionErrorPresentation';
import { getInfrastructureAgentHostProfileSupportText } from '@/utils/infrastructureOnboardingPresentation';
@@ -51,13 +52,14 @@ export const AddressProbeStep: Component<AddressProbeStepProps> = (props) => {
</div>
<div class="flex items-center gap-2">
- <button
+ <Button
type="submit"
- class="inline-flex items-center rounded-md bg-blue-600 px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-500 disabled:opacity-60"
+ variant="primary"
+ size="settingsAction"
disabled={props.state.phase() === 'probing' || props.state.address().trim().length === 0}
>
{props.state.phase() === 'probing' ? 'Probing…' : 'Probe API endpoint'}
- </button>
+ </Button>
</div>
<Show when={props.state.phase() === 'error' && props.state.errorMessage().length > 0}>
diff --git a/frontend-modern/src/components/Settings/ConnectionEditor/ConnectionEditor.tsx b/frontend-modern/src/components/Settings/ConnectionEditor/ConnectionEditor.tsx
index a0bcbaba72..97df4948ac 100644
--- a/frontend-modern/src/components/Settings/ConnectionEditor/ConnectionEditor.tsx
+++ b/frontend-modern/src/components/Settings/ConnectionEditor/ConnectionEditor.tsx
@@ -109,13 +109,14 @@ export const ConnectionEditor: Component<ConnectionEditorProps> = (props) => {
</p>
</div>
<Show when={props.onBackToCatalog}>
- <button
- type="button"
+ <Button
+ variant="outline"
+ size="settingsAction"
onClick={props.onBackToCatalog}
- class="inline-flex items-center self-start rounded-md border border-border px-3 py-2 text-sm font-medium text-base-content transition-colors hover:bg-surface-hover"
+ class="self-start"
>
← Back to source types
- </button>
+ </Button>
</Show>
</div>
diff --git a/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/AvailabilityTargetSlot.tsx b/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/AvailabilityTargetSlot.tsx
index 7325f0e0c4..c1a4763158 100644
--- a/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/AvailabilityTargetSlot.tsx
+++ b/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/AvailabilityTargetSlot.tsx
@@ -1,4 +1,5 @@
import { Component, Show, createSignal, onMount } from 'solid-js';
+import { Button } from '@/components/shared/Button';
import {
formCheckbox,
formControl,
@@ -22,11 +23,6 @@ import {
type AvailabilityTargetPresetID,
} from '../availabilityTargetPresets';
-const buttonClass =
- 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md border border-border px-3 py-2 text-sm font-medium text-base-content transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-60';
-const primaryButtonClass =
- 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md bg-blue-600 px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60';
-
interface AvailabilityForm {
id: string;
name: string;
@@ -422,20 +418,30 @@ export const AvailabilityTargetSlot: Component<AvailabilityTargetSlotProps> = (p
<div class="sticky bottom-0 -mx-4 mt-auto border-t border-border bg-surface px-4 py-3 shadow-[0_-8px_16px_rgba(15,23,42,0.04)]">
<div class="flex flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-between">
<div class="flex flex-col gap-2 sm:flex-row">
- <button type="button" onClick={props.onCancel} class={buttonClass} disabled={isBusy()}>
+ <Button
+ variant="outline"
+ size="settingsAction"
+ onClick={props.onCancel}
+ disabled={isBusy()}
+ >
Cancel
- </button>
- <button type="button" onClick={handleTest} class={buttonClass} disabled={isBusy()}>
+ </Button>
+ <Button
+ variant="outline"
+ size="settingsAction"
+ onClick={handleTest}
+ disabled={isBusy()}
+ >
{testing() ? 'Testing…' : 'Test probe'}
- </button>
+ </Button>
</div>
<div class="flex flex-col-reverse gap-2 sm:flex-row sm:justify-end">
<Show when={isEditing() && props.onToggleEnabled}>
- <button
- type="button"
+ <Button
+ variant="outline"
+ size="settingsAction"
onClick={props.onToggleEnabled}
disabled={isBusy() || props.togglePending}
- class={buttonClass}
>
{props.togglePending
? props.connectionEnabled
@@ -444,34 +450,30 @@ export const AvailabilityTargetSlot: Component<AvailabilityTargetSlotProps> = (p
: props.connectionEnabled
? 'Pause target'
: 'Resume target'}
- </button>
+ </Button>
</Show>
<Show when={isEditing() && props.onDelete}>
- <button
- type="button"
+ <Button
+ variant={props.deleteConfirming ? 'danger' : 'dangerOutline'}
+ size="settingsAction"
onClick={props.onDelete}
disabled={isBusy()}
- class={
- props.deleteConfirming
- ? 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md bg-rose-600 px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-rose-700 disabled:cursor-not-allowed disabled:opacity-60'
- : 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md border border-rose-300 px-3 py-2 text-sm font-medium text-rose-700 transition-colors hover:bg-rose-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-rose-900 dark:text-rose-300 dark:hover:bg-rose-950'
- }
>
{props.deletePending
? 'Removing…'
: props.deleteConfirming
? 'Click again to confirm'
: 'Remove target'}
- </button>
+ </Button>
</Show>
- <button
- type="button"
+ <Button
+ variant="primary"
+ size="settingsAction"
onClick={handleSave}
- class={primaryButtonClass}
disabled={isBusy()}
>
{saving() ? 'Saving…' : isEditing() ? 'Save target' : addButtonLabel()}
- </button>
+ </Button>
</div>
</div>
</div>
diff --git a/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx b/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx
index 3355b6375f..9c7acd48d0 100644
--- a/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx
+++ b/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx
@@ -1,4 +1,5 @@
import { Component, Show, createEffect, onMount } from 'solid-js';
+import { Button } from '@/components/shared/Button';
import {
formCheckbox,
formControl,
@@ -12,11 +13,6 @@ import { MonitoredSystemImpactPreview } from '../../MonitoredSystemImpactPreview
import type { TrueNASConnection } from '@/api/truenas';
import type { TrueNASSettingsPanelState } from '../../useTrueNASSettingsPanelState';
-const buttonClass =
- 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md border border-border px-3 py-2 text-sm font-medium text-base-content transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-60';
-const primaryButtonClass =
- 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md bg-blue-600 px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60';
-
export interface TrueNASCredentialSlotProps {
state: TrueNASSettingsPanelState;
editingConnection?: TrueNASConnection | null;
@@ -314,9 +310,9 @@ export const TrueNASCredentialSlot: Component<TrueNASCredentialSlotProps> = (pro
<div class="flex flex-col-reverse gap-2 sm:flex-row sm:justify-end">
<Show when={isEditing() && props.onToggleEnabled}>
- <button
- type="button"
- class={buttonClass}
+ <Button
+ variant="outline"
+ size="settingsAction"
onClick={() => props.onToggleEnabled?.()}
disabled={
props.state.saving() ||
@@ -332,16 +328,12 @@ export const TrueNASCredentialSlot: Component<TrueNASCredentialSlotProps> = (pro
: props.connectionEnabled
? 'Pause connection'
: 'Resume connection'}
- </button>
+ </Button>
</Show>
<Show when={isEditing() && props.onDelete}>
- <button
- type="button"
- class={
- props.deleteConfirming
- ? 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md bg-rose-600 px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-rose-700 disabled:cursor-not-allowed disabled:opacity-60'
- : 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md border border-rose-300 px-3 py-2 text-sm font-medium text-rose-700 transition-colors hover:bg-rose-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-rose-900 dark:text-rose-300 dark:hover:bg-rose-950'
- }
+ <Button
+ variant={props.deleteConfirming ? 'danger' : 'dangerOutline'}
+ size="settingsAction"
onClick={() => props.onDelete?.()}
disabled={
props.state.saving() ||
@@ -355,11 +347,11 @@ export const TrueNASCredentialSlot: Component<TrueNASCredentialSlotProps> = (pro
: props.deleteConfirming
? 'Click again to confirm'
: 'Delete connection'}
- </button>
+ </Button>
</Show>
- <button
- type="button"
- class={buttonClass}
+ <Button
+ variant="outline"
+ size="settingsAction"
onClick={handleCancel}
disabled={
props.state.saving() ||
@@ -369,10 +361,10 @@ export const TrueNASCredentialSlot: Component<TrueNASCredentialSlotProps> = (pro
}
>
Cancel
- </button>
- <button
- type="button"
- class={buttonClass}
+ </Button>
+ <Button
+ variant="outline"
+ size="settingsAction"
onClick={() => void props.state.testCurrentForm()}
disabled={
props.state.saving() ||
@@ -382,19 +374,19 @@ export const TrueNASCredentialSlot: Component<TrueNASCredentialSlotProps> = (pro
}
>
{props.state.testing() ? 'Testing…' : 'Test connection'}
- </button>
- <button
- type="button"
- class={buttonClass}
+ </Button>
+ <Button
+ variant="outline"
+ size="settingsAction"
onClick={() => void props.state.previewCurrentForm()}
disabled={props.state.saving() || props.state.testing() || props.state.previewing()}
title="Show the resources Pulse would ingest from this connection without saving or starting polling."
>
{props.state.previewing() ? 'Previewing…' : 'Preview impact'}
- </button>
- <button
- type="button"
- class={primaryButtonClass}
+ </Button>
+ <Button
+ variant="primary"
+ size="settingsAction"
onClick={() => void props.state.saveCurrentForm()}
disabled={
props.state.saving() ||
@@ -411,7 +403,7 @@ export const TrueNASCredentialSlot: Component<TrueNASCredentialSlotProps> = (pro
: isEditing()
? 'Update connection'
: 'Add connection'}
- </button>
+ </Button>
</div>
</Show>
</div>
diff --git a/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsx b/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsx
index 4f87a5b85f..ce92f03164 100644
--- a/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsx
+++ b/frontend-modern/src/components/Settings/ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsx
@@ -1,5 +1,6 @@
import { Component, Show, createEffect, onMount } from 'solid-js';
import ShieldAlert from 'lucide-solid/icons/shield-alert';
+import { Button } from '@/components/shared/Button';
import { CalloutCard } from '@/components/shared/CalloutCard';
import {
formCheckbox,
@@ -13,11 +14,6 @@ import { MonitoredSystemImpactPreview } from '../../MonitoredSystemImpactPreview
import type { VMwareConnection } from '@/api/vmware';
import type { VMwareSettingsPanelState } from '../../useVMwareSettingsPanelState';
-const buttonClass =
- 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md border border-border px-3 py-2 text-sm font-medium text-base-content transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-60';
-const primaryButtonClass =
- 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md bg-blue-600 px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-60';
-
export interface VMwareCredentialSlotProps {
state: VMwareSettingsPanelState;
editingConnection?: VMwareConnection | null;
@@ -261,9 +257,9 @@ export const VMwareCredentialSlot: Component<VMwareCredentialSlotProps> = (props
<div class="flex flex-col-reverse gap-2 sm:flex-row sm:justify-end">
<Show when={isEditing() && props.onToggleEnabled}>
- <button
- type="button"
- class={buttonClass}
+ <Button
+ variant="outline"
+ size="settingsAction"
onClick={() => props.onToggleEnabled?.()}
disabled={
props.state.saving() ||
@@ -279,16 +275,12 @@ export const VMwareCredentialSlot: Component<VMwareCredentialSlotProps> = (props
: props.connectionEnabled
? 'Pause connection'
: 'Resume connection'}
- </button>
+ </Button>
</Show>
<Show when={isEditing() && props.onDelete}>
- <button
- type="button"
- class={
- props.deleteConfirming
- ? 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md bg-rose-600 px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-rose-700 disabled:cursor-not-allowed disabled:opacity-60'
- : 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md border border-rose-300 px-3 py-2 text-sm font-medium text-rose-700 transition-colors hover:bg-rose-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-rose-900 dark:text-rose-300 dark:hover:bg-rose-950'
- }
+ <Button
+ variant={props.deleteConfirming ? 'danger' : 'dangerOutline'}
+ size="settingsAction"
onClick={() => props.onDelete?.()}
disabled={
props.state.saving() ||
@@ -302,11 +294,11 @@ export const VMwareCredentialSlot: Component<VMwareCredentialSlotProps> = (props
: props.deleteConfirming
? 'Click again to confirm'
: 'Delete connection'}
- </button>
+ </Button>
</Show>
- <button
- type="button"
- class={buttonClass}
+ <Button
+ variant="outline"
+ size="settingsAction"
onClick={handleCancel}
disabled={
props.state.saving() ||
@@ -316,10 +308,10 @@ export const VMwareCredentialSlot: Component<VMwareCredentialSlotProps> = (props
}
>
Cancel
- </button>
- <button
- type="button"
- class={buttonClass}
+ </Button>
+ <Button
+ variant="outline"
+ size="settingsAction"
onClick={() => void props.state.testCurrentForm()}
disabled={
props.state.saving() ||
@@ -329,10 +321,10 @@ export const VMwareCredentialSlot: Component<VMwareCredentialSlotProps> = (props
}
>
{props.state.testing() ? 'Testing…' : 'Test connection'}
- </button>
- <button
- type="button"
- class={buttonClass}
+ </Button>
+ <Button
+ variant="outline"
+ size="settingsAction"
onClick={() => void props.state.previewCurrentForm()}
disabled={
props.state.saving() || props.state.testing() || props.state.previewing()
@@ -340,10 +332,10 @@ export const VMwareCredentialSlot: Component<VMwareCredentialSlotProps> = (props
title="Show the resources Pulse would ingest from this connection without saving or starting polling."
>
{props.state.previewing() ? 'Previewing…' : 'Preview impact'}
- </button>
- <button
- type="button"
- class={primaryButtonClass}
+ </Button>
+ <Button
+ variant="primary"
+ size="settingsAction"
onClick={() => void props.state.saveCurrentForm()}
disabled={
props.state.saving() ||
@@ -360,7 +352,7 @@ export const VMwareCredentialSlot: Component<VMwareCredentialSlotProps> = (props
: isEditing()
? 'Update connection'
: 'Add connection'}
- </button>
+ </Button>
</div>
</Show>
</div>
diff --git a/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx b/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
index 169a37f4bf..f7960403eb 100644
--- a/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
+++ b/frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx
@@ -91,9 +91,6 @@ const ADD_STEP_TO_INSTALLER_FOCUS: Partial<
kubernetes: 'kubernetes',
};
-const buttonClass =
- 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md border border-border px-3 py-2 text-sm font-medium text-base-content transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-60';
-
const trimSentenceTerminal = (value: string): string => value.trim().replace(/\.+$/, '');
const describeManagedSourceType = (type: ConnectionType | null): string => {
@@ -466,13 +463,14 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
<div class="mt-1 line-clamp-3 break-all font-mono text-[11px] text-base-content">
{agentUninstallCommands().linux}
</div>
- <button
- type="button"
+ <Button
+ variant="outline"
+ size="settingsAction"
onClick={() => void handleCopy(agentUninstallCommands().linux)}
- class={`${buttonClass} mt-3`}
+ class="mt-3"
>
Copy uninstall command
- </button>
+ </Button>
</div>
<div class="rounded-lg border border-border bg-surface-alt px-3 py-3">
@@ -482,13 +480,14 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
<div class="mt-1 line-clamp-3 break-all font-mono text-[11px] text-base-content">
{agentUninstallCommands().windows}
</div>
- <button
- type="button"
+ <Button
+ variant="outline"
+ size="settingsAction"
onClick={() => void handleCopy(agentUninstallCommands().windows)}
- class={`${buttonClass} mt-3`}
+ class="mt-3"
>
Copy uninstall command
- </button>
+ </Button>
</div>
</div>
</div>
@@ -513,22 +512,18 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
</Show>
<div class="flex flex-col-reverse gap-2 sm:flex-row sm:justify-end">
- <button
- type="button"
+ <Button
+ variant={removeConfirming() ? 'danger' : 'dangerOutline'}
+ size="settingsAction"
onClick={() => void rowActions.requestRemove(connection)}
disabled={removePending()}
- class={
- removeConfirming()
- ? 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md bg-rose-600 px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-rose-700 disabled:cursor-not-allowed disabled:opacity-60'
- : 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md border border-rose-300 px-3 py-2 text-sm font-medium text-rose-700 transition-colors hover:bg-rose-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-rose-900 dark:text-rose-300 dark:hover:bg-rose-950'
- }
>
{removePending()
? 'Removing…'
: removeConfirming()
? 'Click again to confirm'
: 'Remove source'}
- </button>
+ </Button>
</div>
</div>
);
@@ -595,29 +590,25 @@ const InfrastructureWorkspaceContent: Component<InfrastructureWorkspaceProps> =
</Show>
<div class="mt-4 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end">
- <button
- type="button"
+ <Button
+ variant="outline"
+ size="settingsAction"
onClick={() => void handleCopy(agentUninstallCommands().linux)}
- class={buttonClass}
>
Copy uninstall command
- </button>
- <button
- type="button"
+ </Button>
+ <Button
+ variant={removeConfirming() ? 'danger' : 'dangerOutline'}
+ size="settingsAction"
onClick={() => void rowActions.requestRemove(connection)}
disabled={removePending()}
- class={
- removeConfirming()
- ? 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md bg-rose-600 px-3 py-2 text-sm font-medium text-white transition-colors hover:bg-rose-700 disabled:cursor-not-allowed disabled:opacity-60'
- : 'inline-flex min-h-10 sm:min-h-9 items-center justify-center rounded-md border border-rose-300 px-3 py-2 text-sm font-medium text-rose-700 transition-colors hover:bg-rose-50 disabled:cursor-not-allowed disabled:opacity-60 dark:border-rose-900 dark:text-rose-300 dark:hover:bg-rose-950'
- }
>
{removePending()
? 'Removing…'
: removeConfirming()
? 'Click again to confirm'
: 'Remove Pulse Agent'}
- </button>
+ </Button>
</div>
</div>
);
diff --git a/frontend-modern/src/components/shared/Button.test.tsx b/frontend-modern/src/components/shared/Button.test.tsx
index 339391042f..1cffba6d3c 100644
--- a/frontend-modern/src/components/shared/Button.test.tsx
+++ b/frontend-modern/src/components/shared/Button.test.tsx
@@ -17,9 +17,13 @@ describe('Button', () => {
expect(buttonModelSource).toContain(
"secondary: 'border border-border bg-surface text-base-content shadow-sm hover:bg-surface-hover'",
);
+ expect(buttonModelSource).toContain('dangerOutline:');
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'");
+ expect(buttonModelSource).toContain(
+ "settingsAction: 'min-h-10 px-3 py-2 text-sm sm:min-h-9'",
+ );
expect(buttonModelSource).toContain("iconMd: 'h-9 w-9 p-0'");
});
@@ -52,6 +56,29 @@ describe('Button', () => {
expect(screen.getByRole('button', { name: 'Refresh' })).toBeDisabled();
});
+ it('renders settings action buttons through named size and variants', () => {
+ render(() => (
+ <>
+ <Button variant="primary" size="settingsAction">
+ Save source
+ </Button>
+ <Button variant="dangerOutline" size="settingsAction">
+ Remove source
+ </Button>
+ </>
+ ));
+
+ const saveButton = screen.getByRole('button', { name: 'Save source' });
+ expect(saveButton).toHaveClass('min-h-10');
+ expect(saveButton).toHaveClass('sm:min-h-9');
+ expect(saveButton).toHaveClass('bg-blue-600');
+
+ const removeButton = screen.getByRole('button', { name: 'Remove source' });
+ expect(removeButton).toHaveClass('min-h-10');
+ expect(removeButton).toHaveClass('border-rose-300');
+ expect(removeButton).toHaveClass('text-rose-700');
+ });
+
it('renders command-copy icon buttons through the shared primitive', () => {
const onClick = vi.fn();
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index db04047466..98e11eaaa9 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -107,7 +107,11 @@ 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 addressProbeStepSource from '@/components/Settings/ConnectionEditor/AddressProbeStep.tsx?raw';
import connectionEditorSource from '@/components/Settings/ConnectionEditor/ConnectionEditor.tsx?raw';
+import availabilityTargetSlotSource from '@/components/Settings/ConnectionEditor/CredentialSlots/AvailabilityTargetSlot.tsx?raw';
+import trueNASCredentialSlotSource from '@/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx?raw';
+import vmwareCredentialSlotSource from '@/components/Settings/ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsx?raw';
import copyCommandBlockSource from '@/components/Settings/CopyCommandBlock.tsx?raw';
import infrastructureAgentUpdatesDialogSource from '@/components/Settings/InfrastructureAgentUpdatesDialog.tsx?raw';
import infrastructureDiscoverySettingsDialogSource from '@/components/Settings/InfrastructureDiscoverySettingsDialog.tsx?raw';
@@ -1518,6 +1522,18 @@ describe('shared primitive guardrails', () => {
const settingsActionGuard = registry.patternGuards?.find(
(guard) => guard.id === 'button-secondary-settings-action-local-shell',
);
+ const settingsOutlineActionGuard = registry.patternGuards?.find(
+ (guard) => guard.id === 'button-outline-settings-action-local-shell',
+ );
+ const settingsPrimaryActionGuard = registry.patternGuards?.find(
+ (guard) => guard.id === 'button-primary-settings-action-local-shell',
+ );
+ const settingsDangerActionGuard = registry.patternGuards?.find(
+ (guard) => guard.id === 'button-danger-settings-action-local-shell',
+ );
+ const settingsDangerOutlineActionGuard = registry.patternGuards?.find(
+ (guard) => guard.id === 'button-danger-outline-settings-action-local-shell',
+ );
const settingsRowActionGuard = registry.patternGuards?.find(
(guard) => guard.id === 'button-outline-settings-row-action-local-shell',
);
@@ -1532,7 +1548,11 @@ describe('shared primitive guardrails', () => {
'src/components/Infrastructure/ResourceDetailDrawerDebugTab.tsx',
'src/components/Settings/AgentProfilesPanel.tsx',
'src/components/Settings/AvailabilitySettingsPanel.tsx',
+ 'src/components/Settings/ConnectionEditor/AddressProbeStep.tsx',
'src/components/Settings/ConnectionEditor/ConnectionEditor.tsx',
+ 'src/components/Settings/ConnectionEditor/CredentialSlots/AvailabilityTargetSlot.tsx',
+ 'src/components/Settings/ConnectionEditor/CredentialSlots/TrueNASCredentialSlot.tsx',
+ 'src/components/Settings/ConnectionEditor/CredentialSlots/VMwareCredentialSlot.tsx',
'src/components/Settings/CopyCommandBlock.tsx',
'src/components/Settings/DataHandlingPanel.tsx',
'src/components/Settings/InfrastructureAgentUpdatesDialog.tsx',
@@ -1573,6 +1593,70 @@ describe('shared primitive guardrails', () => {
]);
expect(settingsActionGuard?.allowedPaths ?? []).toHaveLength(0);
expect(settingsActionGuard?.ignoredPaths).toEqual(['src/components/shared/Button.test.tsx']);
+ expect(settingsOutlineActionGuard?.canonical?.path).toBe(
+ 'src/components/shared/buttonModel.ts',
+ );
+ expect(settingsOutlineActionGuard?.canonical?.export).toBe('getButtonClass');
+ expect(settingsOutlineActionGuard?.allPatterns).toEqual([
+ 'rounded-md border border-border px-3 py-2 text-sm font-medium text-base-content',
+ ]);
+ expect(settingsOutlineActionGuard?.scopes).toEqual([
+ 'src/components/Settings',
+ 'src/features',
+ 'src/pages',
+ ]);
+ expect(settingsOutlineActionGuard?.allowedPaths ?? []).toHaveLength(0);
+ expect(settingsOutlineActionGuard?.ignoredPaths).toEqual([
+ 'src/components/shared/Button.test.tsx',
+ ]);
+ expect(settingsPrimaryActionGuard?.canonical?.path).toBe(
+ 'src/components/shared/buttonModel.ts',
+ );
+ expect(settingsPrimaryActionGuard?.canonical?.export).toBe('getButtonClass');
+ expect(settingsPrimaryActionGuard?.allPatterns).toEqual([
+ 'rounded-md bg-blue-600 px-3 py-2 text-sm font-medium text-white',
+ ]);
+ expect(settingsPrimaryActionGuard?.scopes).toEqual([
+ 'src/components/Settings',
+ 'src/features',
+ 'src/pages',
+ ]);
+ expect(settingsPrimaryActionGuard?.allowedPaths ?? []).toHaveLength(0);
+ expect(settingsPrimaryActionGuard?.ignoredPaths).toEqual([
+ 'src/components/shared/Button.test.tsx',
+ ]);
+ expect(settingsDangerActionGuard?.canonical?.path).toBe(
+ 'src/components/shared/buttonModel.ts',
+ );
+ expect(settingsDangerActionGuard?.canonical?.export).toBe('getButtonClass');
+ expect(settingsDangerActionGuard?.allPatterns).toEqual([
+ 'rounded-md bg-rose-600 px-3 py-2 text-sm font-medium text-white',
+ ]);
+ expect(settingsDangerActionGuard?.scopes).toEqual([
+ 'src/components/Settings',
+ 'src/features',
+ 'src/pages',
+ ]);
+ expect(settingsDangerActionGuard?.allowedPaths ?? []).toHaveLength(0);
+ expect(settingsDangerActionGuard?.ignoredPaths).toEqual([
+ 'src/components/shared/Button.test.tsx',
+ ]);
+ expect(settingsDangerOutlineActionGuard?.canonical?.path).toBe(
+ 'src/components/shared/buttonModel.ts',
+ );
+ expect(settingsDangerOutlineActionGuard?.canonical?.export).toBe('getButtonClass');
+ expect(settingsDangerOutlineActionGuard?.allPatterns).toEqual([
+ 'rounded-md border border-rose-300 px-3 py-2 text-sm font-medium text-rose-700',
+ ]);
+ expect(settingsDangerOutlineActionGuard?.scopes).toEqual([
+ 'src/components/Settings',
+ 'src/features',
+ 'src/pages',
+ ]);
+ expect(settingsDangerOutlineActionGuard?.allowedPaths ?? []).toHaveLength(0);
+ expect(settingsDangerOutlineActionGuard?.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([
@@ -1608,6 +1692,8 @@ describe('shared primitive guardrails', () => {
expect(buttonSource).toContain('getButtonClass');
expect(buttonModelSource).toContain('BUTTON_VARIANT_CLASSES');
expect(buttonModelSource).toContain('BUTTON_SIZE_CLASSES');
+ expect(buttonModelSource).toContain('dangerOutline:');
+ expect(buttonModelSource).toContain('settingsAction:');
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',
@@ -1630,10 +1716,39 @@ describe('shared primitive guardrails', () => {
expect(availabilitySettingsPanelSource).not.toContain(
'h-9 w-9 items-center justify-center rounded-md border border-border text-base-content transition-colors hover:bg-surface-hover',
);
+ expect(addressProbeStepSource).toContain('@/components/shared/Button');
+ expect(addressProbeStepSource).toContain('size="settingsAction"');
+ expect(addressProbeStepSource).not.toContain(
+ 'rounded-md bg-blue-600 px-3 py-2 text-sm font-medium text-white',
+ );
expect(connectionEditorSource).toContain('@/components/shared/Button');
+ expect(connectionEditorSource).toContain('size="settingsAction"');
+ expect(connectionEditorSource).not.toContain(
+ 'rounded-md border border-border px-3 py-2 text-sm font-medium text-base-content',
+ );
expect(connectionEditorSource).not.toContain(
'rounded-md border border-border px-2.5 py-1 text-xs font-medium text-base-content',
);
+ for (const credentialSlotSource of [
+ availabilityTargetSlotSource,
+ trueNASCredentialSlotSource,
+ vmwareCredentialSlotSource,
+ ]) {
+ expect(credentialSlotSource).toContain('@/components/shared/Button');
+ expect(credentialSlotSource).toContain('size="settingsAction"');
+ expect(credentialSlotSource).not.toContain(
+ 'rounded-md border border-border px-3 py-2 text-sm font-medium text-base-content',
+ );
+ expect(credentialSlotSource).not.toContain(
+ 'rounded-md bg-blue-600 px-3 py-2 text-sm font-medium text-white',
+ );
+ expect(credentialSlotSource).not.toContain(
+ 'rounded-md bg-rose-600 px-3 py-2 text-sm font-medium text-white',
+ );
+ expect(credentialSlotSource).not.toContain(
+ 'rounded-md border border-rose-300 px-3 py-2 text-sm font-medium text-rose-700',
+ );
+ }
expect(copyCommandBlockSource).toContain('@/components/shared/Button');
expect(copyCommandBlockSource).toContain('CommandCopyButton');
expect(copyCommandBlockSource).not.toContain('absolute right-2 top-2');
@@ -1669,6 +1784,16 @@ describe('shared primitive guardrails', () => {
'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).toContain('size="settingsAction"');
+ expect(infrastructureWorkspaceSource).not.toContain(
+ 'rounded-md border border-border px-3 py-2 text-sm font-medium text-base-content',
+ );
+ expect(infrastructureWorkspaceSource).not.toContain(
+ 'rounded-md bg-rose-600 px-3 py-2 text-sm font-medium text-white',
+ );
+ expect(infrastructureWorkspaceSource).not.toContain(
+ 'rounded-md border border-rose-300 px-3 py-2 text-sm font-medium text-rose-700',
+ );
expect(infrastructureWorkspaceSource).not.toContain(
'rounded-md border border-border px-2.5 py-1 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 659c739b19..e06020b311 100644
--- a/frontend-modern/src/components/shared/buttonModel.ts
+++ b/frontend-modern/src/components/shared/buttonModel.ts
@@ -1,5 +1,19 @@
-export type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'ghost' | 'outline';
-export type ButtonSize = 'xs' | 'sm' | 'mdCompact' | 'md' | 'lg' | 'icon' | 'iconMd';
+export type ButtonVariant =
+ | 'primary'
+ | 'secondary'
+ | 'danger'
+ | 'dangerOutline'
+ | 'ghost'
+ | 'outline';
+export type ButtonSize =
+ | 'xs'
+ | 'sm'
+ | 'mdCompact'
+ | 'settingsAction'
+ | 'md'
+ | 'lg'
+ | 'icon'
+ | 'iconMd';
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';
@@ -7,7 +21,9 @@ export const BUTTON_BASE_CLASS =
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',
+ danger: 'border border-transparent bg-rose-600 text-white shadow-sm hover:bg-rose-700',
+ dangerOutline:
+ 'border border-rose-300 bg-transparent text-rose-700 hover:bg-rose-50 dark:border-rose-900 dark:text-rose-300 dark:hover:bg-rose-950',
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',
};
@@ -16,6 +32,7 @@ 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',
+ settingsAction: 'min-h-10 px-3 py-2 text-sm sm:min-h-9',
md: 'px-4 py-2 text-sm',
lg: 'px-6 py-3 text-base',
icon: 'p-2',