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 @@ public function get_deployments()
"server_id",
"status"
])->sortBy('id')->groupBy('server_name')->toArray();
$this->dispatch('deployments', $this->deployments_per_tag_per_server);
} catch (\Exception $e) {
return handleError($e, $this);
}

View File

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

View File

@ -203,7 +203,7 @@ .box-boarding {
@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 {
@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 {
@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)
<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)
<div @class([
'box-without-bg dark:bg-coolgray-100 bg-white gap-2 cursor-pointer group border-l-2 border-dotted',
<a href="{{ data_get($deployment, 'deployment_url') }}" @class([
'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',
'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="box-title">
{{ data_get($deployment, 'application_name') }}
</div>
<div class="box-description">
{{ str(data_get($deployment, 'status'))->headline() }}
</div>
<div class="flex flex-col mx-6">
<div class="box-title">
{{ data_get($deployment, 'application_name') }}
</div>
<div class="flex-1"></div>
</a>
</div>
<div class="box-description">
{{ str(data_get($deployment, 'status'))->headline() }}
</div>
</div>
<div class="flex-1"></div>
</a>
@endforeach
</div>
@empty

View File

@ -2,7 +2,7 @@
<h1>Tags</h1>
<div class="flex flex-col pb-6 ">
<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)
<div>No tags yet defined yet. Go to a resource and add a tag there.</div>
@else