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): say what a narrowed date keeps, and yield from a column's floor
zchpetere5f753060abd
diff --git a/docs/design/timestamp-display.md b/docs/design/timestamp-display.mdindex 12a1ea5743..e9c8c281b0 100644--- a/docs/design/timestamp-display.md+++ b/docs/design/timestamp-display.md@@ -137,19 +137,21 @@ compact.****Column width follows the form.** Every form has a width it needs on one line(`TIMESTAMP_COLUMN_WIDTH`), measured over every time zone and shipped locale: 192, 270 and 292 forthe compact, operational and full date-time forms. Moving a surface off relative wording lengthens-its value, so a column sized for the old wording breaks the new one across two lines or cuts it-off. A column this design sizes opens at its form's width, so nothing is cut unless the reader-chooses it or the table has ruled which columns give way first when it is narrower than every-default — the access grants have, and their dates give way first. The work-queue form has no sized-column here; its widest reading is Spanish in the future tense, 183px, so a queue-form column-elsewhere may be sized for the past tense alone. How the width is kept depends on the table. Where-the browser spreads spare width across every sized column, the open-ended column — a title, a-run's detail — is left unsized to take it, so the date neither wraps nor swells; the audit log-does not do this yet, and its date grows with the rest. Where a table fits its columns to the-container itself, a date column takes none of the spare width, and a column raised to its floor-takes that width from the others rather than overrunning the container. The minimum is one value-for every form, room for the date; narrower than its form a cell ellipsizes, and one drag gives-the rest back.+its value, so a column sized for the old wording breaks the new one across two lines or cuts it off.+A column this design sizes opens at its form's width, so nothing is cut unless the reader chooses it+or the table has ruled which columns give way first when it is narrower than the defaults together —+the access grants have, and their dates give way first. The work-queue form has no sized column+here; a column holding its widest reading, Spanish in the future tense, needs 183px, so a queue-form+column elsewhere may be sized for the past tense alone. How the width is kept depends on the table.+Where the browser spreads spare width across every sized column, the open-ended column — a title, a+run's detail — is left unsized to take it, so the date neither wraps nor swells; the audit log does+not do this yet, and its date grows with the rest. Where a table fits its columns to the container+itself, a date column takes none of the spare width, and a column raised to its floor takes that+width from the others rather than overrunning the container. The minimum is one value for every+form, 140px: the date alone where it is written widest, in Japanese. Narrower than its form a cell+ellipsizes from the end, so it keeps what the locale writes first — the date in most locales, the+time and zone in Vietnamese — and in Japanese and Chinese the ellipsis takes the date's last+character. The hover, or one drag, gives the rest back.## Surface classification@@ -168,7 +170,7 @@ Every current `HumanizeTs` call site, classified under the principle:| Schema sync status | `modules/sql-editor/components/SchemaPane/SyncSchemaButton.tsx`, `routes/project/ProjectSyncSchemaPage.tsx`, `components/database/DatabaseOverviewInfo.tsx` | Freshness | 30d switch || Agent chat | `modules/agent/components/AgentWindow.tsx` | Feed | 30d switch || Plan-check run time | `components/plan-check/PlanCheckSection.tsx` (bare `toLocaleString()` today — adopts `HumanizeTs`) | Freshness | 30d switch |-| Access-grant creation time | `routes/project/ProjectAccessGrantsPage.tsx` (`AccessGrantRow`; full absolute today — adopts `HumanizeTs`). Shares the operational form with the expiration beside it: two dates in one row read in one format, and consistency outranks the freshness a relative age would add. The row's status, statement, creator and databases carry what a reader acts on — the status turns Expired by itself — so the dates take none of the spare width, and when the table is narrower than every column's default they give way first, down to the date alone, then the statement, the creator and the databases, with the status last. The zone is the first thing cut on a narrow screen; the full date-time stays on the hover | Operational | Operational (D6 tooltip) |+| Access-grant creation time | `routes/project/ProjectAccessGrantsPage.tsx` (`AccessGrantRow`; full absolute today — adopts `HumanizeTs`). Shares the operational form with the expiration beside it: two dates in one row read in one format, and consistency outranks the freshness a relative age would add. The row's status, statement, creator and databases carry what a reader acts on — the status turns Expired by itself — so the dates take none of the spare width, and when the table is narrower than the defaults together they give way first, down to the timestamp minimum, then the statement, the creator and the databases, with the status last. A narrow screen cuts the end of each date, the zone in most locales; the full date-time stays on the hover | Operational | Operational (D6 tooltip) || **Database changelog** | `routes/project/database-detail/changelog/DatabaseChangelogTable.tsx` | **History view** | **Absolute always — compact tier (D7)** || **Database revisions** | `routes/project/database-detail/revision/DatabaseRevisionTable.tsx` | **History view** | **Absolute always — compact tier (D7)** || **Task-run history** | `routes/project/plan-detail/components/deploy/DeployTaskRunHistorySheet.tsx`, `routes/project/issue-detail/components/IssueDetailTaskRunTable.tsx` | **History view** | **Absolute always — compact tier (D7)** |diff --git a/frontend/src/components/timestampColumn.ts b/frontend/src/components/timestampColumn.tsindex 090941a894..55c441254c 100644--- a/frontend/src/components/timestampColumn.ts+++ b/frontend/src/components/timestampColumn.ts@@ -15,8 +15,9 @@ export const TIMESTAMP_COLUMN_WIDTH = {} as const;/**- * How far a reader may narrow any timestamp column: room for the date,- * measured the same way; ja-JP writes it widest. Past the date the cell- * ellipsizes, and one drag gives the rest back.+ * How far any timestamp column may narrow: the date alone, measured the same+ * way, which ja-JP writes widest. A narrower cell ellipsizes from the end, so+ * it keeps the date only where the locale writes the date first; vi-VN+ * writes the time first.*/export const TIMESTAMP_COLUMN_MIN_WIDTH = 140;diff --git a/frontend/src/hooks/useColumnWidths.test.tsx b/frontend/src/hooks/useColumnWidths.test.tsxindex 52b910a124..3896b1101e 100644--- a/frontend/src/hooks/useColumnWidths.test.tsx+++ b/frontend/src/hooks/useColumnWidths.test.tsx@@ -467,4 +467,12 @@ describe("distributeColumnWidths with a yield order", () => {// Spare width still goes to the columns that grow, not the date.expect(distributeColumnWidths(columns, preferred + 300)[0]).toBe(270);});++ test("raises a column whose default is under its floor, and takes that from the next", () => {+ const narrowDefault = [+ { defaultWidth: 100, minWidth: 120, yieldOrder: 1 },+ { defaultWidth: 300, minWidth: 100, yieldOrder: 2 },+ ];+ expect(distributeColumnWidths(narrowDefault, 350)).toEqual([120, 230]);+ });});diff --git a/frontend/src/hooks/useColumnWidths.ts b/frontend/src/hooks/useColumnWidths.tsindex cd5a1ed327..1d77f5beea 100644--- a/frontend/src/hooks/useColumnWidths.ts+++ b/frontend/src/hooks/useColumnWidths.ts@@ -8,33 +8,34 @@ import {export interface ColumnWithWidth {defaultWidth: number;+ /** The narrowest a drag or `distributeColumnWidths` may make the column. */minWidth?: number;/**- * False for a column whose content has a width of its own, such as a date:- * `distributeColumnWidths` gives it none of the spare width, and `minWidth`- * floors a drag rather than the width it opens at. Without a `yieldOrder`- * it keeps `defaultWidth` at any width. Tables that leave spare width to- * the browser do not read it.+ * False for a column whose content has a width of its own, such as a date,+ * so it takes none of the spare width. Tables that leave spare width to the+ * browser do not read it.*/grow?: boolean;- /**- * When the container is narrower than every column's `defaultWidth`,- * columns give width back in ascending order, each down to its `minWidth`- * before the next gives any. A column without one gives last; one that is- * not resizable never does. Without any, the shortfall is shared.- */+ /** When this column gives way in a table too narrow for its defaults. */yieldOrder?: number;}+const DEFAULT_MIN_WIDTH = 40;+const floorOf = (c: ColumnWithWidth) => c.minWidth ?? DEFAULT_MIN_WIDTH;+/*** Distributes `containerWidth` across columns so the table fills its container- * on first render instead of overflowing at the sum of `defaultWidth`s.- * Columns that are not resizable, or do not grow, keep their `defaultWidth`;- * the rest share the remaining space in proportion to their `defaultWidth`.- * A column whose share falls under its `minWidth` is held there and the rest- * is shared again, so the widths add up to exactly the container whenever it- * can hold every floor. When it cannot, every column sits at its floor and- * the table scrolls.+ * on first render instead of overflowing at the sum of `defaultWidth`s: the+ * widths add up to exactly the container unless it cannot hold every column+ * at the narrowest the rules below allow, and then the table scrolls. A+ * column that is not resizable always keeps its `defaultWidth`.+ *+ * - Narrower than the defaults together, with any column declaring a+ * `yieldOrder`: columns give way in ascending order, each down to its+ * `minWidth` before the next gives any, and those without an order last.+ * - Otherwise: columns that do not grow keep their `defaultWidth`, and the+ * rest share the remaining space in proportion to theirs, none below its+ * `minWidth`.*/export function distributeColumnWidths<T extends ColumnWithWidth & { resizable?: boolean },@@ -44,10 +45,9 @@ export function distributeColumnWidths<containerWidth < preferredTotal &&columns.some((c) => c.yieldOrder !== undefined)) {- return yieldInOrder(columns, preferredTotal - containerWidth);+ return yieldInOrder(columns, containerWidth);}const keepsWidth = (c: T) => c.resizable === false || c.grow === false;- const floorOf = (c: T) => c.minWidth ?? 40;const fixedTotal = columns.filter(keepsWidth).reduce((sum, c) => sum + c.defaultWidth, 0);@@ -92,18 +92,20 @@ export function distributeColumnWidths<return widths;}-// Starts every column at its default and takes `deficit` back, a yield-// group at a time: within a group in proportion to how far each column can-// shrink, and never past a floor. If every group reaches its floors first,-// the widths add up past the container and the table scrolls.+// Starts every column at its default, or its floor if that is wider, and+// takes back what overruns the container a yield group at a time: within a+// group in proportion to how far each column can shrink.function yieldInOrder<T extends ColumnWithWidth & { resizable?: boolean }>(columns: T[],- deficit: number+ containerWidth: number): number[] {- const floorOf = (c: T) => c.minWidth ?? 40;const orderOf = (c: T) => c.yieldOrder ?? Number.POSITIVE_INFINITY;- const widths = columns.map((c) => c.defaultWidth);- let remaining = deficit;+ const widths = columns.map((c) =>+ c.resizable === false+ ? c.defaultWidth+ : Math.max(c.defaultWidth, floorOf(c))+ );+ let remaining = widths.reduce((sum, w) => sum + w, 0) - containerWidth;const orders = [...new Set(columns.filter((c) => c.resizable !== false).map(orderOf)),].sort((a, b) => a - b);@@ -116,9 +118,7 @@ function yieldInOrder<T extends ColumnWithWidth & { resizable?: boolean }>(.filter((i) => columns[i].resizable !== false && orderOf(columns[i]) === order);- const room = group.map((i) =>- Math.max(0, columns[i].defaultWidth - floorOf(columns[i]))- );+ const room = group.map((i) => widths[i] - floorOf(columns[i]));const groupRoom = room.reduce((sum, r) => sum + r, 0);const take = Math.min(remaining, groupRoom);let taken = 0;@@ -211,7 +211,7 @@ export function useColumnWidths<T extends ColumnWithWidth>(columns: T[]) {// and never auto-extends). Without this, startWidth would be// undefined and the drag's newWidth math would produce NaN.startWidth: widthsRef.current[colIndex] ?? col.defaultWidth,- minWidth: col.minWidth ?? 40,+ minWidth: floorOf(col),};const onMouseMove = (ev: MouseEvent) => {