This commit is contained in:
Andras Bacsai 2023-05-16 18:20:24 +02:00
parent 3565dd9c56
commit ae144588cc
2 changed files with 18 additions and 8 deletions

View File

@ -11,6 +11,10 @@ class Revert extends Component
public Application $application; public Application $application;
public $images = []; public $images = [];
public string $current; public string $current;
public function revertImage($tag)
{
dd("Reverting to {$this->application->uuid}:{$tag}");
}
public function loadImages() public function loadImages()
{ {
try { try {
@ -29,11 +33,12 @@ public function loadImages()
})->map(function ($item) { })->map(function ($item) {
$item = Str::of($item)->explode('#'); $item = Str::of($item)->explode('#');
if ($item[1] === $this->current) { if ($item[1] === $this->current) {
$item[1] = $item[1] . " (current)"; $is_current = true;
} }
return [ return [
'tag' => $item[1], 'tag' => $item[1],
'createdAt' => $item[2], 'created_at' => $item[2],
'is_current' => $is_current ?? null,
]; ];
})->toArray(); })->toArray();
} catch (\Throwable $e) { } catch (\Throwable $e) {

View File

@ -2,18 +2,23 @@
<div wire:loading wire:target='loadImages'> <div wire:loading wire:target='loadImages'>
<x-loading /> <x-loading />
</div> </div>
<div wire:loading.remove> <div wire:loading.remove wire:target='loadImages'>
<div class="flex flex-wrap"> <div class="flex flex-wrap">
@forelse ($images as $image) @forelse ($images as $image)
<div class="w-1/2 p-2"> <div class="w-1/2 p-2">
<div class="rounded-lg shadow-lg bg-coolgray-200 "> <div class="rounded-lg shadow-lg bg-coolgray-200">
<div class="p-2"> <div class="p-2">
<div class="text-sm font-bold">{{ data_get($image, 'tag') }}</div> <div class="text-sm">
<div class="text-xs">{{ data_get($image, 'createdAt') }}</div> @if (data_get($image, 'is_current'))
<span class="font-bold text-coollabs">LIVE</span>
@endif
| {{ data_get($image, 'tag') }}
</div>
<div class="text-xs">{{ data_get($image, 'created_at') }}</div>
</div> </div>
<div class="flex justify-end p-2"> <div class="flex justify-end p-2">
<x-inputs.button <x-inputs.button wire:click="revertImage('{{ data_get($image, 'tag') }}')">
wire:click="revertImage('{{ data_get($image, 'name') }}', '{{ data_get($image, 'tag') }}')">
Revert Revert
</x-inputs.button> </x-inputs.button>
</div> </div>