Skip to content

Commit a65c460

Browse files
committed
fix(webapp): Watch tooltip in the Investigate form — 'Get notified when…'
1 parent a9fe736 commit a65c460

2 files changed

Lines changed: 29 additions & 2 deletions

File tree

apps/webapp/app/components/dashboard-agent/WatchButton.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { EyeIcon } from "@heroicons/react/20/solid";
22
import type { WatchSpec } from "@internal/dashboard-agent-contracts";
33
import { Button } from "~/components/primitives/Buttons";
44
import { useDashboardAgent } from "./dashboardAgentLauncher";
5+
import { watchTooltipLabel } from "./watch-presentation";
56

67
/**
78
* The universal **Watch…** action (§2.1).
@@ -54,8 +55,8 @@ export function WatchButton({
5455
fullWidth={fullWidth}
5556
textAlignLeft={fullWidth}
5657
className={className}
57-
// The recommendation's own promise is the best description of the button.
58-
tooltip={tooltip ?? spec.note}
58+
// Same imperative form as the Investigate tooltip.
59+
tooltip={tooltip ?? watchTooltipLabel(spec)}
5960
onClick={() => agent.openWithWatch(spec)}
6061
>
6162
{label}

apps/webapp/app/components/dashboard-agent/watch-presentation.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,32 @@ export function watchConditionLabel(spec: WatchSpec): string {
420420
}
421421
}
422422

423+
/** The Watch button's tooltip — same imperative form as Investigate's. */
424+
export function watchTooltipLabel(spec: WatchSpec): string {
425+
switch (spec.kind) {
426+
case "run_start":
427+
return "Get notified when this run starts";
428+
case "run_finished":
429+
return "Get notified when this run finishes";
430+
case "run_failed":
431+
return "Get notified if this run fails";
432+
case "backlog_drain":
433+
return "Get notified when this queue drains";
434+
case "queue_depth_above":
435+
return `Get notified if this queue goes above ${spec.threshold}`;
436+
case "queue_depth_below":
437+
return `Get notified when this queue is back below ${spec.threshold}`;
438+
case "queue_stalled":
439+
return "Get notified if this queue stops moving";
440+
case "queue_oldest_age":
441+
return `Get notified if runs wait longer than ${formatWatchSla(spec.thresholdMinutes)}`;
442+
case "error_recurrence":
443+
return "Get notified if this error happens again";
444+
case "health_recovery":
445+
return "Get notified when health recovers";
446+
}
447+
}
448+
423449
/** "For 1 hour · checking every 5 min" — the duration line of the card. */
424450
export function watchDurationLabel(spec: WatchSpec): string {
425451
return `For ${formatWatchWindow(spec.maxHours)} · checking ${formatWatchCadence(

0 commit comments

Comments
 (0)