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 SSO endpoint values and copy controls within narrow cards

pulse-triage[bot]6ba801df53a2
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index c49b1ea819..6f8a270274 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -10668,3 +10668,19 @@ protect grouped metadata, responsive columns and bounded rendering. Browser
proof must exercise the consuming list at desktop/narrow widths, inspect actual
pixels, identity, state/age fit, touch/keyboard disclosure, filters and live
updates. This is safer evidence inspection, not a restore or installed recovery.
+
+
+### SSO endpoint cards remain readable and copyable on narrow screens
+
+The SSO provider card in `SSOProvidersPanel.tsx` separates each endpoint's
+label from its value with a definition-list entry. OIDC callbacks and enabled
+SAML metadata/ACS values wrap anywhere rather than truncating or imposing an
+18rem minimum on the card. The shared `CopyValueButton` remains a native,
+keyboard-operable control with a preserved copy icon, a full-width 44px-tall
+narrow target, and the exact server-supplied value. Copying does not navigate,
+normalise or infer a URL. Existing missing-endpoint guidance, disabled-provider
+visibility and read-only management gates remain; viewing/copying is not a
+settings mutation or a paid SSO gate. `SSOProvidersPanel.test.tsx` verifies
+exact OIDC/SAML clipboard values, read-only/disabled-provider controls and
+clipboard rejection. Actual consuming desktop and narrow-browser geometry,
+keyboard/touch and inspected pixels establish responsive fit beyond JSDOM.
diff --git a/frontend-modern/src/components/Settings/SSOProvidersPanel.tsx b/frontend-modern/src/components/Settings/SSOProvidersPanel.tsx
index 5c51ed1016..9c73e3a327 100644
--- a/frontend-modern/src/components/Settings/SSOProvidersPanel.tsx
+++ b/frontend-modern/src/components/Settings/SSOProvidersPanel.tsx
@@ -32,6 +32,31 @@ import {
import { ALERT_EMAIL_REPLY_TO_PLACEHOLDER } from '@/utils/alertEmailPresentation';
import { useSSOProvidersState } from '@/components/Settings/useSSOProvidersState';
+// Endpoint labels and values have separate lines so neither a long URL nor
+// the copy icon can push the other outside a narrow provider card.
+const SSOEndpoint: Component<{
+ caption: string;
+ value: string | undefined;
+ copyLabel: string;
+ onCopyValue: (value: string) => Promise<void>;
+}> = (props) => (
+ <div class="min-w-0 space-y-1">
+ <dt class="text-muted">{props.caption}</dt>
+ <dd class="min-w-0">
+ <CopyValueButton
+ value={props.value}
+ onCopyValue={props.onCopyValue}
+ label={props.copyLabel}
+ variant="accent"
+ size="sm"
+ class="min-h-11 w-full max-w-full justify-between gap-2 py-2 text-left text-xs sm:min-h-0 sm:w-auto [&>svg]:shrink-0"
+ >
+ <span class="min-w-0 [overflow-wrap:anywhere]">{props.value}</span>
+ </CopyValueButton>
+ </dd>
+ </div>
+);
+
interface SSOProvidersPanelProps {
onConfigUpdated?: () => void;
canManage?: boolean;
@@ -202,21 +227,14 @@ export const SSOProvidersPanel: Component<SSOProvidersPanelProps> = (props) => {
</p>
}
>
- <div class="flex flex-wrap gap-4 text-xs">
- <div class="flex items-center gap-1">
- <span class="text-slate-500">Callback / Redirect URL:</span>
- <CopyValueButton
- value={provider.oidcCallbackUrl}
- onCopyValue={(value) => copyToClipboard(value, 'Callback URL')}
- label="Copy callback / redirect URL"
- variant="accent"
- size="chip"
- class="max-w-[18rem] text-xs"
- >
- <span class="min-w-0 truncate">{provider.oidcCallbackUrl}</span>
- </CopyValueButton>
- </div>
- </div>
+ <dl class="grid min-w-0 gap-3 text-xs">
+ <SSOEndpoint
+ caption="Callback / Redirect URL:"
+ value={provider.oidcCallbackUrl}
+ onCopyValue={(value) => copyToClipboard(value, 'Callback URL')}
+ copyLabel="Copy callback / redirect URL"
+ />
+ </dl>
</Show>
</div>
</Show>
@@ -232,34 +250,20 @@ export const SSOProvidersPanel: Component<SSOProvidersPanelProps> = (props) => {
</p>
}
>
- <div class="flex flex-wrap gap-4 text-xs">
- <div class="flex items-center gap-1">
- <span class="text-slate-500">SP Metadata:</span>
- <CopyValueButton
- value={provider.samlMetadataUrl}
- onCopyValue={(value) => copyToClipboard(value, 'Metadata URL')}
- label="Copy SP metadata URL"
- variant="accent"
- size="chip"
- class="max-w-[18rem] text-xs"
- >
- <span class="min-w-0 truncate">{provider.samlMetadataUrl}</span>
- </CopyValueButton>
- </div>
- <div class="flex items-center gap-1">
- <span class="text-slate-500">ACS URL:</span>
- <CopyValueButton
- value={provider.samlAcsUrl}
- onCopyValue={(value) => copyToClipboard(value, 'ACS URL')}
- label="Copy ACS URL"
- variant="accent"
- size="chip"
- class="max-w-[18rem] text-xs"
- >
- <span class="min-w-0 truncate">{provider.samlAcsUrl}</span>
- </CopyValueButton>
- </div>
- </div>
+ <dl class="grid min-w-0 gap-3 text-xs">
+ <SSOEndpoint
+ caption="SP Metadata:"
+ value={provider.samlMetadataUrl}
+ onCopyValue={(value) => copyToClipboard(value, 'Metadata URL')}
+ copyLabel="Copy SP metadata URL"
+ />
+ <SSOEndpoint
+ caption="ACS URL:"
+ value={provider.samlAcsUrl}
+ onCopyValue={(value) => copyToClipboard(value, 'ACS URL')}
+ copyLabel="Copy ACS URL"
+ />
+ </dl>
</Show>
</div>
</Show>
diff --git a/frontend-modern/src/components/Settings/__tests__/SSOProvidersPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/SSOProvidersPanel.test.tsx
index 2db5a9f8b5..bc8d53acde 100644
--- a/frontend-modern/src/components/Settings/__tests__/SSOProvidersPanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/SSOProvidersPanel.test.tsx
@@ -218,6 +218,78 @@ describe('SSOProvidersPanel IdP endpoint URLs', () => {
expect(screen.getByRole('button', { name: 'Copy callback / redirect URL' })).toBeTruthy();
});
+ it.each([true, false])(
+ 'copies the complete server-supplied OIDC endpoint from a read-only card, enabled=%s',
+ async (enabled) => {
+ const callback =
+ 'https://monitoring.example.test/pulse/api/oidc/東京%2Foperations-with-a-long-provider-id/callback?scope=a%2Fb&state=unchanged';
+ const writeText = vi.fn().mockResolvedValue(undefined);
+ Object.defineProperty(navigator, 'clipboard', { value: { writeText }, configurable: true });
+ setupFetch([{ ...corpProvider, enabled, oidcCallbackUrl: callback }]);
+ render(() => <SSOProvidersPanel canManage={false} />);
+
+ const copy = await screen.findByRole('button', { name: 'Copy callback / redirect URL' });
+ expect(copy).toBeEnabled();
+ expect(copy).toHaveTextContent(callback);
+ expect(screen.getByText('Callback / Redirect URL:').tagName).toBe('DT');
+ fireEvent.click(copy);
+ await waitFor(() => expect(writeText).toHaveBeenCalledExactlyOnceWith(callback));
+ expect(notificationSuccessMock).toHaveBeenCalledWith('Callback URL has been copied');
+ expect(screen.getByRole('button', { name: 'Edit provider' })).toBeDisabled();
+ expect(screen.getByRole('button', { name: 'Delete provider' })).toBeDisabled();
+ expect(fetchMock.mock.calls.every(([, options]) => !options?.method)).toBe(true);
+ },
+ );
+
+ it('keeps SAML metadata and ACS endpoints distinct and copyable without write access', async () => {
+ const base =
+ 'https://monitoring.example.test/pulse/api/saml/operations-with-a-very-long-provider-id';
+ const endpoints = [
+ { caption: 'SP Metadata:', label: 'Copy SP metadata URL', value: `${base}/metadata` },
+ { caption: 'ACS URL:', label: 'Copy ACS URL', value: `${base}/acs?target=a%2Fb` },
+ ];
+ const writeText = vi.fn().mockResolvedValue(undefined);
+ Object.defineProperty(navigator, 'clipboard', { value: { writeText }, configurable: true });
+ setupFetch([
+ {
+ id: 'corp-saml',
+ name: 'Corporate SAML',
+ type: 'saml',
+ enabled: true,
+ samlMetadataUrl: endpoints[0].value,
+ samlAcsUrl: endpoints[1].value,
+ },
+ ]);
+ render(() => <SSOProvidersPanel canManage={false} />);
+
+ for (const endpoint of endpoints) {
+ const copy = await screen.findByRole('button', { name: endpoint.label });
+ expect(copy).toBeEnabled();
+ expect(copy).toHaveTextContent(endpoint.value);
+ expect(screen.getByText(endpoint.caption).tagName).toBe('DT');
+ fireEvent.click(copy);
+ await waitFor(() => expect(writeText).toHaveBeenLastCalledWith(endpoint.value));
+ }
+ expect(writeText).toHaveBeenCalledTimes(2);
+ expect(fetchMock.mock.calls.every(([, options]) => !options?.method)).toBe(true);
+ });
+
+ it('reports a rejected card copy without changing its value or provider', async () => {
+ const callback = 'https://monitoring.example.test/api/oidc/corp-oidc/callback';
+ const writeText = vi.fn().mockRejectedValue(new Error('Clipboard unavailable'));
+ Object.defineProperty(navigator, 'clipboard', { value: { writeText }, configurable: true });
+ setupFetch([{ ...corpProvider, oidcCallbackUrl: callback }]);
+ render(() => <SSOProvidersPanel />);
+
+ const copy = await screen.findByRole('button', { name: 'Copy callback / redirect URL' });
+ fireEvent.click(copy);
+ await waitFor(() => expect(notificationErrorMock).toHaveBeenCalledWith('Unable to copy callback url'));
+ expect(copy).toHaveTextContent(callback);
+ expect(copy).toBeEnabled();
+ expect(writeText).toHaveBeenCalledExactlyOnceWith(callback);
+ expect(fetchMock.mock.calls.every(([, options]) => !options?.method)).toBe(true);
+ });
+
it('guides the admin to set a public URL instead of offering a copyable OIDC URL', async () => {
setupFetch([{ ...corpProvider, oidcCallbackUrl: '' }]);
render(() => <SSOProvidersPanel />);
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index 24fa40a5f4..5016bd9d66 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -1238,6 +1238,25 @@ describe('settings architecture guardrails', () => {
expect(ssoProvidersPanelSource).toContain('Group names may contain spaces.');
});
+ it('keeps card endpoint labels outside the wrapping shared copy control', () => {
+ const endpoint = ssoProvidersPanelSource.slice(
+ ssoProvidersPanelSource.indexOf('const SSOEndpoint:'),
+ ssoProvidersPanelSource.indexOf('interface SSOProvidersPanelProps'),
+ );
+ // The old inline flex row let a non-shrinking URL squeeze its label and
+ // disappear beyond the card. Keep this shared card projection explicit;
+ // rendered/browser checks cover copying and actual responsive geometry.
+ expect(endpoint).toContain('<dt class="text-muted">{props.caption}</dt>');
+ expect(endpoint).toContain('value={props.value}');
+ expect(endpoint).toContain('onCopyValue={props.onCopyValue}');
+ expect(endpoint).toContain('w-full max-w-full');
+ expect(endpoint).toContain('[overflow-wrap:anywhere]');
+ expect(endpoint).toContain('[&>svg]:shrink-0');
+ expect(endpoint).not.toContain('truncate');
+ expect(ssoProvidersPanelSource.match(/<SSOEndpoint\s/g)).toHaveLength(3);
+ expect(ssoProvidersPanelSource).not.toContain('max-w-[18rem]');
+ });
+
it('never offers a localhost SSO endpoint URL as if it were registerable with an IdP', () => {
// The panel tells admins to register these URLs with their IdP, so a
// hardcoded localhost guess would be copied out and fail at the IdP. The