Skip to content

Commit cad27fb

Browse files
committed
Style improvements and run pagination
1 parent a6f1b8d commit cad27fb

File tree

3 files changed

+29
-7
lines changed
  • apps/webapp/app

3 files changed

+29
-7
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const errorGroupGranularity = new TimeGranularity([
1212
]);
1313
import { type PrismaClientOrTransaction } from "@trigger.dev/database";
1414
import { timeFilterFromTo } from "~/components/runs/v3/SharedFilters";
15+
import { type Direction, DirectionSchema } from "~/components/ListPagination";
1516
import { findDisplayableEnvironment } from "~/models/runtimeEnvironment.server";
1617
import { ServiceValidationError } from "~/v3/services/baseService.server";
1718
import { BasePresenter } from "~/presenters/v3/basePresenter.server";
@@ -29,6 +30,8 @@ export type ErrorGroupOptions = {
2930
period?: string;
3031
from?: number;
3132
to?: number;
33+
cursor?: string;
34+
direction?: Direction;
3235
};
3336

3437
export const ErrorGroupOptionsSchema = z.object({
@@ -39,6 +42,8 @@ export const ErrorGroupOptionsSchema = z.object({
3942
period: z.string().optional(),
4043
from: z.number().int().nonnegative().optional(),
4144
to: z.number().int().nonnegative().optional(),
45+
cursor: z.string().optional(),
46+
direction: DirectionSchema.optional(),
4247
});
4348

4449
const DEFAULT_RUNS_PAGE_SIZE = 25;
@@ -87,6 +92,8 @@ export class ErrorGroupPresenter extends BasePresenter {
8792
period,
8893
from,
8994
to,
95+
cursor,
96+
direction,
9097
}: ErrorGroupOptions
9198
) {
9299
const displayableEnvironment = await findDisplayableEnvironment(environmentId, userId);
@@ -112,6 +119,8 @@ export class ErrorGroupPresenter extends BasePresenter {
112119
pageSize: runsPageSize,
113120
from: time.from.getTime(),
114121
to: time.to.getTime(),
122+
cursor,
123+
direction,
115124
}),
116125
]);
117126

@@ -268,6 +277,8 @@ export class ErrorGroupPresenter extends BasePresenter {
268277
pageSize: number;
269278
from?: number;
270279
to?: number;
280+
cursor?: string;
281+
direction?: Direction;
271282
}
272283
): Promise<NextRunList | undefined> {
273284
const runListPresenter = new NextRunListPresenter(this.replica, this.clickhouse);
@@ -279,6 +290,8 @@ export class ErrorGroupPresenter extends BasePresenter {
279290
pageSize: options.pageSize,
280291
from: options.from,
281292
to: options.to,
293+
cursor: options.cursor,
294+
direction: options.direction,
282295
});
283296

284297
if (result.runs.length === 0) {

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.errors.$fingerprint/route.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { ErrorId } from "@trigger.dev/core/v3/isomorphic";
3131
import { Chart, type ChartConfig } from "~/components/primitives/charts/ChartCompound";
3232
import { TimeFilter, timeFilterFromTo } from "~/components/runs/v3/SharedFilters";
3333
import { useOptimisticLocation } from "~/hooks/useOptimisticLocation";
34+
import { DirectionSchema, ListPagination } from "~/components/ListPagination";
3435

3536
export const meta: MetaFunction<typeof loader> = ({ data }) => {
3637
return [
@@ -67,6 +68,9 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
6768
const toStr = url.searchParams.get("to");
6869
const from = fromStr ? parseInt(fromStr, 10) : undefined;
6970
const to = toStr ? parseInt(toStr, 10) : undefined;
71+
const cursor = url.searchParams.get("cursor") ?? undefined;
72+
const directionRaw = url.searchParams.get("direction") ?? undefined;
73+
const direction = directionRaw ? DirectionSchema.parse(directionRaw) : undefined;
7074

7175
const presenter = new ErrorGroupPresenter($replica, logsClickhouseClient, clickhouseClient);
7276

@@ -78,6 +82,8 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
7882
period,
7983
from,
8084
to,
85+
cursor,
86+
direction,
8187
})
8288
.catch((error) => {
8389
if (error instanceof ServiceValidationError) {
@@ -250,7 +256,7 @@ function ErrorGroupDetail({
250256

251257
<Property.Table>
252258
<Property.Item>
253-
<Property.Label>Occurrences</Property.Label>
259+
<Property.Label>Total occurrences</Property.Label>
254260
<Property.Value>{formatNumberCompact(errorGroup.count)}</Property.Value>
255261
</Property.Item>
256262
{errorGroup.affectedVersions.length > 0 && (
@@ -300,7 +306,10 @@ function ErrorGroupDetail({
300306

301307
{/* Runs Table */}
302308
<div className="flex flex-col gap-1 overflow-y-hidden">
303-
<Header3 className="mb-1 mt-2 px-4">Recent runs</Header3>
309+
<div className="flex items-center justify-between px-4">
310+
<Header3 className="mb-1 mt-2">Runs</Header3>
311+
{runList && <ListPagination list={runList} />}
312+
</div>
304313
{runList ? (
305314
<TaskRunsTable
306315
total={runList.runs.length}
@@ -318,7 +327,7 @@ function ErrorGroupDetail({
318327
disableAdjacentRows
319328
/>
320329
) : (
321-
<Paragraph variant="small" className="text-text-dimmed">
330+
<Paragraph variant="small" className="p-4 text-text-dimmed">
322331
No runs found for this error.
323332
</Paragraph>
324333
)}
@@ -330,7 +339,7 @@ function ErrorGroupDetail({
330339
const activityChartConfig: ChartConfig = {
331340
count: {
332341
label: "Occurrences",
333-
color: "#EC003F",
342+
color: "#6366F1",
334343
},
335344
};
336345

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.errors._index/route.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,10 @@ function ErrorActivityGraph({ activity }: { activity: ErrorOccurrenceActivity })
421421
wrapperStyle={{ zIndex: 1000 }}
422422
animationDuration={0}
423423
/>
424-
<Bar dataKey="count" fill="#EC003F" strokeWidth={0} isAnimationActive={false} />
425-
<ReferenceLine y={0} stroke="#B5B8C0" strokeWidth={1} />
424+
<Bar dataKey="count" fill="#6366F1" strokeWidth={0} isAnimationActive={false} />
425+
<ReferenceLine y={0} stroke="#2C3034" strokeWidth={1} />
426426
{maxCount > 0 && (
427-
<ReferenceLine y={maxCount} stroke="#B5B8C0" strokeDasharray="3 2" strokeWidth={1} />
427+
<ReferenceLine y={maxCount} stroke="#4D525B" strokeDasharray="4 4" strokeWidth={1} />
428428
)}
429429
</BarChart>
430430
</ResponsiveContainer>

0 commit comments

Comments
 (0)