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.

Fetch reporting catalog before license readiness

rcourtmana6a9501fb0ae
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 3efc08813a..436000792d 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -209,6 +209,9 @@ feature-identity source once it loads. `ReportingPanel.tsx` and
catalog is available, but they must not hardcode the reporting feature key or
the entitled and locked panel title and description once the catalog has
loaded.
+The same metadata route is readable without the reporting feature gate, so the
+settings shell must not delay the catalog fetch on `licenseLoaded()` before it
+can render its canonical loading, locked, or entitled states.
That same catalog-owned contract also includes the locked teaser copy itself:
`ReportingPanel.tsx` may style or place the paywall content, but the locked
title and description must come from the parsed reporting catalog instead of
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index 2b702f9ab3..25daaf3c51 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -1099,7 +1099,7 @@ describe('Settings architecture guardrails', () => {
expect(reportingPanelStateSource).toContain('buildReportingCatalogRequest');
expect(reportingPanelStateSource).toContain('parseReportingCatalog');
expect(reportingPanelStateSource).toContain('reportingFeatureId');
- expect(reportingPanelStateSource).toContain('!licenseLoaded()');
+ expect(reportingPanelStateSource).not.toContain('!licenseLoaded()');
expect(reportingPanelStateSource).not.toContain('!isReportingEnabled()');
expect(reportingPanelStateSource).toContain('buildVMInventoryExportRequest');
expect(reportingPanelStateSource).toContain('getReportingGenerateSuccessMessage');
diff --git a/frontend-modern/src/components/Settings/__tests__/useReportingPanelState.test.ts b/frontend-modern/src/components/Settings/__tests__/useReportingPanelState.test.ts
index d7443d17f8..7249ddc609 100644
--- a/frontend-modern/src/components/Settings/__tests__/useReportingPanelState.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/useReportingPanelState.test.ts
@@ -160,4 +160,54 @@ describe('useReportingPanelState', () => {
dispose();
});
+
+ it('loads the reporting catalog before license readiness settles', async () => {
+ vi.resetModules();
+
+ apiFetchMock = vi
+ .fn()
+ .mockResolvedValue(new Response(JSON.stringify(catalogPayload), { status: 200 }));
+ hasReportingFeature = false;
+ loadLicenseStatusMock = vi.fn();
+
+ vi.doMock('@/utils/apiClient', () => ({
+ apiFetch: apiFetchMock,
+ }));
+
+ vi.doMock('@/utils/toast', () => ({
+ showSuccess: vi.fn(),
+ showWarning: vi.fn(),
+ }));
+
+ vi.doMock('@/utils/trialStartAction', () => ({
+ runStartProTrialAction: vi.fn(),
+ }));
+
+ vi.doMock('@/utils/upgradeMetrics', () => ({
+ trackPaywallViewed: vi.fn(),
+ }));
+
+ vi.doMock('@/stores/license', () => ({
+ entitlements: vi.fn(() => ({ trial_eligible: true })),
+ getUpgradeActionUrlOrFallback: vi.fn(() => '/pricing'),
+ hasFeature: vi.fn(() => false),
+ licenseLoaded: vi.fn(() => false),
+ loadLicenseStatus: loadLicenseStatusMock,
+ }));
+
+ ({ useReportingPanelState } = await import('../useReportingPanelState'));
+
+ const { hookState, dispose } = mountHook();
+
+ await flushAsync();
+ await flushAsync();
+
+ expect(loadLicenseStatusMock).toHaveBeenCalledOnce();
+ expect(apiFetchMock).toHaveBeenCalledWith('/api/admin/reports/catalog');
+ expect(hookState.reportingCatalog()?.title).toBe('Detailed Reporting');
+ expect(hookState.isLocked()).toBe(false);
+ expect(hookState.isReportingEnabled()).toBe(false);
+
+ dispose();
+ });
});
diff --git a/frontend-modern/src/components/Settings/useReportingPanelState.ts b/frontend-modern/src/components/Settings/useReportingPanelState.ts
index 02295af909..bbe9ebc595 100644
--- a/frontend-modern/src/components/Settings/useReportingPanelState.ts
+++ b/frontend-modern/src/components/Settings/useReportingPanelState.ts
@@ -74,12 +74,7 @@ export const useReportingPanelState = () => {
}, false);
createEffect(() => {
- if (
- !licenseLoaded() ||
- reportingCatalog() ||
- reportingCatalogLoading() ||
- reportingCatalogRequested()
- ) {
+ if (reportingCatalog() || reportingCatalogLoading() || reportingCatalogRequested()) {
return;
}