fix(ui): phone-width overflows in the audit's flagged rows, with an e2e check (#1757)
deploy / gate (push) Successful in 4m54s
Quality / check (push) Successful in 6m36s
deploy / archied-image (push) Successful in 3m23s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped

Grants rows and toggle groups wrap with a smaller phone label; the token
form wraps and its input flexes; the sources name column caps at full
width and its action buttons wrap; the rule-editor condition row wraps
with a full-width phone select; the payload tree indents less and breaks
long JSON leaves; the topbar instance badge truncates; org agent rows
keep Assign inline and move Rename/Suspend/Retire into a MoreMenu. New
e2e check phone-overflow.cjs visits these views at 390x844 with seeded
data and asserts no horizontal scroll.
This commit is contained in:
sam committed 2026-11-06 23:23:16 +11:00
1 parent 94f79177a2
commit 461d3dc1f7
8 files changed
+91 -31

No files matched your search

+61
View File
@@ -0,0 +1,61 @@
// Phone-width sweep of the views the November audit flagged (#1757): at
// 390x844 each must fit without horizontal scroll or clipped controls. The
// topbar (with its instance badge) is on every page; /account holds the
// token form, /org/agents the agent rows and the grants card, /events the
// sources table, the event-type rule editor and the mapping editor dialog.
const assert = require('node:assert/strict');
module.exports = async ({ page, go, shot, fail, settled }) => {
await page.setViewportSize({ width: 390, height: 844 });
const assertNoOverflow = async (label) => {
const { scrollWidth, innerWidth } = await page.evaluate(() => ({
scrollWidth: document.documentElement.scrollWidth,
innerWidth: window.innerWidth,
}));
if (scrollWidth > innerWidth) {
fail(`${label} overflows 390px: scrollWidth=${scrollWidth} > innerWidth=${innerWidth}`);
}
};
const visit = async (path, label, waitFor) => {
await go(path);
if (waitFor) await settled(waitFor);
await assertNoOverflow(label);
await shot(label);
};
await visit('/account', 'account-tokens', 'text=API tokens');
await visit('/org/agents', 'org-agents', 'text=Credential grants');
await go('/events');
await settled('[role=tab]');
await assertNoOverflow('events');
await shot('events');
// The seeded event type's rule editor (RuleEditor's condition row) opens
// from the Edit button on its row.
const editType = page.locator('button[aria-label^="Edit "]').first();
if (await editType.count()) {
await editType.click();
await page.getByRole('dialog').first().waitFor();
await settled();
await assertNoOverflow('event-type rule editor');
await shot('rule-editor');
await page.keyboard.press('Escape');
await settled();
}
// The mappings tab's editor dialog carries the payload tree.
await page.getByRole('tab', { name: 'Map' }).click();
await settled('text=New mapping');
await assertNoOverflow('mappings list');
const editMapping = page.locator('button', { hasText: 'Edit' }).first();
if (await editMapping.count()) {
await editMapping.click();
await page.getByRole('dialog').first().waitFor();
await settled();
await assertNoOverflow('mapping editor dialog');
await shot('mapping-editor');
}
};
+2 -2
View File
@@ -75,8 +75,8 @@ onMounted(load);
<template>
<Section title="API tokens">
<template v-if="available" #action>
<form class="flex items-center gap-2" @submit.prevent="create">
<Input v-model="name" class="w-40" maxlength="40" required placeholder="Name" aria-label="Token name" />
<form class="flex flex-wrap items-center gap-2" @submit.prevent="create">
<Input v-model="name" class="w-40 min-w-0 flex-1 sm:flex-none" maxlength="40" required placeholder="Name" aria-label="Token name" />
<Select :model-value="String(days)" @update:model-value="(v) => (days = Number(v))">
<SelectTrigger size="sm" class="w-28" aria-label="Lifetime"><SelectValue /></SelectTrigger>
<SelectContent>
+3 -3
View File
@@ -73,11 +73,11 @@ function asOp(value: unknown): PayloadCondition["op"] {
<div
v-for="(p, i) in rule.payload || []"
:key="`p${i}`"
class="flex items-center gap-2"
class="flex flex-wrap items-center gap-2"
>
<Input
v-model="p.path"
class="font-mono"
class="min-w-0 flex-1 font-mono"
aria-label="Payload path"
placeholder="action"
/>
@@ -85,7 +85,7 @@ function asOp(value: unknown): PayloadCondition["op"] {
:model-value="p.op"
@update:model-value="(value) => (p.op = asOp(value))"
>
<SelectTrigger size="sm" class="w-28 shrink-0" aria-label="Condition">
<SelectTrigger size="sm" class="w-28 shrink-0 max-sm:w-full" aria-label="Condition">
<SelectValue />
</SelectTrigger>
<SelectContent>
+1 -1
View File
@@ -32,6 +32,6 @@ onBeforeUnmount(() => clearTimeout(fold));
controls, so the mark alone carries the brand there (the sheet header
keeps the full logo). -->
<Logo :open="intro || hovered" class="max-sm:[&>span:last-child]:hidden" />
<Badge v-if="accounts.instance" variant="info">{{ accounts.instance }}</Badge>
<Badge v-if="accounts.instance" variant="info" class="max-w-28 truncate">{{ accounts.instance }}</Badge>
</RouterLink>
</template>
+4 -4
View File
@@ -57,12 +57,12 @@ function pick(path: string, key: string, value: unknown): void {
<template>
<ul
v-if="isBranch"
class="flex list-none flex-col gap-0.5 pl-4 font-mono text-caption"
class="flex list-none flex-col gap-0.5 pl-4 font-mono text-caption max-sm:pl-2"
>
<li v-for="entry in entries" :key="entry.path">
<li v-for="entry in entries" :key="entry.path" class="min-w-0">
<button
type="button"
class="focus-visible:ring-ring rounded-sm px-1 text-left outline-none hover:bg-muted focus-visible:ring-2"
class="focus-visible:ring-ring break-all rounded-sm px-1 text-left outline-none hover:bg-muted focus-visible:ring-2"
@click="pick(entry.path, entry.key, entry.value)"
>
{{ entry.key }}
@@ -79,7 +79,7 @@ function pick(path: string, key: string, value: unknown): void {
<button
v-else
type="button"
class="focus-visible:ring-ring ml-1 rounded-sm px-1 text-fg-subtle outline-none hover:bg-muted focus-visible:ring-2"
class="focus-visible:ring-ring ml-1 break-all rounded-sm px-1 text-left text-fg-subtle outline-none hover:bg-muted focus-visible:ring-2"
@click="pick(path, name, value)"
>
{{ JSON.stringify(value) }}
+13 -14
View File
@@ -29,6 +29,8 @@ import {
SelectValue,
} from "@/components/ui/select";
import { Badge } from "@/components/ui/badge";
import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
import { MoreMenu } from "@/components/ui/more-menu";
import { Section } from "@/components/ui/section";
import { api } from "@/lib/api";
import { useOrgStore, type Identity } from "@/stores/org";
@@ -161,7 +163,7 @@ const isAgent = (value: Identity) =>
</div>
<Badge v-if="isAgent(value) && serves.has(value.id)" variant="outline" class="font-mono">{{ org?.id }}</Badge>
<Badge v-if="value.lifecycle !== 'active'" :variant="lifecycle[value.lifecycle]" class="capitalize">{{ value.lifecycle }}</Badge>
<div v-if="value.kind !== 'system' && value.lifecycle !== 'retired'" class="flex flex-wrap gap-1">
<div v-if="value.kind !== 'system' && value.lifecycle !== 'retired'" class="flex flex-wrap items-center gap-1">
<Tooltip v-if="isAgent(value) && !serves.has(value.id)">
<TooltipTrigger as-child>
<Button
@@ -174,19 +176,16 @@ const isAgent = (value: Identity) =>
</TooltipTrigger>
<TooltipContent>Assign to {{ org?.name }}</TooltipContent>
</Tooltip>
<Button variant="ghost" size="sm" :disabled="!!store.identityBusy" @click="startRename(value)">Rename</Button>
<Button
v-if="value.lifecycle === 'active'"
variant="ghost"
size="sm"
:disabled="!!store.identityBusy"
@click="store.identityCommand(value, 'suspend')"
>Suspend</Button
>
<Button v-else variant="ghost" size="sm" :disabled="!!store.identityBusy" @click="store.identityCommand(value, 'reactivate')"
>Reactivate</Button
>
<Button variant="ghost" size="sm" class="text-danger" :disabled="!!store.identityBusy" @click="retiring = value">Retire</Button>
<MoreMenu :label="`Actions for ${value.display_name || value.id}`">
<DropdownMenuItem :disabled="!!store.identityBusy" @select="startRename(value)">Rename</DropdownMenuItem>
<DropdownMenuItem
v-if="value.lifecycle === 'active'"
:disabled="!!store.identityBusy"
@select="store.identityCommand(value, 'suspend')"
>Suspend</DropdownMenuItem>
<DropdownMenuItem v-else :disabled="!!store.identityBusy" @select="store.identityCommand(value, 'reactivate')">Reactivate</DropdownMenuItem>
<DropdownMenuItem variant="destructive" :disabled="!!store.identityBusy" @select="retiring = value">Retire</DropdownMenuItem>
</MoreMenu>
</div>
</Item>
<li v-if="!store.identitiesLoaded" class="py-3 text-label text-fg-muted" role="status">Loading agents…</li>
+5 -5
View File
@@ -54,16 +54,16 @@ function removeIdentity(id: string) {
<Section title="Credential grants">
<Alert v-if="error" variant="destructive" class="mb-3"><AlertDescription>{{ error }}</AlertDescription></Alert>
<ItemGroup v-if="grants">
<Item as="div" role="listitem" variant="outline" size="sm">
<span class="w-40 shrink-0 text-label">Default</span>
<ToggleGroup type="multiple" variant="outline" size="sm" :model-value="grants.root ?? []" aria-label="Default grants" @update:model-value="(v) => setRoot(v as string[])">
<Item as="div" role="listitem" variant="outline" size="sm" class="flex-wrap">
<span class="w-40 shrink-0 text-label max-sm:w-24 max-sm:truncate">Default</span>
<ToggleGroup class="flex-wrap" type="multiple" variant="outline" size="sm" :model-value="grants.root ?? []" aria-label="Default grants" @update:model-value="(v) => setRoot(v as string[])">
<ToggleGroupItem v-for="service in store.credentialServices" :key="service" :value="service" class="font-mono text-caption">{{ service }}</ToggleGroupItem>
</ToggleGroup>
<DraftHint :kind="KIND" path="root" />
</Item>
<Item v-for="(services, id) in grants.identities" :key="id" as="div" role="listitem" variant="outline" size="sm">
<span class="w-40 shrink-0 truncate text-label">{{ org.identityName(String(id)) }}</span>
<ToggleGroup type="multiple" variant="outline" size="sm" :model-value="services" :aria-label="`${org.identityName(String(id))} grants`" @update:model-value="(v) => setIdentity(String(id), v as string[])">
<span class="w-40 shrink-0 truncate text-label max-sm:w-24">{{ org.identityName(String(id)) }}</span>
<ToggleGroup class="flex-wrap" type="multiple" variant="outline" size="sm" :model-value="services" :aria-label="`${org.identityName(String(id))} grants`" @update:model-value="(v) => setIdentity(String(id), v as string[])">
<ToggleGroupItem v-for="service in store.credentialServices" :key="service" :value="service" class="font-mono text-caption">{{ service }}</ToggleGroupItem>
</ToggleGroup>
<Button variant="ghost" size="sm" class="ml-auto" :aria-label="`Remove ${org.identityName(String(id))}`" @click="removeIdentity(String(id))"><X /></Button>
+2 -2
View File
@@ -117,7 +117,7 @@ function url(source: Source): string {
<TableBody>
<TableRow v-for="source in sources" :key="source.path">
<TableCell class="font-mono text-fg-muted">
<div class="flex w-64 min-w-0 flex-col gap-1">
<div class="flex w-64 max-w-full min-w-0 flex-col gap-1">
<Input
class="h-7 border-transparent px-1 font-sans shadow-none hover:border-input dark:bg-transparent"
:model-value="source.name ?? ''"
@@ -152,7 +152,7 @@ function url(source: Source): string {
}}</Badge>
</TableCell>
<TableCell>
<div class="flex items-center justify-end gap-1">
<div class="flex flex-wrap items-center justify-end gap-1">
<Tooltip>
<TooltipTrigger as-child>
<Button