@@ -9,10 +9,10 @@ import { timeFilters } from "~/components/runs/v3/SharedFilters";
9
9
export type BatchListOptions = {
10
10
userId ?: string ;
11
11
projectId : string ;
12
+ environmentId : string ;
12
13
//filters
13
14
friendlyId ?: string ;
14
15
statuses ?: BatchTaskRunStatus [ ] ;
15
- environments ?: string [ ] ;
16
16
period ?: string ;
17
17
from ?: number ;
18
18
to ?: number ;
@@ -34,7 +34,7 @@ export class BatchListPresenter extends BasePresenter {
34
34
projectId,
35
35
friendlyId,
36
36
statuses,
37
- environments ,
37
+ environmentId ,
38
38
period,
39
39
from,
40
40
to,
@@ -81,16 +81,6 @@ export class BatchListPresenter extends BasePresenter {
81
81
} ,
82
82
} ) ;
83
83
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
-
94
84
const periodMs = time . period ? parse ( time . period ) : undefined ;
95
85
96
86
//get the batches
@@ -120,8 +110,8 @@ export class BatchListPresenter extends BasePresenter {
120
110
FROM
121
111
${ sqlDatabaseSchema } ."BatchTaskRun" b
122
112
WHERE
123
- -- environments
124
- b."runtimeEnvironmentId" IN ( ${ Prisma . join ( environmentIds ) } )
113
+ -- environment
114
+ b."runtimeEnvironmentId" = ${ environmentId }
125
115
-- cursor
126
116
${
127
117
cursor
@@ -186,9 +176,7 @@ WHERE
186
176
if ( ! hasAnyBatches ) {
187
177
const firstBatch = await this . _replica . batchTaskRun . findFirst ( {
188
178
where : {
189
- runtimeEnvironmentId : {
190
- in : environmentIds ,
191
- } ,
179
+ runtimeEnvironmentId : environmentId ,
192
180
} ,
193
181
} ) ;
194
182
@@ -233,7 +221,6 @@ WHERE
233
221
filters : {
234
222
friendlyId,
235
223
statuses : statuses || [ ] ,
236
- environments : environments || [ ] ,
237
224
} ,
238
225
hasFilters,
239
226
hasAnyBatches,
0 commit comments