@workflow/web-shared 5.1.1 → 5.3.0
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.
- package/dist/components/event-list/event-details-panel.d.ts.map +1 -1
- package/dist/components/event-list/event-details-panel.js +7 -6
- package/dist/components/event-list/event-list-toolbar.d.ts +2 -1
- package/dist/components/event-list/event-list-toolbar.d.ts.map +1 -1
- package/dist/components/event-list/event-list-toolbar.js +20 -11
- package/dist/components/event-list/event-row.d.ts +3 -3
- package/dist/components/event-list/event-row.d.ts.map +1 -1
- package/dist/components/event-list/event-row.js +15 -13
- package/dist/components/event-list/use-event-search.d.ts +3 -1
- package/dist/components/event-list/use-event-search.d.ts.map +1 -1
- package/dist/components/event-list/use-event-search.js +19 -20
- package/dist/components/event-list-view.d.ts.map +1 -1
- package/dist/components/event-list-view.js +53 -24
- package/dist/components/hook-actions.d.ts +0 -1
- package/dist/components/hook-actions.d.ts.map +1 -1
- package/dist/components/hook-actions.js +1 -3
- package/dist/components/index.d.ts +5 -9
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -9
- package/dist/components/sidebar/attribute-panel.d.ts +0 -13
- package/dist/components/sidebar/attribute-panel.d.ts.map +1 -1
- package/dist/components/sidebar/attribute-panel.js +5 -5
- package/dist/components/sidebar/attributes-block.d.ts +0 -7
- package/dist/components/sidebar/attributes-block.d.ts.map +1 -1
- package/dist/components/sidebar/attributes-block.js +5 -5
- package/dist/components/sidebar/conversation-view.d.ts.map +1 -1
- package/dist/components/sidebar/conversation-view.js +4 -3
- package/dist/components/sidebar/copyable-data-block.d.ts.map +1 -1
- package/dist/components/sidebar/copyable-data-block.js +8 -6
- package/dist/components/sidebar/entity-detail-panel.d.ts.map +1 -1
- package/dist/components/sidebar/entity-detail-panel.js +2 -3
- package/dist/components/stream-image-preview.js +2 -2
- package/dist/components/stream-viewer.js +3 -3
- package/dist/components/trace-viewer/components/detail-panel-shell.d.ts +2 -1
- package/dist/components/trace-viewer/components/detail-panel-shell.d.ts.map +1 -1
- package/dist/components/trace-viewer/components/detail-panel-shell.js +3 -3
- package/dist/components/trace-viewer/components/event-list.d.ts.map +1 -1
- package/dist/components/trace-viewer/components/event-list.js +2 -2
- package/dist/components/trace-viewer/components/middle-truncate/truncate.d.ts +1 -4
- package/dist/components/trace-viewer/components/middle-truncate/truncate.d.ts.map +1 -1
- package/dist/components/trace-viewer/components/middle-truncate/truncate.js +2 -2
- package/dist/components/trace-viewer/components/minimap.d.ts.map +1 -1
- package/dist/components/trace-viewer/components/minimap.js +6 -4
- package/dist/components/trace-viewer/components/timeline.d.ts +0 -11
- package/dist/components/trace-viewer/components/timeline.d.ts.map +1 -1
- package/dist/components/trace-viewer/components/timeline.js +1 -2
- package/dist/components/trace-viewer/trace-viewer.js +9 -10
- package/dist/components/ui/button.d.ts +28 -17
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +47 -43
- package/dist/components/ui/context-card.js +3 -3
- package/dist/components/ui/copy-button.d.ts +15 -0
- package/dist/components/ui/copy-button.d.ts.map +1 -0
- package/dist/components/ui/copy-button.js +41 -0
- package/dist/components/ui/data-inspector.d.ts.map +1 -1
- package/dist/components/ui/data-inspector.js +8 -38
- package/dist/components/ui/decrypt-button.d.ts +3 -2
- package/dist/components/ui/decrypt-button.d.ts.map +1 -1
- package/dist/components/ui/decrypt-button.js +13 -7
- package/dist/components/ui/duplicate-event-tooltip.d.ts +1 -9
- package/dist/components/ui/duplicate-event-tooltip.d.ts.map +1 -1
- package/dist/components/ui/duplicate-event-tooltip.js +2 -10
- package/dist/components/ui/error-stack-block.js +3 -3
- package/dist/components/ui/icon-button.d.ts +2 -2
- package/dist/components/ui/icon-button.d.ts.map +1 -1
- package/dist/components/ui/icon-button.js +2 -3
- package/dist/components/ui/kbd.d.ts +1 -1
- package/dist/components/ui/kbd.d.ts.map +1 -1
- package/dist/components/ui/kbd.js +1 -2
- package/dist/components/ui/search-input.d.ts +19 -0
- package/dist/components/ui/search-input.d.ts.map +1 -0
- package/dist/components/ui/search-input.js +61 -0
- package/dist/components/ui/spinner.d.ts +54 -6
- package/dist/components/ui/spinner.d.ts.map +1 -1
- package/dist/components/ui/spinner.js +84 -46
- package/dist/components/workflow-traces/trace-span-construction.d.ts +1 -22
- package/dist/components/workflow-traces/trace-span-construction.d.ts.map +1 -1
- package/dist/components/workflow-traces/trace-span-construction.js +3 -3
- package/dist/index.d.ts +9 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -11
- package/dist/lib/event-analysis.d.ts +1 -25
- package/dist/lib/event-analysis.d.ts.map +1 -1
- package/dist/lib/event-analysis.js +2 -75
- package/dist/lib/event-list-model.d.ts +4 -2
- package/dist/lib/event-list-model.d.ts.map +1 -1
- package/dist/lib/event-list-model.js +13 -11
- package/dist/lib/exact-event-search-id.d.ts +0 -2
- package/dist/lib/exact-event-search-id.d.ts.map +1 -1
- package/dist/lib/exact-event-search-id.js +1 -12
- package/dist/lib/hydration.d.ts +1 -12
- package/dist/lib/hydration.d.ts.map +1 -1
- package/dist/lib/hydration.js +8 -20
- package/dist/lib/stream-display.d.ts +0 -1
- package/dist/lib/stream-display.d.ts.map +1 -1
- package/dist/lib/stream-display.js +2 -2
- package/dist/lib/trace-builder.d.ts +0 -8
- package/dist/lib/trace-builder.d.ts.map +1 -1
- package/dist/lib/trace-builder.js +2 -2
- package/dist/lib/utils.d.ts +0 -22
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +1 -31
- package/dist/styles.css +286 -117
- package/package.json +5 -17
- package/src/components/event-list/event-details-panel.tsx +22 -26
- package/src/components/event-list/event-list-toolbar.tsx +35 -28
- package/src/components/event-list/event-row.tsx +33 -29
- package/src/components/event-list/use-event-search.ts +29 -22
- package/src/components/event-list-view.tsx +180 -52
- package/src/components/hook-actions.tsx +0 -1
- package/src/components/index.ts +4 -20
- package/src/components/sidebar/attribute-panel.tsx +4 -7
- package/src/components/sidebar/attributes-block.tsx +7 -6
- package/src/components/sidebar/conversation-view.tsx +3 -2
- package/src/components/sidebar/copyable-data-block.tsx +17 -14
- package/src/components/sidebar/entity-detail-panel.tsx +2 -7
- package/src/components/stream-image-preview.tsx +1 -1
- package/src/components/stream-viewer.tsx +4 -4
- package/src/components/trace-viewer/components/detail-panel-shell.tsx +3 -0
- package/src/components/trace-viewer/components/event-list.tsx +16 -18
- package/src/components/trace-viewer/components/middle-truncate/truncate.ts +1 -2
- package/src/components/trace-viewer/components/minimap.tsx +4 -3
- package/src/components/trace-viewer/components/timeline.tsx +0 -2
- package/src/components/trace-viewer/trace-viewer.tsx +19 -38
- package/src/components/ui/button.tsx +144 -46
- package/src/components/ui/context-card.tsx +2 -2
- package/src/components/ui/copy-button.tsx +86 -0
- package/src/components/ui/data-inspector.tsx +23 -67
- package/src/components/ui/decrypt-button.tsx +23 -48
- package/src/components/ui/duplicate-event-tooltip.tsx +1 -22
- package/src/components/ui/error-stack-block.tsx +4 -4
- package/src/components/ui/icon-button.tsx +1 -3
- package/src/components/ui/kbd.tsx +0 -2
- package/src/components/ui/search-input.tsx +143 -0
- package/src/components/ui/spinner.tsx +105 -55
- package/src/components/workflow-traces/trace-span-construction.ts +2 -2
- package/src/index.ts +7 -55
- package/src/lib/event-analysis.ts +1 -104
- package/src/lib/event-list-model.ts +15 -12
- package/src/lib/exact-event-search-id.ts +0 -13
- package/src/lib/hydration.ts +6 -31
- package/src/lib/stream-display.ts +1 -1
- package/src/lib/trace-builder.ts +1 -1
- package/src/lib/utils.ts +0 -48
- package/src/styles.css +286 -117
- package/dist/components/trace-viewer/components/copy-button.d.ts +0 -9
- package/dist/components/trace-viewer/components/copy-button.d.ts.map +0 -1
- package/dist/components/trace-viewer/components/copy-button.js +0 -27
- package/dist/components/ui/alert.d.ts +0 -9
- package/dist/components/ui/alert.d.ts.map +0 -1
- package/dist/components/ui/alert.js +0 -23
- package/dist/components/ui/card.d.ts +0 -9
- package/dist/components/ui/card.d.ts.map +0 -1
- package/dist/components/ui/card.js +0 -18
- package/dist/components/ui/load-more-button.d.ts +0 -13
- package/dist/components/ui/load-more-button.d.ts.map +0 -1
- package/dist/components/ui/load-more-button.js +0 -12
- package/dist/components/ui/menu-dropdown.d.ts +0 -16
- package/dist/components/ui/menu-dropdown.d.ts.map +0 -1
- package/dist/components/ui/menu-dropdown.js +0 -30
- package/dist/hooks/use-dark-mode.d.ts +0 -9
- package/dist/hooks/use-dark-mode.d.ts.map +0 -1
- package/dist/hooks/use-dark-mode.js +0 -30
- package/dist/lib/event-materialization.d.ts +0 -91
- package/dist/lib/event-materialization.d.ts.map +0 -1
- package/dist/lib/event-materialization.js +0 -219
- package/src/components/index.d.ts +0 -1
- package/src/components/trace-viewer/components/copy-button.tsx +0 -68
- package/src/components/ui/alert.tsx +0 -59
- package/src/components/ui/card.tsx +0 -79
- package/src/components/ui/load-more-button.tsx +0 -38
- package/src/components/ui/menu-dropdown.tsx +0 -97
- package/src/hooks/use-dark-mode.ts +0 -34
- package/src/index.d.ts +0 -1
- package/src/lib/event-materialization.ts +0 -304
|
@@ -17,11 +17,10 @@ import {
|
|
|
17
17
|
DetailMonoKeyValueRow,
|
|
18
18
|
} from '../sidebar/attributes-block';
|
|
19
19
|
import { serializeForClipboard } from '../sidebar/copyable-data-block';
|
|
20
|
-
import { CopyButton } from '../trace-viewer/components/copy-button';
|
|
21
20
|
import { DetailPanelShell } from '../trace-viewer/components/detail-panel-shell';
|
|
22
21
|
import type { DetailPanelWidth } from '../trace-viewer/components/use-detail-panel-width';
|
|
23
|
-
import { Button } from '../ui/button';
|
|
24
22
|
import { Collapsible } from '../ui/collapsible';
|
|
23
|
+
import { CopyButton } from '../ui/copy-button';
|
|
25
24
|
import { DataInspector, DecryptClickContext } from '../ui/data-inspector';
|
|
26
25
|
import { DecryptButton } from '../ui/decrypt-button';
|
|
27
26
|
import {
|
|
@@ -29,7 +28,9 @@ import {
|
|
|
29
28
|
isStructuredError,
|
|
30
29
|
type StructuredErrorRecord,
|
|
31
30
|
} from '../ui/error-stack-block';
|
|
31
|
+
import { IconButton } from '../ui/icon-button';
|
|
32
32
|
import { Skeleton } from '../ui/skeleton';
|
|
33
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '../ui/tooltip';
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
* Event types whose eventData contains an error field with a StructuredError.
|
|
@@ -136,9 +137,8 @@ function PayloadView({
|
|
|
136
137
|
label="Payload"
|
|
137
138
|
actions={
|
|
138
139
|
<CopyButton
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
className="flex h-6 w-6 items-center justify-center rounded-md p-0 hover:bg-gray-alpha-200"
|
|
140
|
+
textToCopy={serializeForClipboard(cleaned)}
|
|
141
|
+
aria-label="Copy payload"
|
|
142
142
|
/>
|
|
143
143
|
}
|
|
144
144
|
>
|
|
@@ -264,7 +264,7 @@ function EventDetailsBody({
|
|
|
264
264
|
const structuredError = extractStructuredError(data, event.eventType);
|
|
265
265
|
|
|
266
266
|
return (
|
|
267
|
-
<div className="@container px-4">
|
|
267
|
+
<div className="@container px-4 pb-8">
|
|
268
268
|
{/* Start and since-start are already in the selected row; Timing adds
|
|
269
269
|
the step's breakdown, or the duration for other events. */}
|
|
270
270
|
{timingTotal > 0 ? (
|
|
@@ -376,31 +376,27 @@ export function EventDetailsPanel({
|
|
|
376
376
|
width={width}
|
|
377
377
|
itemLabel="event"
|
|
378
378
|
title={
|
|
379
|
-
<span className="
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
<
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
379
|
+
<span className="truncate block">{row.name || event.eventType}</span>
|
|
380
|
+
}
|
|
381
|
+
actions={
|
|
382
|
+
onViewInTrace ? (
|
|
383
|
+
<Tooltip>
|
|
384
|
+
<TooltipTrigger asChild>
|
|
385
|
+
<IconButton
|
|
386
|
+
aria-label="View in Trace"
|
|
387
|
+
onClick={() => onViewInTrace(getEventSpanId(event))}
|
|
388
|
+
>
|
|
389
|
+
<ChartGantt className="w-4 h-4" />
|
|
390
|
+
</IconButton>
|
|
391
|
+
</TooltipTrigger>
|
|
392
|
+
<TooltipContent>View in Trace</TooltipContent>
|
|
393
|
+
</Tooltip>
|
|
394
|
+
) : null
|
|
387
395
|
}
|
|
388
396
|
onPrev={onPrev}
|
|
389
397
|
onNext={onNext}
|
|
390
398
|
onClose={onClose}
|
|
391
399
|
>
|
|
392
|
-
{onViewInTrace ? (
|
|
393
|
-
<div className="px-4 pb-2">
|
|
394
|
-
<Button
|
|
395
|
-
variant="secondary"
|
|
396
|
-
size="small"
|
|
397
|
-
onClick={() => onViewInTrace(getEventSpanId(event))}
|
|
398
|
-
>
|
|
399
|
-
<ChartGantt />
|
|
400
|
-
View in Trace
|
|
401
|
-
</Button>
|
|
402
|
-
</div>
|
|
403
|
-
) : null}
|
|
404
400
|
<EventDetailsBody key={event.eventId} {...body} />
|
|
405
401
|
</DetailPanelShell>
|
|
406
402
|
);
|
|
@@ -1,47 +1,54 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Info } from 'lucide-react';
|
|
4
|
+
import { useId, useRef, useState } from 'react';
|
|
5
|
+
import { SearchInput } from '../ui/search-input';
|
|
6
|
+
|
|
7
|
+
/** How long typing has to pause before the hint shows. */
|
|
8
|
+
const HINT_DELAY_MS = 500;
|
|
5
9
|
|
|
6
10
|
/** The events search box. */
|
|
7
11
|
export function EventListToolbar({
|
|
8
12
|
query,
|
|
13
|
+
hint,
|
|
9
14
|
onQueryChange,
|
|
10
15
|
}: {
|
|
11
16
|
query: string;
|
|
17
|
+
hint: string | null;
|
|
12
18
|
onQueryChange: (query: string) => void;
|
|
13
19
|
}) {
|
|
20
|
+
const hintId = useId();
|
|
21
|
+
const [paused, setPaused] = useState(false);
|
|
22
|
+
const pauseTimer = useRef<ReturnType<typeof setTimeout>>(undefined);
|
|
23
|
+
|
|
24
|
+
const handleQueryChange = (next: string) => {
|
|
25
|
+
// With no hint showing, the next one waits for typing to pause.
|
|
26
|
+
if (!hint) setPaused(false);
|
|
27
|
+
clearTimeout(pauseTimer.current);
|
|
28
|
+
pauseTimer.current = setTimeout(() => setPaused(true), HINT_DELAY_MS);
|
|
29
|
+
onQueryChange(next);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const shownHint = paused ? hint : null;
|
|
14
33
|
return (
|
|
15
|
-
<div className="
|
|
16
|
-
<
|
|
17
|
-
<input
|
|
18
|
-
type="text"
|
|
34
|
+
<div className="shrink-0">
|
|
35
|
+
<SearchInput
|
|
19
36
|
name="event-list-search"
|
|
20
|
-
|
|
37
|
+
label="Search events"
|
|
21
38
|
placeholder="Search by step ID, wait ID, hook ID, or event ID…"
|
|
39
|
+
aria-describedby={hintId}
|
|
22
40
|
value={query}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (e.key === 'Escape' && query) {
|
|
26
|
-
e.preventDefault();
|
|
27
|
-
e.stopPropagation();
|
|
28
|
-
onQueryChange('');
|
|
29
|
-
}
|
|
30
|
-
}}
|
|
31
|
-
className="min-w-0 flex-1 bg-transparent text-label-14 text-gray-1000 outline-none placeholder:text-gray-800"
|
|
41
|
+
onValueChange={handleQueryChange}
|
|
42
|
+
className="pl-[34px]"
|
|
32
43
|
/>
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Esc
|
|
42
|
-
</Kbd>
|
|
43
|
-
</button>
|
|
44
|
-
) : null}
|
|
44
|
+
<div id={hintId} aria-live="polite">
|
|
45
|
+
{shownHint ? (
|
|
46
|
+
<div className="flex h-8 items-center gap-1.5 bg-gray-100 pl-[34px] pr-2 text-label-13 text-gray-1000">
|
|
47
|
+
<Info className="h-3.5 w-3.5 shrink-0 text-gray-900" />
|
|
48
|
+
<span className="min-w-0 truncate">{shownHint}</span>
|
|
49
|
+
</div>
|
|
50
|
+
) : null}
|
|
51
|
+
</div>
|
|
45
52
|
</div>
|
|
46
53
|
);
|
|
47
54
|
}
|
|
@@ -27,15 +27,15 @@ const COL = {
|
|
|
27
27
|
time: 'w-[172px]',
|
|
28
28
|
since: 'w-[100px]',
|
|
29
29
|
event: 'w-[136px]',
|
|
30
|
-
name: 'w-[
|
|
30
|
+
name: 'w-[280px]',
|
|
31
31
|
duration: 'w-[96px] justify-end',
|
|
32
32
|
} as const;
|
|
33
33
|
|
|
34
34
|
const CELL = 'flex h-full shrink-0 items-center overflow-hidden px-1.5';
|
|
35
35
|
|
|
36
36
|
const LEVEL_ROW_CLASS: Record<EventLevel, string> = {
|
|
37
|
-
default: 'text-gray-1000 hover:bg-gray-
|
|
38
|
-
muted: 'text-gray-700 hover:bg-gray-
|
|
37
|
+
default: 'text-gray-1000 hover:bg-gray-100',
|
|
38
|
+
muted: 'text-gray-700 hover:bg-gray-100',
|
|
39
39
|
warning: 'bg-amber-100 text-amber-900 hover:bg-amber-200',
|
|
40
40
|
error: 'bg-red-100 text-red-900 hover:bg-red-200',
|
|
41
41
|
};
|
|
@@ -49,8 +49,8 @@ const LEVEL_SEPARATOR_CLASS: Record<EventLevel, string> = {
|
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
const LEVEL_SELECTED_CLASS: Record<EventLevel, string> = {
|
|
52
|
-
default: 'bg-
|
|
53
|
-
muted: 'bg-
|
|
52
|
+
default: 'bg-blue-300 hover:bg-blue-300',
|
|
53
|
+
muted: 'bg-blue-300 hover:bg-blue-300',
|
|
54
54
|
warning: 'bg-amber-300 hover:bg-amber-300',
|
|
55
55
|
error: 'bg-red-300 hover:bg-red-300',
|
|
56
56
|
};
|
|
@@ -147,7 +147,7 @@ export function EventListHeader({
|
|
|
147
147
|
return (
|
|
148
148
|
<div
|
|
149
149
|
role="row"
|
|
150
|
-
className="
|
|
150
|
+
className="flex h-10 shrink-0 items-center border-b border-gray-alpha-400 px-1 font-sans text-label-14 text-gray-900"
|
|
151
151
|
>
|
|
152
152
|
<div className={cn(CELL, COL.level)} />
|
|
153
153
|
{showOccurred ? (
|
|
@@ -159,8 +159,8 @@ export function EventListHeader({
|
|
|
159
159
|
sortButton('Time')
|
|
160
160
|
)}
|
|
161
161
|
<div className={cn(CELL, COL.since)} />
|
|
162
|
-
<div className={cn(CELL, COL.event)}>Event</div>
|
|
163
162
|
<div className={cn(CELL, COL.name)}>Name</div>
|
|
163
|
+
<div className={cn(CELL, COL.event)}>Event</div>
|
|
164
164
|
<div
|
|
165
165
|
className={cn(CELL, 'min-w-0 flex-1 h-3.5 border-l border-gray-400')}
|
|
166
166
|
>
|
|
@@ -194,8 +194,8 @@ export interface EventRowProps {
|
|
|
194
194
|
isSelected: boolean;
|
|
195
195
|
/** The one row Tab lands on (roving tabindex): the selection, else the first row. */
|
|
196
196
|
isTabStop: boolean;
|
|
197
|
-
/**
|
|
198
|
-
|
|
197
|
+
/** Whether the row belongs to the selected event's step, hook, wait or run. */
|
|
198
|
+
relation?: 'related' | 'unrelated';
|
|
199
199
|
onSelect: (event: Event) => void;
|
|
200
200
|
/** Show occurredAt separately instead of folding it into the Created timestamp. */
|
|
201
201
|
showSeparateEventOccurrenceTimestamps?: boolean;
|
|
@@ -206,7 +206,7 @@ export function EventRow({
|
|
|
206
206
|
index,
|
|
207
207
|
isSelected,
|
|
208
208
|
isTabStop,
|
|
209
|
-
|
|
209
|
+
relation,
|
|
210
210
|
onSelect,
|
|
211
211
|
showSeparateEventOccurrenceTimestamps = false,
|
|
212
212
|
}: EventRowProps) {
|
|
@@ -215,10 +215,11 @@ export function EventRow({
|
|
|
215
215
|
const displayedAt = showSeparateEventOccurrenceTimestamps
|
|
216
216
|
? new Date(event.createdAt)
|
|
217
217
|
: getEffectiveEventDate(event);
|
|
218
|
-
const zebra = (level === 'default' || level === 'muted') && index % 2 === 1;
|
|
219
218
|
// Tinted rows keep one color throughout.
|
|
220
|
-
const
|
|
221
|
-
|
|
219
|
+
const isTinted = level === 'warning' || level === 'error';
|
|
220
|
+
const isRelated = relation === 'related';
|
|
221
|
+
const isMuted = relation === 'unrelated' && !isTinted;
|
|
222
|
+
const secondaryClass = isTinted || isMuted ? undefined : 'text-gray-900';
|
|
222
223
|
|
|
223
224
|
return (
|
|
224
225
|
<div
|
|
@@ -236,7 +237,9 @@ export function EventRow({
|
|
|
236
237
|
className={cn(
|
|
237
238
|
'mx-1 mt-px flex h-6 cursor-pointer items-center rounded-md font-mono text-[13px] leading-5 outline-none focus-visible:relative focus-visible:z-10 focus-visible:shadow-[0_0_0_2px_var(--ds-focus-color)]',
|
|
238
239
|
LEVEL_ROW_CLASS[level],
|
|
239
|
-
|
|
240
|
+
!isTinted && !relation && index % 2 === 1 && 'bg-background-200',
|
|
241
|
+
isRelated && !isTinted && 'bg-blue-300/50 hover:bg-blue-300/75',
|
|
242
|
+
isMuted && 'text-gray-700 [&_svg]:text-gray-700',
|
|
240
243
|
isSelected && LEVEL_SELECTED_CLASS[level]
|
|
241
244
|
)}
|
|
242
245
|
>
|
|
@@ -255,16 +258,6 @@ export function EventRow({
|
|
|
255
258
|
? formatSinceStart(row.sinceStartMs)
|
|
256
259
|
: ''}
|
|
257
260
|
</div>
|
|
258
|
-
<div className={cn(CELL, COL.event)}>
|
|
259
|
-
<EventNoticeTooltip notice={notice}>
|
|
260
|
-
<span
|
|
261
|
-
className={cn('truncate', notice && 'line-through')}
|
|
262
|
-
title={event.eventType}
|
|
263
|
-
>
|
|
264
|
-
{event.eventType}
|
|
265
|
-
</span>
|
|
266
|
-
</EventNoticeTooltip>
|
|
267
|
-
</div>
|
|
268
261
|
<div className={cn(CELL, COL.name, 'gap-2')} title={name || undefined}>
|
|
269
262
|
<ResourceIcon
|
|
270
263
|
resource={row.resource}
|
|
@@ -275,13 +268,24 @@ export function EventRow({
|
|
|
275
268
|
<span
|
|
276
269
|
className={cn(
|
|
277
270
|
'-mx-1 truncate rounded px-1',
|
|
278
|
-
isRelated && '
|
|
271
|
+
isRelated && 'text-blue-900',
|
|
272
|
+
isRelated && isTinted && 'bg-blue-100'
|
|
279
273
|
)}
|
|
280
274
|
>
|
|
281
275
|
{name}
|
|
282
276
|
</span>
|
|
283
277
|
) : null}
|
|
284
278
|
</div>
|
|
279
|
+
<div className={cn(CELL, COL.event)}>
|
|
280
|
+
<EventNoticeTooltip notice={notice}>
|
|
281
|
+
<span
|
|
282
|
+
className={cn('truncate', notice && 'line-through')}
|
|
283
|
+
title={event.eventType}
|
|
284
|
+
>
|
|
285
|
+
{event.eventType}
|
|
286
|
+
</span>
|
|
287
|
+
</EventNoticeTooltip>
|
|
288
|
+
</div>
|
|
285
289
|
<div
|
|
286
290
|
className={cn(
|
|
287
291
|
CELL,
|
|
@@ -315,7 +319,7 @@ export function EventRowsSkeleton() {
|
|
|
315
319
|
key={i}
|
|
316
320
|
className={cn(
|
|
317
321
|
'mx-1 mt-px flex h-6 items-center rounded-md',
|
|
318
|
-
i % 2 === 1 && 'bg-
|
|
322
|
+
i % 2 === 1 && 'bg-background-200'
|
|
319
323
|
)}
|
|
320
324
|
>
|
|
321
325
|
<div className={cn(CELL, COL.level)} />
|
|
@@ -325,12 +329,12 @@ export function EventRowsSkeleton() {
|
|
|
325
329
|
<div className={cn(CELL, COL.since)}>
|
|
326
330
|
<Skeleton className="h-3 w-12" />
|
|
327
331
|
</div>
|
|
328
|
-
<div className={cn(CELL, COL.event)}>
|
|
329
|
-
<Skeleton className="h-3 w-[104px]" />
|
|
330
|
-
</div>
|
|
331
332
|
<div className={cn(CELL, COL.name)}>
|
|
332
333
|
<Skeleton className="h-3 w-24" />
|
|
333
334
|
</div>
|
|
335
|
+
<div className={cn(CELL, COL.event)}>
|
|
336
|
+
<Skeleton className="h-3 w-[104px]" />
|
|
337
|
+
</div>
|
|
334
338
|
<div className={cn(CELL, 'min-w-0 flex-1')}>
|
|
335
339
|
<Skeleton
|
|
336
340
|
className="h-3"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import type { Event } from '@workflow/world';
|
|
4
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
5
5
|
import type { EventSearchState } from '../../lib/event-list-model';
|
|
6
6
|
import {
|
|
7
7
|
type ExactIdSearchResult,
|
|
@@ -12,12 +12,17 @@ import {
|
|
|
12
12
|
/** How long typing has to pause before an exact-ID lookup is sent. */
|
|
13
13
|
const EXACT_SEARCH_DEBOUNCE_MS = 300;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
type ExactSearchOutcome = { query: string } & (
|
|
15
|
+
type ExactSearchAnswer =
|
|
17
16
|
| { status: 'ok'; events: Event[]; truncated: boolean }
|
|
18
17
|
| { status: 'not_found' }
|
|
19
|
-
| { status: 'error'; message
|
|
20
|
-
|
|
18
|
+
| { status: 'error'; message?: string };
|
|
19
|
+
|
|
20
|
+
/** A settled exact-ID lookup, for the query and attempt it answered. */
|
|
21
|
+
type ExactSearchOutcome = {
|
|
22
|
+
query: string;
|
|
23
|
+
attempt: number;
|
|
24
|
+
answer: ExactSearchAnswer;
|
|
25
|
+
};
|
|
21
26
|
|
|
22
27
|
export type ExactSearchHandler = (
|
|
23
28
|
id: string,
|
|
@@ -28,15 +33,18 @@ export type ExactSearchHandler = (
|
|
|
28
33
|
/**
|
|
29
34
|
* The Events tab search box. The input text is the only thing typed; the
|
|
30
35
|
* search state is derived from it plus the latest settled exact-ID lookup, so
|
|
31
|
-
* a lookup that answered an older query is never shown for the
|
|
36
|
+
* a lookup that answered an older query or attempt is never shown for the
|
|
37
|
+
* current one.
|
|
32
38
|
*/
|
|
33
39
|
export function useEventSearch(onExactIdSearch?: ExactSearchHandler): {
|
|
34
40
|
query: string;
|
|
35
41
|
setQuery: (query: string) => void;
|
|
36
42
|
search: EventSearchState;
|
|
43
|
+
retry: () => void;
|
|
37
44
|
} {
|
|
38
45
|
const [query, setQuery] = useState('');
|
|
39
46
|
const [outcome, setOutcome] = useState<ExactSearchOutcome | null>(null);
|
|
47
|
+
const [attempt, setAttempt] = useState(0);
|
|
40
48
|
|
|
41
49
|
const trimmed = query.trim();
|
|
42
50
|
const parsed = useMemo(() => parseExactWorkflowSearchId(trimmed), [trimmed]);
|
|
@@ -47,7 +55,7 @@ export function useEventSearch(onExactIdSearch?: ExactSearchHandler): {
|
|
|
47
55
|
// Aborted when the query changes, so a superseded lookup never settles.
|
|
48
56
|
const abortController = new AbortController();
|
|
49
57
|
const timer = setTimeout(async () => {
|
|
50
|
-
let
|
|
58
|
+
let answer: ExactSearchAnswer;
|
|
51
59
|
try {
|
|
52
60
|
const result = await onExactIdSearch(
|
|
53
61
|
parsed.id,
|
|
@@ -55,28 +63,25 @@ export function useEventSearch(onExactIdSearch?: ExactSearchHandler): {
|
|
|
55
63
|
abortController.signal
|
|
56
64
|
);
|
|
57
65
|
if (result.status === 'error') {
|
|
58
|
-
|
|
66
|
+
answer = result;
|
|
59
67
|
} else if (
|
|
60
68
|
result.status === 'not_found' ||
|
|
61
69
|
result.events.length === 0
|
|
62
70
|
) {
|
|
63
|
-
|
|
71
|
+
answer = { status: 'not_found' };
|
|
64
72
|
} else {
|
|
65
|
-
|
|
66
|
-
query: trimmed,
|
|
73
|
+
answer = {
|
|
67
74
|
status: 'ok',
|
|
68
75
|
events: result.events,
|
|
69
76
|
truncated: Boolean(result.truncated),
|
|
70
77
|
};
|
|
71
78
|
}
|
|
72
79
|
} catch {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
};
|
|
80
|
+
answer = { status: 'error' };
|
|
81
|
+
}
|
|
82
|
+
if (!abortController.signal.aborted) {
|
|
83
|
+
setOutcome({ query: trimmed, attempt, answer });
|
|
78
84
|
}
|
|
79
|
-
if (!abortController.signal.aborted) setOutcome(next);
|
|
80
85
|
}, EXACT_SEARCH_DEBOUNCE_MS);
|
|
81
86
|
|
|
82
87
|
return () => {
|
|
@@ -86,7 +91,9 @@ export function useEventSearch(onExactIdSearch?: ExactSearchHandler): {
|
|
|
86
91
|
// answer it had before.
|
|
87
92
|
setOutcome(null);
|
|
88
93
|
};
|
|
89
|
-
}, [trimmed, parsed, onExactIdSearch]);
|
|
94
|
+
}, [trimmed, parsed, onExactIdSearch, attempt]);
|
|
95
|
+
|
|
96
|
+
const retry = useCallback(() => setAttempt((n) => n + 1), []);
|
|
90
97
|
|
|
91
98
|
const search = useMemo((): EventSearchState => {
|
|
92
99
|
if (!trimmed) return { status: 'idle' };
|
|
@@ -94,11 +101,11 @@ export function useEventSearch(onExactIdSearch?: ExactSearchHandler): {
|
|
|
94
101
|
return { status: 'incomplete', query: trimmed };
|
|
95
102
|
}
|
|
96
103
|
if (!onExactIdSearch) return { status: 'unavailable', query: trimmed };
|
|
97
|
-
if (outcome?.query !== trimmed) {
|
|
104
|
+
if (outcome?.query !== trimmed || outcome.attempt !== attempt) {
|
|
98
105
|
return { status: 'loading', query: trimmed, id: parsed };
|
|
99
106
|
}
|
|
100
|
-
return { ...outcome, id: parsed };
|
|
101
|
-
}, [trimmed, parsed, onExactIdSearch, outcome]);
|
|
107
|
+
return { ...outcome.answer, query: trimmed, id: parsed };
|
|
108
|
+
}, [trimmed, parsed, onExactIdSearch, outcome, attempt]);
|
|
102
109
|
|
|
103
|
-
return { query, setQuery, search };
|
|
110
|
+
return { query, setQuery, search, retry };
|
|
104
111
|
}
|