fix(ui): phone-width overflows in the audit's flagged rows, with an e2e check (#1757)
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:
8 files changed
+91
-31
No files matched your search
@@ -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');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -75,8 +75,8 @@ onMounted(load);
|
|||||||
<template>
|
<template>
|
||||||
<Section title="API tokens">
|
<Section title="API tokens">
|
||||||
<template v-if="available" #action>
|
<template v-if="available" #action>
|
||||||
<form class="flex items-center gap-2" @submit.prevent="create">
|
<form class="flex flex-wrap items-center gap-2" @submit.prevent="create">
|
||||||
<Input v-model="name" class="w-40" maxlength="40" required placeholder="Name" aria-label="Token name" />
|
<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))">
|
<Select :model-value="String(days)" @update:model-value="(v) => (days = Number(v))">
|
||||||
<SelectTrigger size="sm" class="w-28" aria-label="Lifetime"><SelectValue /></SelectTrigger>
|
<SelectTrigger size="sm" class="w-28" aria-label="Lifetime"><SelectValue /></SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
|||||||
@@ -73,11 +73,11 @@ function asOp(value: unknown): PayloadCondition["op"] {
|
|||||||
<div
|
<div
|
||||||
v-for="(p, i) in rule.payload || []"
|
v-for="(p, i) in rule.payload || []"
|
||||||
:key="`p${i}`"
|
:key="`p${i}`"
|
||||||
class="flex items-center gap-2"
|
class="flex flex-wrap items-center gap-2"
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
v-model="p.path"
|
v-model="p.path"
|
||||||
class="font-mono"
|
class="min-w-0 flex-1 font-mono"
|
||||||
aria-label="Payload path"
|
aria-label="Payload path"
|
||||||
placeholder="action"
|
placeholder="action"
|
||||||
/>
|
/>
|
||||||
@@ -85,7 +85,7 @@ function asOp(value: unknown): PayloadCondition["op"] {
|
|||||||
:model-value="p.op"
|
:model-value="p.op"
|
||||||
@update:model-value="(value) => (p.op = asOp(value))"
|
@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 />
|
<SelectValue />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
|
|||||||
@@ -32,6 +32,6 @@ onBeforeUnmount(() => clearTimeout(fold));
|
|||||||
controls, so the mark alone carries the brand there (the sheet header
|
controls, so the mark alone carries the brand there (the sheet header
|
||||||
keeps the full logo). -->
|
keeps the full logo). -->
|
||||||
<Logo :open="intro || hovered" class="max-sm:[&>span:last-child]:hidden" />
|
<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>
|
</RouterLink>
|
||||||
</template>
|
</template>
|
||||||
@@ -57,12 +57,12 @@ function pick(path: string, key: string, value: unknown): void {
|
|||||||
<template>
|
<template>
|
||||||
<ul
|
<ul
|
||||||
v-if="isBranch"
|
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
|
<button
|
||||||
type="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)"
|
@click="pick(entry.path, entry.key, entry.value)"
|
||||||
>
|
>
|
||||||
{{ entry.key }}
|
{{ entry.key }}
|
||||||
@@ -79,7 +79,7 @@ function pick(path: string, key: string, value: unknown): void {
|
|||||||
<button
|
<button
|
||||||
v-else
|
v-else
|
||||||
type="button"
|
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)"
|
@click="pick(path, name, value)"
|
||||||
>
|
>
|
||||||
{{ JSON.stringify(value) }}
|
{{ JSON.stringify(value) }}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ import {
|
|||||||
SelectValue,
|
SelectValue,
|
||||||
} from "@/components/ui/select";
|
} from "@/components/ui/select";
|
||||||
import { Badge } from "@/components/ui/badge";
|
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 { Section } from "@/components/ui/section";
|
||||||
import { api } from "@/lib/api";
|
import { api } from "@/lib/api";
|
||||||
import { useOrgStore, type Identity } from "@/stores/org";
|
import { useOrgStore, type Identity } from "@/stores/org";
|
||||||
@@ -161,7 +163,7 @@ const isAgent = (value: Identity) =>
|
|||||||
</div>
|
</div>
|
||||||
<Badge v-if="isAgent(value) && serves.has(value.id)" variant="outline" class="font-mono">{{ org?.id }}</Badge>
|
<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>
|
<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)">
|
<Tooltip v-if="isAgent(value) && !serves.has(value.id)">
|
||||||
<TooltipTrigger as-child>
|
<TooltipTrigger as-child>
|
||||||
<Button
|
<Button
|
||||||
@@ -174,19 +176,16 @@ const isAgent = (value: Identity) =>
|
|||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent>Assign to {{ org?.name }}</TooltipContent>
|
<TooltipContent>Assign to {{ org?.name }}</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Button variant="ghost" size="sm" :disabled="!!store.identityBusy" @click="startRename(value)">Rename</Button>
|
<MoreMenu :label="`Actions for ${value.display_name || value.id}`">
|
||||||
<Button
|
<DropdownMenuItem :disabled="!!store.identityBusy" @select="startRename(value)">Rename</DropdownMenuItem>
|
||||||
v-if="value.lifecycle === 'active'"
|
<DropdownMenuItem
|
||||||
variant="ghost"
|
v-if="value.lifecycle === 'active'"
|
||||||
size="sm"
|
:disabled="!!store.identityBusy"
|
||||||
:disabled="!!store.identityBusy"
|
@select="store.identityCommand(value, 'suspend')"
|
||||||
@click="store.identityCommand(value, 'suspend')"
|
>Suspend</DropdownMenuItem>
|
||||||
>Suspend</Button
|
<DropdownMenuItem v-else :disabled="!!store.identityBusy" @select="store.identityCommand(value, 'reactivate')">Reactivate</DropdownMenuItem>
|
||||||
>
|
<DropdownMenuItem variant="destructive" :disabled="!!store.identityBusy" @select="retiring = value">Retire</DropdownMenuItem>
|
||||||
<Button v-else variant="ghost" size="sm" :disabled="!!store.identityBusy" @click="store.identityCommand(value, 'reactivate')"
|
</MoreMenu>
|
||||||
>Reactivate</Button
|
|
||||||
>
|
|
||||||
<Button variant="ghost" size="sm" class="text-danger" :disabled="!!store.identityBusy" @click="retiring = value">Retire</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</Item>
|
</Item>
|
||||||
<li v-if="!store.identitiesLoaded" class="py-3 text-label text-fg-muted" role="status">Loading agents…</li>
|
<li v-if="!store.identitiesLoaded" class="py-3 text-label text-fg-muted" role="status">Loading agents…</li>
|
||||||
|
|||||||
@@ -54,16 +54,16 @@ function removeIdentity(id: string) {
|
|||||||
<Section title="Credential grants">
|
<Section title="Credential grants">
|
||||||
<Alert v-if="error" variant="destructive" class="mb-3"><AlertDescription>{{ error }}</AlertDescription></Alert>
|
<Alert v-if="error" variant="destructive" class="mb-3"><AlertDescription>{{ error }}</AlertDescription></Alert>
|
||||||
<ItemGroup v-if="grants">
|
<ItemGroup v-if="grants">
|
||||||
<Item as="div" role="listitem" variant="outline" size="sm">
|
<Item as="div" role="listitem" variant="outline" size="sm" class="flex-wrap">
|
||||||
<span class="w-40 shrink-0 text-label">Default</span>
|
<span class="w-40 shrink-0 text-label max-sm:w-24 max-sm:truncate">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[])">
|
<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>
|
<ToggleGroupItem v-for="service in store.credentialServices" :key="service" :value="service" class="font-mono text-caption">{{ service }}</ToggleGroupItem>
|
||||||
</ToggleGroup>
|
</ToggleGroup>
|
||||||
<DraftHint :kind="KIND" path="root" />
|
<DraftHint :kind="KIND" path="root" />
|
||||||
</Item>
|
</Item>
|
||||||
<Item v-for="(services, id) in grants.identities" :key="id" as="div" role="listitem" variant="outline" size="sm">
|
<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>
|
<span class="w-40 shrink-0 truncate text-label max-sm:w-24">{{ 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[])">
|
<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>
|
<ToggleGroupItem v-for="service in store.credentialServices" :key="service" :value="service" class="font-mono text-caption">{{ service }}</ToggleGroupItem>
|
||||||
</ToggleGroup>
|
</ToggleGroup>
|
||||||
<Button variant="ghost" size="sm" class="ml-auto" :aria-label="`Remove ${org.identityName(String(id))}`" @click="removeIdentity(String(id))"><X /></Button>
|
<Button variant="ghost" size="sm" class="ml-auto" :aria-label="`Remove ${org.identityName(String(id))}`" @click="removeIdentity(String(id))"><X /></Button>
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ function url(source: Source): string {
|
|||||||
<TableBody>
|
<TableBody>
|
||||||
<TableRow v-for="source in sources" :key="source.path">
|
<TableRow v-for="source in sources" :key="source.path">
|
||||||
<TableCell class="font-mono text-fg-muted">
|
<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
|
<Input
|
||||||
class="h-7 border-transparent px-1 font-sans shadow-none hover:border-input dark:bg-transparent"
|
class="h-7 border-transparent px-1 font-sans shadow-none hover:border-input dark:bg-transparent"
|
||||||
:model-value="source.name ?? ''"
|
:model-value="source.name ?? ''"
|
||||||
@@ -152,7 +152,7 @@ function url(source: Source): string {
|
|||||||
}}</Badge>
|
}}</Badge>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<div class="flex items-center justify-end gap-1">
|
<div class="flex flex-wrap items-center justify-end gap-1">
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger as-child>
|
<TooltipTrigger as-child>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Reference in new issue
Block a user