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.

Align RBAC trial CTA error handling

rcourtman13df9b5c2641
diff --git a/docs/release-control/v6/internal/subsystems/organization-settings.md b/docs/release-control/v6/internal/subsystems/organization-settings.md
index 04e9ae3240..5bf6f97603 100644
--- a/docs/release-control/v6/internal/subsystems/organization-settings.md
+++ b/docs/release-control/v6/internal/subsystems/organization-settings.md
@@ -155,3 +155,8 @@ license and free-trial runtime, `useRolesPanelState.ts` plus
`useUserAssignmentsPanelState.ts` plus `UserAssignmentsDialog.tsx` own the
user-assignment runtime split. `RolesPanel.tsx` and `UserAssignmentsPanel.tsx`
remain the canonical render shells for those governed RBAC surfaces.
+That shared RBAC free-trial runtime must also preserve backend denial reasons
+through the canonical upgrade presentation helper instead of collapsing every
+trial-start conflict into a generic already-used message. Organization settings
+paywalls should only map the explicit canonical trial helper outputs, not
+re-interpret status codes locally.
diff --git a/frontend-modern/src/components/Settings/__tests__/RBACPaywallPanels.test.tsx b/frontend-modern/src/components/Settings/__tests__/RBACPaywallPanels.test.tsx
index 1f7817be98..bea573052b 100644
--- a/frontend-modern/src/components/Settings/__tests__/RBACPaywallPanels.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/RBACPaywallPanels.test.tsx
@@ -191,4 +191,32 @@ describe('RBAC paywall settings panels', () => {
expect(notificationSuccessMock).not.toHaveBeenCalled();
expect(screen.getByRole('dialog', { name: 'Manage access: alice' })).toBeInTheDocument();
});
+
+ it('surfaces backend trial-start messages instead of collapsing every conflict into already-used', async () => {
+ hasFeatureMock.mockImplementation((feature: string) => feature !== 'rbac');
+ entitlementsMock.mockReturnValue({ trial_eligible: true });
+ startProTrialMock.mockRejectedValueOnce(
+ Object.assign(
+ new Error('Trial cannot be started while a paid v5 license migration is pending'),
+ {
+ status: 409,
+ code: 'trial_not_available',
+ },
+ ),
+ );
+
+ render(() => <RolesPanel />);
+
+ await waitFor(() => {
+ expect(screen.getByRole('button', { name: 'Start free trial' })).toBeInTheDocument();
+ });
+
+ fireEvent.click(screen.getByRole('button', { name: 'Start free trial' }));
+
+ await waitFor(() => {
+ expect(notificationErrorMock).toHaveBeenCalledWith(
+ 'Trial cannot be started while a paid v5 license migration is pending',
+ );
+ });
+ });
});
diff --git a/frontend-modern/src/components/Settings/useRBACFeatureGateState.ts b/frontend-modern/src/components/Settings/useRBACFeatureGateState.ts
index ed8dd4c1a8..045d4e2786 100644
--- a/frontend-modern/src/components/Settings/useRBACFeatureGateState.ts
+++ b/frontend-modern/src/components/Settings/useRBACFeatureGateState.ts
@@ -11,7 +11,6 @@ import { getRBACFeatureGateCopy, type RBACFeatureGateCopy } from '@/utils/rbacPr
import { trackPaywallViewed } from '@/utils/upgradeMetrics';
import {
getProTrialStartedMessage,
- getTrialAlreadyUsedMessage,
getTrialStartErrorMessage,
} from '@/utils/upgradePresentation';
@@ -62,14 +61,7 @@ export function useRBACFeatureGateState(options: UseRBACFeatureGateStateOptions)
}
notificationStore.success(getProTrialStartedMessage());
} catch (err) {
- const statusCode = (err as { status?: number } | null)?.status;
- if (statusCode === 409) {
- notificationStore.error(getTrialAlreadyUsedMessage());
- } else {
- notificationStore.error(
- getTrialStartErrorMessage(err instanceof Error ? err.message : undefined),
- );
- }
+ notificationStore.error(getTrialStartErrorMessage(err));
} finally {
setStartingTrial(false);
}