@@ -359,12 +359,66 @@ export function prebuildStatusIcon(prebuild?: PrebuildWithStatus) {
359
359
}
360
360
}
361
361
362
+ function PrebuildStatusDescription ( props : { prebuild : PrebuildWithStatus } ) {
363
+ switch ( props . prebuild . status ) {
364
+ case "queued" :
365
+ return < span > Prebuild is queued and will be processed when there is execution capacity.</ span > ;
366
+ case "building" :
367
+ return < span > Prebuild is currently in progress.</ span > ;
368
+ case "aborted" :
369
+ return (
370
+ < span >
371
+ Prebuild has been cancelled. Either a user cancelled it, or the prebuild rate limit has been
372
+ exceeded. { props . prebuild . error }
373
+ </ span >
374
+ ) ;
375
+ case "failed" :
376
+ return < span > Prebuild failed for system reasons. Please contact support. { props . prebuild . error } </ span > ;
377
+ case "timeout" :
378
+ return (
379
+ < span >
380
+ Prebuild timed out. Either the image, or the prebuild tasks took too long. { props . prebuild . error }
381
+ </ span >
382
+ ) ;
383
+ case "available" :
384
+ if ( props . prebuild ?. error ) {
385
+ return (
386
+ < span >
387
+ The tasks executed in the prebuild returned a non-zero exit code. { props . prebuild . error }
388
+ </ span >
389
+ ) ;
390
+ }
391
+ return < span > Prebuild completed succesfully.</ span > ;
392
+ default :
393
+ return < span > Unknown prebuild status.</ span > ;
394
+ }
395
+ }
396
+
362
397
function formatDuration ( milliseconds : number ) {
363
398
const hours = Math . floor ( milliseconds / ( 1000 * 60 * 60 ) ) ;
364
399
return ( hours > 0 ? `${ hours } :` : "" ) + moment ( milliseconds ) . format ( "mm:ss" ) ;
365
400
}
366
401
367
- export function PrebuildInstanceStatus ( props : { prebuildInstance ?: WorkspaceInstance } ) {
402
+ export function PrebuildStatus ( props : { prebuild : PrebuildWithStatus } ) {
403
+ const prebuild = props . prebuild ;
404
+
405
+ return (
406
+ < div className = "flex flex-col space-y-1 justify-center text-sm font-semibold" >
407
+ < div >
408
+ < div className = "flex space-x-1 items-center" >
409
+ { prebuildStatusIcon ( prebuild ) }
410
+ { prebuildStatusLabel ( prebuild ) }
411
+ </ div >
412
+ </ div >
413
+ < div className = "flex space-x-1 items-center text-gray-400" >
414
+ < PrebuildStatusDescription prebuild = { prebuild } />
415
+ </ div >
416
+ </ div >
417
+ ) ;
418
+ }
419
+
420
+ // Deprecated. Use PrebuildStatus instead.
421
+ export function PrebuildInstanceStatus ( props : { prebuildInstance ?: WorkspaceInstance ; prebuild ?: PrebuildWithStatus } ) {
368
422
let status = < > </ > ;
369
423
let details = < > </ > ;
370
424
switch ( props . prebuildInstance ?. status . phase ) {
0 commit comments