This commit is contained in:
Andras Bacsai
2023-06-05 12:07:55 +02:00
parent 0f28acac00
commit e5aad4d170
42 changed files with 518 additions and 238 deletions

View File

@@ -1,40 +1,69 @@
<div>
<livewire:project.application.preview.form :application="$application" />
<h3>Pull Requests on Git</h3>
<div>
<x-forms.button wire:click="load_prs">Load Pull Requests (open)
</x-forms.button>
<div class="flex items-center gap-2">
<h3>Pull Requests on Git</h3>
<x-forms.button wire:click="load_prs">Load Pull Requests (open)
</x-forms.button>
</div>
@isset($rate_limit_remaining)
<div class="pt-1 text-sm">Requests remaning till rate limited by Git: {{ $rate_limit_remaining }}</div>
@endisset
@if (count($pull_requests) > 0)
<div wire:loading.remove wire:target='load_prs' class="flex gap-4 py-8">
@foreach ($pull_requests as $pull_request)
<div class="flex flex-col gap-4 p-4 text-sm bg-coolgray-200 hover:bg-coolgray-300">
<div class="text-base font-bold text-white">PR #{{ data_get($pull_request, 'number') }} |
{{ data_get($pull_request, 'title') }}</div>
<div class="flex items-center justify-start gap-2">
<x-forms.button isHighlighted
wire:click="deploy('{{ data_get($pull_request, 'number') }}', '{{ data_get($pull_request, 'html_url') }}')">
Deploy
</x-forms.button>
<a target="_blank" class="text-xs" href="{{ data_get($pull_request, 'html_url') }}">Open PR
on
Git
<x-external-link />
</a>
</div>
</div>
@endforeach
<div wire:loading.remove wire:target='load_prs' class="flex gap-4 py-4">
<div class="overflow-x-auto table-md">
<table class="table">
<thead>
<tr class="text-warning border-coolgray-200">
<th>PR Number</th>
<th>PR Title</th>
<th>Git</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($pull_requests as $pull_request)
<tr class="border-coolgray-200">
<th>{{ data_get($pull_request, 'number') }}</th>
<td>{{ data_get($pull_request, 'title') }}</td>
<td>
<a target="_blank" class="text-xs"
href="{{ data_get($pull_request, 'html_url') }}">Open PR on
Git
<x-external-link />
</a>
</td>
<td class="flex items-center justify-center gap-2">
<x-forms.button
wire:click="deploy('{{ data_get($pull_request, 'number') }}', '{{ data_get($pull_request, 'html_url') }}')">
Deploy
</x-forms.button>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
</div>
@if ($application->previews->count() > 0)
<h3>Preview Deployments</h3>
<h4 class="pt-4">Preview Deployments</h4>
<div class="flex gap-6 text-sm">
@foreach ($application->previews as $preview)
<div class="flex flex-col p-4 bg-coolgray-200 " x-init="$wire.loadStatus('{{ data_get($preview, 'pull_request_id') }}')">
<div>PR #{{ data_get($preview, 'pull_request_id') }} | {{ data_get($preview, 'status') }}
<div class="flex gap-2">PR #{{ data_get($preview, 'pull_request_id') }} |
@if (data_get($preview, 'status') === 'running')
<div class="flex items-center gap-2">
<div class="badge badge-success badge-xs"></div>
<div class="text-xs font-medium tracking-wide">Running</div>
</div>
@else
<div class="flex items-center gap-2">
<div class="badge badge-error badge-xs"></div>
<div class="text-xs font-medium tracking-wide">Stopped</div>
</div>
@endif
@if (data_get($preview, 'status') !== 'exited')
| <a target="_blank" href="{{ data_get($preview, 'fqdn') }}">Open Preview
<x-external-link />
@@ -46,7 +75,7 @@
</a>
</div>
<div class="flex items-center gap-2 pt-6">
<x-forms.button isHighlighted wire:click="deploy({{ data_get($preview, 'pull_request_id') }})">
<x-forms.button wire:click="deploy({{ data_get($preview, 'pull_request_id') }})">
@if (data_get($preview, 'status') === 'exited')
Deploy
@else
@@ -58,7 +87,6 @@
Preview
</x-forms.button>
@endif
</div>
</div>
@endforeach