Update modal input behavior and limit-reached layout

This commit is contained in:
Andras Bacsai 2024-03-22 17:02:09 +01:00
parent 54834891fb
commit 04c92ec4bd
7 changed files with 65 additions and 94 deletions

View File

View File

@ -90,8 +90,7 @@ public function loadServices(bool $force = false)
$this->allServices = getServiceTemplates();
$this->services = $this->allServices->filter(function ($service, $key) {
return str_contains(strtolower($key), strtolower($this->search));
});;
$this->dispatch('success', 'Successfully loaded services.');
});
}
} catch (\Throwable $e) {
return handleError($e, $this);

View File

@ -1,4 +1,4 @@
<div class="flex flex-col items-center justify-center h-screen">
<div class="flex flex-col items-center justify-center h-32">
<span class="text-xl font-bold text-white">You have reached the limit of {{ $name }} you can create.</span>
<span>Please <a class="text-white underline "href="{{ route('subscription.show') }}">upgrade your
subscription</a> to create more

View File

@ -6,7 +6,7 @@
'action' => 'delete',
'content' => null,
])
<div x-data="{ modalOpen: false }" :class="{ 'z-40': modalOpen }" class="relative w-auto h-auto">
<div x-data="{ modalOpen: false }" :class="{ 'z-40': modalOpen }" @keydown.window.escape="modalOpen=false" class="relative w-auto h-auto">
@if ($content)
<div @click="modalOpen=true">
{{ $content }}

View File

@ -1,14 +1,9 @@
<x-layout>
<div class="flex items-start gap-2">
<h1>Destinations</h1>
<x-slide-over fullScreen closeWithX>
<x-slot:title>New Destination</x-slot:title>
<x-slot:content>
<livewire:destination.new.docker :server_id="$server_id" />
</x-slot:content>
<button @click="slideOverOpen=true" class="button">+
Add</button>
</x-slide-over>
<x-modal-input buttonTitle="+ Add" title="New Destination">
<livewire:destination.new.docker :server_id="$server_id" />
</x-modal-input>
</div>
<div class="subtitle">Endpoints to deploy your resources.</div>
<div class="grid gap-2 lg:grid-cols-2">

View File

@ -38,8 +38,7 @@
<div class="flex items-center group">
<a class="mx-4 rounded hover:no-underline"
href="{{ route('project.resource.create', ['project_uuid' => data_get($project, 'uuid'), 'environment_name' => data_get($project, 'environments.0.name', 'production')]) }}">
<span
class="p-2 font-bold on-box">+
<span class="p-2 font-bold on-box">+
Add Resource</span>
</a>
<a class="mx-4"
@ -59,18 +58,11 @@ class="p-2 font-bold on-box">+
</div>
@else
<div class="flex flex-col gap-1">
<div class='font-bold text-warning'>No projects found.</div>
<div class="flex gap-1">Add your first project
<div>
<x-slide-over fullScreen closeWithX>
<x-slot:title>New Project</x-slot:title>
<x-slot:content>
<livewire:project.add-empty />
</x-slot:content>
<div class="underline cursor-pointer dark:text-white" @click="slideOverOpen=true">here
</div>
</x-slide-over>
</div> or
<div class='font-bold dark:text-warning'>No projects found.</div>
<div class="flex items-center gap-1">
<x-modal-input buttonTitle="Add" title="New Project">
<livewire:project.add-empty />
</x-modal-input> your first project or
go to the <a class="underline dark:text-white" href="{{ route('onboarding') }}">onboarding</a> page.
</div>
</div>
@ -111,78 +103,69 @@ class="p-2 font-bold on-box">+
@else
@if ($private_keys->count() === 0)
<div class="flex flex-col gap-1">
<div class='font-bold text-warning'>No private keys found.</div>
<div class="flex gap-1">Before you can add your server, first add a private key
<div>
<x-slide-over fullScreen closeWithX>
<x-slot:title>New Private Key</x-slot:title>
<x-slot:content>
<livewire:security.private-key.create from="server" />
</x-slot:content>
<div class="underline cursor-pointer dark:text-white" @click="slideOverOpen=true">here
</div>
</x-slide-over>
</div> or
<div class='font-bold dark:text-warning'>No private keys found.</div>
<div class="flex items-center gap-1">Before you can add your server, first <x-modal-input
buttonTitle="add" title="New Private Key">
<livewire:security.private-key.create from="server" />
</x-modal-input> a private key
or
go to the <a class="underline dark:text-white" href="{{ route('onboarding') }}">onboarding</a>
page.
</div>
</div>
@else
<div class="flex gap-1">
<span class='font-bold text-warning'>No servers found.</span> Add your first server
<div>
<x-slide-over fullScreen closeWithX>
<x-slot:title>New Server</x-slot:title>
<x-slot:content>
<livewire:server.create />
</x-slot:content>
<div class="underline cursor-pointer dark:text-white" @click="slideOverOpen=true">here
</div>
</x-slide-over>
</div> or
<span class='font-bold text-warning'>No servers found.</span>
<x-modal-input buttonTitle="Add"
title="New Server">
<livewire:server.create />
</x-modal-input> your first server
or
go to the <a class="underline dark:text-white" href="{{ route('onboarding') }}">onboarding</a>
page.
</div>
@endif
@endif
<div class="flex items-center gap-2">
<h3 class="py-4">Deployments</h3>
@if (count($deployments_per_server) > 0)
<x-loading />
@endif
<x-forms.button wire:click='cleanup_queue'>Cleanup Queues</x-forms.button>
</div>
<div wire:poll.1000ms="get_deployments" class="grid grid-cols-1">
@forelse ($deployments_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="box-title">
{{ data_get($deployment, 'application_name') }}
</div>
@if (data_get($deployment, 'pull_request_id') !== 0)
<div class="box-description">
PR #{{ data_get($deployment, 'pull_request_id') }}
@if ($servers->count() > 0 && $projects->count() > 0)
<div class="flex items-center gap-2">
<h3 class="py-4">Deployments</h3>
@if (count($deployments_per_server) > 0)
<x-loading />
@endif
<x-forms.button wire:click='cleanup_queue'>Cleanup Queues</x-forms.button>
</div>
<div wire:poll.1000ms="get_deployments" class="grid grid-cols-1">
@forelse ($deployments_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="box-title">
{{ data_get($deployment, 'application_name') }}
</div>
@if (data_get($deployment, 'pull_request_id') !== 0)
<div class="box-description">
PR #{{ data_get($deployment, 'pull_request_id') }}
</div>
@endif
<div class="box-description">
{{ str(data_get($deployment, 'status'))->headline() }}
</div>
@endif
<div class="box-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 class="flex-1"></div>
</a>
@endforeach
</div>
@empty
<div>No deployments running.</div>
@endforelse
</div>
@endif
<script>

View File

@ -1,17 +1,11 @@
<div>
<div class="flex items-start gap-2">
<h1>Servers</h1>
<x-slide-over fullScreen closeWithX>
<x-slot:title>New Server</x-slot:title>
<x-slot:content>
<livewire:server.create />
</x-slot:content>
<button @click="slideOverOpen=true" class="button">+
Add</button>
</x-slide-over>
<x-modal-input buttonTitle="+ Add" title="New Server">
<livewire:server.create />
</x-modal-input>
</div>
<div class="subtitle">All your servers are here.</div>
<div class="grid gap-2 lg:grid-cols-2">
@forelse ($servers as $server)
<a href="{{ route('server.show', ['server_uuid' => data_get($server, 'uuid')]) }}"