2024-01-07 15:23:41 +00:00
< div >
2024-06-07 09:01:10 +00:00
< x - slot : title >
{{ data_get_str ( $application , 'name' ) -> limit ( 10 ) }} > Deployments | Coolify
</ x - slot >
2024-01-07 15:23:41 +00:00
< h1 > Deployments </ h1 >
2024-04-12 10:44:49 +00:00
< livewire : project . shared . configuration - checker : resource = " $application " />
2024-01-07 15:23:41 +00:00
< livewire : project . application . heading : application = " $application " />
2024-01-29 10:23:04 +00:00
< div class = " flex flex-col gap-2 pb-10 "
@ if ( $skip == 0 ) wire : poll . 5000 ms = 'reload_deployments' @ endif >
2024-01-07 15:23:41 +00:00
< div class = " flex items-end gap-2 pt-4 " >
< h2 > Deployments < span class = " text-xs " > ({{ $deployments_count }}) </ span ></ h2 >
2025-01-16 11:05:59 +00:00
@ if ( $deployments_count > 0 && $deployments_count > $default_take )
2024-03-20 11:54:06 +00:00
< x - forms . button disabled = " { { ! $show_prev }} " wire : click = " previous_page(' { { $default_take }}') " >< svg
class = " w-6 h-6 " viewBox = " 0 0 24 24 " xmlns = " http://www.w3.org/2000/svg " >
2024-01-29 12:06:26 +00:00
< path fill = " none " stroke = " currentColor " stroke - linecap = " round " stroke - linejoin = " round "
stroke - width = " 2 " d = " m14 6l-6 6l6 6z " />
</ svg ></ x - forms . button >
2024-03-20 11:54:06 +00:00
< x - forms . button disabled = " { { ! $show_next }} " wire : click = " next_page(' { { $default_take }}') " >< svg
class = " w-6 h-6 " viewBox = " 0 0 24 24 " xmlns = " http://www.w3.org/2000/svg " >
2024-01-29 12:06:26 +00:00
< path fill = " none " stroke = " currentColor " stroke - linecap = " round " stroke - linejoin = " round "
stroke - width = " 2 " d = " m10 18l6-6l-6-6z " />
</ svg ></ x - forms . button >
2024-01-07 15:23:41 +00:00
@ endif
</ div >
2024-03-20 11:54:06 +00:00
@ if ( $deployments_count > 0 )
< form class = " flex items-end gap-2 " >
< x - forms . input id = " pull_request_id " label = " Pull Request " ></ x - forms . input >
< x - forms . button type = " submit " > Filter </ x - forms . button >
</ form >
@ endif
2024-01-07 15:23:41 +00:00
@ forelse ( $deployments as $deployment )
2024-05-15 08:45:08 +00:00
< div @ class ([
2024-09-05 09:23:59 +00:00
'dark:bg-coolgray-100 p-2 border-l-2 transition-colors hover:no-underline box-without-bg-without-border bg-white flex-col cursor-pointer dark:hover:text-neutral-400 dark:hover:bg-coolgray-200' ,
2024-12-04 12:49:19 +00:00
'border-white border-dashed ' =>
2024-01-07 15:23:41 +00:00
data_get ( $deployment , 'status' ) === 'in_progress' ||
data_get ( $deployment , 'status' ) === 'cancelled-by-user' ,
2024-09-05 09:23:59 +00:00
'border-error border-dashed ' =>
data_get ( $deployment , 'status' ) === 'failed' ,
2024-05-15 08:45:08 +00:00
'border-success' => data_get ( $deployment , 'status' ) === 'finished' ,
2025-01-16 11:05:59 +00:00
]) wire : navigate
href = " { { $current_url . '/' . data_get( $deployment , 'deployment_uuid') }} " >
2024-01-07 15:23:41 +00:00
< div class = " flex flex-col justify-start " >
< div class = " flex gap-1 " >
{{ $deployment -> created_at }} UTC
2024-03-25 09:41:44 +00:00
< span class = " dark:text-warning " >></ span >
2024-01-07 15:23:41 +00:00
{{ $deployment -> status }}
</ div >
2024-01-29 10:23:04 +00:00
@ if ( data_get ( $deployment , 'is_webhook' ) || data_get ( $deployment , 'pull_request_id' ))
2024-06-14 12:48:12 +00:00
< div class = " flex items-center gap-1 " >
2024-01-07 15:23:41 +00:00
@ if ( data_get ( $deployment , 'is_webhook' ))
2024-01-29 10:23:04 +00:00
Webhook
2024-01-07 15:23:41 +00:00
@ endif
2024-01-29 10:23:04 +00:00
@ if ( data_get ( $deployment , 'pull_request_id' ))
@ if ( data_get ( $deployment , 'is_webhook' ))
|
@ endif
Pull Request #{{ data_get($deployment, 'pull_request_id') }}
2024-06-14 12:48:12 +00:00
@ endif
@ if ( data_get ( $deployment , 'commit' ))
2025-01-16 11:05:59 +00:00
< div class = " dark:hover:text-white " wire : navigate . prevent
href = " { { $application->gitCommitLink (data_get( $deployment , 'commit')) }} " >
2024-06-14 12:48:12 +00:00
< div class = " text-xs underline " >
@ if ( $deployment -> commitMessage ())
({{ data_get_str ( $deployment , 'commit' ) -> limit ( 7 ) }} -
{{ $deployment -> commitMessage () }})
@ else
{{ data_get_str ( $deployment , 'commit' ) -> limit ( 7 ) }}
@ endif
</ div >
</ div >
2024-01-07 15:23:41 +00:00
@ endif
</ div >
2024-01-29 10:23:04 +00:00
@ else
2024-05-15 08:45:08 +00:00
< div class = " flex items-center gap-1 " >
2024-05-15 08:47:57 +00:00
@ if ( data_get ( $deployment , 'rollback' ) === true )
Rollback
@ else
2024-06-21 14:46:13 +00:00
@ if ( data_get ( $deployment , 'is_api' ))
API
@ else
Manual
@ endif
2024-05-15 08:45:08 +00:00
@ endif
@ if ( data_get ( $deployment , 'commit' ))
2025-01-16 11:05:59 +00:00
< div class = " dark:hover:text-white " wire : navigate . prevent
href = " { { $application->gitCommitLink (data_get( $deployment , 'commit')) }} " >
2024-05-15 08:45:08 +00:00
< div class = " text-xs underline " >
2024-05-15 09:31:03 +00:00
@ if ( $deployment -> commitMessage ())
2024-05-28 17:00:59 +00:00
({{ data_get_str ( $deployment , 'commit' ) -> limit ( 7 ) }} -
{{ $deployment -> commitMessage () }})
2024-05-15 09:31:03 +00:00
@ else
{{ data_get_str ( $deployment , 'commit' ) -> limit ( 7 ) }}
@ endif
</ div >
2024-05-15 08:45:08 +00:00
</ div >
@ endif
2024-01-29 10:23:04 +00:00
</ div >
2024-01-07 15:23:41 +00:00
@ endif
2024-05-15 08:47:57 +00:00
@ if ( data_get ( $deployment , 'server_name' ) && $application -> additional_servers -> count () > 0 )
2024-02-06 14:05:11 +00:00
< div class = " flex gap-1 " >
Server : {{ data_get ( $deployment , 'server_name' ) }}
</ div >
@ endif
2024-01-07 15:23:41 +00:00
</ div >
2025-01-16 11:05:59 +00:00
< div class = " flex flex-col " x - data = " elapsedTime(' { { $deployment->deployment_uuid }}', ' { { $deployment->status }}', ' { { $deployment->created_at }}', ' { { $deployment->finished_at }}') " >
2024-01-07 15:23:41 +00:00
< div >
@ if ( $deployment -> status !== 'in_progress' )
2025-01-16 11:05:59 +00:00
< span x - html = " measurementText() " />
2024-01-07 15:23:41 +00:00
@ else
2025-01-16 11:05:59 +00:00
Running for < span class = " font-bold " x - text = " measureSinceStarted() " > 0 s </ span >
2024-01-07 15:23:41 +00:00
@ endif
2024-05-31 11:01:44 +00:00
2024-01-07 15:23:41 +00:00
</ div >
</ div >
2024-05-15 08:45:08 +00:00
</ div >
2024-01-07 15:23:41 +00:00
@ empty
< div class = " " > No deployments found </ div >
@ endforelse
2024-05-15 08:45:08 +00:00
2024-03-20 11:54:06 +00:00
@ if ( $deployments_count > 0 )
< script >
2024-05-29 09:13:22 +00:00
let timers = {};
2024-01-07 15:23:41 +00:00
2024-05-29 09:13:22 +00:00
dayjs . extend ( window . dayjs_plugin_utc );
dayjs . extend ( window . dayjs_plugin_relativeTime );
2024-01-07 15:23:41 +00:00
2025-01-16 11:05:59 +00:00
Alpine . data ( 'elapsedTime' , ( uuid , status , created_at , finished_at ) => ({
2024-05-31 11:01:44 +00:00
finished_time : 'calculating...' ,
started_time : 'calculating...' ,
init () {
if ( timers [ uuid ]) {
clearInterval ( timers [ uuid ]);
2024-01-07 15:23:41 +00:00
}
2024-05-29 09:13:22 +00:00
if ( status === 'in_progress' ) {
timers [ uuid ] = setInterval (() => {
this . finished_time = dayjs () . diff ( dayjs . utc ( created_at ),
'second' ) + 's'
}, 1000 );
} else {
2025-01-16 11:05:59 +00:00
this . finished_time = dayjs . utc ( finished_at ) . diff ( dayjs . utc ( created_at ), 'second' )
if ( isNaN ( this . finished_time )) {
this . finished_time = 0 ;
}
2024-05-29 09:13:22 +00:00
}
},
2025-01-16 11:05:59 +00:00
measureFinishedTime () {
2024-05-31 11:01:44 +00:00
if ( this . finished_time > 2000 ) {
return 0 ;
} else {
return this . finished_time ;
}
2024-05-29 09:13:22 +00:00
},
2025-01-16 11:05:59 +00:00
measureSinceStarted () {
2024-09-01 20:01:05 +00:00
return dayjs . utc ( created_at ) . fromNow ( true ); // "true" prevents the "ago" suffix
2024-05-31 11:01:44 +00:00
},
2025-01-16 11:05:59 +00:00
measurementText () {
if ( this . measureFinishedTime () === 0 ) {
return 'Finished <span x-text="measureSinceStarted()"></span> ago' ;
} else {
return 'Finished <span x-text="measureSinceStarted()"></span> ago in <span class="font-bold" x-text="measureFinishedTime()"></span><span class="font-bold">s</span>' ;
}
}
2024-05-29 09:13:22 +00:00
}))
2024-03-20 11:54:06 +00:00
</ script >
@ endif
2024-01-07 15:23:41 +00:00
</ div >
</ div >