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.

Keep Billing Admin recovery and phone actions readable

pulse-triage[bot]ae608825fcef
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index 8e33000750..903443f74e 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -40,8 +40,11 @@ withdrawal and disposal abort its transport, including after CSRF preparation.
Cancellation is not server rollback. A failed, malformed or mismatched response
withdraws the row snapshot and says the change is unconfirmed until an explicit
reload. Obsolete completions produce no success or failure toast in a later view.
-Normal-suite BillingAdminPanel/ReadLifetimes and billingAdmin transport tests pin
-these boundaries. Desktop and phone browser evidence uses the actual panel,
+On phones, one set of subscription actions stays in the subscription cell, beside
+its accepted state and recovery control, rather than extending a separate column
+off-screen. Error text and expanded JSON override inherited table no-wrap rules
+so the warning, recovery and billing details remain readable. Normal-suite
+BillingAdminPanel/ReadLifetimes and billingAdmin transport tests pin these boundaries. Desktop and phone browser evidence uses the actual panel,
grid, client and capability stores with synthetic HTTP responses; no installed
billing, provider mutation or original administrator recovery is claimed.
diff --git a/frontend-modern/src/components/Settings/BillingAdminOrganizationsTable.tsx b/frontend-modern/src/components/Settings/BillingAdminOrganizationsTable.tsx
index f470713035..32bd2c0e56 100644
--- a/frontend-modern/src/components/Settings/BillingAdminOrganizationsTable.tsx
+++ b/frontend-modern/src/components/Settings/BillingAdminOrganizationsTable.tsx
@@ -1,6 +1,7 @@
import { Show, type Component } from 'solid-js';
import { Button } from '@/components/shared/Button';
import { PulseDataGrid } from '@/components/shared/PulseDataGrid';
+import { useBreakpoint } from '@/hooks/useBreakpoint';
import {
BILLING_ADMIN_EMPTY_STATE,
getBillingAdminOrganizationBadges,
@@ -34,6 +35,7 @@ const stripeCustomerCell = (state?: BillingState) => {
export const BillingAdminOrganizationsTable: Component<BillingAdminOrganizationsTableProps> = (
props,
) => {
+ const { isMobile } = useBreakpoint();
const unreadLabel = (orgID: string) =>
props.billingLoadingByOrgID[orgID] ? 'Loading' : 'Unavailable';
const actionsDisabled = (orgID: string) =>
@@ -42,6 +44,30 @@ export const BillingAdminOrganizationsTable: Component<BillingAdminOrganizations
!!props.billingErrorByOrgID[orgID] ||
props.savingByOrgID[orgID] ||
props.billingLoadingByOrgID[orgID];
+ const subscriptionActions = (orgID: string) => {
+ const currentSubState = () =>
+ (props.billingByOrgID[orgID]?.subscription_state || '').toLowerCase();
+ return (
+ <div class="inline-flex flex-col sm:flex-row sm:items-center gap-2">
+ <Button
+ variant="secondary"
+ size="sm"
+ onClick={() => props.onSuspendOrganization(orgID)}
+ disabled={actionsDisabled(orgID) || currentSubState() === 'suspended'}
+ >
+ Suspend Org
+ </Button>
+ <Button
+ variant="secondary"
+ size="sm"
+ onClick={() => props.onActivateOrganization(orgID)}
+ disabled={actionsDisabled(orgID) || currentSubState() === 'active'}
+ >
+ Activate Org
+ </Button>
+ </div>
+ );
+ };
return (
<PulseDataGrid
data={props.orgs}
@@ -57,7 +83,7 @@ export const BillingAdminOrganizationsTable: Component<BillingAdminOrganizations
return (
<button
type="button"
- class="text-left w-full"
+ class="text-left w-full whitespace-normal [overflow-wrap:anywhere]"
onClick={() => {
props.onToggleOrganization(orgID);
}}
@@ -97,7 +123,10 @@ export const BillingAdminOrganizationsTable: Component<BillingAdminOrganizations
: unreadLabel(orgID)}
</span>
<Show when={props.billingErrorByOrgID[orgID]}>
- <p role="alert" class="max-w-xs text-xs text-red-700 dark:text-red-300">
+ <p
+ role="alert"
+ class="max-w-xs whitespace-normal [overflow-wrap:anywhere] text-xs text-red-700 dark:text-red-300"
+ >
{props.billingErrorByOrgID[orgID]}
</p>
<Button
@@ -110,6 +139,7 @@ export const BillingAdminOrganizationsTable: Component<BillingAdminOrganizations
Reload billing
</Button>
</Show>
+ <Show when={isMobile()}>{subscriptionActions(orgID)}</Show>
</div>
);
},
@@ -144,36 +174,9 @@ export const BillingAdminOrganizationsTable: Component<BillingAdminOrganizations
{
key: 'actions',
label: 'Actions',
+ hiddenOnMobile: true,
align: 'right',
- render: (org) => {
- const orgID = (org.org_id || '').trim();
- const billing = props.billingByOrgID[orgID];
- const currentSubState = (billing?.subscription_state || '').toLowerCase() || 'unknown';
- return (
- <div class="inline-flex flex-col sm:flex-row sm:items-center gap-2">
- <Button
- variant="secondary"
- size="sm"
- onClick={() => {
- props.onSuspendOrganization(orgID);
- }}
- disabled={actionsDisabled(orgID) || currentSubState === 'suspended'}
- >
- Suspend Org
- </Button>
- <Button
- variant="secondary"
- size="sm"
- onClick={() => {
- props.onActivateOrganization(orgID);
- }}
- disabled={actionsDisabled(orgID) || currentSubState === 'active'}
- >
- Activate Org
- </Button>
- </div>
- );
- },
+ render: (org) => <Show when={!isMobile()}>{subscriptionActions(org.org_id)}</Show>,
},
]}
keyExtractor={(org) => org.org_id}
@@ -181,7 +184,7 @@ export const BillingAdminOrganizationsTable: Component<BillingAdminOrganizations
expandedRender={(org) => {
const orgID = (org.org_id || '').trim();
return (
- <div class="px-3 pb-3 bg-surface-alt">
+ <div class="px-3 pb-3 bg-surface-alt whitespace-normal">
<div class="rounded-md border border-border bg-surface-alt p-3">
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-2">
<div class="text-xs font-semibold text-muted">Billing state JSON</div>
@@ -204,7 +207,7 @@ export const BillingAdminOrganizationsTable: Component<BillingAdminOrganizations
</p>
}
>
- <pre class="text-xs overflow-x-auto whitespace-pre-wrap break-words font-mono text-base-content">
+ <pre class="text-xs overflow-x-auto whitespace-pre-wrap [overflow-wrap:anywhere] font-mono text-base-content">
{JSON.stringify(props.billingByOrgID[orgID], null, 2)}
</pre>
</Show>
diff --git a/frontend-modern/src/components/Settings/__tests__/BillingAdminPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/BillingAdminPanel.test.tsx
index 849dd36016..a8ee90d34e 100644
--- a/frontend-modern/src/components/Settings/__tests__/BillingAdminPanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/BillingAdminPanel.test.tsx
@@ -6,6 +6,7 @@ import billingAdminOrganizationsTableSource from '../BillingAdminOrganizationsTa
import billingAdminPanelSource from '../BillingAdminPanel.tsx?raw';
import billingAdminPanelStateSource from '../useBillingAdminPanelState.ts?raw';
+const isMobileMock = vi.fn();
const listOrganizationsMock = vi.fn();
const getBillingStateMock = vi.fn();
const putBillingStateMock = vi.fn();
@@ -13,6 +14,10 @@ const successMock = vi.fn();
const errorMock = vi.fn();
const presentationPolicyHidesOrganizationSurfacesMock = vi.fn();
+vi.mock('@/hooks/useBreakpoint', () => ({
+ useBreakpoint: () => ({ isMobile: () => isMobileMock() }),
+}));
+
vi.mock('@/api/billingAdmin', () => ({
BillingAdminAPI: {
listOrganizations: (...args: unknown[]) => listOrganizationsMock(...args),
@@ -47,6 +52,7 @@ vi.mock('@/utils/logger', () => ({
describe('BillingAdminPanel', () => {
beforeEach(() => {
+ isMobileMock.mockReset().mockReturnValue(false);
listOrganizationsMock.mockReset();
getBillingStateMock.mockReset();
putBillingStateMock.mockReset();
@@ -179,4 +185,25 @@ describe('BillingAdminPanel', () => {
expect(listOrganizationsMock).not.toHaveBeenCalled();
expect(getBillingStateMock).not.toHaveBeenCalled();
});
+ it('keeps one set of mobile subscription actions beside their confirmed billing state', async () => {
+ isMobileMock.mockReturnValue(true);
+ getBillingStateMock.mockResolvedValue({
+ capabilities: [],
+ limits: {},
+ meters_enabled: [],
+ subscription_state: 'active',
+ });
+ putBillingStateMock.mockImplementation(async (_orgID, payload) => payload);
+ render(() => <BillingAdminPanel />);
+ await waitFor(() => expect(screen.getByRole('button', { name: 'Suspend Org' })).toBeEnabled());
+ expect(screen.getAllByRole('button', { name: 'Suspend Org' })).toHaveLength(1);
+ expect(screen.getAllByRole('button', { name: 'Activate Org' })).toHaveLength(1);
+ expect(screen.getByRole('button', { name: 'Suspend Org' }).closest('td')).toHaveTextContent(
+ 'Active',
+ );
+ await fireEvent.click(screen.getByRole('button', { name: 'Suspend Org' }));
+ await waitFor(() => expect(putBillingStateMock).toHaveBeenCalledTimes(1));
+ expect(putBillingStateMock.mock.calls[0][0]).toBe('org-1');
+ expect(putBillingStateMock.mock.calls[0][1].subscription_state).toBe('suspended');
+ });
});