ui: fix tag view

This commit is contained in:
Andras Bacsai 2024-05-08 10:36:30 +02:00
parent fb80318553
commit b74eab8377
5 changed files with 28 additions and 23 deletions

View File

@ -26,6 +26,7 @@ class Deployments extends Component
"server_id", "server_id",
"status" "status"
])->sortBy('id')->groupBy('server_name')->toArray(); ])->sortBy('id')->groupBy('server_name')->toArray();
$this->dispatch('deployments', $this->deployments_per_tag_per_server);
} catch (\Exception $e) { } catch (\Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -20,6 +20,12 @@ class Index extends Component
public $webhook = null; public $webhook = null;
public $deployments_per_tag_per_server = []; public $deployments_per_tag_per_server = [];
protected $listeners = ['deployments' => 'update_deployments'];
public function update_deployments($deployments)
{
$this->deployments_per_tag_per_server = $deployments;
}
public function tag_updated() public function tag_updated()
{ {
if ($this->tag == "") { if ($this->tag == "") {
@ -39,14 +45,13 @@ class Index extends Component
public function redeploy_all() public function redeploy_all()
{ {
try { try {
$message = collect([]); $this->applications->each(function ($resource){
$this->applications->each(function ($resource) use ($message) {
$deploy = new Deploy(); $deploy = new Deploy();
$message->push($deploy->deploy_resource($resource)); $deploy->deploy_resource($resource);
}); });
$this->services->each(function ($resource) use ($message) { $this->services->each(function ($resource) {
$deploy = new Deploy(); $deploy = new Deploy();
$message->push($deploy->deploy_resource($resource)); $deploy->deploy_resource($resource);
}); });
$this->dispatch('success', 'Mass deployment started.'); $this->dispatch('success', 'Mass deployment started.');
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -203,7 +203,7 @@ tr td:first-child {
@apply flex lg:flex-row flex-col p-2 transition-colors cursor-pointer min-h-[4rem] dark:bg-coolgray-100 dark:text-white bg-neutral-50 border border-neutral-200 dark:border-black hover:bg-neutral-100 dark:hover:bg-coollabs-100 dark:hover:text-white hover:text-black hover:no-underline text-black; @apply flex lg:flex-row flex-col p-2 transition-colors cursor-pointer min-h-[4rem] dark:bg-coolgray-100 dark:text-white bg-neutral-50 border border-neutral-200 dark:border-black hover:bg-neutral-100 dark:hover:bg-coollabs-100 dark:hover:text-white hover:text-black hover:no-underline text-black;
} }
.box-without-bg { .box-without-bg {
@apply flex p-2 transition-colors dark:hover:text-white hover:no-underline min-h-[4rem] border border-neutral-200 dark:border-black; @apply flex p-2 transition-colors dark:hover:text-white hover:no-underline min-h-[4rem] border border-neutral-200 dark:border-black;
} }
.box-without-bg-without-border { .box-without-bg-without-border {
@apply flex p-2 transition-colors dark:hover:text-white hover:no-underline min-h-[4rem]; @apply flex p-2 transition-colors dark:hover:text-white hover:no-underline min-h-[4rem];

View File

@ -1,25 +1,24 @@
<div wire:poll.1000ms="get_deployments" class="grid grid-cols-1"> <div wire:poll.2000ms="get_deployments" wire:init='get_deployments'>
@forelse ($deployments_per_tag_per_server as $server_name => $deployments) @forelse ($deployments_per_tag_per_server as $server_name => $deployments)
<h4 class="py-4">{{ $server_name }}</h4> <h4 class="py-4">{{ $server_name }}</h4>
<div class="grid grid-cols-1 gap-2 lg:grid-cols-3"> <div class="grid grid-cols-1 gap-2">
@foreach ($deployments as $deployment) @foreach ($deployments as $deployment)
<div @class([ <a href="{{ data_get($deployment, 'deployment_url') }}" @class([
'box-without-bg dark:bg-coolgray-100 bg-white gap-2 cursor-pointer group border-l-2 border-dotted', 'box-without-bg-without-border dark:bg-coolgray-100 bg-white gap-2 cursor-pointer group border-l-2',
'dark:border-coolgray-300' => data_get($deployment, 'status') === 'queued', 'dark:border-coolgray-300' => data_get($deployment, 'status') === 'queued',
'border-yellow-500' => data_get($deployment, 'status') === 'in_progress', 'dark:border-yellow-500' =>
data_get($deployment, 'status') === 'in_progress',
])> ])>
<a href="{{ data_get($deployment, 'deployment_url') }}"> <div class="flex flex-col mx-6">
<div class="flex flex-col mx-6"> <div class="box-title">
<div class="box-title"> {{ data_get($deployment, 'application_name') }}
{{ data_get($deployment, 'application_name') }}
</div>
<div class="box-description">
{{ str(data_get($deployment, 'status'))->headline() }}
</div>
</div> </div>
<div class="flex-1"></div> <div class="box-description">
</a> {{ str(data_get($deployment, 'status'))->headline() }}
</div> </div>
</div>
<div class="flex-1"></div>
</a>
@endforeach @endforeach
</div> </div>
@empty @empty

View File

@ -2,7 +2,7 @@
<h1>Tags</h1> <h1>Tags</h1>
<div class="flex flex-col pb-6 "> <div class="flex flex-col pb-6 ">
<div class="subtitle">Tags help you to perform actions on multiple resources.</div> <div class="subtitle">Tags help you to perform actions on multiple resources.</div>
<div class="flex flex-wrap gap-2"> <div class="">
@if ($tags->count() === 0) @if ($tags->count() === 0)
<div>No tags yet defined yet. Go to a resource and add a tag there.</div> <div>No tags yet defined yet. Go to a resource and add a tag there.</div>
@else @else