Skip to content

Commit 77bd829

Browse files
committed
Keep the side panel open when switching tasks & remove links from detail panel
1 parent 77455f3 commit 77bd829

File tree

3 files changed

+119
-32
lines changed

3 files changed

+119
-32
lines changed

apps/webapp/app/presenters/v3/SpanPresenter.server.ts

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,21 @@ export class SpanPresenter extends BasePresenter {
125125
exportName: true,
126126
},
127127
},
128+
//relationships
129+
rootTaskRun: {
130+
select: {
131+
taskIdentifier: true,
132+
friendlyId: true,
133+
spanId: true,
134+
},
135+
},
136+
parentTaskRun: {
137+
select: {
138+
taskIdentifier: true,
139+
friendlyId: true,
140+
spanId: true,
141+
},
142+
},
128143
},
129144
where: {
130145
spanId,
@@ -183,8 +198,6 @@ export class SpanPresenter extends BasePresenter {
183198
}
184199
}
185200

186-
const span = await eventRepository.getSpan(spanId, run.traceId);
187-
188201
const context = {
189202
task: {
190203
id: run.taskIdentifier,
@@ -270,7 +283,15 @@ export class SpanPresenter extends BasePresenter {
270283
output,
271284
outputType: finishedAttempt?.outputType ?? "application/json",
272285
error,
273-
links: span?.links,
286+
relationships: {
287+
root: run.rootTaskRun
288+
? {
289+
...run.rootTaskRun,
290+
isParent: run.parentTaskRun?.friendlyId === run.rootTaskRun.friendlyId,
291+
}
292+
: undefined,
293+
parent: run.parentTaskRun ?? undefined,
294+
},
274295
context: JSON.stringify(context, null, 2),
275296
};
276297
}
@@ -295,10 +316,22 @@ export class SpanPresenter extends BasePresenter {
295316
return;
296317
}
297318

319+
const triggeredRuns = await this._replica.taskRun.findMany({
320+
select: {
321+
friendlyId: true,
322+
taskIdentifier: true,
323+
spanId: true,
324+
},
325+
where: {
326+
parentSpanId: spanId,
327+
},
328+
});
329+
298330
return {
299331
...span,
300332
events: span.events,
301333
properties: span.properties ? JSON.stringify(span.properties, null, 2) : undefined,
334+
triggeredRuns,
302335
showActionBar: span.show?.actions === true,
303336
};
304337
}

apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.v3.$projectParam.runs.$runParam.spans.$spanParam/route.tsx

Lines changed: 79 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -265,18 +265,6 @@ function SpanBody({
265265
)}
266266
</Property.Value>
267267
</Property.Item>
268-
{span.links && span.links.length > 0 && (
269-
<Property.Item>
270-
<Property.Label>Links</Property.Label>
271-
<Property.Value>
272-
<div className="space-y-1">
273-
{span.links.map((link, index) => (
274-
<SpanLinkElement key={index} link={link} />
275-
))}
276-
</div>
277-
</Property.Value>
278-
</Property.Item>
279-
)}
280268
</Property.Table>
281269
</div>
282270
) : (
@@ -318,13 +306,22 @@ function SpanBody({
318306
<Property.Label>Message</Property.Label>
319307
<Property.Value>{span.message}</Property.Value>
320308
</Property.Item>
321-
{span.links && span.links.length > 0 && (
309+
{span.triggeredRuns.length > 0 && (
322310
<Property.Item>
323-
<Property.Label>Links</Property.Label>
311+
<Property.Label>Triggered runs</Property.Label>
324312
<Property.Value>
325313
<div className="space-y-1">
326-
{span.links.map((link, index) => (
327-
<SpanLinkElement key={index} link={link} />
314+
{span.triggeredRuns.map((run) => (
315+
<TextLink
316+
to={v3RunSpanPath(
317+
organization,
318+
project,
319+
{ friendlyId: run.friendlyId },
320+
{ spanId: run.spanId }
321+
)}
322+
>
323+
{run.taskIdentifier} ({run.friendlyId})
324+
</TextLink>
328325
))}
329326
</div>
330327
</Property.Value>
@@ -551,18 +548,7 @@ function RunBody({
551548
)}
552549
</Property.Value>
553550
</Property.Item>
554-
{run.links && run.links.length > 0 && (
555-
<Property.Item>
556-
<Property.Label>Links</Property.Label>
557-
<Property.Value>
558-
<div className="space-y-1">
559-
{run.links.map((link, index) => (
560-
<SpanLinkElement key={index} link={link} />
561-
))}
562-
</div>
563-
</Property.Value>
564-
</Property.Item>
565-
)}
551+
566552
<Property.Item>
567553
<Property.Label>Run invocation cost</Property.Label>
568554
<Property.Value>
@@ -613,6 +599,71 @@ function RunBody({
613599
<TaskRunStatusCombo status={run.status} className="text-sm" />
614600
</div>
615601
<RunTimeline run={run} />
602+
{run.relationships.root ? (
603+
<Property.Table>
604+
{run.relationships.root.isParent ? (
605+
<Property.Item>
606+
<Property.Label>Root & Parent</Property.Label>
607+
<Property.Value>
608+
<TextLink
609+
to={v3RunSpanPath(
610+
organization,
611+
project,
612+
{
613+
friendlyId: run.relationships.root.friendlyId,
614+
},
615+
{ spanId: run.relationships.root.spanId }
616+
)}
617+
>
618+
{run.relationships.root.taskIdentifier} (
619+
{run.relationships.root.friendlyId})
620+
</TextLink>
621+
</Property.Value>
622+
</Property.Item>
623+
) : (
624+
<>
625+
<Property.Item>
626+
<Property.Label>Root</Property.Label>
627+
<Property.Value>
628+
<TextLink
629+
to={v3RunSpanPath(
630+
organization,
631+
project,
632+
{
633+
friendlyId: run.relationships.root.friendlyId,
634+
},
635+
{ spanId: run.relationships.root.spanId }
636+
)}
637+
>
638+
{run.relationships.root.taskIdentifier} (
639+
{run.relationships.root.friendlyId})
640+
</TextLink>
641+
</Property.Value>
642+
</Property.Item>
643+
{run.relationships.parent ? (
644+
<Property.Item>
645+
<Property.Label>Parent</Property.Label>
646+
<Property.Value>
647+
<TextLink
648+
to={v3RunSpanPath(
649+
organization,
650+
project,
651+
{
652+
friendlyId: run.relationships.parent.friendlyId,
653+
},
654+
{ spanId: run.relationships.parent.spanId }
655+
)}
656+
>
657+
{run.relationships.parent.taskIdentifier} (
658+
{run.relationships.parent.friendlyId})
659+
</TextLink>
660+
</Property.Value>
661+
</Property.Item>
662+
) : null}
663+
</>
664+
)}
665+
</Property.Table>
666+
) : null}
616667
{run.payload !== undefined && (
617668
<PacketDisplay data={run.payload} dataType={run.payloadType} title="Payload" />
618669
)}

references/v3-catalog/src/trigger/taskHierarchy.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ export const rootTask = task({
1717
}
1818
} else {
1919
if (useBatch) {
20-
await childTask.batchTrigger([{ payload: { useWaits, useBatch } }]);
20+
await childTask.batchTrigger([
21+
{ payload: { useWaits, useBatch } },
22+
{ payload: { useWaits, useBatch } },
23+
]);
2124
} else {
2225
await childTask.trigger({ useWaits, useBatch });
2326
}

0 commit comments

Comments
 (0)