Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix(frontend): keep the row's layout when a tooltip has something to say

zchpeter20b0e2d413c2
diff --git a/frontend/src/components/task-run-log/SectionContent.tsx b/frontend/src/components/task-run-log/SectionContent.tsx
index db0e36be95..ba7cc2a765 100644
--- a/frontend/src/components/task-run-log/SectionContent.tsx
+++ b/frontend/src/components/task-run-log/SectionContent.tsx
@@ -4,8 +4,18 @@ import { FullDateTime } from "@/components/HumanizeTs";
import { Button } from "@/components/ui/button";
import { Tooltip } from "@/components/ui/tooltip";
import { cn } from "@/lib/utils";
+import { displayableInstantMs } from "@/utils/datetime";
import type { Section } from "./types";
+// A log line carries 0 for a step that has no time yet, and the full reading
+// is only offered for an instant the formatters can render.
+const fullTime = (timeMs: number) => {
+ const instantMs = timeMs > 0 ? displayableInstantMs(timeMs) : undefined;
+ return instantMs === undefined ? undefined : (
+ <FullDateTime tsMs={instantMs} />
+ );
+};
+
const ITEM_HEIGHT = 20;
const MAX_VISIBLE_ITEMS = 10;
const MAX_RENDERED_ITEMS = 50;
@@ -51,15 +61,9 @@ export function SectionContent({
<span className="w-6 shrink-0 text-right text-control-placeholder tabular-nums">
{index + 1}
</span>
- <Tooltip
- content={
- item.timeMs > 0 ? <FullDateTime tsMs={item.timeMs} /> : undefined
- }
- >
- <span className="shrink-0 text-control-placeholder tabular-nums">
- {item.time}
- </span>
- </Tooltip>
+ <span className="shrink-0 text-control-placeholder tabular-nums">
+ <Tooltip content={fullTime(item.timeMs)}>{item.time}</Tooltip>
+ </span>
{item.relativeTime ? (
<span className="shrink-0 text-control-placeholder tabular-nums">
{item.relativeTime}
diff --git a/frontend/src/modules/sql-editor/components/AccessGrantItem.tsx b/frontend/src/modules/sql-editor/components/AccessGrantItem.tsx
index 535fa4ffdf..ef04fa2b08 100644
--- a/frontend/src/modules/sql-editor/components/AccessGrantItem.tsx
+++ b/frontend/src/modules/sql-editor/components/AccessGrantItem.tsx
@@ -156,11 +156,13 @@ export function AccessGrantItem({
)}
</div>
{expiration && (
- <Tooltip content={expiration.hiddenDeadline}>
- <span className="text-xs text-control-placeholder shrink-0">
+ // The span stays outside the tooltip: it carries this row's layout,
+ // and a tooltip with nothing to say renders its children bare.
+ <span className="text-xs text-control-placeholder shrink-0">
+ <Tooltip content={expiration.hiddenDeadline}>
{expiration.text}
- </span>
- </Tooltip>
+ </Tooltip>
+ </span>
)}
</div>
diff --git a/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskHeader.tsx b/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskHeader.tsx
index 5b899347ba..f744f2a27f 100644
--- a/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskHeader.tsx
+++ b/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskHeader.tsx
@@ -35,7 +35,7 @@ export function DeployTaskHeader({
onRollback,
onToggleExpand,
onToggleSelect,
- scheduledTimeTs,
+ scheduledTimeMs,
showRollback,
task,
timingDisplay,
@@ -51,7 +51,7 @@ export function DeployTaskHeader({
onRollback: () => void;
onToggleExpand: () => void;
onToggleSelect: () => void;
- scheduledTimeTs: number;
+ scheduledTimeMs: number | undefined;
showRollback: boolean;
task: Task;
timingDisplay: string;
@@ -84,10 +84,10 @@ export function DeployTaskHeader({
<TaskStatusIcon size="small" status={task.status} />
<div className="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1">
<PlanTargetDisplay size="md" target={task.target} />
- {isExpanded && scheduledTimeTs > 0 && (
+ {isExpanded && scheduledTimeMs !== undefined && (
<span className="flex shrink-0 items-center gap-x-1 rounded-full bg-info/10 px-2 py-0.5 text-xs text-info">
<LoaderCircle className="size-3 animate-spin motion-reduce:animate-none" />
- <HumanizeTs mode="operational" ts={scheduledTimeTs} />
+ <HumanizeTs mode="operational" ts={scheduledTimeMs / 1000} />
</span>
)}
</div>
@@ -99,12 +99,15 @@ export function DeployTaskHeader({
<div className="ml-auto flex shrink-0 items-center gap-x-2">
{!isExpanded && (
<span className="text-xs tabular-nums text-control-light">
- {scheduledTimeTs > 0 ||
+ {scheduledTimeMs !== undefined ||
(task.status === Task_Status.RUNNING && timingDisplay) ? (
<span className="flex items-center gap-x-1 text-info">
<LoaderCircle className="size-3 animate-spin motion-reduce:animate-none" />
- {scheduledTimeTs > 0 ? (
- <HumanizeTs mode="operational" ts={scheduledTimeTs} />
+ {scheduledTimeMs !== undefined ? (
+ <HumanizeTs
+ mode="operational"
+ ts={scheduledTimeMs / 1000}
+ />
) : (
timingDisplay
)}
diff --git a/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskItem.tsx b/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskItem.tsx
index 1015cb0ce1..6827455a88 100644
--- a/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskItem.tsx
+++ b/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskItem.tsx
@@ -133,10 +133,10 @@ export const DeployTaskItem = memo(function DeployTaskItem({
latestTaskRun.hasPriorBackup
? latestTaskRun
: undefined;
- const scheduledTimeTs =
+ const scheduledTimeMs =
task.runTime && task.status === Task_Status.PENDING
- ? getTimeForPbTimestampProtoEs(task.runTime, 0) / 1000
- : 0;
+ ? getTimeForPbTimestampProtoEs(task.runTime)
+ : undefined;
// Same duration source as the history sheet and the expanded body, so all
// three render identical strings for the same run.
const timingDisplay = latestTaskRun
@@ -207,7 +207,7 @@ export const DeployTaskItem = memo(function DeployTaskItem({
onRollback={() => setRollbackOpen(true)}
onToggleExpand={() => onToggleExpand(task)}
onToggleSelect={() => onToggleSelect(task)}
- scheduledTimeTs={scheduledTimeTs}
+ scheduledTimeMs={scheduledTimeMs}
showRollback={Boolean(rollbackableTaskRun)}
task={task}
timingDisplay={timingDisplay}
diff --git a/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskRunHistorySheet.tsx b/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskRunHistorySheet.tsx
index 865668b319..e280b79c0e 100644
--- a/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskRunHistorySheet.tsx
+++ b/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskRunHistorySheet.tsx
@@ -108,9 +108,9 @@ function TaskRunHistoryItem({
taskRun: TaskRun;
}) {
const { t } = useTranslation();
- const startTs =
- getTimeForPbTimestampProtoEs(taskRun.startTime, 0) ||
- getTimeForPbTimestampProtoEs(taskRun.createTime, 0);
+ const startMs =
+ getTimeForPbTimestampProtoEs(taskRun.startTime) ??
+ getTimeForPbTimestampProtoEs(taskRun.createTime);
const duration = formatTaskRunDuration(taskRun);
const executorEmail = executorEmailOfTaskRun(taskRun);
const comment = getTaskRunComment(taskRun, t);
@@ -142,7 +142,9 @@ function TaskRunHistoryItem({
)}
</span>
<span className="flex shrink-0 items-center gap-x-3 text-xs text-control-light">
- {startTs > 0 && <HumanizeTs mode="compact" ts={startTs / 1000} />}
+ {startMs !== undefined && (
+ <HumanizeTs mode="compact" ts={startMs / 1000} />
+ )}
{duration && (
<span className="flex items-center gap-x-1">
<Clock3 className="size-3" />