Skip to content

Commit 31e6822

Browse files
Wrap authorized clients in fading scroll area (pingdotgg#3085)
1 parent 1db5858 commit 31e6822

2 files changed

Lines changed: 60 additions & 1 deletion

File tree

apps/web/src/components/settings/ConnectionsSettings.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3007,7 +3007,13 @@ export function ConnectionsSettings() {
30073007
/>
30083008
}
30093009
>
3010-
{renderAuthorizedClients("current")}
3010+
<ScrollArea
3011+
scrollFade
3012+
className="max-h-[22.5rem]"
3013+
data-testid="authorized-clients-scroll-area"
3014+
>
3015+
{renderAuthorizedClients("current")}
3016+
</ScrollArea>
30113017
</SettingsSection>
30123018
) : null}
30133019
<AlertDialog

apps/web/src/components/settings/SettingsPanels.browser.tsx

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,59 @@ describe("GeneralSettingsPanel observability", () => {
917917
await expect.element(page.getByText("Revoke others")).toBeInTheDocument();
918918
});
919919

920+
it("keeps authorized clients within a five-row fading scroll area", async () => {
921+
window.desktopBridge = createDesktopBridgeStub({
922+
serverExposureState: {
923+
mode: "network-accessible",
924+
endpointUrl: "http://192.168.1.44:3773",
925+
advertisedHost: "192.168.1.44",
926+
tailscaleServeEnabled: false,
927+
tailscaleServePort: 443,
928+
},
929+
});
930+
authAccessHarness.setSnapshot({
931+
pairingLinks: [],
932+
clientSessions: Array.from({ length: 7 }, (_, index) =>
933+
makeClientSession({
934+
sessionId: `session-client-${index}`,
935+
subject: `client-${index}`,
936+
scopes: ["orchestration:read"],
937+
method: "browser-session-cookie",
938+
client: {
939+
label: `Client ${index + 1}`,
940+
deviceType: "desktop",
941+
os: "macOS",
942+
browser: "Electron",
943+
ipAddress: `192.168.1.${index + 10}`,
944+
},
945+
issuedAt: "2036-04-07T00:00:00.000Z",
946+
expiresAt: "2036-05-07T00:00:00.000Z",
947+
connected: index === 0,
948+
current: index === 0,
949+
}),
950+
),
951+
});
952+
setServerConfigSnapshot(createBaseServerConfig());
953+
954+
mounted = await render(
955+
<AppAtomRegistryProvider>
956+
<ConnectionsSettings />
957+
</AppAtomRegistryProvider>,
958+
);
959+
960+
await expect.element(page.getByText("Client 7")).toBeInTheDocument();
961+
const scrollArea = document.querySelector<HTMLElement>(
962+
'[data-testid="authorized-clients-scroll-area"]',
963+
);
964+
const viewport = scrollArea?.querySelector<HTMLElement>('[data-slot="scroll-area-viewport"]');
965+
966+
expect(scrollArea).not.toBeNull();
967+
expect(viewport).not.toBeNull();
968+
expect(scrollArea?.clientHeight).toBe(360);
969+
expect(viewport?.scrollHeight).toBeGreaterThan(viewport?.clientHeight ?? 0);
970+
expect(viewport?.className).toContain("mask-b-from");
971+
});
972+
920973
it("revokes all other paired clients from settings", async () => {
921974
window.desktopBridge = createDesktopBridgeStub({
922975
serverExposureState: {

0 commit comments

Comments
 (0)