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.

Move reporting locked copy into catalog

rcourtman51067ed03457
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index d1e89caeb4..7caaee44cd 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -229,7 +229,7 @@ own `/api/admin/reports/catalog` as the canonical operator-facing reporting
catalog plus `/api/admin/reports/inventory/vms/definition` and
`/api/admin/reports/inventory/vms/export` as the stable VM inventory sub-
contract. The catalog endpoint owns the reporting panel title, description,
-historical performance report options, and nested VM inventory definition,
+locked-shell teaser copy, historical performance report options, and nested VM inventory definition,
while the export endpoint remains the spreadsheet-shaped CSV transport. That
export is intentionally not comment-prefixed like the legacy metrics CSV, and
it now carries Proxmox pool membership from the canonical unified VM runtime
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 85faacdce3..47522054b7 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -202,6 +202,10 @@ 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 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
+hardcoded component strings.
The shared updates settings owner also defines the user-facing framing for
rc-tagged builds. `frontend-modern/src/components/Settings/updatesSettingsModel.ts`
and `frontend-modern/src/utils/updatesPresentation.ts` must present that
diff --git a/frontend-modern/src/components/Settings/ReportingPanel.tsx b/frontend-modern/src/components/Settings/ReportingPanel.tsx
index 1470479bf1..eb68671c0c 100644
--- a/frontend-modern/src/components/Settings/ReportingPanel.tsx
+++ b/frontend-modern/src/components/Settings/ReportingPanel.tsx
@@ -69,6 +69,7 @@ export function ReportingPanel() {
const performanceReport = () => reportingCatalog()?.performanceReport ?? null;
const inventoryDefinition = () => reportingCatalog()?.vmInventoryExport ?? null;
+ const lockedState = () => reportingCatalog()?.lockedState ?? null;
const supportsMetricFilter = () => performanceReport()?.supportsMetricFilter ?? false;
const supportsCustomTitle = () => performanceReport()?.supportsCustomTitle ?? false;
const selectedRange = (): ReportingRangeValue => range() ?? performanceReport()!.defaultRange;
@@ -105,11 +106,14 @@ export function ReportingPanel() {
<div class="p-4 sm:p-6">
<div class="flex flex-col sm:flex-row items-center gap-4">
<div class="flex-1 text-center sm:text-left">
- <h4 class="text-base font-semibold text-base-content">Advanced Reporting (Pro)</h4>
- <p class="text-sm text-muted mt-1">
- Generate PDF and CSV performance reports plus current-state VM inventory exports
- across infrastructure and workload resources.
- </p>
+ <Show when={lockedState()}>
+ {(state) => (
+ <>
+ <h4 class="text-base font-semibold text-base-content">{state().title}</h4>
+ <p class="text-sm text-muted mt-1">{state().description}</p>
+ </>
+ )}
+ </Show>
</div>
<div class="flex flex-col sm:flex-row items-center gap-2">
<a
diff --git a/frontend-modern/src/components/Settings/__tests__/ReportingPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/ReportingPanel.test.tsx
index f06bcb4d19..54f788dc3f 100644
--- a/frontend-modern/src/components/Settings/__tests__/ReportingPanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/ReportingPanel.test.tsx
@@ -23,6 +23,10 @@ const baseCatalog = {
id: 'advanced_reporting',
title: 'Detailed Reporting',
description: 'Canonical reporting surfaces',
+ lockedState: {
+ title: 'Advanced Reporting (Pro)',
+ description: 'Canonical locked reporting teaser',
+ },
performanceReport: {
id: 'performance_reports',
title: 'Performance Reports',
@@ -126,4 +130,25 @@ describe('ReportingPanel', () => {
expect(screen.queryByLabelText('Metric Type (Optional)')).not.toBeInTheDocument();
expect(screen.queryByLabelText('Report Title')).not.toBeInTheDocument();
});
+
+ it('uses catalog-owned locked teaser copy for the paywalled shell', () => {
+ useReportingPanelStateMock.mockReturnValue(
+ buildState({
+ isLocked: () => true,
+ isReportingEnabled: () => false,
+ reportingCatalog: () => ({
+ ...baseCatalog,
+ lockedState: {
+ title: 'Reporting for Paid Workflows',
+ description: 'Catalog-owned locked teaser copy',
+ },
+ }),
+ }),
+ );
+
+ render(() => <ReportingPanel />);
+
+ expect(screen.getByText('Reporting for Paid Workflows')).toBeInTheDocument();
+ expect(screen.getByText('Catalog-owned locked teaser copy')).toBeInTheDocument();
+ });
});
diff --git a/frontend-modern/src/components/Settings/__tests__/reportingCatalogModel.test.ts b/frontend-modern/src/components/Settings/__tests__/reportingCatalogModel.test.ts
index b9ddfaff28..b08db8d05c 100644
--- a/frontend-modern/src/components/Settings/__tests__/reportingCatalogModel.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/reportingCatalogModel.test.ts
@@ -8,6 +8,10 @@ const baseCatalogPayload = {
id: 'advanced_reporting',
title: 'Detailed Reporting',
description: 'Canonical reporting surfaces',
+ lockedState: {
+ title: 'Advanced Reporting (Pro)',
+ description: 'Canonical locked reporting teaser',
+ },
performanceReport: {
id: 'performance_reports',
title: 'Performance Reports',
@@ -61,6 +65,7 @@ describe('reporting catalog model', () => {
it('parses the canonical reporting catalog payload', () => {
const catalog = parseReportingCatalog(baseCatalogPayload);
+ expect(catalog.lockedState.title).toBe('Advanced Reporting (Pro)');
expect(catalog.performanceReport.defaultFormat).toBe('pdf');
expect(catalog.performanceReport.ranges[0].windowHours).toBe(24);
expect(catalog.vmInventoryExport.exportEndpoint).toBe(
@@ -100,4 +105,15 @@ describe('reporting catalog model', () => {
}),
).toThrow('Invalid reporting catalog payload');
});
+
+ it('rejects a catalog whose locked-state teaser is incomplete', () => {
+ expect(() =>
+ parseReportingCatalog({
+ ...baseCatalogPayload,
+ lockedState: {
+ title: 'Advanced Reporting (Pro)',
+ },
+ }),
+ ).toThrow('Invalid reporting catalog payload');
+ });
});
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index b31eca9527..2434d5a63c 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -1104,6 +1104,8 @@ describe('Settings architecture guardrails', () => {
expect(reportingPanelStateSource).not.toContain('getTrialAlreadyUsedMessage()');
expect(reportingCatalogModelSource).toContain('export function buildReportingCatalogRequest');
expect(reportingCatalogModelSource).toContain('export function parseReportingCatalog');
+ expect(reportingCatalogModelSource).toContain('interface ReportingLockedStateDefinition');
+ expect(reportingPanelSource).not.toContain('Advanced Reporting (Pro)');
expect(reportingPanelModelSource).toContain('export function getReportingRangeStart');
expect(reportingPanelModelSource).toContain('export function buildReportingRequest');
expect(reportingPanelModelSource).toContain('export function buildReportingFilename');
diff --git a/frontend-modern/src/components/Settings/__tests__/useReportingPanelState.test.ts b/frontend-modern/src/components/Settings/__tests__/useReportingPanelState.test.ts
index 683c4600db..a5e823b8c8 100644
--- a/frontend-modern/src/components/Settings/__tests__/useReportingPanelState.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/useReportingPanelState.test.ts
@@ -14,6 +14,10 @@ const catalogPayload = {
id: 'advanced_reporting',
title: 'Detailed Reporting',
description: 'Canonical reporting surfaces',
+ lockedState: {
+ title: 'Advanced Reporting (Pro)',
+ description: 'Canonical locked reporting teaser',
+ },
performanceReport: {
id: 'performance_reports',
title: 'Performance Reports',
@@ -147,6 +151,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)');
dispose();
});
diff --git a/frontend-modern/src/components/Settings/reportingCatalogModel.ts b/frontend-modern/src/components/Settings/reportingCatalogModel.ts
index 7a126a775f..85622f5df1 100644
--- a/frontend-modern/src/components/Settings/reportingCatalogModel.ts
+++ b/frontend-modern/src/components/Settings/reportingCatalogModel.ts
@@ -34,10 +34,16 @@ export interface ReportingPerformanceReportDefinition {
supportsCustomTitle: boolean;
}
+export interface ReportingLockedStateDefinition {
+ title: string;
+ description: string;
+}
+
export interface ReportingCatalog {
id: string;
title: string;
description: string;
+ lockedState: ReportingLockedStateDefinition;
performanceReport: ReportingPerformanceReportDefinition;
vmInventoryExport: ReportingInventoryExportDefinition;
}
@@ -146,6 +152,21 @@ function parseReportingPerformanceReportDefinition(
};
}
+function parseReportingLockedStateDefinition(input: unknown): ReportingLockedStateDefinition {
+ if (!input || typeof input !== 'object') {
+ throw new Error('Invalid reporting catalog payload');
+ }
+ const candidate = input as Partial<ReportingLockedStateDefinition>;
+ if (typeof candidate.title !== 'string' || typeof candidate.description !== 'string') {
+ throw new Error('Invalid reporting catalog payload');
+ }
+
+ return {
+ title: candidate.title,
+ description: candidate.description,
+ };
+}
+
export function parseReportingCatalog(input: unknown): ReportingCatalog {
if (!input || typeof input !== 'object') {
throw new Error('Invalid reporting catalog payload');
@@ -163,6 +184,7 @@ export function parseReportingCatalog(input: unknown): ReportingCatalog {
id: candidate.id,
title: candidate.title,
description: candidate.description,
+ lockedState: parseReportingLockedStateDefinition(candidate.lockedState),
performanceReport: parseReportingPerformanceReportDefinition(candidate.performanceReport),
vmInventoryExport: parseVMInventoryExportDefinition(candidate.vmInventoryExport),
};
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index a99360deef..b500cb6e42 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -349,6 +349,10 @@ func TestContract_ReportingCatalogJSONSnapshot(t *testing.T) {
"id":"advanced_reporting",
"title":"Detailed Reporting",
"description":"Generate performance reports and current-state exports across infrastructure and workloads.",
+ "lockedState":{
+ "title":"Advanced Reporting (Pro)",
+ "description":"Generate PDF and CSV performance reports plus current-state VM inventory exports across infrastructure and workload resources."
+ },
"performanceReport":{
"id":"performance_reports",
"title":"Performance Reports",
diff --git a/pkg/reporting/catalog.go b/pkg/reporting/catalog.go
index 4fb6ee9436..916966aa54 100644
--- a/pkg/reporting/catalog.go
+++ b/pkg/reporting/catalog.go
@@ -39,12 +39,18 @@ type PerformanceReportDefinition struct {
// ReportingCatalog describes the backend-owned admin reporting surface for the
// Pulse settings UI.
+type ReportingLockedStateDefinition struct {
+ Title string `json:"title"`
+ Description string `json:"description"`
+}
+
type ReportingCatalog struct {
- ID string `json:"id"`
- Title string `json:"title"`
- Description string `json:"description"`
- PerformanceReport PerformanceReportDefinition `json:"performanceReport"`
- VMInventoryExport VMInventoryExportDefinition `json:"vmInventoryExport"`
+ ID string `json:"id"`
+ Title string `json:"title"`
+ Description string `json:"description"`
+ LockedState ReportingLockedStateDefinition `json:"lockedState"`
+ PerformanceReport PerformanceReportDefinition `json:"performanceReport"`
+ VMInventoryExport VMInventoryExportDefinition `json:"vmInventoryExport"`
}
// SupportsFormat reports whether the performance reporting surface allows the
@@ -101,9 +107,13 @@ func DescribePerformanceReport() PerformanceReportDefinition {
// definition for the advanced reporting feature.
func DescribeReportingCatalog() ReportingCatalog {
return ReportingCatalog{
- ID: "advanced_reporting",
- Title: "Detailed Reporting",
- Description: "Generate performance reports and current-state exports across infrastructure and workloads.",
+ ID: "advanced_reporting",
+ Title: "Detailed Reporting",
+ Description: "Generate performance reports and current-state exports across infrastructure and workloads.",
+ LockedState: ReportingLockedStateDefinition{
+ Title: "Advanced Reporting (Pro)",
+ Description: "Generate PDF and CSV performance reports plus current-state VM inventory exports across infrastructure and workload resources.",
+ },
PerformanceReport: DescribePerformanceReport(),
VMInventoryExport: DescribeVMInventoryExport(),
}
diff --git a/pkg/reporting/catalog_test.go b/pkg/reporting/catalog_test.go
index 60a84d8143..bb6da8d16d 100644
--- a/pkg/reporting/catalog_test.go
+++ b/pkg/reporting/catalog_test.go
@@ -14,6 +14,9 @@ func TestDescribeReportingCatalog_DefinesCanonicalSurfaces(t *testing.T) {
if catalog.PerformanceReport.ID != "performance_reports" {
t.Fatalf("performance report ID = %q, want performance_reports", catalog.PerformanceReport.ID)
}
+ if catalog.LockedState.Title != "Advanced Reporting (Pro)" {
+ t.Fatalf("locked state title = %q, want Advanced Reporting (Pro)", catalog.LockedState.Title)
+ }
if catalog.PerformanceReport.MultiResourceMax != 50 {
t.Fatalf("multi-resource max = %d, want 50", catalog.PerformanceReport.MultiResourceMax)
}