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
Add explicit plan and usage focus to Pulse Pro billing
rcourtman1db6b41aacc8
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.mdindex 65948c5648..e908712d72 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -123,7 +123,10 @@ agreement, and cloud-specific enforcement rules.the plan-focused billing state. The owned billing shell must express thosestates explicitly through its section selector and rendered content, notmerely through nearby hash anchors that still present the same visible- destination.+ destination. `frontend-modern/src/components/Settings/ProLicensePanel.tsx`+ and `frontend-modern/src/components/Settings/useProLicensePanelState.ts`+ therefore own a canonical two-state billing focus model (`plan` vs+ `usage`) that survives direct links and in-product CTA navigation.## Forbidden Pathsdiff --git a/frontend-modern/src/components/Settings/ProLicensePanel.tsx b/frontend-modern/src/components/Settings/ProLicensePanel.tsxindex 3b3a3921ef..15569059e6 100644--- a/frontend-modern/src/components/Settings/ProLicensePanel.tsx+++ b/frontend-modern/src/components/Settings/ProLicensePanel.tsx@@ -1,4 +1,4 @@-import type { Component } from 'solid-js';+import { Show, type Component } from 'solid-js';import RefreshCw from 'lucide-solid/icons/refresh-cw';import ShieldCheck from 'lucide-solid/icons/shield-check';import { MonitoredSystemLedgerPanel } from './MonitoredSystemLedgerPanel';@@ -7,6 +7,7 @@ import { ProLicensePlanSection } from './ProLicensePlanSection';import { SelfHostedCommercialActivationSection } from './SelfHostedCommercialActivationSection';import { useProLicensePanelState } from './useProLicensePanelState';import { SELF_HOSTED_PRO_BILLING_PRESENTATION } from './selfHostedBillingPresentation';+import { Subtabs } from '@/components/shared/Subtabs';import { getMonitoredSystemBriefSummary } from '@/utils/monitoredSystemPresentation';import {SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID,@@ -35,34 +36,54 @@ export const ProLicensePanel: Component = () => {loading={false}><div class="space-y-6">- <CommercialSection- id={SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID}- title={SELF_HOSTED_PRO_BILLING_PRESENTATION.planSectionTitle}- description={SELF_HOSTED_PRO_BILLING_PRESENTATION.planSectionDescription}- >- <ProLicensePlanSection- commercialMigrationNotice={state.commercialMigrationNotice()}- commercialPlanModel={state.commercialPlanModel()}- entitlements={state.entitlements()}- formattedFeatures={state.formattedFeatures()}- grandfatheredPriceNotice={state.grandfatheredPriceNotice()}- hasLicenseDetails={state.hasLicenseDetails()}- hasPaidFeatures={state.hasPaidFeatures()}- loading={state.loading()}- onReload={() => void state.loadPanelData()}- statusPresentation={state.statusPresentation()}- trialActivationNotice={state.trialActivationNotice()}- trialEnded={state.trialEnded()}- />- </CommercialSection>+ <Subtabs+ value={state.activeSection()}+ onChange={state.setActiveSection}+ ariaLabel={SELF_HOSTED_PRO_BILLING_PRESENTATION.sectionSelectorAriaLabel}+ tabs={[+ {+ value: 'plan',+ label: SELF_HOSTED_PRO_BILLING_PRESENTATION.planTabLabel,+ },+ {+ value: 'usage',+ label: SELF_HOSTED_PRO_BILLING_PRESENTATION.usageTabLabel,+ },+ ]}+ />- <CommercialSection- id={SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID}- title={SELF_HOSTED_PRO_BILLING_PRESENTATION.usageSectionTitle}- description={getMonitoredSystemBriefSummary()}- >- <MonitoredSystemLedgerPanel embedded />- </CommercialSection>+ <Show when={state.activeSection() === 'plan'}>+ <CommercialSection+ id={SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID}+ title={SELF_HOSTED_PRO_BILLING_PRESENTATION.planSectionTitle}+ description={SELF_HOSTED_PRO_BILLING_PRESENTATION.planSectionDescription}+ >+ <ProLicensePlanSection+ commercialMigrationNotice={state.commercialMigrationNotice()}+ commercialPlanModel={state.commercialPlanModel()}+ entitlements={state.entitlements()}+ formattedFeatures={state.formattedFeatures()}+ grandfatheredPriceNotice={state.grandfatheredPriceNotice()}+ hasLicenseDetails={state.hasLicenseDetails()}+ hasPaidFeatures={state.hasPaidFeatures()}+ loading={state.loading()}+ onReload={() => void state.loadPanelData()}+ statusPresentation={state.statusPresentation()}+ trialActivationNotice={state.trialActivationNotice()}+ trialEnded={state.trialEnded()}+ />+ </CommercialSection>+ </Show>++ <Show when={state.activeSection() === 'usage'}>+ <CommercialSection+ id={SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID}+ title={SELF_HOSTED_PRO_BILLING_PRESENTATION.usageSectionTitle}+ description={getMonitoredSystemBriefSummary()}+ >+ <MonitoredSystemLedgerPanel embedded />+ </CommercialSection>+ </Show><SelfHostedCommercialActivationSectionlicenseKey={state.licenseKey()}diff --git a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsxindex 0bbf2286c4..0a287221f1 100644--- a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx+++ b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx@@ -21,9 +21,12 @@ const activateLicenseMock = vi.fn();const clearLicenseMock = vi.fn();const notificationSuccessMock = vi.fn();const notificationErrorMock = vi.fn();-const useLocationMock = vi.fn(() => ({ search: '' }));+const useLocationMock = vi.fn(() => ({+ search: '',+ pathname: '/settings/system/billing',+ hash: '',+}));const navigateMock = vi.fn();-const scrollIntoViewMock = vi.fn();const getUpgradeActionDestinationMock = vi.hoisted(() => vi.fn());const getUpgradeActionUrlOrFallbackMock = vi.hoisted(() => vi.fn());@@ -75,7 +78,6 @@ describe('ProLicensePanel', () => {notificationErrorMock.mockReset();useLocationMock.mockReset();navigateMock.mockReset();- scrollIntoViewMock.mockReset();getUpgradeActionDestinationMock.mockReset();getUpgradeActionUrlOrFallbackMock.mockReset();loadLicenseStatusMock.mockResolvedValue(undefined);@@ -87,20 +89,15 @@ describe('ProLicensePanel', () => {external: true,}));getUpgradeActionUrlOrFallbackMock.mockImplementation((feature?: string) => getPublicPricingUrl(feature));- useLocationMock.mockReturnValue({ search: '' });- vi.stubGlobal('requestAnimationFrame', (callback: FrameRequestCallback) => {- callback(0);- return 0;- });- Object.defineProperty(HTMLElement.prototype, 'scrollIntoView', {- configurable: true,- value: scrollIntoViewMock,+ useLocationMock.mockReturnValue({+ search: '',+ pathname: '/settings/system/billing',+ hash: '',});});afterEach(() => {cleanup();- vi.unstubAllGlobals();});it('shows start trial action only when trial_eligible is true', async () => {@@ -183,26 +180,15 @@ describe('ProLicensePanel', () => {expect(screen.getAllByText('Active').length).toBeGreaterThan(0);expect(screen.getByText('V5 Lifetime Grandfathered')).toBeInTheDocument();expect(screen.getByText('Included Monitored Systems')).toBeInTheDocument();- expect(- screen.getByText('Billing is based on monitored systems. Child resources are included.'),- ).toBeInTheDocument();- expect(- screen.queryByText(/a monitored system is a top-level machine or cluster/i),- ).not.toBeInTheDocument();- expect(screen.getByRole('button', { name: 'View counting rules' })).toHaveAttribute(- 'aria-expanded',- 'false',- );+ expect(screen.getByRole('tab', { name: 'Plan' })).toHaveAttribute('aria-selected', 'true');+ expect(screen.getByRole('tab', { name: 'Usage' })).toHaveAttribute('aria-selected', 'false');- fireEvent.click(screen.getByRole('button', { name: 'View counting rules' }));+ fireEvent.click(screen.getByRole('tab', { name: 'Usage' }));- expect(screen.getByRole('button', { name: 'Hide counting rules' })).toHaveAttribute(- 'aria-expanded',- 'true',- );- expect(- screen.getByText(/a monitored system is a top-level machine or cluster/i),- ).toBeInTheDocument();+ expect(navigateMock).toHaveBeenCalledWith('/settings/system/billing#pulse-pro-usage', {+ replace: false,+ scroll: false,+ });});it('shows recurring grandfathered pricing continuity for migrated v5 Pro plans', async () => {@@ -344,7 +330,7 @@ describe('ProLicensePanel', () => {});});- it('anchors the plan and usage sections and scrolls to the requested billing hash', async () => {+ it('focuses the usage billing section when the route hash requests it', async () => {useLocationMock.mockReturnValue({search: '',pathname: '/settings/system/billing',@@ -353,12 +339,28 @@ describe('ProLicensePanel', () => {render(() => <ProLicensePanel />);- await waitFor(() => {- expect(scrollIntoViewMock).toHaveBeenCalled();+ expect(screen.getByRole('tab', { name: 'Usage' })).toHaveAttribute('aria-selected', 'true');+ expect(document.getElementById(SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID)).not.toBeInTheDocument();+ expect(document.getElementById(SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID)).toBeInTheDocument();+ expect(screen.getByText('Monitored Systems')).toBeInTheDocument();+ expect(screen.getByRole('button', { name: 'View counting rules' })).toBeInTheDocument();+ });++ it('navigates between plan and usage focus states through the billing subtabs', async () => {+ useLocationMock.mockReturnValue({+ search: '',+ pathname: '/settings/system/billing',+ hash: `#${SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID}`,});- expect(document.getElementById(SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID)).toBeInTheDocument();- expect(document.getElementById(SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID)).toBeInTheDocument();+ render(() => <ProLicensePanel />);++ fireEvent.click(screen.getByRole('tab', { name: 'Usage' }));++ expect(navigateMock).toHaveBeenCalledWith('/settings/system/billing#pulse-pro-usage', {+ replace: false,+ scroll: false,+ });});it('shows a migration-pending notice and hides the trial CTA', async () => {@@ -502,11 +504,13 @@ describe('ProLicensePanel', () => {expect(proLicensePanelSource).toContain('./ProLicensePlanSection');expect(proLicensePanelSource).toContain('SelfHostedCommercialActivationSection');expect(proLicensePanelSource).toContain('SELF_HOSTED_PRO_BILLING_PRESENTATION');+ expect(proLicensePanelSource).toContain("value={state.activeSection()}");+ expect(proLicensePanelSource).toContain('<Subtabs');expect(proLicensePanelSource).not.toContain('createSignal(');expect(proLicensePanelSource).not.toContain('useLocation()');expect(proLicensePanelStateSource).toContain('useLocation');- expect(proLicensePanelStateSource).toContain('requestAnimationFrame(scrollToBillingSectionHash);');- expect(proLicensePanelStateSource).toContain('SELF_HOSTED_PRO_BILLING_SECTION_IDS');+ expect(proLicensePanelStateSource).toContain('const activeSection = createMemo<SelfHostedBillingSection>(() => {');+ expect(proLicensePanelStateSource).toContain('const setActiveSection = (section: SelfHostedBillingSection) => {');expect(proLicensePanelStateSource).toContain('loadLicenseStatus(true)');expect(proLicensePanelStateSource).toContain('buildSelfHostedCommercialPlanModel');expect(proLicensePanelStateSource).toContain('runStartProTrialAction({');diff --git a/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts b/frontend-modern/src/components/Settings/selfHostedBillingPresentation.tsindex 8b1bcf1a0d..0fc7524914 100644--- a/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts+++ b/frontend-modern/src/components/Settings/selfHostedBillingPresentation.ts@@ -3,7 +3,10 @@ export interface SelfHostedProBillingPresentation {shellDescription: string;infrastructureRouteReferral: string;infrastructureWorkspaceReferral: string;+ sectionSelectorAriaLabel: string;refreshLabel: string;+ planTabLabel: string;+ usageTabLabel: string;planSectionTitle: string;planSectionDescription: string;usageSectionTitle: string;@@ -16,7 +19,10 @@ export const SELF_HOSTED_PRO_BILLING_PRESENTATION: SelfHostedProBillingPresentatinfrastructureRouteReferral: 'Billing and monitored-system limits live in Pulse Pro.',infrastructureWorkspaceReferral:'Billing, monitored-system limits, and Pulse Pro license status live in Pulse Pro, not here.',+ sectionSelectorAriaLabel: 'Pulse Pro billing section',refreshLabel: 'Refresh',+ planTabLabel: 'Plan',+ usageTabLabel: 'Usage',planSectionTitle: 'Plan',planSectionDescription: 'Review your active plan, expiry, included limits, and paid capabilities.',usageSectionTitle: 'Usage',diff --git a/frontend-modern/src/components/Settings/useProLicensePanelState.ts b/frontend-modern/src/components/Settings/useProLicensePanelState.tsindex b0d4d40fc6..6b575028da 100644--- a/frontend-modern/src/components/Settings/useProLicensePanelState.ts+++ b/frontend-modern/src/components/Settings/useProLicensePanelState.ts@@ -1,4 +1,4 @@-import { createEffect, createMemo, createSignal, onMount } from 'solid-js';+import { createMemo, createSignal, onMount } from 'solid-js';import { useLocation, useNavigate } from '@solidjs/router';import { notificationStore } from '@/stores/notifications';import {@@ -30,6 +30,8 @@ const SELF_HOSTED_PRO_BILLING_SECTION_IDS = new Set([SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID,]);+export type SelfHostedBillingSection = 'plan' | 'usage';+const formatDate = (value?: string | null) => {if (!value) return 'Not available';const date = new Date(value);@@ -78,30 +80,28 @@ export function useProLicensePanelState() {void loadPanelData();});- const scrollToBillingSectionHash = () => {+ const activeSection = createMemo<SelfHostedBillingSection>(() => {const hash = location.hash?.trim();- if (!hash?.startsWith('#')) {- return;+ const sectionId = hash?.startsWith('#') ? hash.slice(1) : '';+ if (sectionId === SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID) {+ return 'usage';}+ return 'plan';+ });- const sectionId = hash.slice(1);+ const setActiveSection = (section: SelfHostedBillingSection) => {+ const sectionId =+ section === 'usage'+ ? SELF_HOSTED_PRO_BILLING_USAGE_SECTION_ID+ : SELF_HOSTED_PRO_BILLING_PLAN_SECTION_ID;if (!SELF_HOSTED_PRO_BILLING_SECTION_IDS.has(sectionId)) {return;}- const target = document.getElementById(sectionId);- if (!target) {- return;- }-- target.scrollIntoView({ behavior: 'smooth', block: 'start' });+ const nextPath = `${location.pathname}${location.search}${`#${sectionId}`}`;+ navigate(nextPath, { replace: false, scroll: false });};- createEffect(() => {- location.hash;- requestAnimationFrame(scrollToBillingSectionHash);- });-const showTrialStart = createMemo(() => {const current = entitlements();if (!current) return false;@@ -289,6 +289,7 @@ export function useProLicensePanelState() {};return {+ activeSection,activating,clearing,commercialMigrationNotice,@@ -305,6 +306,7 @@ export function useProLicensePanelState() {loadPanelData,loading,looksLikeLegacyLicenseKey,+ setActiveSection,setLicenseKey,showTrialStart,startingTrial,diff --git a/frontend-modern/src/utils/__tests__/licensePresentation.test.ts b/frontend-modern/src/utils/__tests__/licensePresentation.test.tsindex f45b9a4b55..17b7c4bfed 100644--- a/frontend-modern/src/utils/__tests__/licensePresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/licensePresentation.test.ts@@ -69,7 +69,10 @@ describe('licensePresentation', () => {infrastructureRouteReferral: 'Billing and monitored-system limits live in Pulse Pro.',infrastructureWorkspaceReferral:'Billing, monitored-system limits, and Pulse Pro license status live in Pulse Pro, not here.',+ sectionSelectorAriaLabel: 'Pulse Pro billing section',refreshLabel: 'Refresh',+ planTabLabel: 'Plan',+ usageTabLabel: 'Usage',planSectionTitle: 'Plan',planSectionDescription:'Review your active plan, expiry, included limits, and paid capabilities.',