2023-05-16 15:53:48 +00:00
< div x - init = " $wire .loadImages " >
2023-06-02 10:34:45 +00:00
< div class = " flex items-center gap-2 " >
< h2 > Rollback </ h2 >
2025-08-26 08:27:31 +00:00
@ can ( 'view' , $application )
< x - forms . button wire : click = 'loadImages(true)' > Reload Available Images </ x - forms . button >
@ endcan
2023-05-16 16:23:29 +00:00
</ div >
2025-12-05 10:02:07 +00:00
< div class = " pb-4 " > You can easily rollback to a previously built ( local ) images quickly .</ div >
2025-12-05 11:22:20 +00:00
@ if ( $serverRetentionDisabled )
< x - callout type = " warning " class = " mb-4 " >
Image retention is disabled at the server level . This setting has no effect until the server administrator enables it .
</ x - callout >
@ endif
2025-12-05 10:02:07 +00:00
< div class = " pb-4 " >
< form wire : submit = " saveSettings " class = " flex items-end gap-2 w-96 " >
< x - forms . input id = " dockerImagesToKeep " type = " number " min = " 0 " max = " 100 " label = " Images to keep for rollback "
2025-12-05 11:22:20 +00:00
helper = " Number of Docker images to keep for rollback during cleanup. Set to 0 to only keep the currently running image. PR images are always deleted during cleanup.<br><br><strong>Note:</strong> Server administrators can disable image retention at the server level, which overrides this setting. "
canGate = " update " : canResource = " $application " : disabled = " $serverRetentionDisabled " />
< x - forms . button canGate = " update " : canResource = " $application " type = " submit " : disabled = " $serverRetentionDisabled " > Save </ x - forms . button >
2025-12-05 10:02:07 +00:00
</ form >
</ div >
2025-06-25 08:56:35 +00:00
< div wire : target = 'loadImages' wire : loading . remove >
2023-05-16 15:53:48 +00:00
< div class = " flex flex-wrap " >
2023-11-20 12:49:10 +00:00
@ forelse ( $images as $image )
2023-05-22 08:34:00 +00:00
< div class = " w-2/4 p-2 " >
2025-12-05 10:02:07 +00:00
< div
class = " bg-white border rounded-sm dark:border-coolgray-300 dark:bg-coolgray-100 border-neutral-200 " >
2025-12-05 10:48:42 +00:00
@ php
$tag = data_get ( $image , 'tag' );
$date = data_get ( $image , 'created_at' );
$interval = \Illuminate\Support\Carbon :: parse ( $date );
// Check if tag looks like a commit SHA (hex string) or PR tag (pr-N)
$isCommitSha = preg_match ( '/^[0-9a-f]{7,128}$/i' , $tag );
$isPrTag = preg_match ( '/^pr-\d+$/' , $tag );
$isRollbackable = $isCommitSha || $isPrTag ;
@ endphp
2023-05-16 15:53:48 +00:00
< div class = " p-2 " >
2023-06-16 10:35:40 +00:00
< div class = " " >
2023-05-16 16:20:24 +00:00
@ if ( data_get ( $image , 'is_current' ))
2024-03-25 09:41:44 +00:00
< span class = " font-bold dark:text-warning " > LIVE </ span >
2023-05-16 19:49:29 +00:00
|
2023-05-16 16:20:24 +00:00
@ endif
2025-12-05 10:48:42 +00:00
@ if ( $isCommitSha )
SHA : {{ $tag }}
@ elseif ( $isPrTag )
PR : {{ $tag }}
@ else
Tag : {{ $tag }}
@ endif
2023-05-16 16:20:24 +00:00
</ div >
2024-07-11 02:56:31 +00:00
< div class = " text-xs " > {{ $interval -> diffForHumans () }} </ div >
< div class = " text-xs " > {{ $date }} </ div >
2023-05-16 15:53:48 +00:00
</ div >
< div class = " flex justify-end p-2 " >
2025-08-26 08:27:31 +00:00
@ can ( 'deploy' , $application )
@ if ( data_get ( $image , 'is_current' ))
< x - forms . button disabled tooltip = " This image is currently running. " >
Rollback
</ x - forms . button >
2025-12-05 10:48:42 +00:00
@ elseif ( ! $isRollbackable )
< x - forms . button disabled tooltip = " Rollback not available for ' { { $tag }}' tag. Only commit-based tags support rollback. Re-deploy to create a rollback-enabled image. " >
Rollback
</ x - forms . button >
2025-08-26 08:27:31 +00:00
@ else
< x - forms . button class = " dark:bg-coolgray-100 "
2025-12-05 10:48:42 +00:00
wire : click = " rollbackImage(' { { $tag }}') " >
2025-08-26 08:27:31 +00:00
Rollback
</ x - forms . button >
@ endif
@ endcan
2023-05-16 15:53:48 +00:00
</ div >
</ div >
</ div >
2023-11-20 12:49:10 +00:00
@ empty
< div > No images found locally .</ div >
@ endforelse
2023-05-16 15:53:48 +00:00
</ div >
</ div >
2025-06-25 08:56:35 +00:00
< div wire : target = 'loadImages' wire : loading > Loading available docker images ...</ div >
2025-12-05 10:02:07 +00:00
</ div >