@workflow/web-shared 5.0.8 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/README.md +8 -0
  2. package/dist/components/error-boundary.js +1 -1
  3. package/dist/components/event-list/event-details-panel.d.ts +25 -0
  4. package/dist/components/event-list/event-details-panel.d.ts.map +1 -0
  5. package/dist/components/event-list/event-details-panel.js +156 -0
  6. package/dist/components/event-list/event-list-toolbar.d.ts +6 -0
  7. package/dist/components/event-list/event-list-toolbar.d.ts.map +1 -0
  8. package/dist/components/event-list/event-list-toolbar.js +15 -0
  9. package/dist/components/event-list/event-row.d.ts +29 -0
  10. package/dist/components/event-list/event-row.d.ts.map +1 -0
  11. package/dist/components/event-list/event-row.js +102 -0
  12. package/dist/components/event-list/use-event-search.d.ts +14 -0
  13. package/dist/components/event-list/use-event-search.d.ts.map +1 -0
  14. package/dist/components/event-list/use-event-search.js +74 -0
  15. package/dist/components/event-list-view.d.ts +10 -67
  16. package/dist/components/event-list-view.d.ts.map +1 -1
  17. package/dist/components/event-list-view.js +112 -984
  18. package/dist/components/hook-actions.js +1 -1
  19. package/dist/components/index.js +1 -1
  20. package/dist/components/sidebar/attribute-panel.d.ts +2 -2
  21. package/dist/components/sidebar/attribute-panel.d.ts.map +1 -1
  22. package/dist/components/sidebar/attribute-panel.js +1 -1
  23. package/dist/components/sidebar/attributes-block.d.ts +5 -5
  24. package/dist/components/sidebar/attributes-block.d.ts.map +1 -1
  25. package/dist/components/sidebar/attributes-block.js +1 -1
  26. package/dist/components/sidebar/conversation-view.d.ts +1 -1
  27. package/dist/components/sidebar/conversation-view.d.ts.map +1 -1
  28. package/dist/components/sidebar/conversation-view.js +1 -1
  29. package/dist/components/sidebar/copyable-data-block.d.ts +2 -2
  30. package/dist/components/sidebar/copyable-data-block.d.ts.map +1 -1
  31. package/dist/components/sidebar/copyable-data-block.js +1 -1
  32. package/dist/components/sidebar/entity-detail-panel.js +1 -1
  33. package/dist/components/sidebar/events-list.d.ts +1 -1
  34. package/dist/components/sidebar/events-list.d.ts.map +1 -1
  35. package/dist/components/sidebar/events-list.js +1 -1
  36. package/dist/components/sidebar/resolve-hook-modal.js +1 -1
  37. package/dist/components/sidebar/sidebar-data-context.d.ts +1 -1
  38. package/dist/components/sidebar/sidebar-data-context.d.ts.map +1 -1
  39. package/dist/components/sidebar/sidebar-data-context.js +1 -1
  40. package/dist/components/sidebar/span-detail-merge.js +1 -1
  41. package/dist/components/sidebar/use-selected-span-detail.js +1 -1
  42. package/dist/components/stream-image-preview.d.ts +4 -0
  43. package/dist/components/stream-image-preview.d.ts.map +1 -0
  44. package/dist/components/stream-image-preview.js +21 -0
  45. package/dist/components/stream-viewer-skeleton.d.ts +1 -1
  46. package/dist/components/stream-viewer-skeleton.d.ts.map +1 -1
  47. package/dist/components/stream-viewer-skeleton.js +1 -1
  48. package/dist/components/stream-viewer.d.ts +2 -1
  49. package/dist/components/stream-viewer.d.ts.map +1 -1
  50. package/dist/components/stream-viewer.js +7 -2
  51. package/dist/components/trace-viewer/components/copy-button.js +1 -1
  52. package/dist/components/trace-viewer/components/detail-panel-shell.d.ts +22 -0
  53. package/dist/components/trace-viewer/components/detail-panel-shell.d.ts.map +1 -0
  54. package/dist/components/trace-viewer/components/detail-panel-shell.js +49 -0
  55. package/dist/components/trace-viewer/components/detail-panel-width.js +1 -1
  56. package/dist/components/trace-viewer/components/detail-panel.d.ts +4 -4
  57. package/dist/components/trace-viewer/components/detail-panel.d.ts.map +1 -1
  58. package/dist/components/trace-viewer/components/detail-panel.js +11 -51
  59. package/dist/components/trace-viewer/components/draggable-border.d.ts +1 -1
  60. package/dist/components/trace-viewer/components/draggable-border.d.ts.map +1 -1
  61. package/dist/components/trace-viewer/components/draggable-border.js +1 -1
  62. package/dist/components/trace-viewer/components/event-list.d.ts +10 -1
  63. package/dist/components/trace-viewer/components/event-list.d.ts.map +1 -1
  64. package/dist/components/trace-viewer/components/event-list.js +10 -3
  65. package/dist/components/trace-viewer/components/middle-truncate/copy-selection.js +1 -1
  66. package/dist/components/trace-viewer/components/middle-truncate/measurement-batch.js +1 -1
  67. package/dist/components/trace-viewer/components/middle-truncate/middle-truncate.js +1 -1
  68. package/dist/components/trace-viewer/components/middle-truncate/truncate.js +1 -1
  69. package/dist/components/trace-viewer/components/middle-truncate/use-middle-truncate.js +1 -1
  70. package/dist/components/trace-viewer/components/minimap.js +1 -1
  71. package/dist/components/trace-viewer/components/pane-constants.js +1 -1
  72. package/dist/components/trace-viewer/components/span-markers.js +1 -1
  73. package/dist/components/trace-viewer/components/split-pane.d.ts +1 -1
  74. package/dist/components/trace-viewer/components/split-pane.d.ts.map +1 -1
  75. package/dist/components/trace-viewer/components/split-pane.js +1 -1
  76. package/dist/components/trace-viewer/components/timeline.js +1 -1
  77. package/dist/components/trace-viewer/components/trace-shortcut-helper.d.ts +1 -1
  78. package/dist/components/trace-viewer/components/trace-shortcut-helper.d.ts.map +1 -1
  79. package/dist/components/trace-viewer/components/trace-shortcut-helper.js +1 -1
  80. package/dist/components/trace-viewer/components/trace-viewer-skeleton.d.ts +1 -1
  81. package/dist/components/trace-viewer/components/trace-viewer-skeleton.d.ts.map +1 -1
  82. package/dist/components/trace-viewer/components/trace-viewer-skeleton.js +1 -1
  83. package/dist/components/trace-viewer/components/use-alt-held.d.ts +1 -0
  84. package/dist/components/trace-viewer/components/use-alt-held.d.ts.map +1 -1
  85. package/dist/components/trace-viewer/components/use-alt-held.js +2 -2
  86. package/dist/components/trace-viewer/components/use-detail-panel-width.d.ts +19 -0
  87. package/dist/components/trace-viewer/components/use-detail-panel-width.d.ts.map +1 -0
  88. package/dist/components/trace-viewer/components/use-detail-panel-width.js +26 -0
  89. package/dist/components/trace-viewer/components/use-element-width.js +1 -1
  90. package/dist/components/trace-viewer/components/use-row-window.js +1 -1
  91. package/dist/components/trace-viewer/context.d.ts +3 -2
  92. package/dist/components/trace-viewer/context.d.ts.map +1 -1
  93. package/dist/components/trace-viewer/context.js +3 -3
  94. package/dist/components/trace-viewer/icons.d.ts +4 -4
  95. package/dist/components/trace-viewer/icons.d.ts.map +1 -1
  96. package/dist/components/trace-viewer/icons.js +1 -1
  97. package/dist/components/trace-viewer/search.js +1 -1
  98. package/dist/components/trace-viewer/trace-viewer.d.ts +2 -1
  99. package/dist/components/trace-viewer/trace-viewer.d.ts.map +1 -1
  100. package/dist/components/trace-viewer/trace-viewer.js +3 -12
  101. package/dist/components/trace-viewer/types.js +1 -1
  102. package/dist/components/trace-viewer/util/timing.js +1 -1
  103. package/dist/components/trace-viewer/utils.d.ts.map +1 -1
  104. package/dist/components/trace-viewer/utils.js +12 -3
  105. package/dist/components/trace-viewer.d.ts +3 -2
  106. package/dist/components/trace-viewer.d.ts.map +1 -1
  107. package/dist/components/trace-viewer.js +3 -3
  108. package/dist/components/ui/alert.js +1 -1
  109. package/dist/components/ui/button.js +1 -1
  110. package/dist/components/ui/card.js +1 -1
  111. package/dist/components/ui/collapsible.d.ts +6 -4
  112. package/dist/components/ui/collapsible.d.ts.map +1 -1
  113. package/dist/components/ui/collapsible.js +3 -3
  114. package/dist/components/ui/context-card.js +1 -1
  115. package/dist/components/ui/data-inspector.js +1 -1
  116. package/dist/components/ui/data-inspector.styles.js +1 -1
  117. package/dist/components/ui/decrypt-button.d.ts +1 -1
  118. package/dist/components/ui/decrypt-button.d.ts.map +1 -1
  119. package/dist/components/ui/decrypt-button.js +2 -2
  120. package/dist/components/ui/duplicate-event-tooltip.js +1 -1
  121. package/dist/components/ui/error-card.d.ts +1 -1
  122. package/dist/components/ui/error-card.d.ts.map +1 -1
  123. package/dist/components/ui/error-card.js +2 -2
  124. package/dist/components/ui/error-stack-block.d.ts +1 -1
  125. package/dist/components/ui/error-stack-block.d.ts.map +1 -1
  126. package/dist/components/ui/error-stack-block.js +1 -1
  127. package/dist/components/ui/icon-button.d.ts +2 -2
  128. package/dist/components/ui/icon-button.js +1 -1
  129. package/dist/components/ui/kbd.d.ts +1 -1
  130. package/dist/components/ui/kbd.js +1 -1
  131. package/dist/components/ui/load-more-button.d.ts +1 -1
  132. package/dist/components/ui/load-more-button.d.ts.map +1 -1
  133. package/dist/components/ui/load-more-button.js +1 -1
  134. package/dist/components/ui/menu-dropdown.d.ts +1 -1
  135. package/dist/components/ui/menu-dropdown.d.ts.map +1 -1
  136. package/dist/components/ui/menu-dropdown.js +1 -1
  137. package/dist/components/ui/skeleton.d.ts +1 -1
  138. package/dist/components/ui/skeleton.d.ts.map +1 -1
  139. package/dist/components/ui/skeleton.js +1 -1
  140. package/dist/components/ui/spinner.d.ts +1 -1
  141. package/dist/components/ui/spinner.d.ts.map +1 -1
  142. package/dist/components/ui/spinner.js +1 -1
  143. package/dist/components/ui/timestamp-tooltip.js +1 -1
  144. package/dist/components/ui/tooltip.js +1 -1
  145. package/dist/components/workflow-traces/event-colors.js +1 -1
  146. package/dist/components/workflow-traces/trace-span-construction.d.ts +8 -2
  147. package/dist/components/workflow-traces/trace-span-construction.d.ts.map +1 -1
  148. package/dist/components/workflow-traces/trace-span-construction.js +29 -11
  149. package/dist/components/workflow-traces/trace-time-utils.js +1 -1
  150. package/dist/hooks/use-dark-mode.js +1 -1
  151. package/dist/hooks/use-intersection-observer.js +1 -1
  152. package/dist/hooks/use-load-more-on-scroll.js +1 -1
  153. package/dist/hooks/use-reduced-motion.js +1 -1
  154. package/dist/index.d.ts +2 -0
  155. package/dist/index.d.ts.map +1 -1
  156. package/dist/index.js +3 -1
  157. package/dist/lib/cn.js +1 -1
  158. package/dist/lib/duplicate-events.js +1 -1
  159. package/dist/lib/event-analysis.d.ts.map +1 -1
  160. package/dist/lib/event-analysis.js +10 -2
  161. package/dist/lib/event-list-model.d.ts +179 -0
  162. package/dist/lib/event-list-model.d.ts.map +1 -0
  163. package/dist/lib/event-list-model.js +459 -0
  164. package/dist/lib/event-materialization.d.ts +4 -0
  165. package/dist/lib/event-materialization.d.ts.map +1 -1
  166. package/dist/lib/event-materialization.js +25 -7
  167. package/dist/lib/exact-event-search-id.js +1 -1
  168. package/dist/lib/hydration.d.ts +5 -3
  169. package/dist/lib/hydration.d.ts.map +1 -1
  170. package/dist/lib/hydration.js +10 -6
  171. package/dist/lib/run-limit-guidance.js +1 -1
  172. package/dist/lib/sealed-events.js +1 -1
  173. package/dist/lib/start-hook.d.ts +30 -0
  174. package/dist/lib/start-hook.d.ts.map +1 -0
  175. package/dist/lib/start-hook.js +50 -0
  176. package/dist/lib/state-hydration.d.ts +37 -0
  177. package/dist/lib/state-hydration.d.ts.map +1 -0
  178. package/dist/lib/state-hydration.js +148 -0
  179. package/dist/lib/stream-display.js +1 -1
  180. package/dist/lib/stream-image.d.ts +3 -0
  181. package/dist/lib/stream-image.d.ts.map +1 -0
  182. package/dist/lib/stream-image.js +23 -0
  183. package/dist/lib/toast.js +1 -1
  184. package/dist/lib/trace-builder.d.ts +1 -0
  185. package/dist/lib/trace-builder.d.ts.map +1 -1
  186. package/dist/lib/trace-builder.js +16 -5
  187. package/dist/lib/trace-types.js +1 -1
  188. package/dist/lib/utils.js +1 -1
  189. package/dist/lib/zstd-browser-decoder.js +1 -1
  190. package/package.json +22 -19
  191. package/src/components/event-list/event-details-panel.tsx +407 -0
  192. package/src/components/event-list/event-list-toolbar.tsx +47 -0
  193. package/src/components/event-list/event-row.tsx +348 -0
  194. package/src/components/event-list/use-event-search.ts +104 -0
  195. package/src/components/event-list-view.tsx +258 -1848
  196. package/src/components/stream-image-preview.tsx +54 -0
  197. package/src/components/stream-viewer.tsx +16 -6
  198. package/src/components/trace-viewer/components/detail-panel-shell.tsx +143 -0
  199. package/src/components/trace-viewer/components/detail-panel.tsx +37 -176
  200. package/src/components/trace-viewer/components/event-list.tsx +35 -14
  201. package/src/components/trace-viewer/components/use-alt-held.ts +1 -1
  202. package/src/components/trace-viewer/components/use-detail-panel-width.ts +53 -0
  203. package/src/components/trace-viewer/context.tsx +5 -1
  204. package/src/components/trace-viewer/trace-viewer.tsx +6 -11
  205. package/src/components/trace-viewer/utils.ts +14 -2
  206. package/src/components/trace-viewer.tsx +3 -0
  207. package/src/components/ui/collapsible.tsx +11 -0
  208. package/src/components/ui/decrypt-button.tsx +1 -1
  209. package/src/components/ui/error-card.tsx +1 -1
  210. package/src/components/workflow-traces/trace-span-construction.ts +34 -11
  211. package/src/index.ts +7 -0
  212. package/src/lib/event-analysis.ts +9 -0
  213. package/src/lib/event-list-model.ts +684 -0
  214. package/src/lib/event-materialization.ts +26 -7
  215. package/src/lib/hydration.ts +11 -5
  216. package/src/lib/start-hook.ts +82 -0
  217. package/src/lib/state-hydration.ts +208 -0
  218. package/src/lib/stream-image.ts +21 -0
  219. package/src/lib/trace-builder.ts +22 -2
  220. package/src/components/event-list-view.test.ts +0 -51
  221. package/src/components/trace-viewer/components/detail-panel-width.test.ts +0 -123
  222. package/src/components/trace-viewer/utils.test.ts +0 -468
  223. package/src/components/workflow-traces/event-colors.test.ts +0 -14
  224. package/src/components/workflow-traces/trace-span-construction.test.ts +0 -172
  225. package/src/lib/duplicate-events.test.ts +0 -336
  226. package/src/lib/event-materialization.test.ts +0 -136
  227. package/src/lib/hydration.test.ts +0 -63
  228. package/src/lib/run-limit-guidance.test.ts +0 -90
  229. package/src/lib/trace-builder.test.ts +0 -143
  230. package/src/lib/utils.test.ts +0 -33
@@ -1,821 +1,39 @@
1
1
  'use client';
2
2
 
3
- import { parseStepName, parseWorkflowName } from '@workflow/utils/parse-name';
4
- import {
5
- type Event,
6
- getEventDataRefFields,
7
- type WorkflowRun,
8
- } from '@workflow/world';
9
- import { Check, ChevronRight, Copy } from 'lucide-react';
10
- import type {
11
- KeyboardEvent as ReactKeyboardEvent,
12
- MouseEvent as ReactMouseEvent,
13
- ReactNode,
14
- } from 'react';
15
- import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
+ import type { Event, WorkflowRun } from '@workflow/world';
4
+ import type { KeyboardEvent as ReactKeyboardEvent } from 'react';
5
+ import { useCallback, useMemo, useRef, useState } from 'react';
16
6
  import { Virtuoso, type VirtuosoHandle } from 'react-virtuoso';
7
+ import { findDuplicateEventIds } from '../lib/duplicate-events';
17
8
  import {
18
- DUPLICATE_EVENT_MESSAGE,
19
- findDuplicateEventIds,
20
- } from '../lib/duplicate-events';
9
+ buildEventLookups,
10
+ buildEventRow,
11
+ buildListItems,
12
+ getEmptyMessage,
13
+ getEventEntity,
14
+ getFooterLabel,
15
+ getListSource,
16
+ mergeEventsById,
17
+ sortEventsByTime,
18
+ } from '../lib/event-list-model';
19
+ import { EventDetailsPanel } from './event-list/event-details-panel';
20
+ import { EventListToolbar } from './event-list/event-list-toolbar';
21
21
  import {
22
- type ExactIdSearchResult,
23
- type ExactWorkflowSearchIdKind,
24
- looksLikeWorkflowIdSearchInput,
25
- parseExactWorkflowSearchId,
26
- } from '../lib/exact-event-search-id';
27
- import { isEncryptedMarker } from '../lib/hydration';
28
- import { isSealedNoopEvent, SEALED_EVENT_MESSAGE } from '../lib/sealed-events';
29
- import { useToast } from '../lib/toast';
30
- import { formatDuration } from '../lib/utils';
31
- import { AttrSetEventBlock } from './sidebar/attributes-block';
32
- import { ContextCardProvider } from './ui/context-card';
33
- import { DataInspector, DecryptClickContext } from './ui/data-inspector';
34
- import { DecryptButton } from './ui/decrypt-button';
35
- import { EventNoticeTooltip } from './ui/duplicate-event-tooltip';
22
+ EventListHeader,
23
+ EventRow,
24
+ EventRowsSkeleton,
25
+ type EventSortOrder,
26
+ IdleGapRow,
27
+ } from './event-list/event-row';
36
28
  import {
37
- ErrorStackBlock,
38
- isStructuredError,
39
- type StructuredErrorRecord,
40
- } from './ui/error-stack-block';
29
+ type ExactSearchHandler,
30
+ useEventSearch,
31
+ } from './event-list/use-event-search';
32
+ import { useDetailPanelWidth } from './trace-viewer/components/use-detail-panel-width';
33
+ import { ContextCardProvider } from './ui/context-card';
34
+ import { DecryptClickContext } from './ui/data-inspector';
41
35
  import { LoadMoreButton } from './ui/load-more-button';
42
- import { MenuDropdown } from './ui/menu-dropdown';
43
- import { Skeleton } from './ui/skeleton';
44
- import { TimestampTooltip } from './ui/timestamp-tooltip';
45
-
46
- /**
47
- * Event types whose eventData contains an error field with a StructuredError.
48
- */
49
- const ERROR_EVENT_TYPES = new Set([
50
- 'step_failed',
51
- 'step_retrying',
52
- 'run_failed',
53
- 'workflow_failed',
54
- ]);
55
-
56
- const BUTTON_RESET_STYLE: React.CSSProperties = {
57
- appearance: 'none',
58
- WebkitAppearance: 'none',
59
- border: 'none',
60
- background: 'transparent',
61
- };
62
- const DOT_PULSE_ANIMATION =
63
- 'workflow-dot-pulse 1.25s cubic-bezier(0, 0, 0.2, 1) infinite';
64
-
65
- // ──────────────────────────────────────────────────────────────────────────
66
- // Helpers
67
- // ──────────────────────────────────────────────────────────────────────────
68
-
69
- function formatEventTime(date: Date): string {
70
- return (
71
- date.toLocaleTimeString('en-US', {
72
- hour: '2-digit',
73
- minute: '2-digit',
74
- second: '2-digit',
75
- hour12: false,
76
- }) +
77
- '.' +
78
- date.getMilliseconds().toString().padStart(3, '0')
79
- );
80
- }
81
-
82
- function parseEventDate(value: unknown): Date | null {
83
- if (value == null) return null;
84
-
85
- const date = value instanceof Date ? value : new Date(String(value));
86
- return Number.isNaN(date.getTime()) ? null : date;
87
- }
88
-
89
- function getEffectiveEventDate(
90
- event: Pick<Event, 'createdAt' | 'occurredAt'>
91
- ): Date {
92
- return parseEventDate(event.occurredAt) ?? new Date(event.createdAt);
93
- }
94
-
95
- function getEffectiveEventTime(
96
- event: Pick<Event, 'createdAt' | 'occurredAt'>
97
- ): number {
98
- return getEffectiveEventDate(event).getTime();
99
- }
100
-
101
- function formatEventType(eventType: Event['eventType']): string {
102
- return eventType
103
- .split('_')
104
- .map((word: string) => word.charAt(0).toUpperCase() + word.slice(1))
105
- .join(' ');
106
- }
107
-
108
- // ──────────────────────────────────────────────────────────────────────────
109
- // Event type → status color (small dot only)
110
- // ──────────────────────────────────────────────────────────────────────────
111
-
112
- /** Returns the Workflow Observability status color for the event's state. */
113
- function getStatusDotColor(eventType: string): string {
114
- // Failed → error red
115
- if (
116
- eventType === 'step_failed' ||
117
- eventType === 'run_failed' ||
118
- eventType === 'workflow_failed'
119
- ) {
120
- return 'var(--geist-error, var(--ds-red-700))';
121
- }
122
- // Cancelled → gray
123
- if (eventType === 'run_cancelled') {
124
- return 'var(--ds-gray-500)';
125
- }
126
- // Retrying → warning amber
127
- if (eventType === 'step_retrying') {
128
- return 'var(--geist-warning, var(--ds-amber-700))';
129
- }
130
- // Attribute changes → teal
131
- if (eventType === 'attr_set') {
132
- return 'var(--ds-teal-900)';
133
- }
134
- // Completed/succeeded → cyan
135
- if (
136
- eventType === 'step_completed' ||
137
- eventType === 'run_completed' ||
138
- eventType === 'workflow_completed' ||
139
- eventType === 'hook_disposed' ||
140
- eventType === 'wait_completed'
141
- ) {
142
- return 'var(--geist-cyan, var(--ds-teal-700))';
143
- }
144
- // Started/running → warning amber
145
- if (
146
- eventType === 'step_started' ||
147
- eventType === 'run_started' ||
148
- eventType === 'workflow_started' ||
149
- eventType === 'hook_received'
150
- ) {
151
- return 'var(--geist-warning, var(--ds-amber-700))';
152
- }
153
- // Sealed positions → gray: the row is log filler the run never observed.
154
- if (eventType === 'noop') {
155
- return 'var(--ds-gray-500)';
156
- }
157
- // Created/pending → gray
158
- return 'var(--ds-gray-500)';
159
- }
160
-
161
- /**
162
- * Build a map from correlationId (stepId) → display name using step_created
163
- * events, and parse the workflow name from the run.
164
- */
165
- export function buildNameMaps(
166
- events: Event[] | null,
167
- run: WorkflowRun | null
168
- ): {
169
- correlationNameMap: Map<string, string>;
170
- workflowName: string | null;
171
- } {
172
- const correlationNameMap = new Map<string, string>();
173
-
174
- // Map step correlationId (= stepId) → parsed step name. Taken from
175
- // step_created, or from step_started for a step whose creation the World
176
- // recorded on its start alone (no step_created in the log).
177
- if (events) {
178
- for (const event of events) {
179
- if (
180
- (event.eventType === 'step_created' ||
181
- event.eventType === 'step_started') &&
182
- event.correlationId
183
- ) {
184
- const stepName = event.eventData?.stepName;
185
- if (typeof stepName !== 'string') continue;
186
- if (
187
- event.eventType === 'step_started' &&
188
- correlationNameMap.has(event.correlationId)
189
- ) {
190
- continue;
191
- }
192
- const parsed =
193
- parseStepName(String(stepName)) ??
194
- parseWorkflowName(String(stepName));
195
- correlationNameMap.set(
196
- event.correlationId,
197
- parsed?.shortName ?? stepName
198
- );
199
- }
200
- }
201
- }
202
-
203
- // Parse workflow name from run
204
- const workflowName = run?.workflowName
205
- ? (parseWorkflowName(run.workflowName)?.shortName ?? run.workflowName)
206
- : null;
207
-
208
- return { correlationNameMap, workflowName };
209
- }
210
-
211
- export interface DurationInfo {
212
- /** Time from created → started (ms) */
213
- queued?: number;
214
- /** Time from started → completed/failed/cancelled (ms) */
215
- ran?: number;
216
- }
217
-
218
- /**
219
- * Build a map from correlationId → duration info by diffing
220
- * created ↔ started (queued) and started ↔ completed/failed/cancelled (ran).
221
- * Also computes run-level durations under the key '__run__'.
222
- *
223
- * Events every replay reads past as repeats are excluded: a second
224
- * `step_completed` written by a concurrent replay would otherwise stretch the
225
- * step's measured runtime to whenever that replay happened to commit. The
226
- * caller supplies them, because whether an event is a repeat is a property of
227
- * the whole log and this function may be handed a page of it.
228
- */
229
- export function buildDurationMap(
230
- events: Event[],
231
- duplicateEventIds: ReadonlySet<string> = new Set()
232
- ): Map<string, DurationInfo> {
233
- // Process events in chronological order so the result doesn't depend on
234
- // the caller's sort direction. Retried steps emit multiple `step_started`
235
- // events for the same correlationId; the queued duration must be measured
236
- // against the first one, not the last.
237
- const chronological = [...events]
238
- .filter((event) => !duplicateEventIds.has(event.eventId))
239
- .sort((a, b) => getEffectiveEventTime(a) - getEffectiveEventTime(b));
240
-
241
- const createdTimes = new Map<string, number>();
242
- const firstStartedTimes = new Map<string, number>();
243
- const startedTimes = new Map<string, number>();
244
- const durations = new Map<string, DurationInfo>();
245
-
246
- for (const event of chronological) {
247
- const ts = getEffectiveEventTime(event);
248
- const key = event.correlationId ?? '__run__';
249
- const type: string = event.eventType;
250
-
251
- // Track created times (first event for each correlation)
252
- if (type === 'step_created' || type === 'run_created') {
253
- if (!createdTimes.has(key)) {
254
- createdTimes.set(key, ts);
255
- }
256
- }
257
-
258
- // Track started times & compute queued duration
259
- if (
260
- type === 'step_started' ||
261
- type === 'run_started' ||
262
- type === 'workflow_started'
263
- ) {
264
- startedTimes.set(key, ts);
265
- // The queued duration is anchored on the first start event only, since
266
- // subsequent step_started events come from retries.
267
- if (!firstStartedTimes.has(key)) {
268
- firstStartedTimes.set(key, ts);
269
- // If no explicit created event was seen, use the started time as created
270
- if (!createdTimes.has(key)) {
271
- createdTimes.set(key, ts);
272
- }
273
- const createdAt = createdTimes.get(key);
274
- const info = durations.get(key) ?? {};
275
- if (createdAt !== undefined) {
276
- info.queued = ts - createdAt;
277
- }
278
- durations.set(key, info);
279
- }
280
- }
281
-
282
- // Compute ran duration on terminal events
283
- if (
284
- type === 'step_completed' ||
285
- type === 'step_failed' ||
286
- type === 'run_completed' ||
287
- type === 'run_failed' ||
288
- type === 'run_cancelled' ||
289
- type === 'workflow_completed' ||
290
- type === 'workflow_failed' ||
291
- type === 'wait_completed' ||
292
- type === 'hook_disposed'
293
- ) {
294
- const startedAt = startedTimes.get(key);
295
- const info = durations.get(key) ?? {};
296
- if (startedAt !== undefined) {
297
- info.ran = ts - startedAt;
298
- }
299
- durations.set(key, info);
300
- }
301
- }
302
-
303
- return durations;
304
- }
305
-
306
- /** Check if a loaded eventData object contains any encrypted marker values. */
307
- function hasEncryptedValues(data: unknown): boolean {
308
- if (!data || typeof data !== 'object') return false;
309
- for (const val of Object.values(data as Record<string, unknown>)) {
310
- if (isEncryptedMarker(val)) return true;
311
- }
312
- return false;
313
- }
314
-
315
- function isRunLevel(eventType: string): boolean {
316
- return (
317
- eventType === 'run_created' ||
318
- eventType === 'run_started' ||
319
- eventType === 'run_completed' ||
320
- eventType === 'run_failed' ||
321
- eventType === 'run_cancelled' ||
322
- eventType === 'workflow_started' ||
323
- eventType === 'workflow_completed' ||
324
- eventType === 'workflow_failed' ||
325
- // attr_set and noop carry a dedup/positional correlationId rather than a
326
- // child entity ID, so they group and label with the run itself.
327
- eventType === 'attr_set' ||
328
- eventType === 'noop'
329
- );
330
- }
331
-
332
- // ──────────────────────────────────────────────────────────────────────────
333
- // Tree gutter: fixed-width, shows branch lines only for the selected group
334
- // ──────────────────────────────────────────────────────────────────────────
335
-
336
- /** Fixed gutter width: 20px root area + 16px for one branch lane */
337
- const GUTTER_WIDTH = 36;
338
- /** X position of the single branch lane line */
339
- const LANE_X = 20;
340
- const ROOT_LINE_COLOR = 'var(--ds-gray-500)';
341
-
342
- function TreeGutter({
343
- isFirst,
344
- isLast,
345
- isRunLevel: isRun,
346
- statusDotColor,
347
- pulse = false,
348
- hasSelection,
349
- showBranch,
350
- showLaneLine,
351
- isLaneStart,
352
- isLaneEnd,
353
- continuationOnly = false,
354
- }: {
355
- isFirst: boolean;
356
- isLast: boolean;
357
- isRunLevel: boolean;
358
- statusDotColor?: string;
359
- pulse?: boolean;
360
- /** Whether any group is currently active (selected or hovered) */
361
- hasSelection: boolean;
362
- /** Whether to show a horizontal branch line for this row (event belongs to active group) */
363
- showBranch: boolean;
364
- /** Whether the vertical lane line passes through this row */
365
- showLaneLine: boolean;
366
- /** Whether the vertical lane line starts at this row (top clipped to 50%) */
367
- isLaneStart: boolean;
368
- /** Whether the vertical lane line ends at this row (bottom clipped to 50%) */
369
- isLaneEnd: boolean;
370
- continuationOnly?: boolean;
371
- }) {
372
- const dotSize = isRun ? 8 : 6;
373
- const dotLeft = isRun ? 5 : 6;
374
- const dotOpacity = hasSelection && !showBranch && !isRun ? 0.3 : 1;
375
-
376
- return (
377
- <div
378
- className="relative flex-shrink-0 self-stretch"
379
- style={{
380
- width: GUTTER_WIDTH,
381
- minHeight: continuationOnly ? 0 : undefined,
382
- }}
383
- >
384
- {/* Root vertical line (leftmost, always visible) */}
385
- <div
386
- style={{
387
- position: 'absolute',
388
- left: 8,
389
- top: continuationOnly ? 0 : isFirst ? '50%' : 0,
390
- bottom: continuationOnly ? 0 : isLast ? '50%' : 0,
391
- width: 2,
392
- backgroundColor: ROOT_LINE_COLOR,
393
- zIndex: 0,
394
- }}
395
- />
396
-
397
- {!continuationOnly && (
398
- <>
399
- {/* Status dot on the root line for every event */}
400
- <div
401
- style={{
402
- position: 'absolute',
403
- left: dotLeft,
404
- top: '50%',
405
- transform: 'translateY(-50%)',
406
- width: dotSize,
407
- height: dotSize,
408
- zIndex: 2,
409
- }}
410
- >
411
- {/* Opaque backdrop ensures gutter lines never visually cut through dots */}
412
- <div
413
- style={{
414
- position: 'absolute',
415
- inset: 0,
416
- borderRadius: '50%',
417
- backgroundColor: 'var(--ds-background-100)',
418
- zIndex: 0,
419
- }}
420
- />
421
- {pulse && (
422
- <div
423
- style={{
424
- position: 'absolute',
425
- inset: 0,
426
- borderRadius: '50%',
427
- backgroundColor: statusDotColor,
428
- opacity: 0.75 * dotOpacity,
429
- animation: DOT_PULSE_ANIMATION,
430
- zIndex: 1,
431
- }}
432
- />
433
- )}
434
- <div
435
- style={{
436
- position: 'relative',
437
- width: '100%',
438
- height: '100%',
439
- borderRadius: '50%',
440
- backgroundColor: statusDotColor,
441
- opacity: dotOpacity,
442
- transition: 'opacity 150ms',
443
- zIndex: 2,
444
- }}
445
- />
446
- </div>
447
-
448
- {/* Horizontal branch from root to gutter edge (selected group events only) */}
449
- {showBranch && (
450
- <div
451
- style={{
452
- position: 'absolute',
453
- left: 9,
454
- top: '50%',
455
- width: GUTTER_WIDTH - 9,
456
- height: 2,
457
- backgroundColor: ROOT_LINE_COLOR,
458
- zIndex: 0,
459
- }}
460
- />
461
- )}
462
- </>
463
- )}
464
-
465
- {/* Vertical lane line connecting the selected group's events */}
466
- {showLaneLine && (
467
- <div
468
- style={{
469
- position: 'absolute',
470
- left: LANE_X,
471
- top: continuationOnly ? 0 : isLaneStart ? '50%' : 0,
472
- bottom: continuationOnly ? 0 : isLaneEnd ? '50%' : 0,
473
- width: 2,
474
- backgroundColor: ROOT_LINE_COLOR,
475
- zIndex: 0,
476
- }}
477
- />
478
- )}
479
- </div>
480
- );
481
- }
482
-
483
- // ──────────────────────────────────────────────────────────────────────────
484
- // Copyable cell: shows a copy button on hover
485
- // ──────────────────────────────────────────────────────────────────────────
486
-
487
- function CopyableCell({
488
- value,
489
- className,
490
- style: styleProp,
491
- }: {
492
- value: string;
493
- className?: string;
494
- style?: React.CSSProperties;
495
- }): ReactNode {
496
- const [copied, setCopied] = useState(false);
497
- const resetCopiedTimeoutRef = useRef<number | null>(null);
498
-
499
- useEffect(() => {
500
- return () => {
501
- if (resetCopiedTimeoutRef.current !== null) {
502
- window.clearTimeout(resetCopiedTimeoutRef.current);
503
- }
504
- };
505
- }, []);
506
-
507
- const handleCopy = useCallback(
508
- (e: ReactMouseEvent) => {
509
- e.stopPropagation();
510
- navigator.clipboard.writeText(value).then(() => {
511
- setCopied(true);
512
- if (resetCopiedTimeoutRef.current !== null) {
513
- window.clearTimeout(resetCopiedTimeoutRef.current);
514
- }
515
- resetCopiedTimeoutRef.current = window.setTimeout(() => {
516
- setCopied(false);
517
- resetCopiedTimeoutRef.current = null;
518
- }, 1500);
519
- });
520
- },
521
- [value]
522
- );
523
-
524
- return (
525
- <div
526
- className={`group/copy flex items-center gap-1 min-w-0 px-4 ${className ?? ''}`}
527
- style={styleProp}
528
- >
529
- <span className="overflow-hidden text-ellipsis whitespace-nowrap">
530
- {value || '-'}
531
- </span>
532
- {value ? (
533
- <button
534
- type="button"
535
- onClick={handleCopy}
536
- className="flex-shrink-0 opacity-0 group-hover/copy:opacity-100 transition-opacity p-0.5 rounded hover:bg-[var(--ds-gray-alpha-200)]"
537
- style={BUTTON_RESET_STYLE}
538
- aria-label={`Copy ${value}`}
539
- >
540
- {copied ? (
541
- <Check
542
- className="h-3 w-3"
543
- style={{ color: 'var(--ds-green-700)' }}
544
- />
545
- ) : (
546
- <Copy className="h-3 w-3" style={{ color: 'var(--ds-gray-700)' }} />
547
- )}
548
- </button>
549
- ) : null}
550
- </div>
551
- );
552
- }
553
-
554
- /** Recursively parse stringified JSON values so escaped slashes / quotes are cleaned up */
555
- function deepParseJson(value: unknown): unknown {
556
- if (typeof value === 'string') {
557
- const trimmed = value.trim();
558
- if (
559
- (trimmed.startsWith('{') && trimmed.endsWith('}')) ||
560
- (trimmed.startsWith('[') && trimmed.endsWith(']')) ||
561
- (trimmed.startsWith('"') && trimmed.endsWith('"'))
562
- ) {
563
- try {
564
- return deepParseJson(JSON.parse(trimmed));
565
- } catch {
566
- return value;
567
- }
568
- }
569
- return value;
570
- }
571
- if (Array.isArray(value)) {
572
- return value.map(deepParseJson);
573
- }
574
- if (value !== null && typeof value === 'object') {
575
- // Preserve objects with custom constructors (e.g., encrypted markers,
576
- // class instance refs); don't destructure them into plain objects
577
- if (value.constructor !== Object) {
578
- return value;
579
- }
580
- const result: Record<string, unknown> = {};
581
- for (const [k, v] of Object.entries(value)) {
582
- result[k] = deepParseJson(v);
583
- }
584
- return result;
585
- }
586
- return value;
587
- }
588
-
589
- /**
590
- * Extracts a structured error from event data, if present.
591
- * Returns the error object to render with ErrorStackBlock, or null if not applicable.
592
- */
593
- function extractStructuredError(
594
- data: unknown,
595
- eventType?: string
596
- ): StructuredErrorRecord | null {
597
- if (!eventType || !ERROR_EVENT_TYPES.has(eventType)) return null;
598
- if (data == null || typeof data !== 'object') return null;
599
- const record = data as Record<string, unknown>;
600
- // Check the nested `error` field first (the StructuredError)
601
- if (isStructuredError(record.error)) return record.error;
602
- // Some error formats put the message/stack at the top level of eventData.
603
- if (isStructuredError(record)) return record;
604
- return null;
605
- }
606
-
607
- function PayloadBlock({
608
- data,
609
- eventType,
610
- }: {
611
- data: unknown;
612
- eventType?: string;
613
- }): ReactNode {
614
- const structuredError = useMemo(
615
- () => extractStructuredError(data, eventType),
616
- [data, eventType]
617
- );
618
-
619
- const [copied, setCopied] = useState(false);
620
- const resetCopiedTimeoutRef = useRef<number | null>(null);
621
- const cleaned = useMemo(() => deepParseJson(data), [data]);
622
-
623
- useEffect(() => {
624
- return () => {
625
- if (resetCopiedTimeoutRef.current !== null) {
626
- window.clearTimeout(resetCopiedTimeoutRef.current);
627
- }
628
- };
629
- }, []);
630
-
631
- const formatted = useMemo(() => {
632
- try {
633
- return JSON.stringify(cleaned, null, 2);
634
- } catch {
635
- return String(cleaned);
636
- }
637
- }, [cleaned]);
638
-
639
- const handleCopy = useCallback(
640
- (e: ReactMouseEvent) => {
641
- e.stopPropagation();
642
- navigator.clipboard.writeText(formatted).then(() => {
643
- setCopied(true);
644
- if (resetCopiedTimeoutRef.current !== null) {
645
- window.clearTimeout(resetCopiedTimeoutRef.current);
646
- }
647
- resetCopiedTimeoutRef.current = window.setTimeout(() => {
648
- setCopied(false);
649
- resetCopiedTimeoutRef.current = null;
650
- }, 1500);
651
- });
652
- },
653
- [formatted]
654
- );
655
-
656
- if (structuredError) {
657
- return (
658
- <div className="p-2">
659
- <ErrorStackBlock value={structuredError} />
660
- </div>
661
- );
662
- }
663
-
664
- // Attribute changes: render the changed keys and the writer instead of
665
- // the raw JSON payload.
666
- if (eventType === 'attr_set') {
667
- return <AttrSetEventBlock data={cleaned} />;
668
- }
669
-
670
- // Cancellation reason: render the free-text reason as a readable line
671
- // instead of a raw JSON payload (the only field run_cancelled carries).
672
- if (eventType === 'run_cancelled') {
673
- const cancelReason =
674
- cleaned != null &&
675
- typeof cleaned === 'object' &&
676
- typeof (cleaned as Record<string, unknown>).cancelReason === 'string'
677
- ? ((cleaned as Record<string, unknown>).cancelReason as string)
678
- : null;
679
- if (cancelReason) {
680
- return (
681
- <div
682
- className="p-2 text-label-12"
683
- style={{ color: 'var(--ds-gray-1000)' }}
684
- >
685
- <span style={{ color: 'var(--ds-gray-900)' }}>Reason: </span>
686
- <span className="whitespace-pre-wrap break-words">
687
- {cancelReason}
688
- </span>
689
- </div>
690
- );
691
- }
692
- }
693
-
694
- return (
695
- <div className="relative group/payload">
696
- <div
697
- className="overflow-x-auto p-2 text-[11px]"
698
- style={{ color: 'var(--ds-gray-1000)' }}
699
- >
700
- <DataInspector data={cleaned} expandLevel={2} />
701
- </div>
702
- <button
703
- type="button"
704
- onClick={handleCopy}
705
- className="absolute bottom-2 right-2 opacity-0 group-hover/payload:opacity-100 transition-opacity flex items-center gap-1 px-2 py-1 rounded-md text-button-12 hover:bg-[var(--ds-gray-alpha-200)]"
706
- style={{ ...BUTTON_RESET_STYLE, color: 'var(--ds-gray-700)' }}
707
- aria-label="Copy payload"
708
- >
709
- {copied ? (
710
- <>
711
- <Check
712
- className="h-3 w-3"
713
- style={{ color: 'var(--ds-green-700)' }}
714
- />
715
- <span style={{ color: 'var(--ds-green-700)' }}>Copied</span>
716
- </>
717
- ) : (
718
- <>
719
- <Copy className="h-3 w-3" />
720
- <span>Copy</span>
721
- </>
722
- )}
723
- </button>
724
- </div>
725
- );
726
- }
727
-
728
- // ──────────────────────────────────────────────────────────────────────────
729
- // Sort options for the events list
730
- // ──────────────────────────────────────────────────────────────────────────
731
-
732
- const SORT_OPTIONS = [
733
- { value: 'desc' as const, label: 'Newest' },
734
- { value: 'asc' as const, label: 'Oldest' },
735
- ];
736
-
737
- function RowsSkeleton({
738
- showSeparateEventOccurrenceTimestamps = false,
739
- }: {
740
- showSeparateEventOccurrenceTimestamps?: boolean;
741
- }) {
742
- return (
743
- <div className="flex-1 overflow-hidden">
744
- {Array.from({ length: 16 }, (_, i) => (
745
- <div key={i} className="flex items-center gap-0" style={{ height: 40 }}>
746
- {/* Gutter area */}
747
- <div
748
- className="relative flex-shrink-0 self-stretch flex items-center"
749
- style={{ width: GUTTER_WIDTH }}
750
- >
751
- {/* Vertical line skeleton */}
752
- <div
753
- style={{
754
- position: 'absolute',
755
- left: 8,
756
- top: i === 0 ? '50%' : 0,
757
- bottom: 0,
758
- width: 2,
759
- }}
760
- >
761
- <Skeleton className="w-full h-full" style={{ borderRadius: 1 }} />
762
- </div>
763
- {/* Dot skeleton */}
764
- <Skeleton
765
- className="flex-shrink-0"
766
- style={{
767
- width: i % 4 === 0 ? 8 : 6,
768
- height: i % 4 === 0 ? 8 : 6,
769
- borderRadius: '50%',
770
- marginLeft: i % 4 === 0 ? 5 : 6,
771
- }}
772
- />
773
- </div>
774
- {/* Chevron placeholder */}
775
- <div className="w-5 flex-shrink-0 flex items-center justify-center">
776
- <Skeleton className="w-5 h-5" style={{ borderRadius: 4 }} />
777
- </div>
778
- {showSeparateEventOccurrenceTimestamps && (
779
- <div className="min-w-0 px-4" style={{ flex: '2 1 0%' }}>
780
- <Skeleton className="h-3" style={{ width: '70%' }} />
781
- </div>
782
- )}
783
- {/* Created */}
784
- <div className="min-w-0 px-4" style={{ flex: '2 1 0%' }}>
785
- <Skeleton className="h-3" style={{ width: '70%' }} />
786
- </div>
787
- {/* Event Type */}
788
- <div
789
- className="min-w-0 px-4 flex items-center gap-1.5"
790
- style={{ flex: '2 1 0%' }}
791
- >
792
- <Skeleton
793
- className="flex-shrink-0"
794
- style={{ width: 6, height: 6, borderRadius: '50%' }}
795
- />
796
- <Skeleton className="h-3" style={{ width: '60%' }} />
797
- </div>
798
- {/* Name */}
799
- <div className="min-w-0 px-4" style={{ flex: '2 1 0%' }}>
800
- <Skeleton className="h-3" style={{ width: '50%' }} />
801
- </div>
802
- {/* Correlation ID */}
803
- <div className="min-w-0 px-4" style={{ flex: '3 1 0%' }}>
804
- <Skeleton className="h-3" style={{ width: '75%' }} />
805
- </div>
806
- {/* Event ID */}
807
- <div className="min-w-0 px-4" style={{ flex: '3 1 0%' }}>
808
- <Skeleton className="h-3" style={{ width: '75%' }} />
809
- </div>
810
- </div>
811
- ))}
812
- </div>
813
- );
814
- }
815
-
816
- // ──────────────────────────────────────────────────────────────────────────
817
- // Event row
818
- // ──────────────────────────────────────────────────────────────────────────
36
+ import { TooltipProvider } from './ui/tooltip';
819
37
 
820
38
  interface EventsListProps {
821
39
  events: Event[] | null;
@@ -828,11 +46,10 @@ interface EventsListProps {
828
46
  encryptionKey?: Uint8Array;
829
47
  /** When true, shows a loading state instead of "No events found" for empty lists */
830
48
  isLoading?: boolean;
831
- /** Sort order for events. Defaults to 'asc'. */
832
- sortOrder?: 'asc' | 'desc';
833
- /** Called when the user changes sort order. When provided, the sort dropdown is shown
834
- * and the parent is expected to refetch from the API with the new order. */
835
- onSortOrderChange?: (order: 'asc' | 'desc') => void;
49
+ /** Sort order for events. Uncontrolled (starting at 'asc') when unset. */
50
+ sortOrder?: EventSortOrder;
51
+ /** Called when the Time header's sort is toggled. */
52
+ onSortOrderChange?: (order: EventSortOrder) => void;
836
53
  /** Called when the user clicks the Decrypt button. */
837
54
  onDecrypt?: () => void;
838
55
  /** Whether the encryption key is currently being fetched. */
@@ -841,493 +58,13 @@ interface EventsListProps {
841
58
  isDecryptDisabled?: boolean;
842
59
  /** Explains why decryption is unavailable. */
843
60
  decryptDisabledReason?: string;
844
- /** Run-level hint: the run contains encrypted data (from probe). */
845
- hasEncryptedData?: boolean;
846
61
  /** Fetch events for an exact correlation or event ID. */
847
- onExactIdSearch?: (
848
- id: string,
849
- kind: ExactWorkflowSearchIdKind,
850
- signal?: AbortSignal
851
- ) => Promise<ExactIdSearchResult>;
62
+ onExactIdSearch?: ExactSearchHandler;
852
63
  /** Show occurredAt separately instead of folding it into the Created timestamp. */
853
64
  showSeparateEventOccurrenceTimestamps?: boolean;
65
+ onViewInTrace?: (spanId: string) => void;
854
66
  }
855
67
 
856
- export function EventRow({
857
- event,
858
- index,
859
- isFirst,
860
- isLast,
861
- isExpanded,
862
- onToggleExpand,
863
- activeGroupKey,
864
- selectedGroupKey,
865
- selectedGroupRange,
866
- correlationNameMap,
867
- workflowName,
868
- durationMap,
869
- onSelectGroup,
870
- onHoverGroup,
871
- onLoadEventData,
872
- cachedEventData,
873
- onCacheEventData,
874
- encryptionKey,
875
- onEncryptedDataDetected,
876
- suppressGroupDimming = false,
877
- showSeparateEventOccurrenceTimestamps = false,
878
- isDuplicate = false,
879
- }: {
880
- event: Event;
881
- index: number;
882
- isFirst: boolean;
883
- isLast: boolean;
884
- isExpanded: boolean;
885
- onToggleExpand: (eventId: string) => void;
886
- activeGroupKey?: string;
887
- selectedGroupKey?: string;
888
- selectedGroupRange: { first: number; last: number } | null;
889
- correlationNameMap: Map<string, string>;
890
- workflowName: string | null;
891
- durationMap: Map<string, DurationInfo>;
892
- onSelectGroup: (groupKey: string | undefined) => void;
893
- onHoverGroup: (groupKey: string | undefined) => void;
894
- onLoadEventData?: (event: Event) => Promise<unknown | null>;
895
- cachedEventData: unknown | null;
896
- onCacheEventData: (eventId: string, data: unknown) => void;
897
- encryptionKey?: Uint8Array;
898
- onEncryptedDataDetected?: () => void;
899
- /** Exact-ID search results should not dim unrelated rows. */
900
- suppressGroupDimming?: boolean;
901
- /** Show occurredAt separately instead of folding it into the Created timestamp. */
902
- showSeparateEventOccurrenceTimestamps?: boolean;
903
- /** The event repeats a class already in the log, so the runtime ignored it. */
904
- isDuplicate?: boolean;
905
- }) {
906
- const [isLoading, setIsLoading] = useState(false);
907
- const [loadedEventData, setLoadedEventData] = useState<unknown | null>(
908
- cachedEventData
909
- );
910
- const [loadError, setLoadError] = useState<string | null>(null);
911
- const [hasAttemptedLoad, setHasAttemptedLoad] = useState(
912
- cachedEventData !== null
913
- );
914
-
915
- // Notify parent if cached data has encrypted markers on mount
916
- useEffect(() => {
917
- if (
918
- cachedEventData !== null &&
919
- !encryptionKey &&
920
- hasEncryptedValues(cachedEventData)
921
- ) {
922
- onEncryptedDataDetected?.();
923
- }
924
- // eslint-disable-next-line react-hooks/exhaustive-deps
925
- }, []);
926
-
927
- const rowGroupKey = isRunLevel(event.eventType)
928
- ? '__run__'
929
- : (event.correlationId ?? undefined);
930
-
931
- const isSealed = isSealedNoopEvent(event);
932
- const rowNotice = isDuplicate
933
- ? DUPLICATE_EVENT_MESSAGE
934
- : isSealed
935
- ? SEALED_EVENT_MESSAGE
936
- : undefined;
937
- const statusDotColor = getStatusDotColor(event.eventType);
938
- const createdAt = new Date(event.createdAt);
939
- const occurredAt = parseEventDate(event.occurredAt);
940
- const displayedCreatedAt = showSeparateEventOccurrenceTimestamps
941
- ? createdAt
942
- : getEffectiveEventDate(event);
943
- // List endpoints resolve events with `resolveData: 'none'`, which strips the
944
- // ref/payload fields (input, result, error, …) and leaves a partial stub
945
- // (stepName, timings, …). Rendering that stub while the full payload loads
946
- // flashes an incomplete JSON document whose missing fields pop in after a
947
- // skeleton, so only trust inline eventData when it can't be a stub: either
948
- // there is no loader to fetch the full payload, or the event type carries
949
- // no ref fields (its eventData is never stripped).
950
- const hasExistingEventData =
951
- 'eventData' in event &&
952
- event.eventData != null &&
953
- (!onLoadEventData || getEventDataRefFields(event.eventType).length === 0);
954
- const isRun = isRunLevel(event.eventType);
955
- const eventName = isRun
956
- ? (workflowName ?? '-')
957
- : event.correlationId
958
- ? (correlationNameMap.get(event.correlationId) ?? '-')
959
- : '-';
960
-
961
- const durationKey = event.correlationId ?? (isRun ? '__run__' : '');
962
- const durationInfo = durationKey ? durationMap.get(durationKey) : undefined;
963
-
964
- const hasActive = activeGroupKey !== undefined;
965
- const isRelated = rowGroupKey !== undefined && rowGroupKey === activeGroupKey;
966
- const isDimmed = hasActive && !isRelated && !suppressGroupDimming;
967
- const isPulsing = hasActive && isRelated;
968
-
969
- // Gutter state derived from selectedGroupRange
970
- const showBranch = hasActive && isRelated && !isRun;
971
- const showLaneLine =
972
- selectedGroupRange !== null &&
973
- index >= selectedGroupRange.first &&
974
- index <= selectedGroupRange.last;
975
- const isLaneStart =
976
- selectedGroupRange !== null && index === selectedGroupRange.first;
977
- const isLaneEnd =
978
- selectedGroupRange !== null && index === selectedGroupRange.last;
979
-
980
- const loadEventDetails = useCallback(async () => {
981
- if (loadedEventData !== null) {
982
- return;
983
- }
984
- if (cachedEventData !== null) {
985
- setLoadedEventData(cachedEventData);
986
- setHasAttemptedLoad(true);
987
- return;
988
- }
989
- // Inline eventData of a ref-less event type is already complete (ref
990
- // fields are the only ones ever stripped), so there is nothing to fetch.
991
- if (hasExistingEventData) {
992
- setHasAttemptedLoad(true);
993
- return;
994
- }
995
- if (isLoading) {
996
- return;
997
- }
998
- setIsLoading(true);
999
- setLoadError(null);
1000
- try {
1001
- if (!onLoadEventData) {
1002
- setLoadError('Event details unavailable');
1003
- return;
1004
- }
1005
- const data = await onLoadEventData(event);
1006
- if (data !== null && data !== undefined) {
1007
- setLoadedEventData(data);
1008
- onCacheEventData(event.eventId, data);
1009
- if (!encryptionKey && hasEncryptedValues(data)) {
1010
- onEncryptedDataDetected?.();
1011
- }
1012
- }
1013
- } catch (err) {
1014
- setLoadError(
1015
- err instanceof Error ? err.message : 'Failed to load event details'
1016
- );
1017
- } finally {
1018
- setIsLoading(false);
1019
- setHasAttemptedLoad(true);
1020
- }
1021
- }, [
1022
- event,
1023
- loadedEventData,
1024
- isLoading,
1025
- onLoadEventData,
1026
- onCacheEventData,
1027
- encryptionKey,
1028
- onEncryptedDataDetected,
1029
- cachedEventData,
1030
- hasExistingEventData,
1031
- ]);
1032
-
1033
- // Auto-load event data when remounting in expanded state without cached data
1034
- useEffect(() => {
1035
- if (!isExpanded || isLoading) {
1036
- return;
1037
- }
1038
- void loadEventDetails();
1039
- // eslint-disable-next-line react-hooks/exhaustive-deps
1040
- }, []);
1041
-
1042
- // When encryption key changes and this event was previously loaded,
1043
- // re-load to get decrypted data. Keep the encrypted value visible until the
1044
- // refreshed data arrives so the payload does not flash empty while decrypting.
1045
- useEffect(() => {
1046
- if (encryptionKey && hasAttemptedLoad && onLoadEventData) {
1047
- setHasAttemptedLoad(false);
1048
- onLoadEventData(event)
1049
- .then((data) => {
1050
- if (data !== null && data !== undefined) {
1051
- setLoadedEventData(data);
1052
- onCacheEventData(event.eventId, data);
1053
- }
1054
- setHasAttemptedLoad(true);
1055
- })
1056
- .catch(() => {
1057
- setHasAttemptedLoad(true);
1058
- });
1059
- }
1060
- // eslint-disable-next-line react-hooks/exhaustive-deps
1061
- }, [encryptionKey]);
1062
-
1063
- const handleRowClick = useCallback(() => {
1064
- onSelectGroup(rowGroupKey === selectedGroupKey ? undefined : rowGroupKey);
1065
- onToggleExpand(event.eventId);
1066
- if (!isExpanded) {
1067
- void loadEventDetails();
1068
- }
1069
- }, [
1070
- selectedGroupKey,
1071
- rowGroupKey,
1072
- onSelectGroup,
1073
- onToggleExpand,
1074
- event.eventId,
1075
- isExpanded,
1076
- loadEventDetails,
1077
- ]);
1078
-
1079
- const mergedEventData =
1080
- loadedEventData ??
1081
- (hasExistingEventData
1082
- ? (event as Event & { eventData: unknown }).eventData
1083
- : null);
1084
-
1085
- const displayPayload = isLoading ? loadedEventData : mergedEventData;
1086
-
1087
- const contentOpacity = isDimmed ? 0.3 : 1;
1088
-
1089
- return (
1090
- <div
1091
- data-event-id={event.eventId}
1092
- onMouseEnter={() => onHoverGroup(rowGroupKey)}
1093
- onMouseLeave={() => onHoverGroup(undefined)}
1094
- >
1095
- {/* Row */}
1096
- <div
1097
- role="button"
1098
- tabIndex={0}
1099
- onClick={handleRowClick}
1100
- onKeyDown={(e) => {
1101
- if (e.key === 'Enter' || e.key === ' ') handleRowClick();
1102
- }}
1103
- className="w-full text-left flex items-center gap-0 text-label-13 hover:bg-[var(--ds-gray-alpha-100)] transition-colors cursor-pointer"
1104
- style={{ minHeight: 40 }}
1105
- >
1106
- <TreeGutter
1107
- isFirst={isFirst}
1108
- isLast={isLast && !isExpanded}
1109
- isRunLevel={isRun}
1110
- statusDotColor={statusDotColor}
1111
- pulse={isPulsing}
1112
- hasSelection={hasActive}
1113
- showBranch={showBranch}
1114
- showLaneLine={showLaneLine}
1115
- isLaneStart={isLaneStart}
1116
- isLaneEnd={isLaneEnd}
1117
- />
1118
-
1119
- {/* Content area: dims when unrelated */}
1120
- <div
1121
- className="flex items-center flex-1 min-w-0"
1122
- style={{ opacity: contentOpacity, transition: 'opacity 150ms' }}
1123
- >
1124
- {/* Expand chevron indicator */}
1125
- <div
1126
- className="flex items-center justify-center w-5 h-5 flex-shrink-0 rounded"
1127
- style={{
1128
- border: '1px solid var(--ds-gray-400)',
1129
- }}
1130
- >
1131
- <ChevronRight
1132
- className="h-3 w-3 transition-transform"
1133
- style={{
1134
- color: 'var(--ds-gray-900)',
1135
- transform: isExpanded ? 'rotate(90deg)' : 'rotate(0deg)',
1136
- }}
1137
- />
1138
- </div>
1139
-
1140
- {showSeparateEventOccurrenceTimestamps && (
1141
- <div
1142
- className="tabular-nums min-w-0 px-4"
1143
- style={{ color: 'var(--ds-gray-900)', flex: '2 1 0%' }}
1144
- >
1145
- {occurredAt ? (
1146
- <TimestampTooltip date={occurredAt}>
1147
- <span>{formatEventTime(occurredAt)}</span>
1148
- </TimestampTooltip>
1149
- ) : (
1150
- '-'
1151
- )}
1152
- </div>
1153
- )}
1154
-
1155
- {/* Created */}
1156
- <div
1157
- className="tabular-nums min-w-0 px-4"
1158
- style={{ color: 'var(--ds-gray-900)', flex: '2 1 0%' }}
1159
- >
1160
- <TimestampTooltip date={displayedCreatedAt}>
1161
- <span>{formatEventTime(displayedCreatedAt)}</span>
1162
- </TimestampTooltip>
1163
- </div>
1164
-
1165
- {/* Event Type */}
1166
- <div className="font-medium min-w-0 px-4" style={{ flex: '2 1 0%' }}>
1167
- <EventNoticeTooltip notice={rowNotice}>
1168
- <span
1169
- className="inline-flex items-center gap-1.5"
1170
- style={{
1171
- color: rowNotice
1172
- ? 'var(--ds-gray-700)'
1173
- : 'var(--ds-gray-900)',
1174
- }}
1175
- >
1176
- <span
1177
- style={{
1178
- position: 'relative',
1179
- display: 'inline-flex',
1180
- width: 6,
1181
- height: 6,
1182
- flexShrink: 0,
1183
- }}
1184
- >
1185
- {isPulsing && (
1186
- <span
1187
- style={{
1188
- position: 'absolute',
1189
- inset: 0,
1190
- borderRadius: '50%',
1191
- backgroundColor: statusDotColor,
1192
- opacity: 0.75,
1193
- animation: DOT_PULSE_ANIMATION,
1194
- }}
1195
- />
1196
- )}
1197
- <span
1198
- style={{
1199
- position: 'relative',
1200
- width: 6,
1201
- height: 6,
1202
- borderRadius: '50%',
1203
- backgroundColor: statusDotColor,
1204
- }}
1205
- />
1206
- </span>
1207
- {formatEventType(event.eventType)}
1208
- </span>
1209
- </EventNoticeTooltip>
1210
- </div>
1211
-
1212
- {/* Name */}
1213
- <div
1214
- className="min-w-0 px-4 overflow-hidden text-ellipsis whitespace-nowrap"
1215
- style={{ flex: '2 1 0%' }}
1216
- title={eventName !== '-' ? eventName : undefined}
1217
- >
1218
- {eventName}
1219
- </div>
1220
-
1221
- {/* Correlation ID */}
1222
- <CopyableCell
1223
- value={event.correlationId || ''}
1224
- className="font-mono"
1225
- style={{ flex: '3 1 0%' }}
1226
- />
1227
-
1228
- {/* Event ID */}
1229
- <CopyableCell
1230
- value={event.eventId}
1231
- className="font-mono"
1232
- style={{ flex: '3 1 0%' }}
1233
- />
1234
- </div>
1235
- </div>
1236
-
1237
- {/* Expanded details: tree lines continue through this area */}
1238
- {isExpanded && (
1239
- <div className="flex">
1240
- {/* Continuation gutter: lane line continues if not at lane end */}
1241
- <TreeGutter
1242
- isFirst={false}
1243
- isLast={isLast}
1244
- isRunLevel={isRun}
1245
- hasSelection={hasActive}
1246
- showBranch={false}
1247
- showLaneLine={showLaneLine && !isLaneEnd}
1248
- isLaneStart={false}
1249
- isLaneEnd={false}
1250
- continuationOnly
1251
- />
1252
- {/* Spacer for chevron column */}
1253
- <div className="w-5 flex-shrink-0" />
1254
- <div
1255
- className="flex-1 my-1.5 mr-3 ml-2 py-2 rounded-md border overflow-hidden"
1256
- style={{
1257
- borderColor: 'var(--ds-gray-alpha-200)',
1258
- opacity: contentOpacity,
1259
- transition: 'opacity 150ms',
1260
- }}
1261
- >
1262
- {/* Duration info */}
1263
- {(durationInfo?.queued !== undefined ||
1264
- durationInfo?.ran !== undefined) && (
1265
- <div
1266
- className="px-2 pb-1.5 text-label-12 flex gap-3"
1267
- style={{ color: 'var(--ds-gray-900)' }}
1268
- >
1269
- {durationInfo.queued !== undefined &&
1270
- durationInfo.queued > 0 && (
1271
- <span>
1272
- Queued for{' '}
1273
- <span className="font-mono tabular-nums">
1274
- {formatDuration(durationInfo.queued)}
1275
- </span>
1276
- </span>
1277
- )}
1278
- {durationInfo.ran !== undefined && (
1279
- <span>
1280
- Ran for{' '}
1281
- <span className="font-mono tabular-nums">
1282
- {formatDuration(durationInfo.ran)}
1283
- </span>
1284
- </span>
1285
- )}
1286
- </div>
1287
- )}
1288
-
1289
- {/* Payload */}
1290
- {displayPayload != null ? (
1291
- <PayloadBlock data={displayPayload} eventType={event.eventType} />
1292
- ) : loadError ? (
1293
- <div
1294
- className="rounded-md border p-3 text-label-12"
1295
- style={{
1296
- borderColor: 'var(--ds-red-400)',
1297
- backgroundColor: 'var(--ds-red-100)',
1298
- color: 'var(--ds-red-900)',
1299
- }}
1300
- >
1301
- {loadError}
1302
- </div>
1303
- ) : isLoading ||
1304
- (loadedEventData === null &&
1305
- !hasAttemptedLoad &&
1306
- event.correlationId) ? (
1307
- <div className="flex flex-col gap-2 p-3">
1308
- <Skeleton className="h-3" style={{ width: '75%' }} />
1309
- <Skeleton className="h-3" style={{ width: '50%' }} />
1310
- <Skeleton className="h-3" style={{ width: '60%' }} />
1311
- </div>
1312
- ) : (
1313
- <div
1314
- className="p-2 text-label-12"
1315
- style={{ color: 'var(--ds-gray-900)' }}
1316
- >
1317
- No data
1318
- </div>
1319
- )}
1320
- </div>
1321
- </div>
1322
- )}
1323
- </div>
1324
- );
1325
- }
1326
-
1327
- // ──────────────────────────────────────────────────────────────────────────
1328
- // Main component
1329
- // ──────────────────────────────────────────────────────────────────────────
1330
-
1331
68
  function EventListViewInner({
1332
69
  events,
1333
70
  run,
@@ -1343,133 +80,77 @@ function EventListViewInner({
1343
80
  isDecrypting = false,
1344
81
  isDecryptDisabled = false,
1345
82
  decryptDisabledReason,
1346
- hasEncryptedData: hasEncryptedDataProp = false,
1347
83
  onExactIdSearch,
1348
84
  showSeparateEventOccurrenceTimestamps = false,
85
+ onViewInTrace,
1349
86
  }: EventsListProps) {
1350
- const toast = useToast();
1351
- const [internalSortOrder, setInternalSortOrder] = useState<'asc' | 'desc'>(
1352
- 'asc'
1353
- );
1354
- const effectiveSortOrder = sortOrderProp ?? internalSortOrder;
1355
- const handleSortOrderChange = useCallback(
1356
- (order: 'asc' | 'desc') => {
1357
- if (onSortOrderChange) {
1358
- onSortOrderChange(order);
1359
- } else {
1360
- setInternalSortOrder(order);
1361
- }
1362
- },
1363
- [onSortOrderChange]
1364
- );
1365
-
1366
- const [searchQuery, setSearchQuery] = useState('');
1367
- const [searchResults, setSearchResults] = useState<Event[] | null>(null);
1368
- const [searchResultsTruncated, setSearchResultsTruncated] = useState(false);
1369
- const [searchError, setSearchError] = useState<string | null>(null);
1370
- const [searchLoading, setSearchLoading] = useState(false);
1371
- const [searchNotFound, setSearchNotFound] = useState(false);
1372
- const searchRequestRef = useRef(0);
87
+ const [internalSortOrder, setInternalSortOrder] =
88
+ useState<EventSortOrder>('asc');
89
+ const sortOrder = sortOrderProp ?? internalSortOrder;
90
+ const handleSortOrderChange = onSortOrderChange ?? setInternalSortOrder;
1373
91
  const virtuosoRef = useRef<VirtuosoHandle>(null);
92
+ const bodyRef = useRef<HTMLDivElement>(null);
1374
93
 
1375
- const parsedSearchId = useMemo(
1376
- () => parseExactWorkflowSearchId(searchQuery),
1377
- [searchQuery]
1378
- );
1379
- const isExactSearchActive = searchResults !== null;
94
+ const [selectedEventId, setSelectedEventId] = useState<string | undefined>();
95
+ const { query, setQuery, search } = useEventSearch(onExactIdSearch);
96
+ const list = getListSource(search, { events, hasMore: hasMoreEvents });
1380
97
 
1381
- const sortedEvents = useMemo(() => {
1382
- const sourceEvents = isExactSearchActive ? searchResults : (events ?? []);
1383
- if (sourceEvents.length === 0) return [];
1384
- const dir = effectiveSortOrder === 'desc' ? -1 : 1;
1385
- return [...sourceEvents].sort(
1386
- (a, b) => dir * (getEffectiveEventTime(a) - getEffectiveEventTime(b))
1387
- );
1388
- }, [events, effectiveSortOrder, isExactSearchActive, searchResults]);
1389
-
1390
- // Events every replay reads past as repeats. Computed from the source list
1391
- // rather than `sortedEvents` because which occurrence counted is a property
1392
- // of the log, not of the direction the table happens to be sorted in.
1393
- //
1394
- // A page short of the whole log, or an exact-ID search that returns one
1395
- // event, cannot answer that question: the event a repeat lost to may be
1396
- // outside the window, and reading it the other way round would mark the
1397
- // event the run acted on and drop it from the durations. Both cases classify
1398
- // nothing.
1399
- const duplicateEventIds = useMemo(
1400
- () =>
1401
- findDuplicateEventIds(events ?? [], {
1402
- isCompleteHistory: !hasMoreEvents && !isExactSearchActive,
1403
- }),
1404
- [events, hasMoreEvents, isExactSearchActive]
98
+ // Rows come from the list's source; names and timings from every event on
99
+ // hand.
100
+ const sortedEvents = useMemo(
101
+ () => sortEventsByTime(list.events, sortOrder),
102
+ [list.events, sortOrder]
1405
103
  );
1406
-
1407
- // Detect encrypted fields across all loaded events (inline eventData).
1408
- const hasEncryptedInlineData = useMemo(() => {
1409
- const sourceEvents = isExactSearchActive ? searchResults : events;
1410
- if (!sourceEvents) return false;
1411
- for (const event of sourceEvents) {
1412
- const ed = (event as Record<string, unknown>).eventData;
1413
- if (hasEncryptedValues(ed)) return true;
1414
- }
1415
- return false;
1416
- }, [events, isExactSearchActive, searchResults]);
1417
-
1418
- // Tracks whether any expanded row's lazy-loaded data contained encrypted markers.
1419
- // Set to true by EventRow via onEncryptedDataDetected; never reset (sticky).
1420
- const [foundEncryptedInLazyData, setFoundEncryptedInLazyData] =
1421
- useState(false);
1422
- const handleEncryptedDataDetected = useCallback(() => {
1423
- setFoundEncryptedInLazyData(true);
1424
- }, []);
1425
-
1426
- const hasEncryptedData =
1427
- hasEncryptedDataProp || hasEncryptedInlineData || foundEncryptedInLazyData;
1428
-
1429
- const { correlationNameMap, workflowName } = useMemo(
1430
- () =>
1431
- buildNameMaps(
1432
- isExactSearchActive ? searchResults : (events ?? null),
1433
- run ?? null
1434
- ),
1435
- [events, isExactSearchActive, run, searchResults]
104
+ const knownEvents = useMemo(
105
+ () => mergeEventsById(events ?? [], list.events),
106
+ [events, list.events]
1436
107
  );
1437
108
 
1438
- const durationMap = useMemo(
1439
- () => buildDurationMap(sortedEvents, duplicateEventIds),
1440
- [sortedEvents, duplicateEventIds]
109
+ // Events every replay reads past as repeats. A page short of the whole log,
110
+ // or an exact-ID search, cannot answer that question, so both classify
111
+ // nothing (see findDuplicateEventIds).
112
+ const isCompleteHistory = list.isLog && !list.hasMore;
113
+ const duplicateEventIds = useMemo(
114
+ () => findDuplicateEventIds(events ?? [], { isCompleteHistory }),
115
+ [events, isCompleteHistory]
1441
116
  );
1442
117
 
1443
- const [selectedGroupKey, setSelectedGroupKey] = useState<string | undefined>(
1444
- undefined
118
+ const lookups = useMemo(
119
+ () => buildEventLookups(knownEvents, run ?? null, duplicateEventIds),
120
+ [knownEvents, run, duplicateEventIds]
1445
121
  );
1446
- const [hoveredGroupKey, setHoveredGroupKey] = useState<string | undefined>(
1447
- undefined
122
+ const rows = useMemo(
123
+ () => sortedEvents.map((event) => buildEventRow(event, lookups)),
124
+ [sortedEvents, lookups]
1448
125
  );
1449
- const onSelectGroup = useCallback((groupKey: string | undefined) => {
1450
- setSelectedGroupKey(groupKey);
1451
- }, []);
1452
- const onHoverGroup = useCallback((groupKey: string | undefined) => {
1453
- setHoveredGroupKey(groupKey);
1454
- }, []);
1455
-
1456
- const activeGroupKey = selectedGroupKey ?? hoveredGroupKey;
1457
-
1458
- // Expanded state lifted out of EventRow so it survives virtualization
1459
- const [expandedEventIds, setExpandedEventIds] = useState<Set<string>>(
1460
- () => new Set()
126
+ const listItems = useMemo(
127
+ () =>
128
+ buildListItems(rows, {
129
+ showGaps: list.isLog,
130
+ hookNameMap: lookups.names.hookNameMap,
131
+ }),
132
+ [rows, list.isLog, lookups]
1461
133
  );
1462
- const toggleEventExpanded = useCallback((eventId: string) => {
1463
- setExpandedEventIds((prev) => {
1464
- const next = new Set(prev);
1465
- if (next.has(eventId)) {
1466
- next.delete(eventId);
1467
- } else {
1468
- next.add(eventId);
1469
- }
1470
- return next;
1471
- });
134
+
135
+ const toggleSelectedEvent = useCallback((event: Event) => {
136
+ setSelectedEventId((id) =>
137
+ id === event.eventId ? undefined : event.eventId
138
+ );
1472
139
  }, []);
140
+ const selectedRow = useMemo(() => {
141
+ if (!selectedEventId) return undefined;
142
+ const event = knownEvents.find((e) => e.eventId === selectedEventId);
143
+ return event ? buildEventRow(event, lookups) : undefined;
144
+ }, [selectedEventId, knownEvents, lookups]);
145
+
146
+ // Every event of the step, hook, wait or run an exact-ID search found is
147
+ // marked; with no search result, those of the selected event's.
148
+ const relatedKey =
149
+ search.status === 'ok'
150
+ ? search.id.kind === 'event'
151
+ ? getEventEntity(search.events[0]).key
152
+ : search.id.id
153
+ : (selectedRow?.entity.key ?? null);
1473
154
 
1474
155
  // Event data cache: ref avoids re-renders when cache updates
1475
156
  const eventDataCacheRef = useRef<Map<string, unknown>>(new Map());
@@ -1477,225 +158,80 @@ function EventListViewInner({
1477
158
  eventDataCacheRef.current.set(eventId, data);
1478
159
  }, []);
1479
160
 
1480
- // Lookup from eventId → groupKey for efficient collapse filtering
1481
- const eventGroupKeyMap = useMemo(() => {
1482
- const map = new Map<string, string>();
1483
- for (const ev of sortedEvents) {
1484
- const gk = isRunLevel(ev.eventType)
1485
- ? '__run__'
1486
- : (ev.correlationId ?? '');
1487
- if (gk) map.set(ev.eventId, gk);
1488
- }
1489
- return map;
1490
- }, [sortedEvents]);
1491
-
1492
- // Collapse expanded events that don't belong to the newly selected group
1493
- useEffect(() => {
1494
- if (selectedGroupKey === undefined) return;
1495
- setExpandedEventIds((prev) => {
1496
- if (prev.size === 0) return prev;
1497
- let changed = false;
1498
- const next = new Set<string>();
1499
- for (const eventId of prev) {
1500
- if (eventGroupKeyMap.get(eventId) === selectedGroupKey) {
1501
- next.add(eventId);
1502
- } else {
1503
- changed = true;
1504
- }
1505
- }
1506
- return changed ? next : prev;
1507
- });
1508
- }, [selectedGroupKey, eventGroupKeyMap]);
1509
-
1510
- // Compute the row-index range for the active group's connecting lane line.
1511
- // Only applies to non-run groups (step/hook/wait correlations).
1512
- const selectedGroupRange = useMemo(() => {
1513
- if (!activeGroupKey || activeGroupKey === '__run__') return null;
1514
- let first = -1;
1515
- let last = -1;
1516
- for (let i = 0; i < sortedEvents.length; i++) {
1517
- if (sortedEvents[i].correlationId === activeGroupKey) {
1518
- if (first === -1) first = i;
1519
- last = i;
1520
- }
1521
- }
1522
- return first >= 0 ? { first, last } : null;
1523
- }, [activeGroupKey, sortedEvents]);
1524
-
1525
- useEffect(() => {
1526
- const trimmed = searchQuery.trim();
1527
- if (!trimmed) {
1528
- searchRequestRef.current += 1;
1529
- setSearchResults(null);
1530
- setSearchResultsTruncated(false);
1531
- setSearchError(null);
1532
- setSearchLoading(false);
1533
- setSearchNotFound(false);
1534
- setSelectedGroupKey(undefined);
1535
- return;
1536
- }
1537
-
1538
- const parsed = parseExactWorkflowSearchId(trimmed);
1539
- if (!parsed || !onExactIdSearch) {
1540
- setSearchResults(null);
1541
- setSearchLoading(false);
1542
- setSearchNotFound(false);
1543
- return;
1544
- }
1545
-
1546
- const requestId = ++searchRequestRef.current;
1547
- setSearchLoading(true);
1548
- setSearchNotFound(false);
1549
- setSearchError(null);
1550
-
1551
- const abortController = new AbortController();
1552
-
1553
- const timer = setTimeout(() => {
1554
- void (async () => {
1555
- try {
1556
- const results = await onExactIdSearch(
1557
- parsed.id,
1558
- parsed.kind,
1559
- abortController.signal
1560
- );
1561
- if (
1562
- abortController.signal.aborted ||
1563
- searchRequestRef.current !== requestId
1564
- ) {
1565
- return;
1566
- }
1567
-
1568
- if (results.status === 'error') {
1569
- setSearchResults([]);
1570
- setSearchResultsTruncated(false);
1571
- setSearchNotFound(false);
1572
- setSearchError(results.message);
1573
- setSelectedGroupKey(undefined);
1574
- return;
1575
- }
1576
-
1577
- if (
1578
- results.status === 'not_found' ||
1579
- (results.status === 'ok' && results.events.length === 0)
1580
- ) {
1581
- setSearchResults([]);
1582
- setSearchResultsTruncated(false);
1583
- setSearchNotFound(true);
1584
- setSearchError(null);
1585
- setSelectedGroupKey(undefined);
1586
- return;
1587
- }
1588
-
1589
- setSearchResults(results.events);
1590
- setSearchResultsTruncated(Boolean(results.truncated));
1591
- setSearchNotFound(false);
1592
- setSearchError(null);
1593
- setSelectedGroupKey(
1594
- parsed.kind === 'event'
1595
- ? (() => {
1596
- const first = results.events[0];
1597
- if (!first) return undefined;
1598
- return isRunLevel(first.eventType)
1599
- ? '__run__'
1600
- : (first.correlationId ?? undefined);
1601
- })()
1602
- : parsed.id
1603
- );
1604
- virtuosoRef.current?.scrollToIndex({
1605
- index: 0,
1606
- align: 'start',
1607
- behavior: 'smooth',
1608
- });
1609
- } catch {
1610
- if (
1611
- abortController.signal.aborted ||
1612
- searchRequestRef.current !== requestId
1613
- ) {
1614
- return;
1615
- }
1616
- setSearchResults([]);
1617
- setSearchResultsTruncated(false);
1618
- setSearchNotFound(false);
1619
- setSearchError('Failed to search events. Try again.');
1620
- setSelectedGroupKey(undefined);
1621
- } finally {
1622
- if (
1623
- searchRequestRef.current === requestId &&
1624
- !abortController.signal.aborted
1625
- ) {
1626
- setSearchLoading(false);
1627
- }
1628
- }
1629
- })();
1630
- }, 300);
1631
-
1632
- return () => {
1633
- clearTimeout(timer);
1634
- abortController.abort();
1635
- };
1636
- }, [searchQuery, onExactIdSearch]);
161
+ // Track whether we've ever had events to distinguish initial load from refetch
162
+ const hasHadEventsRef = useRef(false);
163
+ if (sortedEvents.length > 0) {
164
+ hasHadEventsRef.current = true;
165
+ }
166
+ const isInitialLoad = isLoading && !hasHadEventsRef.current;
167
+ const isRefetching =
168
+ isLoading && hasHadEventsRef.current && sortedEvents.length === 0;
1637
169
 
1638
- const handleSearchKeyDown = useCallback(
1639
- (event: ReactKeyboardEvent<HTMLInputElement>) => {
1640
- if (event.key !== 'Enter') {
1641
- return;
170
+ const selectedIndex = selectedEventId
171
+ ? rows.findIndex((row) => row.event.eventId === selectedEventId)
172
+ : -1;
173
+
174
+ // Move the selection by one event, keeping the row in view and focused.
175
+ const moveSelection = useCallback(
176
+ (delta: 1 | -1) => {
177
+ if (rows.length === 0) return;
178
+ const nextIndex =
179
+ selectedIndex === -1
180
+ ? 0
181
+ : Math.min(Math.max(selectedIndex + delta, 0), rows.length - 1);
182
+ const next = rows[nextIndex].event;
183
+ setSelectedEventId(next.eventId);
184
+ const itemIndex = listItems.findIndex(
185
+ (item) =>
186
+ item.kind === 'event' && item.row.event.eventId === next.eventId
187
+ );
188
+ if (itemIndex >= 0) {
189
+ virtuosoRef.current?.scrollIntoView({ index: itemIndex });
1642
190
  }
191
+ requestAnimationFrame(() => {
192
+ bodyRef.current
193
+ ?.querySelector<HTMLElement>(
194
+ `[data-event-id="${CSS.escape(next.eventId)}"]`
195
+ )
196
+ ?.focus();
197
+ });
198
+ },
199
+ [selectedIndex, rows, listItems]
200
+ );
1643
201
 
1644
- const trimmed = searchQuery.trim();
202
+ // With no listed row selected, Up/Down or J/K select the first one. Once a
203
+ // listed row is selected, the details panel handles those keys and Escape;
204
+ // it offers no prev/next until then, so a press is handled once.
205
+ const handleListKeyDown = useCallback(
206
+ (e: ReactKeyboardEvent<HTMLDivElement>) => {
207
+ if (selectedIndex !== -1) return;
1645
208
  if (
1646
- !trimmed ||
1647
- parseExactWorkflowSearchId(trimmed) ||
1648
- !onExactIdSearch ||
1649
- !looksLikeWorkflowIdSearchInput(trimmed)
209
+ e.key === 'ArrowDown' ||
210
+ e.key === 'j' ||
211
+ e.key === 'ArrowUp' ||
212
+ e.key === 'k'
1650
213
  ) {
1651
- return;
214
+ e.preventDefault();
215
+ moveSelection(1);
1652
216
  }
1653
-
1654
- toast.info('Enter a full step ID, wait ID, hook ID, or event ID');
1655
217
  },
1656
- [searchQuery, onExactIdSearch, toast]
218
+ [selectedIndex, moveSelection]
1657
219
  );
1658
220
 
1659
- // Track whether we've ever had events to distinguish initial load from refetch
1660
- const hasHadEventsRef = useRef(false);
1661
- if (sortedEvents.length > 0) {
1662
- hasHadEventsRef.current = true;
1663
- }
1664
- const isInitialLoad = isLoading && !hasHadEventsRef.current;
1665
- const isRefetching =
1666
- isLoading && hasHadEventsRef.current && sortedEvents.length === 0;
221
+ const panelWidth = useDetailPanelWidth(bodyRef, selectedRow !== undefined);
222
+
223
+ const toolbar = <EventListToolbar query={query} onQueryChange={setQuery} />;
1667
224
 
1668
225
  if (isInitialLoad) {
1669
226
  return (
1670
- <div className="h-full flex flex-col overflow-hidden">
1671
- {/* Skeleton search bar */}
1672
- <div style={{ padding: 6 }}>
1673
- <Skeleton style={{ height: 40, borderRadius: 6 }} />
1674
- </div>
1675
- {/* Skeleton header */}
1676
- <div
1677
- className="flex items-center gap-0 h-10 border-b flex-shrink-0"
1678
- style={{ borderColor: 'var(--ds-gray-alpha-200)' }}
1679
- >
1680
- <div className="flex-shrink-0" style={{ width: GUTTER_WIDTH }} />
1681
- <div className="w-5 flex-shrink-0" />
1682
- <div className="min-w-0 px-4" style={{ flex: '2 1 0%' }}>
1683
- <Skeleton className="h-3" style={{ width: 40 }} />
1684
- </div>
1685
- <div className="min-w-0 px-4" style={{ flex: '2 1 0%' }}>
1686
- <Skeleton className="h-3" style={{ width: 72 }} />
1687
- </div>
1688
- <div className="min-w-0 px-4" style={{ flex: '2 1 0%' }}>
1689
- <Skeleton className="h-3" style={{ width: 44 }} />
1690
- </div>
1691
- <div className="min-w-0 px-4" style={{ flex: '3 1 0%' }}>
1692
- <Skeleton className="h-3" style={{ width: 92 }} />
1693
- </div>
1694
- <div className="min-w-0 px-4" style={{ flex: '3 1 0%' }}>
1695
- <Skeleton className="h-3" style={{ width: 60 }} />
1696
- </div>
1697
- </div>
1698
- <RowsSkeleton />
227
+ <div className="flex h-full flex-col overflow-hidden bg-background-100">
228
+ {toolbar}
229
+ <EventListHeader
230
+ showOccurred={showSeparateEventOccurrenceTimestamps}
231
+ sortOrder={sortOrder}
232
+ onSortOrderChange={handleSortOrderChange}
233
+ />
234
+ <EventRowsSkeleton />
1699
235
  </div>
1700
236
  );
1701
237
  }
@@ -1713,241 +249,113 @@ function EventListViewInner({
1713
249
  : undefined
1714
250
  }
1715
251
  >
1716
- <div className="h-full flex flex-col overflow-hidden">
1717
- <style>{`@keyframes workflow-dot-pulse{0%{transform:scale(1);opacity:.7}70%,100%{transform:scale(2.2);opacity:0}}`}</style>
1718
- {/* Search bar + sort */}
1719
- <div
1720
- style={{
1721
- padding: 6,
1722
- backgroundColor: 'var(--ds-background-100)',
1723
- display: 'flex',
1724
- gap: 6,
1725
- }}
1726
- >
1727
- <label
1728
- style={{
1729
- display: 'flex',
1730
- alignItems: 'center',
1731
- justifyContent: 'center',
1732
- borderRadius: 6,
1733
- boxShadow: '0 0 0 1px var(--ds-gray-alpha-400)',
1734
- background: 'var(--ds-background-100)',
1735
- height: 40,
1736
- flex: 1,
1737
- minWidth: 0,
1738
- }}
252
+ <div className="flex h-full flex-col overflow-hidden bg-background-100">
253
+ {toolbar}
254
+ <div ref={bodyRef} className="flex min-h-0 flex-1">
255
+ {/* biome-ignore lint/a11y/noStaticElementInteractions: keyboard navigation for the rows inside */}
256
+ <div
257
+ className="flex min-w-0 flex-1 flex-col"
258
+ onKeyDown={handleListKeyDown}
1739
259
  >
1740
- <div
1741
- style={{
1742
- width: 40,
1743
- height: 40,
1744
- display: 'flex',
1745
- alignItems: 'center',
1746
- justifyContent: 'center',
1747
- color: 'var(--ds-gray-800)',
1748
- flexShrink: 0,
1749
- }}
1750
- >
1751
- <svg
1752
- width={16}
1753
- height={16}
1754
- viewBox="0 0 16 16"
1755
- fill="none"
1756
- aria-hidden="true"
1757
- focusable="false"
1758
- >
1759
- <circle
1760
- cx="7"
1761
- cy="7"
1762
- r="4.5"
1763
- stroke="currentColor"
1764
- strokeWidth="1.5"
1765
- />
1766
- <path
1767
- d="M11.5 11.5L14 14"
1768
- stroke="currentColor"
1769
- strokeWidth="1.5"
1770
- strokeLinecap="round"
1771
- />
1772
- </svg>
1773
- </div>
1774
- <input
1775
- type="search"
1776
- placeholder="Search by step ID, wait ID, hook ID, or event ID…"
1777
- value={searchQuery}
1778
- onChange={(e) => setSearchQuery(e.target.value)}
1779
- onKeyDown={handleSearchKeyDown}
1780
- disabled={!onExactIdSearch}
1781
- title={
1782
- onExactIdSearch
1783
- ? undefined
1784
- : 'Exact ID search is unavailable in this view.'
1785
- }
1786
- style={{
1787
- marginLeft: -16,
1788
- paddingInline: 12,
1789
- fontFamily: 'inherit',
1790
- fontSize: 14,
1791
- background: 'transparent',
1792
- border: 'none',
1793
- outline: 'none',
1794
- height: 40,
1795
- width: '100%',
1796
- opacity: onExactIdSearch ? 1 : 0.5,
1797
- cursor: onExactIdSearch ? 'text' : 'not-allowed',
1798
- }}
260
+ <EventListHeader
261
+ showOccurred={showSeparateEventOccurrenceTimestamps}
262
+ sortOrder={sortOrder}
263
+ onSortOrderChange={handleSortOrderChange}
1799
264
  />
1800
- </label>
1801
- <MenuDropdown
1802
- options={SORT_OPTIONS}
1803
- value={effectiveSortOrder}
1804
- onChange={handleSortOrderChange}
1805
- />
1806
- {(hasEncryptedData || encryptionKey) && onDecrypt && (
1807
- <DecryptButton
1808
- decrypted={!!encryptionKey}
1809
- loading={isDecrypting}
1810
- disabled={isDecryptDisabled}
1811
- disabledReason={decryptDisabledReason}
1812
- onClick={onDecrypt}
1813
- />
1814
- )}
1815
- </div>
1816
265
 
1817
- {/* Header */}
1818
- <div
1819
- className="flex items-center gap-0 text-label-13 font-medium h-10 border-b flex-shrink-0"
1820
- style={{
1821
- borderColor: 'var(--ds-gray-alpha-200)',
1822
- color: 'var(--ds-gray-900)',
1823
- backgroundColor: 'var(--ds-background-100)',
1824
- }}
1825
- >
1826
- <div className="flex-shrink-0" style={{ width: GUTTER_WIDTH }} />
1827
- <div className="w-5 flex-shrink-0" />
1828
- {showSeparateEventOccurrenceTimestamps && (
1829
- <div className="min-w-0 px-4" style={{ flex: '2 1 0%' }}>
1830
- Occurred
1831
- </div>
1832
- )}
1833
- <div className="min-w-0 px-4" style={{ flex: '2 1 0%' }}>
1834
- Created
1835
- </div>
1836
- <div className="min-w-0 px-4" style={{ flex: '2 1 0%' }}>
1837
- Event Type
1838
- </div>
1839
- <div className="min-w-0 px-4" style={{ flex: '2 1 0%' }}>
1840
- Name
1841
- </div>
1842
- <div className="min-w-0 px-4" style={{ flex: '3 1 0%' }}>
1843
- Correlation ID
1844
- </div>
1845
- <div className="min-w-0 px-4" style={{ flex: '3 1 0%' }}>
1846
- Event ID
1847
- </div>
1848
- </div>
1849
-
1850
- {/* Virtualized event rows or refetching skeleton */}
1851
- {isRefetching || searchLoading ? (
1852
- <RowsSkeleton
1853
- showSeparateEventOccurrenceTimestamps={
1854
- showSeparateEventOccurrenceTimestamps
1855
- }
1856
- />
1857
- ) : sortedEvents.length === 0 ? (
1858
- <div
1859
- className="flex flex-1 items-center justify-center px-6 text-center text-copy-14"
1860
- style={{ color: 'var(--ds-gray-700)' }}
1861
- >
1862
- {searchNotFound && searchQuery.trim()
1863
- ? `No events found for ${searchQuery.trim()}`
1864
- : searchError
1865
- ? searchError
1866
- : parsedSearchId && searchQuery.trim() && !onExactIdSearch
1867
- ? 'Exact ID search is unavailable in this view.'
1868
- : 'No events found'}
1869
- </div>
1870
- ) : (
1871
- <Virtuoso
1872
- ref={virtuosoRef}
1873
- totalCount={sortedEvents.length}
1874
- overscan={20}
1875
- defaultItemHeight={40}
1876
- endReached={() => {
1877
- if (
1878
- isExactSearchActive ||
1879
- !hasMoreEvents ||
1880
- isLoadingMoreEvents
1881
- ) {
1882
- return;
1883
- }
1884
- void onLoadMoreEvents?.();
1885
- }}
1886
- itemContent={(index: number) => {
1887
- const ev = sortedEvents[index];
1888
- return (
1889
- <EventRow
1890
- event={ev}
1891
- index={index}
1892
- isFirst={index === 0}
1893
- isLast={index === sortedEvents.length - 1}
1894
- isExpanded={expandedEventIds.has(ev.eventId)}
1895
- onToggleExpand={toggleEventExpanded}
1896
- activeGroupKey={activeGroupKey}
1897
- selectedGroupKey={selectedGroupKey}
1898
- selectedGroupRange={selectedGroupRange}
1899
- correlationNameMap={correlationNameMap}
1900
- workflowName={workflowName}
1901
- durationMap={durationMap}
1902
- onSelectGroup={onSelectGroup}
1903
- onHoverGroup={onHoverGroup}
1904
- onLoadEventData={onLoadEventData}
1905
- cachedEventData={
1906
- eventDataCacheRef.current.get(ev.eventId) ?? null
266
+ {isRefetching || search.status === 'loading' ? (
267
+ <EventRowsSkeleton />
268
+ ) : rows.length === 0 ? (
269
+ <div className="flex flex-1 items-center justify-center px-6 text-center text-copy-14 text-gray-900">
270
+ {getEmptyMessage(search)}
271
+ </div>
272
+ ) : (
273
+ <Virtuoso
274
+ ref={virtuosoRef}
275
+ totalCount={listItems.length}
276
+ overscan={20}
277
+ defaultItemHeight={25}
278
+ computeItemKey={(i) => {
279
+ const item = listItems[i];
280
+ return item.kind === 'gap'
281
+ ? item.key
282
+ : item.row.event.eventId;
283
+ }}
284
+ endReached={() => {
285
+ if (list.hasMore && !isLoadingMoreEvents) {
286
+ void onLoadMoreEvents?.();
1907
287
  }
1908
- onCacheEventData={cacheEventData}
1909
- encryptionKey={encryptionKey}
1910
- onEncryptedDataDetected={handleEncryptedDataDetected}
1911
- suppressGroupDimming={isExactSearchActive}
1912
- isDuplicate={duplicateEventIds.has(ev.eventId)}
1913
- showSeparateEventOccurrenceTimestamps={
1914
- showSeparateEventOccurrenceTimestamps
288
+ }}
289
+ components={{ Footer: () => <div className="h-2" /> }}
290
+ itemContent={(i: number) => {
291
+ const item = listItems[i];
292
+ if (item.kind === 'gap') {
293
+ return <IdleGapRow ms={item.ms} reason={item.reason} />;
1915
294
  }
1916
- />
1917
- );
1918
- }}
1919
- style={{ flex: 1, minHeight: 0 }}
1920
- />
1921
- )}
295
+ const { row } = item;
296
+ const isSelected = selectedEventId === row.event.eventId;
297
+ return (
298
+ <EventRow
299
+ row={row}
300
+ index={item.index}
301
+ isSelected={isSelected}
302
+ isTabStop={
303
+ selectedIndex === -1 ? item.index === 0 : isSelected
304
+ }
305
+ isRelated={
306
+ relatedKey !== null && row.entity.key === relatedKey
307
+ }
308
+ onSelect={toggleSelectedEvent}
309
+ showSeparateEventOccurrenceTimestamps={
310
+ showSeparateEventOccurrenceTimestamps
311
+ }
312
+ />
313
+ );
314
+ }}
315
+ style={{ flex: 1, minHeight: 0 }}
316
+ />
317
+ )}
1922
318
 
1923
- {/* Fixed footer: count + load more */}
1924
- <div
1925
- className="relative flex-shrink-0 flex items-center h-10 border-t px-4 text-label-12"
1926
- style={{
1927
- borderColor: 'var(--ds-gray-alpha-200)',
1928
- color: 'var(--ds-gray-900)',
1929
- backgroundColor: 'var(--ds-background-100)',
1930
- }}
1931
- >
1932
- <span>
1933
- {isExactSearchActive
1934
- ? searchError
1935
- ? searchError
1936
- : searchNotFound
1937
- ? `No events found for ${searchQuery.trim()}`
1938
- : `${sortedEvents.length} event${sortedEvents.length !== 1 ? 's' : ''} for ${searchQuery.trim()}${searchResultsTruncated ? ' (results may be truncated)' : ''}`
1939
- : `${sortedEvents.length} event${sortedEvents.length !== 1 ? 's' : ''} loaded`}
1940
- </span>
1941
- {!isExactSearchActive && hasMoreEvents && (
1942
- <div className="absolute inset-0 flex items-center justify-center pointer-events-none">
1943
- <div className="pointer-events-auto">
1944
- <LoadMoreButton
1945
- loading={isLoadingMoreEvents}
1946
- onClick={() => void onLoadMoreEvents?.()}
1947
- />
1948
- </div>
319
+ <div className="relative flex h-10 shrink-0 items-center border-t border-gray-alpha-400 px-4 text-label-13 text-gray-900">
320
+ <span>
321
+ {getFooterLabel(search, {
322
+ total: sortedEvents.length,
323
+ hasMoreEvents,
324
+ })}
325
+ </span>
326
+ {list.hasMore && (
327
+ <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
328
+ <div className="pointer-events-auto">
329
+ <LoadMoreButton
330
+ loading={isLoadingMoreEvents}
331
+ onClick={() => void onLoadMoreEvents?.()}
332
+ />
333
+ </div>
334
+ </div>
335
+ )}
1949
336
  </div>
1950
- )}
337
+ </div>
338
+
339
+ {selectedRow ? (
340
+ <EventDetailsPanel
341
+ row={selectedRow}
342
+ onLoadEventData={onLoadEventData}
343
+ cachedEventData={
344
+ eventDataCacheRef.current.get(selectedRow.event.eventId) ?? null
345
+ }
346
+ onCacheEventData={cacheEventData}
347
+ encryptionKey={encryptionKey}
348
+ width={panelWidth}
349
+ onPrev={selectedIndex > 0 ? () => moveSelection(-1) : undefined}
350
+ onNext={
351
+ selectedIndex >= 0 && selectedIndex < rows.length - 1
352
+ ? () => moveSelection(1)
353
+ : undefined
354
+ }
355
+ onClose={() => setSelectedEventId(undefined)}
356
+ onViewInTrace={onViewInTrace}
357
+ />
358
+ ) : null}
1951
359
  </div>
1952
360
  </div>
1953
361
  </DecryptClickContext.Provider>
@@ -1956,8 +364,10 @@ function EventListViewInner({
1956
364
 
1957
365
  export function EventListView(props: EventsListProps) {
1958
366
  return (
1959
- <ContextCardProvider>
1960
- <EventListViewInner {...props} />
1961
- </ContextCardProvider>
367
+ <TooltipProvider delayDuration={300}>
368
+ <ContextCardProvider>
369
+ <EventListViewInner {...props} />
370
+ </ContextCardProvider>
371
+ </TooltipProvider>
1962
372
  );
1963
373
  }