Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(frontend): let a reader narrow a timestamp column
zchpeter82a42a364c5c
diff --git a/docs/design/timestamp-display.md b/docs/design/timestamp-display.mdindex 85d2950f69..13d5ed8194 100644--- a/docs/design/timestamp-display.md+++ b/docs/design/timestamp-display.md@@ -138,12 +138,13 @@ compact.**months ago" is about 125px in a table cell, the compact form 190, the operational 260, the fulldate-time 280 — so a column sized for the old wording breaks the new one across two lines ortruncates it. Each form has a measured width (`TIMESTAMP_COLUMN`, the widest rendering across-every shipped locale), and a column holding it gets that width. In a fixed-layout table the-open-ended column — a title, a statement — is the one left unsized: the browser spreads spare-width across every sized column, so sizing them all lets the timestamp swell on a wide screen. A-column narrows below its form only where the tooltip restores what truncation hides: compact may,-operational may not, since its zone has to stay visible, and the full date-time may not, since its-tooltip is the age.+every shipped locale), and a column holding it opens at that width, so nothing is cut unless the+reader chooses it. In a fixed-layout table the open-ended column — a title, a statement — is the+one left unsized: the browser spreads spare width across every sized column, so sizing them all+lets the timestamp swell on a wide screen. The minimum is one floor for every form, room for the+date, and a column narrower than its form ellipsizes rather than wraps. A reader who drags past+the seconds or the zone has traded them for another column's room, and one drag undoes it; a floor+at the widest case would take that trade away from everyone to serve a half-hour zone.## Surface classificationdiff --git a/frontend/src/components/AuditLogTable.test.tsx b/frontend/src/components/AuditLogTable.test.tsxindex aa80668ef2..229460dff5 100644--- a/frontend/src/components/AuditLogTable.test.tsx+++ b/frontend/src/components/AuditLogTable.test.tsx@@ -173,6 +173,35 @@ afterEach(() => {});describe("AuditLogTable", () => {+ test("lets the reader narrow the date column for room elsewhere", async () => {+ // The default shows the whole value; how much of it to keep is the+ // reader's trade against four other columns, and one drag undoes it.+ mocks.searchAuditLogs.mockResolvedValue({+ auditLogs: [create(AuditLogSchema, { name: "auditLogs/1" })],+ nextPageToken: "",+ });+ const { container, render, unmount } = renderIntoContainer(+ <AuditLogTable parent="projects/-" canExport={false} />+ );+ await render();++ const handle = container.querySelector("th [class*=cursor-col-resize]");+ expect(handle).not.toBeNull();+ const [created] = Array.from(container.querySelectorAll("col"));+ act(() => {+ handle?.dispatchEvent(+ new MouseEvent("mousedown", { bubbles: true, clientX: 400 })+ );+ document.dispatchEvent(new MouseEvent("mousemove", { clientX: 300 }));+ document.dispatchEvent(new MouseEvent("mouseup"));+ });+ expect(created.style.width).toBe(+ `${TIMESTAMP_COLUMN.datetime.width - 100}px`+ );++ unmount();+ });+test("keeps the full date-time on one line at any width", async () => {// The evidence tier's tooltip is the age, which cannot give the value// back, so its column never narrows past the form: sized to it, and thediff --git a/frontend/src/components/AuditLogTable.tsx b/frontend/src/components/AuditLogTable.tsxindex 38ff2dbc01..7fda063aed 100644--- a/frontend/src/components/AuditLogTable.tsx+++ b/frontend/src/components/AuditLogTable.tsx@@ -445,6 +445,7 @@ function useColumnDefs(): ColumnDef[] {render: (log: AuditLog) =>log.createTime ? (<HumanizeTs+ className="block truncate"mode="datetime"tsMs={getTimeForPbTimestampProtoEs(log.createTime)}/>diff --git a/frontend/src/components/timestampColumn.ts b/frontend/src/components/timestampColumn.tsindex 8649bd5d4a..c96c0078cb 100644--- a/frontend/src/components/timestampColumn.ts+++ b/frontend/src/components/timestampColumn.ts@@ -2,18 +2,22 @@// test that stubs the component still has the real widths to lay out with./**- * The width of a table column that holds a form on one line: the widest- * rendering (a two-digit hour, a zone as long as GMT-3:30) at a table's 14px,- * plus a cell's 32px of padding. Measured in every locale the app ships;- * en-US is the widest in all three forms.+ * The default width of a table column that holds a form on one line: the+ * widest rendering (a two-digit hour, a zone as long as GMT-3:30) at a+ * table's 14px, plus a cell's 32px of padding. Measured in every locale the+ * app ships; en-US is the widest in all three forms. The default shows the+ * whole value, so nothing is cut unless the reader chooses it.*- * A column may be dragged below its form only where the tooltip restores what- * the truncation hides. Compact's tooltip is the full date-time, so it may.- * Operational may not, because its zone has to stay visible; nor may the full- * date-time, whose tooltip is the age and cannot give the value back.+ * The minimum is one floor for every form -- room for the date -- rather than+ * the form's width. A reader who narrows a column past the seconds or the+ * zone has traded them for another column's room, and one drag undoes it;+ * a floor at the widest case would take that choice away from everyone to+ * serve a half-hour zone.*/+const MIN_WIDTH = 120;+export const TIMESTAMP_COLUMN = {- compact: { width: 190, minWidth: 120 },- operational: { width: 260, minWidth: 260 },- datetime: { width: 280, minWidth: 280 },+ compact: { width: 190, minWidth: MIN_WIDTH },+ operational: { width: 260, minWidth: MIN_WIDTH },+ datetime: { width: 280, minWidth: MIN_WIDTH },} as const;diff --git a/frontend/src/routes/project/ProjectAccessGrantsPage.test.tsx b/frontend/src/routes/project/ProjectAccessGrantsPage.test.tsxindex 9a615ada99..36e22b0849 100644--- a/frontend/src/routes/project/ProjectAccessGrantsPage.test.tsx+++ b/frontend/src/routes/project/ProjectAccessGrantsPage.test.tsx@@ -9,15 +9,17 @@ vi.mock("react-i18next", () => ({import { grantColumns } from "./ProjectAccessGrantsPage";describe("grantColumns", () => {- test("keeps the expiry's zone in view at any width", () => {+ test("shows the expiry's zone by default, and lets the reader trade it", () => {// An operational time carries its zone so a reader elsewhere knows when// access really ends, and the zone is the end of the string -- the first- // thing a narrow column cuts. So the column is sized to the whole form,- // and a drag stops there.+ // thing a narrow column cuts. So the column opens wide enough for all of+ // it; narrower is the reader's call, not a floor set by the widest zone.const expiration = grantColumns((key) => key).find((column) => column.key === "expiration");expect(expiration?.defaultWidth).toBe(TIMESTAMP_COLUMN.operational.width);- expect(expiration?.minWidth).toBe(TIMESTAMP_COLUMN.operational.width);+ expect(expiration?.minWidth).toBeLessThan(+ TIMESTAMP_COLUMN.operational.width+ );});});