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.

Route monitored-system upgrade fallback to billing

rcourtman9cc60a51e6bb
diff --git a/frontend-modern/src/stores/__tests__/license.test.ts b/frontend-modern/src/stores/__tests__/license.test.ts
index d6eb97839f..4a23857672 100644
--- a/frontend-modern/src/stores/__tests__/license.test.ts
+++ b/frontend-modern/src/stores/__tests__/license.test.ts
@@ -315,6 +315,34 @@ describe('license store', () => {
await loadLicenseStatus(true);
expect(getUpgradeActionUrlOrFallback('feature1')).toBe('/pricing?feature=feature1');
});
+
+ it('routes monitored-system limit fallbacks to billing usage', async () => {
+ vi.mocked(LicenseAPI.getEntitlements).mockResolvedValue({
+ ...mockProEntitlements,
+ upgrade_reasons: [{ key: 'reason1', reason: 'Reason 1', action_url: '/upgrade/reason1' }],
+ });
+ await loadLicenseStatus(true);
+ expect(getUpgradeActionUrlOrFallback('max_monitored_systems')).toBe(
+ '/settings/system/billing',
+ );
+ });
+
+ it('prefers a specific monitored-system upgrade action when provided', async () => {
+ vi.mocked(LicenseAPI.getEntitlements).mockResolvedValue({
+ ...mockProEntitlements,
+ upgrade_reasons: [
+ {
+ key: 'max_monitored_systems',
+ reason: 'Expand monitored-system capacity',
+ action_url: '/upgrade/max-monitored-systems',
+ },
+ ],
+ });
+ await loadLicenseStatus(true);
+ expect(getUpgradeActionUrlOrFallback('max_monitored_systems')).toBe(
+ '/upgrade/max-monitored-systems',
+ );
+ });
});
describe('getLimit', () => {
diff --git a/frontend-modern/src/stores/license.ts b/frontend-modern/src/stores/license.ts
index ae4805df7f..9d32cac087 100644
--- a/frontend-modern/src/stores/license.ts
+++ b/frontend-modern/src/stores/license.ts
@@ -183,9 +183,20 @@ export function getFirstUpgradeActionUrl(): string | undefined {
return current?.upgrade_reasons?.[0]?.action_url;
}
+const IN_PRODUCT_UPGRADE_FALLBACKS: Record<string, string> = {
+ // Limit-driven upsells should land on billing/usage so operators can see
+ // the counted-system ledger before choosing how to expand capacity.
+ max_monitored_systems: '/settings/system/billing',
+};
+
+function getInProductUpgradeFallback(key: string): string | undefined {
+ return IN_PRODUCT_UPGRADE_FALLBACKS[key];
+}
+
export function getUpgradeActionUrlOrFallback(key: string): string {
return (
getUpgradeActionUrl(key) ||
+ getInProductUpgradeFallback(key) ||
getFirstUpgradeActionUrl() ||
`/pricing?feature=${encodeURIComponent(key)}`
);