@@ -9,10 +9,10 @@ import { timeFilters } from "~/components/runs/v3/SharedFilters";
99export type BatchListOptions = {
1010 userId ?: string ;
1111 projectId : string ;
12+ environmentId : string ;
1213 //filters
1314 friendlyId ?: string ;
1415 statuses ?: BatchTaskRunStatus [ ] ;
15- environments ?: string [ ] ;
1616 period ?: string ;
1717 from ?: number ;
1818 to ?: number ;
@@ -34,7 +34,7 @@ export class BatchListPresenter extends BasePresenter {
3434 projectId,
3535 friendlyId,
3636 statuses,
37- environments ,
37+ environmentId ,
3838 period,
3939 from,
4040 to,
@@ -81,16 +81,6 @@ export class BatchListPresenter extends BasePresenter {
8181 } ,
8282 } ) ;
8383
84- let environmentIds = project . environments . map ( ( e ) => e . id ) ;
85- if ( environments && environments . length > 0 ) {
86- //if environments are passed in, we only include them if they're in the project
87- environmentIds = environments . filter ( ( e ) => project . environments . some ( ( pe ) => pe . id === e ) ) ;
88- }
89-
90- if ( environmentIds . length === 0 ) {
91- throw new Error ( "No matching environments found for the project" ) ;
92- }
93-
9484 const periodMs = time . period ? parse ( time . period ) : undefined ;
9585
9686 //get the batches
@@ -120,8 +110,8 @@ export class BatchListPresenter extends BasePresenter {
120110FROM
121111 ${ sqlDatabaseSchema } ."BatchTaskRun" b
122112WHERE
123- -- environments
124- b."runtimeEnvironmentId" IN ( ${ Prisma . join ( environmentIds ) } )
113+ -- environment
114+ b."runtimeEnvironmentId" = ${ environmentId }
125115 -- cursor
126116 ${
127117 cursor
@@ -186,9 +176,7 @@ WHERE
186176 if ( ! hasAnyBatches ) {
187177 const firstBatch = await this . _replica . batchTaskRun . findFirst ( {
188178 where : {
189- runtimeEnvironmentId : {
190- in : environmentIds ,
191- } ,
179+ runtimeEnvironmentId : environmentId ,
192180 } ,
193181 } ) ;
194182
@@ -233,7 +221,6 @@ WHERE
233221 filters : {
234222 friendlyId,
235223 statuses : statuses || [ ] ,
236- environments : environments || [ ] ,
237224 } ,
238225 hasFilters,
239226 hasAnyBatches,
0 commit comments