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
Suppress unavailable monitored-system warning banners
rcourtman9ca3a43e79d4
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 352d8e5910..5251a9ad3e 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -209,7 +209,12 @@ work extends shared components instead of creating new local variants.When a shared banner renders both explanatory and commercial CTAs, thoselabels must resolve to distinct owned destinations or section anchorsinstead of presenting two different labels that land on the same- unscoped billing screen.+ unscoped billing screen. Monitored-system warning banners must also honor+ canonical runtime usage availability before treating a limit as urgent:+ when the backend marks `max_monitored_systems.current_available=false`,+ the shared banner model must suppress usage summaries, upgrade pressure,+ and upgrade-impression telemetry rather than rendering stale `current/limit`+ counts or paid-plan CTAs.15. Keep assistant availability bootstrap on the shared app-shell boundary.`frontend-modern/src/useAppRuntimeState.ts`,`frontend-modern/src/App.tsx`,diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex ed748ac9f9..90adb01db9 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -468,7 +468,8 @@ describe('shared primitive guardrails', () => {expect(trialBannerStateSource).toContain('createSignal');expect(trialBannerStateSource).toContain('createMemo');expect(trialBannerStateSource).not.toContain('loadCommercialPosture');- expect(trialBannerStateSource).toContain('commercialPosture');+ expect(trialBannerStateSource).toContain('commercialTrialDaysRemaining');+ expect(trialBannerStateSource).toContain('isCommercialTrialActive');expect(trialBannerStateSource).toContain('presentationPolicyHidesCommercialSurfaces');expect(trialBannerStateSource).toContain('getUpgradeActionDestination');expect(trialBannerStateSource).toContain('snoozeUpsell');@@ -690,6 +691,10 @@ describe('shared primitive guardrails', () => {expect(monitoredSystemLimitWarningBannerModelSource).toContain('getMonitoredSystemLimitInstallCollectorsLabel',);+ expect(monitoredSystemLimitWarningBannerModelSource).toContain(+ 'isMonitoredSystemLimitUsageAvailable',+ );+ expect(monitoredSystemLimitWarningBannerModelSource).toContain('current_available');expect(monitoredSystemLimitWarningBannerModelSource).toContain('SELF_HOSTED_PRO_BILLING_USAGE_COUNTING_RULES_HREF',);diff --git a/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx b/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsxindex 5209f64ccf..24d25fd837 100644--- a/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx+++ b/frontend-modern/src/components/shared/__tests__/MonitoredSystemLimitWarningBanner.test.tsx@@ -15,6 +15,8 @@ type MockLimitRecord = {key: string;limit: number;current: number;+ current_available?: boolean;+ current_unavailable_reason?: string;state: string;};const mockGetLimit = vi.hoisted(() =>@@ -36,21 +38,20 @@ const mockGetUpgradeActionDestination = vi.hoisted(() => vi.fn());const mockGetUpgradeActionUrlOrFallback = vi.hoisted(() => vi.fn());vi.mock('@/stores/license', () => ({- getRuntimeLimit: (...args: unknown[]) => mockGetLimit(...args),- loadRuntimeCapabilities: (...args: unknown[]) => mockLoadRuntimeLicenseStatus(...args),+ getRuntimeLimit: (key: string) => mockGetLimit(key),+ loadRuntimeCapabilities: (force?: boolean) => mockLoadRuntimeLicenseStatus(force),}));vi.mock('@/stores/licenseCommercial', () => ({commercialOverflowDaysRemaining: () => mockEntitlements().overflow_days_remaining ?? null,- getUpgradeActionDestination: (...args: unknown[]) => mockGetUpgradeActionDestination(...args),- getUpgradeActionUrlOrFallback: (...args: unknown[]) => mockGetUpgradeActionUrlOrFallback(...args),+ getUpgradeActionDestination: (key: string) => mockGetUpgradeActionDestination(key),+ getUpgradeActionUrlOrFallback: (key: string) => mockGetUpgradeActionUrlOrFallback(key),hasMigrationGap: mockHasMigrationGap,legacyConnections: mockLegacyConnections,}));vi.mock('@/stores/sessionPresentationPolicy', () => ({- presentationPolicyHidesCommercialSurfaces: () =>- mockPresentationPolicyHidesCommercialSurfaces(),+ presentationPolicyHidesCommercialSurfaces: () => mockPresentationPolicyHidesCommercialSurfaces(),}));vi.mock('@/utils/upgradeMetrics', () => ({@@ -65,7 +66,12 @@ describe('MonitoredSystemLimitWarningBanner', () => {beforeEach(() => {localStorage.clear();mockEntitlements.mockReturnValue({ overflow_days_remaining: undefined });- mockGetLimit.mockReturnValue({ key: 'max_monitored_systems', limit: 6, current: 0, state: 'ok' });+ mockGetLimit.mockReturnValue({+ key: 'max_monitored_systems',+ limit: 6,+ current: 0,+ state: 'ok',+ });mockHasMigrationGap.mockReturnValue(false);mockLegacyConnections.mockReturnValue({proxmox_nodes: 0,@@ -123,14 +129,16 @@ describe('MonitoredSystemLimitWarningBanner', () => {);expect(monitoredSystemLimitWarningBannerStateSource).toContain('trackUpgradeMetricEvent');expect(monitoredSystemLimitWarningBannerStateSource).toContain('legacyConnections');- expect(monitoredSystemLimitWarningBannerStateSource).toContain('scopeSelfHostedBillingDestination');+ expect(monitoredSystemLimitWarningBannerStateSource).toContain(+ 'scopeSelfHostedBillingDestination',+ );expect(monitoredSystemLimitWarningBannerStateSource).toContain('SELF_HOSTED_PRO_BILLING_MONITORED_SYSTEM_INTENT',);expect(monitoredSystemLimitWarningBannerStateSource).toContain('handleUpgradeClick');expect(monitoredSystemLimitWarningBannerModelSource).toContain(- "@/utils/monitoredSystemPresentation",+ '@/utils/monitoredSystemPresentation',);expect(monitoredSystemLimitWarningBannerModelSource).toContain('getMonitoredSystemMigrationMessage',@@ -144,6 +152,10 @@ describe('MonitoredSystemLimitWarningBanner', () => {expect(monitoredSystemLimitWarningBannerModelSource).toContain('getMonitoredSystemLimitInstallCollectorsLabel',);+ expect(monitoredSystemLimitWarningBannerModelSource).toContain(+ 'isMonitoredSystemLimitUsageAvailable',+ );+ expect(monitoredSystemLimitWarningBannerModelSource).toContain('current_available');expect(monitoredSystemLimitWarningBannerModelSource).not.toContain('Upgrade to add more');expect(monitoredSystemLimitWarningBannerModelSource).not.toContain('Install v6 collectors');});@@ -179,7 +191,12 @@ describe('MonitoredSystemLimitWarningBanner', () => {});it('keeps urgent limit warnings visible even without migration gap', async () => {- mockGetLimit.mockReturnValue({ key: 'max_monitored_systems', limit: 6, current: 5, state: 'warning' });+ mockGetLimit.mockReturnValue({+ key: 'max_monitored_systems',+ limit: 6,+ current: 5,+ state: 'warning',+ });const mod = await import('../MonitoredSystemLimitWarningBanner');render(() => (@@ -201,10 +218,37 @@ describe('MonitoredSystemLimitWarningBanner', () => {expect(screen.queryByText('Install v6 collectors')).not.toBeInTheDocument();});+ it('stays hidden while canonical monitored-system usage is unavailable', async () => {+ mockGetLimit.mockReturnValue({+ key: 'max_monitored_systems',+ limit: 6,+ current: 6,+ current_available: false,+ current_unavailable_reason: 'supplemental_inventory_unsettled',+ state: 'enforced',+ });++ const mod = await import('../MonitoredSystemLimitWarningBanner');+ render(() => (+ <Router>+ <Route path="/" component={mod.MonitoredSystemLimitWarningBanner} />+ </Router>+ ));++ expect(screen.queryByText(/Monitored systems:/i)).not.toBeInTheDocument();+ expect(screen.queryByText('Upgrade to add more')).not.toBeInTheDocument();+ expect(mockTrackUpgradeMetricEvent).not.toHaveBeenCalled();+ });+it('keeps urgent limit warnings visible with migration context', async () => {mockHasMigrationGap.mockReturnValue(true);mockEntitlements.mockReturnValue({ overflow_days_remaining: 14 });- mockGetLimit.mockReturnValue({ key: 'max_monitored_systems', limit: 6, current: 5, state: 'warning' });+ mockGetLimit.mockReturnValue({+ key: 'max_monitored_systems',+ limit: 6,+ current: 5,+ state: 'warning',+ });mockLegacyConnections.mockReturnValue({proxmox_nodes: 2,docker_hosts: 1,diff --git a/frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.ts b/frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.tsindex 20c689520f..728069d753 100644--- a/frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.ts+++ b/frontend-modern/src/components/shared/monitoredSystemLimitWarningBannerModel.ts@@ -13,6 +13,8 @@ import { SELF_HOSTED_PRO_BILLING_USAGE_COUNTING_RULES_HREF } from '@/utils/pricitype LimitState = {current: number;limit: number;+ current_available?: boolean;+ current_unavailable_reason?: string;state?: string;};@@ -25,7 +27,12 @@ export const MONITORED_SYSTEM_LIMIT_INSTALL_COLLECTORS_LABEL =getMonitoredSystemLimitInstallCollectorsLabel();export const MONITORED_SYSTEM_LIMIT_UPGRADE_LABEL = getMonitoredSystemLimitUpgradeLabel();+export function isMonitoredSystemLimitUsageAvailable(limit: LimitState | undefined): boolean {+ return limit?.current_available !== false;+}+export function isMonitoredSystemLimitUrgent(limit: LimitState | undefined): boolean {+ if (!limit || !isMonitoredSystemLimitUsageAvailable(limit)) return false;const state = limit?.state;return state === 'warning' || state === 'enforced';}@@ -35,7 +42,7 @@ export function shouldShowMonitoredSystemLimitBanner(limit: LimitState | undefin}export function getMonitoredSystemSummary(limit: LimitState | undefined): string {- if (!limit) return '';+ if (!limit || !isMonitoredSystemLimitUsageAvailable(limit)) return '';return formatMonitoredSystemLimitSummary(limit);}@@ -57,8 +64,10 @@ export function getMonitoredSystemMigrationMessage(return formatMonitoredSystemMigrationMessage(counts);}-export function getMonitoredSystemOverflowSummary(daysRemaining: number | undefined): string {- return formatMonitoredSystemOverflowSummary(daysRemaining);+export function getMonitoredSystemOverflowSummary(+ daysRemaining: number | null | undefined,+): string {+ return formatMonitoredSystemOverflowSummary(daysRemaining ?? undefined);}export function getMonitoredSystemBannerToneClass(isUrgent: boolean): string {@@ -68,7 +77,5 @@ export function getMonitoredSystemBannerToneClass(isUrgent: boolean): string {}export function getMonitoredSystemMigrationTextClass(isUrgent: boolean): string {- return isUrgent- ? 'text-amber-800 dark:text-amber-200'- : 'text-sky-800 dark:text-sky-200';+ return isUrgent ? 'text-amber-800 dark:text-amber-200' : 'text-sky-800 dark:text-sky-200';}diff --git a/tests/integration/tests/54-monitored-system-billing-focus.spec.ts b/tests/integration/tests/54-monitored-system-billing-focus.spec.tsindex 0563c08a02..a449a1a897 100644--- a/tests/integration/tests/54-monitored-system-billing-focus.spec.ts+++ b/tests/integration/tests/54-monitored-system-billing-focus.spec.ts@@ -4,7 +4,9 @@ const DEV_SERVER_URL = 'http://127.0.0.1:5173';const MONITORED_SYSTEM_ENTITLEMENTS = {capabilities: [],- limits: [{ key: 'max_monitored_systems', limit: 5, current: 16, state: 'enforced' }],+ limits: [+ { key: 'max_monitored_systems', limit: 5, current: 16, state: 'enforced' },+ ],subscription_state: 'expired',upgrade_reasons: [],tier: 'free',@@ -21,11 +23,32 @@ const MONITORED_SYSTEM_ENTITLEMENTS = {const MONITORED_SYSTEM_RUNTIME_CAPABILITIES = {capabilities: [],- limits: [{ key: 'max_monitored_systems', limit: 5, current: 16, state: 'enforced' }],+ limits: [+ { key: 'max_monitored_systems', limit: 5, current: 16, state: 'enforced' },+ ],hosted_mode: false,max_history_days: 90,};+const UNAVAILABLE_MONITORED_SYSTEM_LIMIT = {+ key: 'max_monitored_systems',+ limit: 5,+ current: 0,+ current_available: false,+ current_unavailable_reason: 'supplemental_inventory_unsettled',+ state: 'enforced',+};++const UNAVAILABLE_MONITORED_SYSTEM_ENTITLEMENTS = {+ ...MONITORED_SYSTEM_ENTITLEMENTS,+ limits: [UNAVAILABLE_MONITORED_SYSTEM_LIMIT],+};++const UNAVAILABLE_MONITORED_SYSTEM_RUNTIME_CAPABILITIES = {+ ...MONITORED_SYSTEM_RUNTIME_CAPABILITIES,+ limits: [UNAVAILABLE_MONITORED_SYSTEM_LIMIT],+};+const MONITORED_SYSTEM_COMMERCIAL_POSTURE = {subscription_state: 'expired',upgrade_reasons: [],@@ -62,7 +85,9 @@ const MONITORED_SYSTEM_LEDGER = {summary:'Counts as one monitored system because Pulse merged multiple top-level views into one canonical cluster.',reasons: [],- surfaces: [{ name: 'edge-cluster', type: 'cluster', source: 'kubernetes' }],+ surfaces: [+ { name: 'edge-cluster', type: 'cluster', source: 'kubernetes' },+ ],},},],@@ -70,7 +95,24 @@ const MONITORED_SYSTEM_LEDGER = {limit: 5,};-async function configureMonitoredSystemBillingFixtures(page: Page) {+type MonitoredSystemBillingFixtures = {+ commercialPosture?: typeof MONITORED_SYSTEM_COMMERCIAL_POSTURE;+ entitlements?: typeof MONITORED_SYSTEM_ENTITLEMENTS;+ ledger?: typeof MONITORED_SYSTEM_LEDGER;+ runtimeCapabilities?: typeof MONITORED_SYSTEM_RUNTIME_CAPABILITIES;+};++async function configureMonitoredSystemBillingFixtures(+ page: Page,+ fixtures: MonitoredSystemBillingFixtures = {},+) {+ const commercialPosture =+ fixtures.commercialPosture ?? MONITORED_SYSTEM_COMMERCIAL_POSTURE;+ const entitlements = fixtures.entitlements ?? MONITORED_SYSTEM_ENTITLEMENTS;+ const ledger = fixtures.ledger ?? MONITORED_SYSTEM_LEDGER;+ const runtimeCapabilities =+ fixtures.runtimeCapabilities ?? MONITORED_SYSTEM_RUNTIME_CAPABILITIES;+await page.addInitScript(() => {localStorage.setItem('pulse_whats_new_v2_shown', 'true');});@@ -111,12 +153,7 @@ async function configureMonitoredSystemBillingFixtures(page: Page) {await route.fulfill({status: 200,contentType: 'application/json',- body: JSON.stringify({- capabilities: [],- limits: [{ key: 'max_monitored_systems', limit: 5, current: 16, state: 'enforced' }],- hosted_mode: false,- max_history_days: 90,- }),+ body: JSON.stringify(runtimeCapabilities),});});@@ -124,15 +161,7 @@ async function configureMonitoredSystemBillingFixtures(page: Page) {await route.fulfill({status: 200,contentType: 'application/json',- body: JSON.stringify(MONITORED_SYSTEM_ENTITLEMENTS),- });- });-- await page.route('**/api/license/runtime-capabilities', async (route) => {- await route.fulfill({- status: 200,- contentType: 'application/json',- body: JSON.stringify(MONITORED_SYSTEM_RUNTIME_CAPABILITIES),+ body: JSON.stringify(entitlements),});});@@ -140,20 +169,23 @@ async function configureMonitoredSystemBillingFixtures(page: Page) {await route.fulfill({status: 200,contentType: 'application/json',- body: JSON.stringify(MONITORED_SYSTEM_COMMERCIAL_POSTURE),+ body: JSON.stringify(commercialPosture),});});- await page.route('**/api/license/monitored-system-ledger**', async (route) => {- const payload = route.request().url().endsWith('/explain')- ? { ledger: MONITORED_SYSTEM_LEDGER, preview: null }- : MONITORED_SYSTEM_LEDGER;- await route.fulfill({- status: 200,- contentType: 'application/json',- body: JSON.stringify(payload),- });- });+ await page.route(+ '**/api/license/monitored-system-ledger**',+ async (route) => {+ const payload = route.request().url().endsWith('/explain')+ ? { ledger, preview: null }+ : ledger;+ await route.fulfill({+ status: 200,+ contentType: 'application/json',+ body: JSON.stringify(payload),+ });+ },+ );}async function openPageWithUrgentMonitoredSystemBanner(page: Page) {@@ -169,20 +201,29 @@ test.describe('Monitored-system billing focus', () => {test('keeps Learn more and Upgrade arrivals distinct on the billing surface', async ({page,}, testInfo) => {- test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only billing navigation');+ test.skip(+ testInfo.project.name.startsWith('mobile-'),+ 'Desktop-only billing navigation',+ );await configureMonitoredSystemBillingFixtures(page);await openPageWithUrgentMonitoredSystemBanner(page);- const banner = page.getByRole('status').filter({ hasText: 'Monitored systems: 16/5' });+ const banner = page+ .getByRole('status')+ .filter({ hasText: 'Monitored systems: 16/5' });await banner.getByRole('link', { name: 'Learn more' }).click();- await page.waitForURL('**/settings/system/billing/usage?details=counting-rules');+ await page.waitForURL(+ '**/settings/system/billing/usage?details=counting-rules',+ );await expect(page.getByRole('tab', { name: 'Usage' })).toHaveAttribute('aria-selected','true',);- await expect(page.getByRole('button', { name: 'Hide counting rules' })).toBeVisible();+ await expect(+ page.getByRole('button', { name: 'Hide counting rules' }),+ ).toBeVisible();await expect(page.getByText('Counts as 1 monitored system')).toBeVisible();await expect(page.getByText('1 grouped source')).toBeVisible();await expect(@@ -192,22 +233,55 @@ test.describe('Monitored-system billing focus', () => {).first(),).toBeVisible();- await expect(page.getByText('edge-cluster (Cluster via Kubernetes)').first()).toBeVisible();+ await expect(+ page.getByText('edge-cluster (Cluster via Kubernetes)').first(),+ ).toBeVisible();await openPageWithUrgentMonitoredSystemBanner(page);await banner.getByRole('link', { name: 'Upgrade to add more' }).click();- await page.waitForURL('**/settings/system/billing/plan?intent=max_monitored_systems');+ await page.waitForURL(+ '**/settings/system/billing/plan?intent=max_monitored_systems',+ );await expect(page.getByRole('tab', { name: 'Plan' })).toHaveAttribute('aria-selected','true',);- await expect(page.getByText('Need a higher monitored-system cap?')).toBeVisible();+ await expect(+ page.getByText('Need a higher monitored-system cap?'),+ ).toBeVisible();await expect(page.getByText('Redeem existing key')).toBeVisible();await expect(page.getByLabel('Pulse Pro Key')).toBeHidden();- await expect(page.getByRole('link', { name: 'Compare plans' })).toHaveAttribute(+ await expect(+ page.getByRole('link', { name: 'Compare plans' }),+ ).toHaveAttribute('href','/auth/license-purchase-start?feature=max_monitored_systems',);});++ test('does not show upgrade pressure while monitored-system usage is unavailable', async ({+ page,+ }, testInfo) => {+ test.skip(+ testInfo.project.name.startsWith('mobile-'),+ 'Desktop-only billing navigation',+ );++ await configureMonitoredSystemBillingFixtures(page, {+ entitlements: UNAVAILABLE_MONITORED_SYSTEM_ENTITLEMENTS,+ runtimeCapabilities: UNAVAILABLE_MONITORED_SYSTEM_RUNTIME_CAPABILITIES,+ });++ await page.goto(`${DEV_SERVER_URL}/settings/system-general`, {+ waitUntil: 'domcontentloaded',+ });++ await expect(+ page.getByRole('status').filter({ hasText: 'Monitored systems:' }),+ ).toHaveCount(0);+ await expect(+ page.getByRole('link', { name: 'Upgrade to add more' }),+ ).toHaveCount(0);+ });});