@@ -176,17 +176,16 @@ const ReviewForm: FC<ReviewFormProps> = ({
176
176
? templateVersionQueries . map ( ( q ) => q . data )
177
177
: undefined ;
178
178
179
- const [ running , notRunning ] = _ . partition (
180
- readyToUpdate ,
181
- ( ws ) => ws . latest_build . status === "running" ,
179
+ const runningIds = new Set < string > (
180
+ readyToUpdate
181
+ . filter ( ( ws ) => ws . latest_build . status === "running" )
182
+ . map ( ( ws ) => ws . id ) ,
182
183
) ;
183
184
184
185
const workspacesChangedWhileOpen = workspacesToUpdate !== cachedWorkspaces ;
185
- const consequencesResolved = running . length === 0 || acceptedConsequences ;
186
+ const consequencesResolved = runningIds . size === 0 || acceptedConsequences ;
186
187
const canSubmit =
187
- consequencesResolved &&
188
- error === undefined &&
189
- ( running . length > 0 || notRunning . length > 0 ) ;
188
+ consequencesResolved && error === undefined && readyToUpdate . length > 0 ;
190
189
191
190
return (
192
191
< form
@@ -232,37 +231,7 @@ const ReviewForm: FC<ReviewFormProps> = ({
232
231
</ div >
233
232
234
233
< ul className = "list-none p-0 flex flex-col rounded-md border border-solid border-border" >
235
- { running . map ( ( ws ) => {
236
- const matchedQuery = templateVersionQueries . find (
237
- ( q ) => q . data ?. id === ws . template_active_version_id ,
238
- ) ;
239
- const newTemplateName = matchedQuery ?. data ?. name ;
240
-
241
- return (
242
- < li
243
- key = { ws . id }
244
- className = "[&:not(:last-child)]:border-b-border [&:not(:last-child)]:border-b [&:not(:last-child)]:border-solid border-0"
245
- >
246
- < ReviewPanel
247
- running
248
- className = "border-none"
249
- workspaceName = { ws . name }
250
- workspaceIconUrl = { ws . template_icon }
251
- label = {
252
- newTemplateName !== undefined && (
253
- < TemplateNameChange
254
- newTemplateName = { newTemplateName }
255
- oldTemplateName = {
256
- ws . latest_build . template_version_name
257
- }
258
- />
259
- )
260
- }
261
- />
262
- </ li >
263
- ) ;
264
- } ) }
265
- { notRunning . map ( ( ws ) => {
234
+ { readyToUpdate . map ( ( ws ) => {
266
235
const matchedQuery = templateVersionQueries . find (
267
236
( q ) => q . data ?. id === ws . template_active_version_id ,
268
237
) ;
@@ -275,6 +244,7 @@ const ReviewForm: FC<ReviewFormProps> = ({
275
244
>
276
245
< ReviewPanel
277
246
className = "border-none"
247
+ running = { runningIds . has ( ws . id ) }
278
248
workspaceName = { ws . name }
279
249
workspaceIconUrl = { ws . template_icon }
280
250
label = {
@@ -367,14 +337,14 @@ const ReviewForm: FC<ReviewFormProps> = ({
367
337
type BatchUpdateModalFormProps = Readonly < {
368
338
workspacesToUpdate : readonly Workspace [ ] ;
369
339
open : boolean ;
370
- loading : boolean ;
340
+ isProcessing : boolean ;
371
341
onClose : ( ) => void ;
372
342
onSubmit : ( ) => void ;
373
343
} > ;
374
344
375
345
export const BatchUpdateModalForm : FC < BatchUpdateModalFormProps > = ( {
376
346
open,
377
- loading ,
347
+ isProcessing ,
378
348
workspacesToUpdate,
379
349
onClose,
380
350
onSubmit,
@@ -389,7 +359,7 @@ export const BatchUpdateModalForm: FC<BatchUpdateModalFormProps> = ({
389
359
} }
390
360
>
391
361
< DialogContent className = "max-w-screen-md" >
392
- { loading ? (
362
+ { isProcessing ? (
393
363
< >
394
364
< DialogTitle > Loading…</ DialogTitle >
395
365
< Loader />
0 commit comments