@@ -11,7 +11,7 @@ import {
11
11
MagnifyingGlassPlusIcon ,
12
12
StopCircleIcon ,
13
13
} from "@heroicons/react/20/solid" ;
14
- import { useLoaderData , useParams , useRevalidator } from "@remix-run/react" ;
14
+ import { useLoaderData , useRevalidator } from "@remix-run/react" ;
15
15
import { type LoaderFunctionArgs , type SerializeFrom , json } from "@remix-run/server-runtime" ;
16
16
import { type Virtualizer } from "@tanstack/react-virtual" ;
17
17
import {
@@ -25,7 +25,8 @@ import { motion } from "framer-motion";
25
25
import { useCallback , useEffect , useRef , useState } from "react" ;
26
26
import { useHotkeys } from "react-hotkeys-hook" ;
27
27
import { redirect } from "remix-typedjson" ;
28
- import { ShowParentIcon , ShowParentIconSelected } from "~/assets/icons/ShowParentIcon" ;
28
+ import { MoveToTopIcon } from "~/assets/icons/MoveToTopIcon" ;
29
+ import { MoveUpIcon } from "~/assets/icons/MoveUpIcon" ;
29
30
import tileBgPath from "~/assets/images/error-banner-tile@2x.png" ;
30
31
import { DevDisconnectedBanner , useCrossEngineIsConnected } from "~/components/DevPresence" ;
31
32
import { WarmStartIconWithTooltip } from "~/components/WarmStarts" ;
@@ -87,15 +88,13 @@ import {
87
88
docsPath ,
88
89
v3BillingPath ,
89
90
v3RunParamsSchema ,
90
- v3RunPath ,
91
91
v3RunRedirectPath ,
92
92
v3RunSpanPath ,
93
93
v3RunStreamingPath ,
94
94
v3RunsPath ,
95
95
} from "~/utils/pathBuilder" ;
96
96
import { useCurrentPlan } from "../_app.orgs.$organizationSlug/route" ;
97
97
import { SpanView } from "../resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.runs.$runParam.spans.$spanParam/route" ;
98
- import { TextLink } from "~/components/primitives/TextLink" ;
99
98
100
99
const resizableSettings = {
101
100
parent : {
@@ -297,8 +296,7 @@ function TraceView({ run, trace, maximumLiveReloadingSetting, resizable }: Loade
297
296
return < > </ > ;
298
297
}
299
298
300
- const { events, parentRunFriendlyId, duration, rootSpanStatus, rootStartedAt, queuedDuration } =
301
- trace ;
299
+ const { events, duration, rootSpanStatus, rootStartedAt, queuedDuration } = trace ;
302
300
const shouldLiveReload = events . length <= maximumLiveReloadingSetting ;
303
301
304
302
const changeToSpan = useDebounce ( ( selectedSpan : string ) => {
@@ -335,7 +333,6 @@ function TraceView({ run, trace, maximumLiveReloadingSetting, resizable }: Loade
335
333
selectedId = { selectedSpanId }
336
334
key = { events [ 0 ] ?. id ?? "-" }
337
335
events = { events }
338
- parentRunFriendlyId = { parentRunFriendlyId }
339
336
onSelectedIdChanged = { ( selectedSpan ) => {
340
337
//instantly close the panel if no span is selected
341
338
if ( ! selectedSpan ) {
@@ -353,6 +350,7 @@ function TraceView({ run, trace, maximumLiveReloadingSetting, resizable }: Loade
353
350
shouldLiveReload = { shouldLiveReload }
354
351
maximumLiveReloadingSetting = { maximumLiveReloadingSetting }
355
352
rootRun = { run . rootTaskRun }
353
+ parentRun = { run . parentTaskRun }
356
354
isCompleted = { run . completedAt !== null }
357
355
/>
358
356
</ ResizablePanel >
@@ -471,7 +469,6 @@ function NoLogsView({ run, resizable }: LoaderData) {
471
469
type TasksTreeViewProps = {
472
470
events : TraceEvent [ ] ;
473
471
selectedId ?: string ;
474
- parentRunFriendlyId ?: string ;
475
472
onSelectedIdChanged : ( selectedId : string | undefined ) => void ;
476
473
totalDuration : number ;
477
474
rootSpanStatus : "executing" | "completed" | "failed" ;
@@ -485,13 +482,17 @@ type TasksTreeViewProps = {
485
482
taskIdentifier : string ;
486
483
spanId : string ;
487
484
} | null ;
485
+ parentRun : {
486
+ friendlyId : string ;
487
+ taskIdentifier : string ;
488
+ spanId : string ;
489
+ } | null ;
488
490
isCompleted : boolean ;
489
491
} ;
490
492
491
493
function TasksTreeView ( {
492
494
events,
493
495
selectedId,
494
- parentRunFriendlyId,
495
496
onSelectedIdChanged,
496
497
totalDuration,
497
498
rootSpanStatus,
@@ -501,6 +502,7 @@ function TasksTreeView({
501
502
shouldLiveReload,
502
503
maximumLiveReloadingSetting,
503
504
rootRun,
505
+ parentRun,
504
506
isCompleted,
505
507
} : TasksTreeViewProps ) {
506
508
const isAdmin = useHasAdminAccess ( ) ;
@@ -584,35 +586,32 @@ function TasksTreeView({
584
586
id = { resizableSettings . tree . tree . id }
585
587
default = { resizableSettings . tree . tree . default }
586
588
min = { resizableSettings . tree . tree . min }
587
- className = "pl-3"
588
589
>
589
590
< div className = "grid h-full grid-rows-[2rem_1fr] overflow-hidden" >
590
- < div className = "flex items-center pr-2" >
591
- { rootRun || parentRunFriendlyId ? (
591
+ < div className = "flex items-center pl-1 pr-2" >
592
+ { rootRun || parentRun ? (
592
593
< ShowParentOrRootLinks
593
594
relationships = { {
594
595
root : rootRun
595
596
? {
596
597
friendlyId : rootRun . friendlyId ,
597
598
taskIdentifier : rootRun . taskIdentifier ,
598
599
spanId : rootRun . spanId ,
599
- isParent : parentRunFriendlyId
600
- ? rootRun . friendlyId === parentRunFriendlyId
601
- : true ,
600
+ isParent : parentRun ? rootRun . friendlyId === parentRun . friendlyId : true ,
602
601
}
603
602
: undefined ,
604
603
parent :
605
- parentRunFriendlyId && rootRun ?. friendlyId !== parentRunFriendlyId
604
+ parentRun && rootRun ?. friendlyId !== parentRun . friendlyId
606
605
? {
607
- friendlyId : parentRunFriendlyId ,
606
+ friendlyId : parentRun . friendlyId ,
608
607
taskIdentifier : "" ,
609
608
spanId : "" ,
610
609
}
611
610
: undefined ,
612
611
} }
613
612
/>
614
613
) : (
615
- < Paragraph variant = "extra-small" className = "flex-1 text-charcoal-500" >
614
+ < Paragraph variant = "extra-small" className = "flex-1 pl-3 text-charcoal-500" >
616
615
This is the root task
617
616
</ Paragraph >
618
617
) }
@@ -631,6 +630,7 @@ function TasksTreeView({
631
630
nodes = { nodes }
632
631
getNodeProps = { getNodeProps }
633
632
getTreeProps = { getTreeProps }
633
+ parentClassName = "pl-3"
634
634
renderNode = { ( { node, state, index } ) => (
635
635
< >
636
636
< div
@@ -1166,54 +1166,81 @@ function ShowParentOrRootLinks({
1166
1166
// Case 1: Root is also the parent
1167
1167
if ( relationships . root ?. isParent === true ) {
1168
1168
return (
1169
- < TextLink
1169
+ < LinkButton
1170
+ variant = "minimal/small"
1170
1171
to = { v3RunSpanPath (
1171
1172
organization ,
1172
1173
project ,
1173
1174
environment ,
1174
1175
{ friendlyId : relationships . root . friendlyId } ,
1175
1176
{ spanId : relationships . root . spanId }
1176
1177
) }
1178
+ LeadingIcon = { MoveToTopIcon }
1177
1179
shortcut = { { key : "t" } }
1180
+ hideShortcutKey
1181
+ tooltip = {
1182
+ < div className = "-mr-1 flex items-center gap-1" >
1183
+ < Paragraph variant = "extra-small" > Jump to root/parent run</ Paragraph >
1184
+ < ShortcutKey shortcut = { { key : "t" } } variant = "small" />
1185
+ </ div >
1186
+ }
1178
1187
className = "text-xs"
1179
1188
>
1180
- Jump to Root & Parent
1181
- </ TextLink >
1189
+ Root/parent
1190
+ </ LinkButton >
1182
1191
) ;
1183
1192
}
1184
1193
1185
1194
// Case 2: Root and Parent are different runs
1186
1195
return (
1187
- < div className = "flex flex-1 items-center gap-2 " >
1196
+ < div className = "flex items-center" >
1188
1197
{ relationships . root && (
1189
- < TextLink
1198
+ < LinkButton
1199
+ variant = "minimal/small"
1190
1200
to = { v3RunSpanPath (
1191
1201
organization ,
1192
1202
project ,
1193
1203
environment ,
1194
1204
{ friendlyId : relationships . root . friendlyId } ,
1195
1205
{ spanId : relationships . root . spanId }
1196
1206
) }
1207
+ LeadingIcon = { MoveToTopIcon }
1197
1208
shortcut = { { key : "t" } }
1209
+ hideShortcutKey
1210
+ tooltip = {
1211
+ < div className = "-mr-1 flex items-center gap-1" >
1212
+ < Paragraph variant = "extra-small" > Jump to root run</ Paragraph >
1213
+ < ShortcutKey shortcut = { { key : "t" } } variant = "small" />
1214
+ </ div >
1215
+ }
1198
1216
className = "text-xs"
1199
1217
>
1200
- Jump to Root
1201
- </ TextLink >
1218
+ Root
1219
+ </ LinkButton >
1202
1220
) }
1203
1221
{ relationships . parent && (
1204
- < TextLink
1222
+ < LinkButton
1223
+ variant = "minimal/small"
1205
1224
to = { v3RunSpanPath (
1206
1225
organization ,
1207
1226
project ,
1208
1227
environment ,
1209
1228
{ friendlyId : relationships . parent . friendlyId } ,
1210
1229
{ spanId : relationships . parent . spanId }
1211
1230
) }
1231
+ LeadingIcon = { MoveUpIcon }
1212
1232
shortcut = { { key : "p" } }
1233
+ hideShortcutKey
1234
+ tooltip = {
1235
+ < div className = "-mr-1 flex items-center gap-1" >
1236
+ < Paragraph variant = "extra-small" > Jump to parent run</ Paragraph >
1237
+ < ShortcutKey shortcut = { { key : "p" } } variant = "small" />
1238
+ </ div >
1239
+ }
1213
1240
className = "text-xs"
1214
1241
>
1215
- Jump to Parent
1216
- </ TextLink >
1242
+ Parent
1243
+ </ LinkButton >
1217
1244
) }
1218
1245
</ div >
1219
1246
) ;
0 commit comments