fix: refactor tags view / remove obsolete one

This commit is contained in:
Andras Bacsai
2024-11-05 10:11:15 +01:00
parent 9b578b2003
commit ae7d88df9f
6 changed files with 118 additions and 241 deletions

View File

@@ -215,7 +215,7 @@
<li>
<a title="Tags"
class="{{ request()->is('tags*') ? 'menu-item-active menu-item' : 'menu-item' }}"
href="{{ route('tags.index') }}">
href="{{ route('tags.show') }}">
<svg class="icon" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<g fill="none" stroke="currentColor" stroke-linecap="round"
stroke-linejoin="round" stroke-width="2">

View File

@@ -1,64 +0,0 @@
<div>
<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="">
@if ($tags->count() === 0)
<div>No tags yet defined yet. Go to a resource and add a tag there.</div>
@else
<x-forms.datalist wire:model="tag" onUpdate='tagUpdated'>
@foreach ($tags as $oneTag)
<option value="{{ $oneTag->name }}">{{ $oneTag->name }}</option>
@endforeach
</x-forms.datalist>
@if ($tag)
<div class="pt-5">
<div class="flex items-end gap-2 ">
<div class="w-[500px]">
<x-forms.input readonly label="Deploy Webhook URL" id="webhook" />
</div>
<x-modal-confirmation title="Redeploy all resources with this tag?" isHighlighted
buttonTitle="Redeploy All" submitAction="redeployAll" :actions="[
'All resources with this tag will be redeployed.',
'During redeploy resources will be temporarily unavailable.',
]"
confirmationText="{{ $tag }}"
confirmationLabel="Please confirm the execution of the actions by entering the Tag Name below"
shortConfirmationLabel="Tag Name" :confirmWithPassword="false" step2ButtonText="Redeploy All" />
</div>
<div class="grid grid-cols-1 gap-2 pt-4 lg:grid-cols-2 xl:grid-cols-3">
@foreach ($applications as $application)
<a href="{{ $application->link() }}"class="box group">
<div class="flex flex-col">
<div class="box-title">{{ $application->name }}</div>
<div class="box-description">
{{ $application->project()->name }}/{{ $application->environment->name }}
</div>
<div class="box-description">{{ $application->description }}</div>
</div>
</a>
@endforeach
@foreach ($services as $service)
<a href="{{ $service->link() }}" class="box group">
<div class="flex flex-col ">
<div class="box-title">{{ $service->name }}</div>
<div class="box-description">
{{ $service->project()->name }}/{{ $service->environment->name }}</div>
<div class="box-description">{{ $service->description }}</div>
</div>
</a>
@endforeach
</div>
<div class="flex items-center gap-2">
<h3 class="py-4">Deployments</h3>
@if (count($deploymentsPerTagPerServer) > 0)
<x-loading />
@endif
</div>
<livewire:tags.deployments :deploymentsPerTagPerServer="$deploymentsPerTagPerServer" :resourceIds="$applications->pluck('id')" />
</div>
@endif
@endif
</div>
</div>
</div>

View File

@@ -1,87 +1,96 @@
<div>
<div class="flex items-start gap-2">
<div class="flex items-start gap-2 pb-10">
<div>
<h1>Tags</h1>
<div>Tags help you to perform actions on multiple resources.</div>
</div>
</div>
<div class="flex flex-col gap-2 pb-6 ">
<div>Available tags</div>
<div class="flex flex-wrap gap-2 ">
@forelse ($tags as $oneTag)
<a :class="{{ $tag->id == $oneTag->id }} && 'bg-coollabs hover:bg-coollabs-100'" class="w-64 box"
href="{{ route('tags.show', ['tag_name' => $oneTag->name]) }}">{{ $oneTag->name }}</a>
@empty
<div>No tags yet defined yet. Go to a resource and add a tag there.</div>
@endforelse
</div>
<div class="flex flex-wrap gap-2 ">
@forelse ($tags as $oneTag)
<a wire:navigate :class="{{ $tag?->id == $oneTag->id }} && 'dark:bg-coollabs hover:bg-coollabs-100'"
class="w-64 box-without-bg dark:bg-coolgray-100 dark:text-white font-bold"
href="{{ route('tags.show', ['tagName' => $oneTag->name]) }}">{{ $oneTag->name }}</a>
@empty
<div>No tags yet defined yet. Go to a resource and add a tag there.</div>
@endforelse
</div>
<div>
<h3 class="py-4">Details</h3>
<div class="flex items-end gap-2 ">
<div class="w-[500px]">
<x-forms.input readonly label="Deploy Webhook URL" id="webhook" />
@if (isset($tag))
<div>
<h3 class="py-4">Details</h3>
<div class="flex items-end gap-2 ">
<div class="w-[500px]">
<x-forms.input readonly label="Deploy Webhook URL" id="webhook" />
</div>
<x-modal-confirmation title="Redeploy all resources with this tag?" isHighlighted
buttonTitle="Redeploy All" submitAction="redeployAll" :actions="[
'All resources with this tag will be redeployed.',
'During redeploy resources will be temporarily unavailable.',
]"
confirmationText="{{ $tag->name }}"
confirmationLabel="Please confirm the execution of the actions by entering the Tag Name below"
shortConfirmationLabel="Tag Name" :confirmWithPassword="false" step2ButtonText="Redeploy All" />
</div>
<x-modal-confirmation title="Redeploy all resources with this tag?" isHighlighted buttonTitle="Redeploy All"
submitAction="redeploy_all" :actions="[
'All resources with this tag will be redeployed.',
'During redeploy resources will be temporarily unavailable.',
]" confirmationText="{{ $tag }}"
confirmationLabel="Please confirm the execution of the actions by entering the Tag Name below"
shortConfirmationLabel="Tag Name" :confirmWithPassword="false" step2ButtonText="Redeploy All" />
</div>
<div class="grid grid-cols-1 gap-2 pt-4 lg:grid-cols-2 xl:grid-cols-3">
@foreach ($applications as $application)
<a href="{{ $application->link() }}" class="box group">
<div class="flex flex-col">
<div class="box-title">{{ $application->project()->name }}/{{ $application->environment->name }}
</div>
<div class="box-description">{{ $application->name }}</div>
<div class="box-description">{{ $application->description }}</div>
</div>
</a>
@endforeach
@foreach ($services as $service)
<a href="{{ $service->link() }}" class="flex flex-col box group">
<div class="flex flex-col">
<div class="box-title">{{ $service->project()->name }}/{{ $service->environment->name }}
</div>
<div class="box-description">{{ $service->name }}</div>
<div class="box-description">{{ $service->description }}</div>
</div>
</a>
@endforeach
</div>
<div class="flex items-center gap-2">
<h3 class="py-4">Deployments</h3>
@if (count($deployments_per_tag_per_server) > 0)
<x-loading />
@endif
</div>
<div wire:poll.1000ms="get_deployments" class="grid grid-cols-1">
@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">
@foreach ($deployments as $deployment)
<a href="{{ data_get($deployment, 'deployment_url') }}" @class([
'gap-2 cursor-pointer box group border-l-2 border-dotted',
'dark:border-coolgray-300' => data_get($deployment, 'status') === 'queued',
'border-yellow-500' => data_get($deployment, 'status') === 'in_progress',
])>
<div class="flex flex-col mx-6">
<div class="font-bold dark:text-white">
{{ data_get($deployment, 'application_name') }}
</div>
<div class="description">
{{ str(data_get($deployment, 'status'))->headline() }}
<div class="grid grid-cols-1 gap-2 pt-4 lg:grid-cols-2 xl:grid-cols-3">
@if (isset($applications) && count($applications) > 0)
@foreach ($applications as $application)
<a href="{{ $application->link() }}" class="box group">
<div class="flex flex-col">
<div class="box-title">
{{ $application->project()->name }}/{{ $application->environment->name }}
</div>
<div class="box-description">{{ $application->name }}</div>
<div class="box-description">{{ $application->description }}</div>
</div>
<div class="flex-1"></div>
</a>
@endforeach
</div>
@empty
<div>No deployments running.</div>
@endforelse
@endif
@if (isset($services) && count($services) > 0)
@foreach ($services as $service)
<a href="{{ $service->link() }}" class="flex flex-col box group">
<div class="flex flex-col">
<div class="box-title">
{{ $service->project()->name }}/{{ $service->environment->name }}
</div>
<div class="box-description">{{ $service->name }}</div>
<div class="box-description">{{ $service->description }}</div>
</div>
</a>
@endforeach
@endif
</div>
<div class="flex items-center gap-2">
<h3 class="py-4">Deployments</h3>
@if (count($deploymentsPerTagPerServer) > 0)
<x-loading />
@endif
</div>
<div wire:poll="getDeployments" class="grid grid-cols-1">
@forelse ($deploymentsPerTagPerServer as $serverName => $deployments)
<h4 class="py-4">{{ $serverName }}</h4>
<div class="grid grid-cols-1 gap-2 lg:grid-cols-3">
@foreach ($deployments as $deployment)
<a href="{{ data_get($deployment, 'deployment_url') }}" @class([
'gap-2 cursor-pointer box group border-l-2 border-dotted',
'dark:border-coolgray-300' => data_get($deployment, 'status') === 'queued',
'border-yellow-500' => data_get($deployment, 'status') === 'in_progress',
])>
<div class="flex flex-col mx-6">
<div class="font-bold dark:text-white">
{{ data_get($deployment, 'application_name') }}
</div>
<div class="description">
{{ str(data_get($deployment, 'status'))->headline() }}
</div>
</div>
<div class="flex-1"></div>
</a>
@endforeach
</div>
@empty
<div>No deployments running.</div>
@endforelse
</div>
</div>
</div>
@endif
</div>