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.

Consume self-hosted trial activation notices once

rcourtman9a7ec5c1c308
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 41dfbc5656..3337eaa5c6 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -273,6 +273,10 @@ than falling back to a form with missing Pulse initiation context.
Hosted service/configuration failures during verification, hosted checkout
preparation, or checkout-session creation must also render as owned
"temporarily unavailable" outcome UX rather than inline form errors.
+The self-hosted activation return notice on `/settings/system-pro` is part of
+that same boundary: the `trial` query result is a one-shot handoff outcome and
+must be consumed into owned UI state, then removed from the URL rather than
+becoming sticky page state across refresh and sharing.
That same hosted owner also applies after Stripe returns to
`/trial-signup/complete`: customer-facing completion failures must stay inside
owned trial UX rather than dropping raw control-plane error strings, and they
diff --git a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
index 5610a309ee..bef08d0902 100644
--- a/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/ProLicensePanel.test.tsx
@@ -16,9 +16,11 @@ const clearLicenseMock = vi.fn();
const notificationSuccessMock = vi.fn();
const notificationErrorMock = vi.fn();
const useLocationMock = vi.fn(() => ({ search: '' }));
+const navigateMock = vi.fn();
vi.mock('@solidjs/router', () => ({
useLocation: () => useLocationMock(),
+ useNavigate: () => navigateMock,
}));
vi.mock('@/stores/license', () => ({
@@ -62,6 +64,7 @@ describe('ProLicensePanel', () => {
notificationSuccessMock.mockReset();
notificationErrorMock.mockReset();
useLocationMock.mockReset();
+ navigateMock.mockReset();
loadLicenseStatusMock.mockResolvedValue(undefined);
startProTrialMock.mockResolvedValue(undefined);
activateLicenseMock.mockResolvedValue({ success: true });
@@ -299,7 +302,11 @@ describe('ProLicensePanel', () => {
});
it('shows the hosted activation success banner on the Pro settings route', async () => {
- useLocationMock.mockReturnValue({ search: '?trial=activated' });
+ useLocationMock.mockReturnValue({
+ search: '?trial=activated',
+ pathname: '/settings/system/billing',
+ hash: '',
+ });
render(() => <ProLicensePanel />);
@@ -307,6 +314,10 @@ describe('ProLicensePanel', () => {
expect(
screen.getByText(/Pulse activated the Pro trial for this instance/i),
).toBeInTheDocument();
+ expect(navigateMock).toHaveBeenCalledWith('/settings/system/billing', {
+ replace: true,
+ scroll: false,
+ });
});
it('shows a migration-pending notice and hides the trial CTA', async () => {
diff --git a/frontend-modern/src/components/Settings/useProLicensePanelState.ts b/frontend-modern/src/components/Settings/useProLicensePanelState.ts
index ee972eac5f..2ff14b93d3 100644
--- a/frontend-modern/src/components/Settings/useProLicensePanelState.ts
+++ b/frontend-modern/src/components/Settings/useProLicensePanelState.ts
@@ -1,5 +1,5 @@
import { createMemo, createSignal, onMount } from 'solid-js';
-import { useLocation } from '@solidjs/router';
+import { useLocation, useNavigate } from '@solidjs/router';
import { notificationStore } from '@/stores/notifications';
import {
isMultiTenantEnabled,
@@ -36,11 +36,13 @@ const formatUnixDate = (value?: number) => {
export function useProLicensePanelState() {
const location = useLocation();
+ const navigate = useNavigate();
const [licenseKey, setLicenseKey] = createSignal('');
const [loading, setLoading] = createSignal(false);
const [activating, setActivating] = createSignal(false);
const [clearing, setClearing] = createSignal(false);
const [startingTrial, setStartingTrial] = createSignal(false);
+ const [trialActivationResult, setTrialActivationResult] = createSignal('');
const entitlements = createMemo(() => licenseStatus());
const subscriptionState = createMemo(() => entitlements()?.subscription_state);
@@ -54,6 +56,15 @@ export function useProLicensePanelState() {
};
onMount(() => {
+ const params = new URLSearchParams(location.search);
+ const result = params.get('trial')?.trim().toLowerCase() ?? '';
+ if (result) {
+ setTrialActivationResult(result);
+ params.delete('trial');
+ const nextSearch = params.toString();
+ const nextPath = `${location.pathname}${nextSearch ? `?${nextSearch}` : ''}${location.hash ?? ''}`;
+ navigate(nextPath, { replace: true, scroll: false });
+ }
void loadPanelData();
});
@@ -161,8 +172,7 @@ export function useProLicensePanelState() {
);
const trialActivationNotice = createMemo(() => {
- const params = new URLSearchParams(location.search);
- return getTrialActivationNotice(params.get('trial')?.trim().toLowerCase() ?? '');
+ return getTrialActivationNotice(trialActivationResult());
});
const commercialMigrationNotice = createMemo(() =>