Skip to content

Commit 9663a05

Browse files
committed
cleaned LogDetails view
1 parent 075175f commit 9663a05

File tree

3 files changed

+56
-109
lines changed

3 files changed

+56
-109
lines changed

apps/webapp/app/components/logs/LogDetailView.tsx

Lines changed: 33 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { XMarkIcon, ArrowTopRightOnSquareIcon, CheckIcon, ClockIcon } from "@heroicons/react/20/solid";
22
import { Link } from "@remix-run/react";
33
import {
4-
formatDurationNanoseconds,
54
type MachinePresetName,
65
formatDurationMilliseconds,
76
} from "@trigger.dev/core/v3";
@@ -267,16 +266,14 @@ export function LogDetailView({ logId, initialLog, onClose, searchTerm }: LogDet
267266
>
268267
{log.level}
269268
</span>
270-
<span className="text-text-dimmed">·</span>
271-
<DateTime date={log.startTime} />
272269
</div>
273270
<Button variant="minimal/small" onClick={onClose} shortcut={{ key: "esc" }}>
274271
<XMarkIcon className="size-5" />
275272
</Button>
276273
</div>
277274

278275
{/* Tabs */}
279-
<div className="border-b border-grid-dimmed px-4">
276+
<div className="flex items-center justify-between border-b border-grid-dimmed px-4">
280277
<TabContainer>
281278
<TabButton
282279
isActive={activeTab === "details"}
@@ -295,6 +292,11 @@ export function LogDetailView({ logId, initialLog, onClose, searchTerm }: LogDet
295292
Run
296293
</TabButton>
297294
</TabContainer>
295+
<Link to={runPath} target="_blank" rel="noopener noreferrer">
296+
<Button variant="secondary/small" LeadingIcon={ArrowTopRightOnSquareIcon}>
297+
View Full Run
298+
</Button>
299+
</Link>
298300
</div>
299301

300302
{/* Content */}
@@ -323,87 +325,35 @@ function DetailsTab({ log, runPath, searchTerm }: { log: LogEntry; runPath: stri
323325
beautifiedAttributes = formatStringJSON(beautifiedAttributes);
324326
}
325327

326-
// const showMetadata = beautifiedMetadata && beautifiedMetadata !== "{}";
327328
const showAttributes = beautifiedAttributes && beautifiedAttributes !== "{}";
328329

330+
// Determine message to show
331+
let message = log.message;
332+
333+
if (log.status === 'ERROR'){
334+
message = (logWithExtras?.attributes?.error as any)?.message;
335+
}
336+
329337
return (
330338
<>
339+
{/* Time */}
340+
<div className="mb-6">
341+
<Header3 className="mb-2">Time</Header3>
342+
<div className="text-sm text-text-dimmed">
343+
<DateTime date={log.startTime} />
344+
</div>
345+
</div>
346+
331347
{/* Message */}
332348
<div className="mb-6">
333349
<Header3 className="mb-2">Message</Header3>
334350
<div className="rounded-md border border-grid-dimmed bg-charcoal-850 p-3">
335351
<div className="whitespace-pre-wrap break-words font-mono text-sm text-text-bright">
336-
{highlightJsonWithSearch(log.message, searchTerm)}
352+
{highlightJsonWithSearch(message, searchTerm)}
337353
</div>
338354
</div>
339355
</div>
340356

341-
{/* Run Link */}
342-
<div className="mb-6">
343-
<Header3 className="mb-2">Run</Header3>
344-
<div className="flex items-center gap-3">
345-
<span className="font-mono text-sm text-text-bright">{log.runId}</span>
346-
<Link to={runPath} target="_blank" rel="noopener noreferrer">
347-
<Button variant="tertiary/small" LeadingIcon={ArrowTopRightOnSquareIcon}>
348-
View in Run
349-
</Button>
350-
</Link>
351-
</div>
352-
</div>
353-
354-
{/* Details */}
355-
<div className="mb-6">
356-
<Header3 className="mb-2">Details</Header3>
357-
<Property.Table>
358-
<Property.Item>
359-
<Property.Label>Task</Property.Label>
360-
<Property.Value>
361-
<span className="font-mono">{log.taskIdentifier}</span>
362-
</Property.Value>
363-
</Property.Item>
364-
365-
<Property.Item>
366-
<Property.Label>Kind</Property.Label>
367-
<Property.Value>{log.kind}</Property.Value>
368-
</Property.Item>
369-
370-
<Property.Item>
371-
<Property.Label>Duration</Property.Label>
372-
<Property.Value className="flex items-center gap-1">
373-
<ClockIcon className="size-4 text-text-dimmed" />
374-
<span>
375-
{log.duration > 0
376-
? formatDurationNanoseconds(log.duration, { style: "short" })
377-
: "–"}
378-
</span>
379-
</Property.Value>
380-
</Property.Item>
381-
382-
<Property.Item>
383-
<Property.Label>Trace ID</Property.Label>
384-
<Property.Value>
385-
<span className="font-mono text-xs">{log.traceId}</span>
386-
</Property.Value>
387-
</Property.Item>
388-
389-
<Property.Item>
390-
<Property.Label>Span ID</Property.Label>
391-
<Property.Value>
392-
<span className="font-mono text-xs">{log.spanId}</span>
393-
</Property.Value>
394-
</Property.Item>
395-
396-
{log.parentSpanId && (
397-
<Property.Item>
398-
<Property.Label>Parent Span ID</Property.Label>
399-
<Property.Value>
400-
<span className="font-mono text-xs">{log.parentSpanId}</span>
401-
</Property.Value>
402-
</Property.Item>
403-
)}
404-
</Property.Table>
405-
</div>
406-
407357
{/* Attributes - only available in full log detail */}
408358
{showAttributes && beautifiedAttributes && (
409359
<div className="mb-6">
@@ -463,6 +413,13 @@ function RunTab({ log, runPath }: { log: LogEntry; runPath: string }) {
463413
return (
464414
<div className="flex flex-col gap-4 py-3">
465415
<Property.Table>
416+
<Property.Item>
417+
<Property.Label>Run ID</Property.Label>
418+
<Property.Value>
419+
<CopyableText value={runData.friendlyId} copyValue={runData.friendlyId} asChild />
420+
</Property.Value>
421+
</Property.Item>
422+
466423
<Property.Item>
467424
<Property.Label>Status</Property.Label>
468425
<Property.Value>
@@ -477,22 +434,10 @@ function RunTab({ log, runPath }: { log: LogEntry; runPath: string }) {
477434
<Property.Item>
478435
<Property.Label>Task</Property.Label>
479436
<Property.Value>
480-
<SimpleTooltip
481-
button={
482-
<TextLink
483-
to={v3RunsPath(organization, project, environment, {
484-
tasks: [runData.taskIdentifier],
485-
})}
486-
>
487-
<CopyableText
488-
value={runData.taskIdentifier}
489-
copyValue={runData.taskIdentifier}
490-
asChild
491-
/>
492-
</TextLink>
493-
}
494-
content={`View runs filtered by ${runData.taskIdentifier}`}
495-
disableHoverableContent
437+
<CopyableText
438+
value={runData.taskIdentifier}
439+
copyValue={runData.taskIdentifier}
440+
asChild
496441
/>
497442
</Property.Value>
498443
</Property.Item>
@@ -673,22 +618,7 @@ function RunTab({ log, runPath }: { log: LogEntry; runPath: string }) {
673618
: "–"}
674619
</Property.Value>
675620
</Property.Item>
676-
677-
<Property.Item>
678-
<Property.Label>Run ID</Property.Label>
679-
<Property.Value>
680-
<CopyableText value={runData.friendlyId} copyValue={runData.friendlyId} asChild />
681-
</Property.Value>
682-
</Property.Item>
683621
</Property.Table>
684-
685-
<div className="flex justify-end gap-2 pt-2">
686-
<Link to={runPath} target="_blank" rel="noopener noreferrer">
687-
<Button variant="secondary/small" LeadingIcon={ArrowTopRightOnSquareIcon}>
688-
View Full Run
689-
</Button>
690-
</Link>
691-
</div>
692622
</div>
693623
);
694624
}

apps/webapp/app/components/logs/LogsTable.tsx

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ArrowPathIcon } from "@heroicons/react/20/solid";
1+
import { ArrowPathIcon, ArrowTopRightOnSquareIcon } from "@heroicons/react/20/solid";
22
import { formatDurationNanoseconds } from "@trigger.dev/core/v3";
33
import { type ReactNode, useEffect, useRef, useState } from "react";
44
import { cn } from "~/utils/cn";
@@ -17,11 +17,13 @@ import {
1717
TableBlankRow,
1818
TableBody,
1919
TableCell,
20+
TableCellMenu,
2021
TableHeader,
2122
TableHeaderCell,
2223
TableRow,
2324
type TableVariant,
2425
} from "../primitives/Table";
26+
import { PopoverMenuItem } from "~/components/primitives/Popover";
2527

2628
type LogsTableProps = {
2729
logs: LogEntry[];
@@ -161,10 +163,10 @@ export function LogsTable({
161163
<Table variant="compact/mono" containerClassName="overflow-visible">
162164
<TableHeader className="sticky top-0 z-10">
163165
<TableRow>
164-
<TableHeaderCell className="w-48 whitespace-nowrap">Time</TableHeaderCell>
165-
<TableHeaderCell className="w-24 whitespace-nowrap">Run</TableHeaderCell>
166-
<TableHeaderCell className="w-32 whitespace-nowrap">Task</TableHeaderCell>
167-
<TableHeaderCell className="whitespace-nowrap">Level</TableHeaderCell>
166+
<TableHeaderCell className="min-w-48 whitespace-nowrap">Time</TableHeaderCell>
167+
<TableHeaderCell className="min-w-24 whitespace-nowrap">Run</TableHeaderCell>
168+
<TableHeaderCell className="min-w-32 whitespace-nowrap">Task</TableHeaderCell>
169+
<TableHeaderCell className="min-w-24 whitespace-nowrap">Level</TableHeaderCell>
168170
<TableHeaderCell className="w-full min-w-0">Message</TableHeaderCell>
169171
</TableRow>
170172
</TableHeader>
@@ -208,7 +210,7 @@ export function LogsTable({
208210
<TableCell className="min-w-24">
209211
<TruncatedCopyableValue value={log.runId} />
210212
</TableCell>
211-
<TableCell className="min-w-32" onClick={handleRowClick} hasAction>
213+
<TableCell className="min-w-32" onClick={handleRowClick} hasAction>
212214
<span className="font-mono text-xs">{log.taskIdentifier}</span>
213215
</TableCell>
214216
<TableCell onClick={handleRowClick} hasAction>
@@ -226,6 +228,17 @@ export function LogsTable({
226228
{highlightText(log.message, searchTerm)}
227229
</span>
228230
</TableCell>
231+
<TableCellMenu
232+
className="pl-32"
233+
hiddenButtons={
234+
<PopoverMenuItem
235+
openInNewTab={true}
236+
to={runPath}
237+
icon={ArrowTopRightOnSquareIcon}
238+
title="View Run"
239+
/>
240+
}
241+
/>
229242
</TableRow>
230243
);
231244
})

apps/webapp/app/components/primitives/Popover.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const PopoverMenuItem = React.forwardRef<
6565
className?: string;
6666
onClick?: React.MouseEventHandler;
6767
disabled?: boolean;
68+
openInNewTab?: boolean;
6869
}
6970
>(
7071
(
@@ -78,6 +79,7 @@ const PopoverMenuItem = React.forwardRef<
7879
className,
7980
onClick,
8081
disabled,
82+
openInNewTab = false,
8183
},
8284
ref
8385
) => {
@@ -102,6 +104,8 @@ const PopoverMenuItem = React.forwardRef<
102104
ref={ref as React.Ref<HTMLAnchorElement>}
103105
className={cn("group/button focus-custom", contentProps.fullWidth ? "w-full" : "")}
104106
onClick={onClick as any}
107+
target={openInNewTab ? "_blank" : undefined}
108+
rel={openInNewTab ? "noopener noreferrer" : undefined}
105109
>
106110
<ButtonContent {...contentProps}>{title}</ButtonContent>
107111
</Link>

0 commit comments

Comments
 (0)