diff --git a/apps/webapp/app/components/runs/v3/RunFilters.tsx b/apps/webapp/app/components/runs/v3/RunFilters.tsx index 498a89859a0..9db584cbeb4 100644 --- a/apps/webapp/app/components/runs/v3/RunFilters.tsx +++ b/apps/webapp/app/components/runs/v3/RunFilters.tsx @@ -104,7 +104,7 @@ export const TaskRunListSearchFilters = z.object({ to: z.coerce.number().optional(), rootOnly: z.coerce.boolean().optional(), batchId: z.string().optional(), - runId: z.string().optional(), + runId: StringOrStringArray, scheduleId: z.string().optional(), }); @@ -199,7 +199,10 @@ export function getRunFiltersFromSearchParams( from: searchParams.get("from") ?? undefined, to: searchParams.get("to") ?? undefined, rootOnly: searchParams.has("rootOnly") ? searchParams.get("rootOnly") === "true" : undefined, - runId: searchParams.get("runId") ?? undefined, + runId: + searchParams.getAll("runId").filter((v) => v.length > 0).length > 0 + ? searchParams.getAll("runId") + : undefined, batchId: searchParams.get("batchId") ?? undefined, scheduleId: searchParams.get("scheduleId") ?? undefined, }; diff --git a/apps/webapp/app/presenters/RunFilters.server.ts b/apps/webapp/app/presenters/RunFilters.server.ts index 91cf02e9432..37a5a4755bc 100644 --- a/apps/webapp/app/presenters/RunFilters.server.ts +++ b/apps/webapp/app/presenters/RunFilters.server.ts @@ -41,7 +41,7 @@ export async function getRunFiltersFromRequest(request: Request) { from, to, batchId, - runIds: runId ? [runId] : undefined, + runId, scheduleId, rootOnly: rootOnlyValue, direction: direction, diff --git a/apps/webapp/app/presenters/v3/BulkActionPresenter.server.ts b/apps/webapp/app/presenters/v3/BulkActionPresenter.server.ts index cf62cd26532..0434045ea49 100644 --- a/apps/webapp/app/presenters/v3/BulkActionPresenter.server.ts +++ b/apps/webapp/app/presenters/v3/BulkActionPresenter.server.ts @@ -53,7 +53,11 @@ export class BulkActionPresenter extends BasePresenter { ); let mode: BulkActionMode = "filter"; - if (filtersParsed.success && Object.keys(filtersParsed.data).length === 0) { + if ( + filtersParsed.success && + Object.keys(filtersParsed.data).length === 1 && + filtersParsed.data.runId?.length + ) { mode = "selected"; } diff --git a/apps/webapp/app/presenters/v3/NextRunListPresenter.server.ts b/apps/webapp/app/presenters/v3/NextRunListPresenter.server.ts index b799c99a198..bc061b36d78 100644 --- a/apps/webapp/app/presenters/v3/NextRunListPresenter.server.ts +++ b/apps/webapp/app/presenters/v3/NextRunListPresenter.server.ts @@ -1,5 +1,9 @@ -import { ClickHouse } from "@internal/clickhouse"; -import { PrismaClient, PrismaClientOrTransaction, type TaskRunStatus } from "@trigger.dev/database"; +import { type ClickHouse } from "@internal/clickhouse"; +import { + type PrismaClient, + type PrismaClientOrTransaction, + type TaskRunStatus, +} from "@trigger.dev/database"; import { type Direction } from "~/components/ListPagination"; import { timeFilters } from "~/components/runs/v3/SharedFilters"; import { findDisplayableEnvironment } from "~/models/runtimeEnvironment.server"; @@ -7,7 +11,6 @@ import { getAllTaskIdentifiers } from "~/models/task.server"; import { RunsRepository } from "~/services/runsRepository.server"; import { ServiceValidationError } from "~/v3/services/baseService.server"; import { isCancellableRunStatus, isFinalRunStatus, isPendingRunStatus } from "~/v3/taskStatus"; -import parseDuration from "parse-duration"; export type RunListOptions = { userId?: string; @@ -25,7 +28,7 @@ export type RunListOptions = { isTest?: boolean; rootOnly?: boolean; batchId?: string; - runIds?: string[]; + runId?: string[]; //pagination direction?: Direction; cursor?: string; @@ -60,7 +63,7 @@ export class NextRunListPresenter { isTest, rootOnly, batchId, - runIds, + runId, from, to, direction = "forward", @@ -85,7 +88,7 @@ export class NextRunListPresenter { (scheduleId !== undefined && scheduleId !== "") || (tags !== undefined && tags.length > 0) || batchId !== undefined || - (runIds !== undefined && runIds.length > 0) || + (runId !== undefined && runId.length > 0) || typeof isTest === "boolean" || rootOnly === true || !time.isDefault; @@ -167,7 +170,7 @@ export class NextRunListPresenter { isTest, rootOnly, batchId, - runIds, + runId, bulkId, page: { size: pageSize, diff --git a/apps/webapp/app/presenters/v3/WaitpointPresenter.server.ts b/apps/webapp/app/presenters/v3/WaitpointPresenter.server.ts index 50890a44114..9abcdf32215 100644 --- a/apps/webapp/app/presenters/v3/WaitpointPresenter.server.ts +++ b/apps/webapp/app/presenters/v3/WaitpointPresenter.server.ts @@ -85,7 +85,7 @@ export class WaitpointPresenter extends BasePresenter { environmentId, { projectId: projectId, - runIds: connectedRunIds, + runId: connectedRunIds, pageSize: 5, period: "31d", } diff --git a/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.bulk-actions.$bulkActionParam/route.tsx b/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.bulk-actions.$bulkActionParam/route.tsx index a81f39dbfcc..8aa34624d08 100644 --- a/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.bulk-actions.$bulkActionParam/route.tsx +++ b/apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.bulk-actions.$bulkActionParam/route.tsx @@ -157,8 +157,8 @@ export default function Page() { return (