Skip to content

Commit 54ba468

Browse files
committed
Merge remote-tracking branch 'origin/feature/tri-6738-show-aggregated-logs-in-main-page' into feature/tri-6738-show-aggregated-logs-in-main-page
2 parents 58ae425 + 10955a2 commit 54ba468

6 files changed

Lines changed: 129 additions & 41 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
export function LogsIcon({ className }: { className?: string }) {
2+
return (
3+
<svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
4+
<circle cx="4" cy="10" r="1" fill="currentColor" />
5+
<circle cx="4" cy="5" r="1" fill="currentColor" />
6+
<circle cx="4" cy="14" r="1" fill="currentColor" />
7+
<circle cx="4" cy="19" r="1" fill="currentColor" />
8+
<path
9+
d="M7 9.75L10 9.75"
10+
stroke="currentColor"
11+
strokeWidth="2"
12+
strokeLinecap="round"
13+
strokeLinejoin="round"
14+
/>
15+
<path
16+
d="M7 5L10 5"
17+
stroke="currentColor"
18+
strokeWidth="2"
19+
strokeLinecap="round"
20+
strokeLinejoin="round"
21+
/>
22+
<path
23+
d="M7 14.25H10"
24+
stroke="currentColor"
25+
strokeWidth="2"
26+
strokeLinecap="round"
27+
strokeLinejoin="round"
28+
/>
29+
<path
30+
d="M7 19H10"
31+
stroke="currentColor"
32+
strokeWidth="2"
33+
strokeLinecap="round"
34+
strokeLinejoin="round"
35+
/>
36+
<path
37+
d="M13 5H20"
38+
stroke="currentColor"
39+
strokeWidth="2"
40+
strokeLinecap="round"
41+
strokeLinejoin="round"
42+
/>
43+
<path
44+
d="M13 9.75H20"
45+
stroke="currentColor"
46+
strokeWidth="2"
47+
strokeLinecap="round"
48+
strokeLinejoin="round"
49+
/>
50+
<path
51+
d="M13 14.25H20"
52+
stroke="currentColor"
53+
strokeWidth="2"
54+
strokeLinecap="round"
55+
strokeLinejoin="round"
56+
/>
57+
<path
58+
d="M13 19H20"
59+
stroke="currentColor"
60+
strokeWidth="2"
61+
strokeLinecap="round"
62+
strokeLinejoin="round"
63+
/>
64+
</svg>
65+
);
66+
}

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

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { ArrowPathIcon, ArrowTopRightOnSquareIcon } from "@heroicons/react/20/solid";
1+
import { ArrowPathIcon } from "@heroicons/react/20/solid";
2+
import { Link } from "@remix-run/react";
23
import { formatDurationNanoseconds } from "@trigger.dev/core/v3";
34
import { type ReactNode, useEffect, useRef } from "react";
45
import { cn } from "~/utils/cn";
@@ -11,6 +12,7 @@ import { v3RunSpanPath } from "~/utils/pathBuilder";
1112
import { DateTime } from "../primitives/DateTime";
1213
import { Paragraph } from "../primitives/Paragraph";
1314
import { Spinner } from "../primitives/Spinner";
15+
import { SimpleTooltip } from "../primitives/Tooltip";
1416
import {
1517
Table,
1618
TableBlankRow,
@@ -84,15 +86,12 @@ function getLevelBorderColor(level: LogEntry["level"]): string {
8486
case "TRACE":
8587
case "LOG":
8688
default:
87-
return "border-l-transparent";
89+
return "border-l-transparent hover:border-l-charcoal-800";
8890
}
8991
}
9092

9193
// Case-insensitive text highlighting
92-
function highlightText(
93-
text: string,
94-
searchTerm: string | undefined
95-
): ReactNode {
94+
function highlightText(text: string, searchTerm: string | undefined): ReactNode {
9695
if (!searchTerm || searchTerm.trim() === "") {
9796
return text;
9897
}
@@ -161,7 +160,7 @@ export function LogsTable({
161160

162161
return (
163162
<div className="relative h-full overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
164-
<Table variant={variant}>
163+
<Table variant="compact/mono">
165164
<TableHeader>
166165
<TableRow>
167166
<TableHeaderCell>Time</TableHeaderCell>
@@ -197,11 +196,9 @@ export function LogsTable({
197196
<TableRow
198197
key={log.id}
199198
className={cn(
200-
"cursor-pointer transition-colors border-l-2",
199+
"cursor-pointer border-l-2 transition-colors",
201200
getLevelBorderColor(log.level),
202-
isSelected
203-
? "bg-charcoal-750"
204-
: "hover:bg-charcoal-850"
201+
isSelected ? "bg-charcoal-750" : "hover:bg-charcoal-850"
205202
)}
206203
isSelected={isSelected}
207204
>
@@ -213,22 +210,26 @@ export function LogsTable({
213210
<DateTime date={log.startTime} />
214211
</TableCell>
215212
<TableCell>
216-
<a
217-
href={runPath}
218-
className="flex items-center gap-1 text-blue-500 hover:underline"
219-
title="View run"
220-
>
221-
<span className="font-mono text-xs">{log.runId.slice(0, 12)}...</span>
222-
<ArrowTopRightOnSquareIcon className="size-3" />
223-
</a>
213+
<SimpleTooltip
214+
content="Jump to run"
215+
disableHoverableContent
216+
button={
217+
<Link
218+
to={runPath}
219+
className="flex items-center gap-1 text-blue-500 hover:text-blue-400"
220+
>
221+
{log.runId.slice(0, 12)}
222+
</Link>
223+
}
224+
/>
224225
</TableCell>
225226
<TableCell onClick={handleRowClick} hasAction>
226227
<span className="font-mono text-xs">{log.taskIdentifier}</span>
227228
</TableCell>
228229
<TableCell onClick={handleRowClick} hasAction>
229230
<span
230231
className={cn(
231-
"inline-flex items-center rounded border px-1.5 py-0.5 text-xs font-medium uppercase",
232+
"inline-flex items-center rounded border px-1 py-0.5 text-xxs font-medium uppercase tracking-wider",
232233
getLevelColor(log.level)
233234
)}
234235
>
@@ -238,7 +239,7 @@ export function LogsTable({
238239
<TableCell onClick={handleRowClick} hasAction>
239240
<span
240241
className={cn(
241-
"inline-flex items-center rounded border px-1.5 py-0.5 text-xs font-medium",
242+
"inline-flex items-center rounded border px-1 py-0.5 text-xxs font-medium uppercase tracking-wider",
242243
getStatusColor(log.status)
243244
)}
244245
>
@@ -255,10 +256,7 @@ export function LogsTable({
255256
: "–"}
256257
</TableCell>
257258
<TableCell className="max-w-0 truncate" onClick={handleRowClick} hasAction>
258-
<span
259-
className="block truncate font-mono text-xs"
260-
title={log.message}
261-
>
259+
<span className="block truncate font-mono text-xs" title={log.message}>
262260
{highlightText(log.message, searchTerm)}
263261
</span>
264262
</TableCell>
@@ -270,10 +268,7 @@ export function LogsTable({
270268
</Table>
271269
{/* Infinite scroll trigger */}
272270
{hasMore && logs.length > 0 && (
273-
<div
274-
ref={loadMoreRef}
275-
className="flex items-center justify-center py-4"
276-
>
271+
<div ref={loadMoreRef} className="flex items-center justify-center py-4">
277272
{isLoadingMore && (
278273
<div className="flex items-center gap-2">
279274
<Spinner /> <span className="text-text-dimmed">Loading more…</span>

apps/webapp/app/components/navigation/SideMenu.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
ClockIcon,
99
Cog8ToothIcon,
1010
CogIcon,
11-
DocumentTextIcon,
1211
FolderIcon,
1312
FolderOpenIcon,
1413
GlobeAmericasIcon,
@@ -24,9 +23,10 @@ import {
2423
import { Link, useNavigation } from "@remix-run/react";
2524
import { useEffect, useRef, useState, type ReactNode } from "react";
2625
import simplur from "simplur";
27-
import { BranchEnvironmentIconSmall } from "~/assets/icons/EnvironmentIcons";
2826
import { ConcurrencyIcon } from "~/assets/icons/ConcurrencyIcon";
27+
import { BranchEnvironmentIconSmall } from "~/assets/icons/EnvironmentIcons";
2928
import { ListCheckedIcon } from "~/assets/icons/ListCheckedIcon";
29+
import { LogsIcon } from "~/assets/icons/LogsIcon";
3030
import { RunsIconExtraSmall } from "~/assets/icons/RunsIcon";
3131
import { TaskIconSmall } from "~/assets/icons/TaskIcon";
3232
import { WaitpointTokenIcon } from "~/assets/icons/WaitpointTokenIcon";
@@ -57,10 +57,10 @@ import {
5757
v3BatchesPath,
5858
v3BillingPath,
5959
v3BulkActionsPath,
60-
v3LogsPath,
6160
v3DeploymentsPath,
6261
v3EnvironmentPath,
6362
v3EnvironmentVariablesPath,
63+
v3LogsPath,
6464
v3ProjectAlertsPath,
6565
v3ProjectPath,
6666
v3ProjectSettingsPath,
@@ -264,8 +264,8 @@ export function SideMenu({
264264
/>
265265
<SideMenuItem
266266
name="Logs"
267-
icon={DocumentTextIcon}
268-
activeIconColor="text-deployments"
267+
icon={LogsIcon}
268+
activeIconColor="text-logs"
269269
to={v3LogsPath(organization, project, environment)}
270270
data-action="logs"
271271
/>

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

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import { InfoIconTooltip } from "./Tooltip";
88
const variants = {
99
bright: {
1010
header: "bg-background-bright",
11+
headerCell: "px-3 py-2.5 pb-3 text-sm",
1112
cell: "group-hover/table-row:bg-charcoal-750 group-has-[[tabindex='0']:focus]/table-row:bg-charcoal-750",
13+
cellSize: "px-3 py-3",
14+
cellText: "text-xs group-hover/table-row:text-text-bright",
1215
stickyCell: "bg-background-bright group-hover/table-row:bg-charcoal-750",
1316
menuButton:
1417
"bg-background-bright group-hover/table-row:bg-charcoal-750 group-hover/table-row:ring-charcoal-600/70 group-has-[[tabindex='0']:focus]/table-row:bg-charcoal-750",
@@ -17,7 +20,22 @@ const variants = {
1720
},
1821
dimmed: {
1922
header: "bg-background-dimmed",
23+
headerCell: "px-3 py-2.5 pb-3 text-sm",
2024
cell: "group-hover/table-row:bg-charcoal-800 group-has-[[tabindex='0']:focus]/table-row:bg-background-bright",
25+
cellSize: "px-3 py-3",
26+
cellText: "text-xs group-hover/table-row:text-text-bright",
27+
stickyCell: "group-hover/table-row:bg-charcoal-800",
28+
menuButton:
29+
"bg-background-dimmed group-hover/table-row:bg-charcoal-800 group-hover/table-row:ring-grid-bright group-has-[[tabindex='0']:focus]/table-row:bg-background-bright",
30+
menuButtonDivider: "group-hover/table-row:border-grid-bright",
31+
rowSelected: "bg-charcoal-750 group-hover/table-row:bg-charcoal-750",
32+
},
33+
"compact/mono": {
34+
header: "bg-background-dimmed",
35+
headerCell: "px-2 py-1.5 text-sm",
36+
cell: "group-hover/table-row:bg-charcoal-800 group-has-[[tabindex='0']:focus]/table-row:bg-background-bright",
37+
cellSize: "px-2 py-1.5",
38+
cellText: "text-xs font-mono group-hover/table-row:text-text-bright",
2139
stickyCell: "group-hover/table-row:bg-charcoal-800",
2240
menuButton:
2341
"bg-background-dimmed group-hover/table-row:bg-charcoal-800 group-hover/table-row:ring-grid-bright group-has-[[tabindex='0']:focus]/table-row:bg-background-bright",
@@ -136,6 +154,7 @@ type TableHeaderCellProps = TableCellBasicProps & {
136154

137155
export const TableHeaderCell = forwardRef<HTMLTableCellElement, TableHeaderCellProps>(
138156
({ className, alignment = "left", children, colSpan, hiddenLabel = false, tooltip }, ref) => {
157+
const { variant } = useContext(TableContext);
139158
let alignmentClassName = "text-left";
140159
switch (alignment) {
141160
case "center":
@@ -151,7 +170,8 @@ export const TableHeaderCell = forwardRef<HTMLTableCellElement, TableHeaderCellP
151170
ref={ref}
152171
scope="col"
153172
className={cn(
154-
"px-3 py-2.5 pb-3 align-middle text-sm font-medium text-text-bright",
173+
"align-middle font-medium text-text-bright",
174+
variants[variant].headerCell,
155175
alignmentClassName,
156176
className
157177
)}
@@ -217,23 +237,28 @@ export const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(
217237
break;
218238
}
219239

240+
const { variant } = useContext(TableContext);
220241
const flexClasses = cn(
221-
"flex w-full whitespace-nowrap px-3 py-3 items-center text-xs text-text-dimmed",
242+
"flex w-full whitespace-nowrap items-center text-text-dimmed",
243+
variants[variant].cellSize,
244+
variants[variant].cellText,
222245
alignment === "left"
223246
? "justify-start text-left"
224247
: alignment === "center"
225248
? "justify-center text-center"
226249
: "justify-end text-right"
227250
);
228-
const { variant } = useContext(TableContext);
229251

230252
return (
231253
<td
232254
ref={ref}
233255
className={cn(
234-
"text-xs text-charcoal-400 has-[[tabindex='0']:focus]:before:absolute has-[[tabindex='0']:focus]:before:-top-px has-[[tabindex='0']:focus]:before:left-0 has-[[tabindex='0']:focus]:before:h-px has-[[tabindex='0']:focus]:before:w-3 has-[[tabindex='0']:focus]:before:bg-grid-dimmed has-[[tabindex='0']:focus]:after:absolute has-[[tabindex='0']:focus]:after:bottom-0 has-[[tabindex='0']:focus]:after:left-0 has-[[tabindex='0']:focus]:after:right-0 has-[[tabindex='0']:focus]:after:h-px has-[[tabindex='0']:focus]:after:bg-grid-dimmed",
256+
"text-charcoal-400 has-[[tabindex='0']:focus]:before:absolute has-[[tabindex='0']:focus]:before:-top-px has-[[tabindex='0']:focus]:before:left-0 has-[[tabindex='0']:focus]:before:h-px has-[[tabindex='0']:focus]:before:w-3 has-[[tabindex='0']:focus]:before:bg-grid-dimmed has-[[tabindex='0']:focus]:after:absolute has-[[tabindex='0']:focus]:after:bottom-0 has-[[tabindex='0']:focus]:after:left-0 has-[[tabindex='0']:focus]:after:right-0 has-[[tabindex='0']:focus]:after:h-px has-[[tabindex='0']:focus]:after:bg-grid-dimmed",
257+
variants[variant].cellText,
235258
variants[variant].cell,
236-
to || onClick || hasAction ? "cursor-pointer" : "cursor-default px-3 py-3 align-middle",
259+
to || onClick || hasAction
260+
? "cursor-pointer"
261+
: cn("cursor-default align-middle", variants[variant].cellSize),
237262
!to && !onClick && alignmentClassName,
238263
isSticky &&
239264
"[&:has(.group-hover/table-row:block)]:w-auto sticky right-0 bg-background-dimmed",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { cn } from "~/utils/cn";
55

66
const variantClasses = {
77
basic:
8-
"bg-background-bright border border-grid-bright rounded px-3 py-2 text-sm text-text-bright shadow-md fade-in-50",
9-
dark: "bg-background-dimmed border border-grid-bright rounded px-3 py-2 text-sm text-text-bright shadow-md fade-in-50"
8+
"bg-background-bright border border-grid-bright rounded px-2 py-1.5 text-xs text-text-bright shadow-md fade-in-50",
9+
dark: "bg-background-dimmed border border-grid-bright rounded px-2 py-1.5 text-xs text-text-bright shadow-md fade-in-50",
1010
};
1111

1212
type Variant = keyof typeof variantClasses;

apps/webapp/tailwind.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ const batches = colors.pink[500];
160160
const schedules = colors.yellow[500];
161161
const queues = colors.purple[500];
162162
const deployments = colors.green[500];
163+
const logs = colors.blue[500];
163164
const tests = colors.lime[500];
164165
const apiKeys = colors.amber[500];
165166
const environmentVariables = colors.pink[500];
@@ -236,6 +237,7 @@ module.exports = {
236237
schedules,
237238
queues,
238239
deployments,
240+
logs,
239241
tests,
240242
apiKeys,
241243
environmentVariables,

0 commit comments

Comments
 (0)