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.

Make reporting shell catalog-first

rcourtmanf993c9b14f27
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 46a0379d57..3efc08813a 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -203,6 +203,12 @@ parsed backend definition.
That same settings shell must also read the reporting catalog for locked users,
not just entitled users, so the paywalled reporting panel does not drift onto a
separate frontend-owned title or description contract.
+That same settings shell must now also treat the reporting catalog as the
+feature-identity source once it loads. `ReportingPanel.tsx` and
+`useReportingPanelState.ts` may use a generic loading or error shell before the
+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.
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/ReportingPanel.tsx b/frontend-modern/src/components/Settings/ReportingPanel.tsx
index 7fd767cc39..a671e9dd90 100644
--- a/frontend-modern/src/components/Settings/ReportingPanel.tsx
+++ b/frontend-modern/src/components/Settings/ReportingPanel.tsx
@@ -71,6 +71,7 @@ export function ReportingPanel() {
const inventoryDefinition = () => reportingCatalog()?.vmInventoryExport ?? null;
const lockedState = () => reportingCatalog()?.lockedState ?? null;
const guidance = () => reportingCatalog()?.guidance ?? null;
+ const catalogReady = () => reportingCatalog() !== null;
const supportsMetricFilter = () => performanceReport()?.supportsMetricFilter ?? false;
const supportsCustomTitle = () => performanceReport()?.supportsCustomTitle ?? false;
const selectedRange = (): ReportingRangeValue => range() ?? performanceReport()!.defaultRange;
@@ -95,13 +96,34 @@ export function ReportingPanel() {
return (
<div class="space-y-6">
+ <Show when={reportingCatalogLoading() && !catalogReady()}>
+ <OperationsPanel
+ title="Reporting"
+ description="Loading reporting surfaces..."
+ icon={<BarChart class="w-5 h-5" strokeWidth={2} />}
+ >
+ <div class="p-4 sm:p-6">
+ <p class="text-sm text-muted">Loading reporting surfaces...</p>
+ </div>
+ </OperationsPanel>
+ </Show>
+
+ <Show when={reportingCatalogError() && !catalogReady()}>
+ <OperationsPanel
+ title="Reporting"
+ description="Reporting surfaces are currently unavailable."
+ icon={<BarChart class="w-5 h-5" strokeWidth={2} />}
+ >
+ <div class="p-4 sm:p-6">
+ <p class="text-sm text-warning">{reportingCatalogError()}</p>
+ </div>
+ </OperationsPanel>
+ </Show>
+
<Show when={isLocked()}>
<OperationsPanel
- title={reportingCatalog()?.title ?? 'Detailed Reporting'}
- description={
- reportingCatalog()?.description ??
- 'Generate performance reports and current-state exports across infrastructure and workloads.'
- }
+ title={reportingCatalog()!.title}
+ description={reportingCatalog()!.description}
icon={<BarChart class="w-5 h-5" strokeWidth={2} />}
>
<div class="p-4 sm:p-6">
@@ -122,9 +144,7 @@ export function ReportingPanel() {
target="_blank"
rel="noopener noreferrer"
class={getUpgradeActionButtonClass()}
- onClick={() =>
- trackUpgradeClicked('settings_reporting_panel', 'advanced_reporting')
- }
+ onClick={() => trackUpgradeClicked('settings_reporting_panel', reportingCatalog()!.id)}
>
{UPGRADE_ACTION_LABEL}
</a>
@@ -146,11 +166,8 @@ export function ReportingPanel() {
<Show when={isReportingEnabled()}>
<OperationsPanel
- title={reportingCatalog()?.title ?? 'Detailed Reporting'}
- description={
- reportingCatalog()?.description ??
- 'Generate performance reports and current-state exports across infrastructure and workloads.'
- }
+ title={reportingCatalog()!.title}
+ description={reportingCatalog()!.description}
icon={<BarChart class="w-5 h-5" strokeWidth={2} />}
>
<div class="space-y-6 p-4 sm:p-6">
diff --git a/frontend-modern/src/components/Settings/__tests__/ReportingPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/ReportingPanel.test.tsx
index a488e0f1fe..d6542d8a1c 100644
--- a/frontend-modern/src/components/Settings/__tests__/ReportingPanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/ReportingPanel.test.tsx
@@ -176,4 +176,19 @@ describe('ReportingPanel', () => {
screen.getByText('Catalog-owned explainer for when to use each reporting surface.'),
).toBeInTheDocument();
});
+
+ it('shows a generic loading shell before the reporting catalog arrives', () => {
+ useReportingPanelStateMock.mockReturnValue(
+ buildState({
+ isReportingEnabled: () => false,
+ reportingCatalog: () => null,
+ reportingCatalogLoading: () => true,
+ }),
+ );
+
+ render(() => <ReportingPanel />);
+
+ expect(screen.getByText('Reporting')).toBeInTheDocument();
+ expect(screen.getAllByText('Loading reporting surfaces...').length).toBeGreaterThan(0);
+ });
});
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index d444a5f366..2b702f9ab3 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -1086,6 +1086,7 @@ describe('Settings architecture guardrails', () => {
expect(reportingPanelSource).toContain('@/components/Settings/reportingCatalogModel');
expect(reportingPanelSource).toContain('@/components/Settings/reportingPanelModel');
expect(reportingPanelSource).toContain('reportingCatalog');
+ expect(reportingPanelSource).toContain('title="Reporting"');
expect(reportingPanelSource).not.toContain('loadLicenseStatus()');
expect(reportingPanelSource).not.toContain('startProTrial()');
expect(reportingPanelSource).not.toContain("apiFetch('/api/admin/reports/generate");
@@ -1097,10 +1098,12 @@ describe('Settings architecture guardrails', () => {
expect(reportingPanelStateSource).toContain('buildReportingRequest');
expect(reportingPanelStateSource).toContain('buildReportingCatalogRequest');
expect(reportingPanelStateSource).toContain('parseReportingCatalog');
+ expect(reportingPanelStateSource).toContain('reportingFeatureId');
expect(reportingPanelStateSource).toContain('!licenseLoaded()');
expect(reportingPanelStateSource).not.toContain('!isReportingEnabled()');
expect(reportingPanelStateSource).toContain('buildVMInventoryExportRequest');
expect(reportingPanelStateSource).toContain('getReportingGenerateSuccessMessage');
+ expect(reportingPanelStateSource).not.toContain("'advanced_reporting'");
expect(reportingPanelStateSource).not.toContain('getTrialAlreadyUsedMessage()');
expect(reportingCatalogModelSource).toContain('export function buildReportingCatalogRequest');
expect(reportingCatalogModelSource).toContain('export function parseReportingCatalog');
@@ -1108,6 +1111,7 @@ describe('Settings architecture guardrails', () => {
expect(reportingCatalogModelSource).toContain('interface ReportingGuidanceDefinition');
expect(reportingPanelSource).not.toContain('Advanced Reporting (Pro)');
expect(reportingPanelSource).not.toContain('Advanced Insights');
+ expect(reportingPanelSource).not.toContain('Detailed Reporting');
expect(reportingPanelSource).not.toContain(
'Performance reports come from the historical metrics store',
);
diff --git a/frontend-modern/src/components/Settings/__tests__/useReportingPanelState.test.ts b/frontend-modern/src/components/Settings/__tests__/useReportingPanelState.test.ts
index 3ccd78a98d..d7443d17f8 100644
--- a/frontend-modern/src/components/Settings/__tests__/useReportingPanelState.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/useReportingPanelState.test.ts
@@ -156,6 +156,7 @@ describe('useReportingPanelState', () => {
expect(apiFetchMock).toHaveBeenCalledWith('/api/admin/reports/catalog');
expect(hookState.reportingCatalog()?.title).toBe('Detailed Reporting');
expect(hookState.reportingCatalog()?.lockedState.title).toBe('Advanced Reporting (Pro)');
+ expect(hookState.isLocked()).toBe(true);
dispose();
});
diff --git a/frontend-modern/src/components/Settings/useReportingPanelState.ts b/frontend-modern/src/components/Settings/useReportingPanelState.ts
index e2347ea45b..02295af909 100644
--- a/frontend-modern/src/components/Settings/useReportingPanelState.ts
+++ b/frontend-modern/src/components/Settings/useReportingPanelState.ts
@@ -47,11 +47,19 @@ export const useReportingPanelState = () => {
const [reportingCatalogRequested, setReportingCatalogRequested] = createSignal(false);
const [title, setTitle] = createSignal('');
const [startingTrial, setStartingTrial] = createSignal(false);
+ const reportingFeatureId = () => reportingCatalog()?.id ?? '';
- const isLocked = () => licenseLoaded() && !hasFeature('advanced_reporting');
+ const isLocked = () =>
+ licenseLoaded() &&
+ reportingFeatureId() !== '' &&
+ !hasFeature(reportingFeatureId());
const canStartTrial = () => entitlements()?.trial_eligible !== false;
- const isReportingEnabled = () => licenseLoaded() && hasFeature('advanced_reporting');
- const upgradeActionUrl = () => getUpgradeActionUrlOrFallback('advanced_reporting');
+ const isReportingEnabled = () =>
+ licenseLoaded() &&
+ reportingFeatureId() !== '' &&
+ hasFeature(reportingFeatureId());
+ const upgradeActionUrl = () =>
+ reportingFeatureId() === '' ? '' : getUpgradeActionUrlOrFallback(reportingFeatureId());
onMount(() => {
loadLicenseStatus();
@@ -60,7 +68,7 @@ export const useReportingPanelState = () => {
createEffect((wasVisible: boolean) => {
const visible = isLocked();
if (visible && !wasVisible) {
- trackPaywallViewed('advanced_reporting', 'settings_reporting_panel');
+ trackPaywallViewed(reportingFeatureId(), 'settings_reporting_panel');
}
return visible;
}, false);