fix: destinations livewire refactor
removed unnecessary livewire components, renamed them ,etc etc
This commit is contained in:
@@ -148,7 +148,7 @@
|
||||
<li>
|
||||
<a title="Destinations"
|
||||
class="{{ request()->is('destination*') ? 'menu-item-active menu-item' : 'menu-item' }}"
|
||||
href="{{ route('destination.all') }}">
|
||||
href="{{ route('destination.index') }}" wire:navigate>
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24">
|
||||
<path fill="none" stroke="currentColor" stroke-linecap="round"
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
<x-layout>
|
||||
<x-slot:title>
|
||||
Destinations | Coolify
|
||||
</x-slot>
|
||||
<div class="flex items-start gap-2">
|
||||
<h1>Destinations</h1>
|
||||
@if ($servers->count() > 0)
|
||||
<x-modal-input buttonTitle="+ Add" title="New Destination">
|
||||
<livewire:destination.new.docker :server_id="$server_id" />
|
||||
</x-modal-input>
|
||||
@endif
|
||||
</div>
|
||||
<div class="subtitle">Network endpoints to deploy your resources.</div>
|
||||
<div class="grid gap-2 lg:grid-cols-1">
|
||||
@forelse ($destinations as $destination)
|
||||
@if ($destination->getMorphClass() === 'App\Models\StandaloneDocker')
|
||||
<a class="box group"
|
||||
href="{{ route('destination.show', ['destination_uuid' => data_get($destination, 'uuid')]) }}">
|
||||
<div class="flex flex-col mx-6">
|
||||
<div class="box-title">{{ $destination->name }}</div>
|
||||
<div class="box-description">server: {{ $destination->server->name }}</div>
|
||||
</div>
|
||||
</a>
|
||||
@endif
|
||||
@if ($destination->getMorphClass() === 'App\Models\SwarmDocker')
|
||||
<a class="box group"
|
||||
href="{{ route('destination.show', ['destination_uuid' => data_get($destination, 'uuid')]) }}">
|
||||
<div class="flex flex-col mx-6">
|
||||
<div class="box-title">{{ $destination->name }}</div>
|
||||
<div class="box-description">server: {{ $destination->server->name }}</div>
|
||||
</div>
|
||||
</a>
|
||||
@endif
|
||||
@empty
|
||||
<div>
|
||||
@if ($servers->count() === 0)
|
||||
<div>No servers found. Please add one first.</div>
|
||||
@else
|
||||
<div>No destinations found.</div>
|
||||
@endif
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</x-layout>
|
||||
@@ -1,3 +0,0 @@
|
||||
<x-layout>
|
||||
<livewire:destination.form :destination="$destination" />
|
||||
</x-layout>
|
||||
@@ -1,29 +0,0 @@
|
||||
<div>
|
||||
<form class="flex flex-col">
|
||||
<div class="flex items-center gap-2">
|
||||
<h1>Destination</h1>
|
||||
<x-forms.button wire:click.prevent='submit' type="submit">
|
||||
Save
|
||||
</x-forms.button>
|
||||
@if ($destination->network !== 'coolify')
|
||||
<x-modal-confirmation title="Confirm Destination Deletion?" buttonTitle="Delete Destination" isErrorButton
|
||||
submitAction="delete" :actions="['This will delete the selected destination/network.']" confirmationText="{{ $destination->name }}"
|
||||
confirmationLabel="Please confirm the execution of the actions by entering the Destination Name below"
|
||||
shortConfirmationLabel="Destination Name" :confirmWithPassword="false" step2ButtonText="Permanently Delete" />
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if ($destination->getMorphClass() === 'App\Models\StandaloneDocker')
|
||||
<div class="subtitle ">A Docker network in a non-swarm environment.</div>
|
||||
@else
|
||||
<div class="subtitle ">Your swarm docker network. WIP</div>
|
||||
@endif
|
||||
<div class="flex gap-2">
|
||||
<x-forms.input id="destination.name" label="Name" />
|
||||
<x-forms.input id="destination.server.ip" label="Server IP" readonly />
|
||||
@if ($destination->getMorphClass() === 'App\Models\StandaloneDocker')
|
||||
<x-forms.input id="destination.network" label="Docker Network" readonly />
|
||||
@endif
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
44
resources/views/livewire/destination/index.blade.php
Normal file
44
resources/views/livewire/destination/index.blade.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<div>
|
||||
<x-slot:title>
|
||||
Destinations | Coolify
|
||||
</x-slot>
|
||||
<div class="flex items-start gap-2">
|
||||
<h1>Destinations</h1>
|
||||
@if ($servers->count() > 0)
|
||||
<x-modal-input buttonTitle="+ Add" title="New Destination">
|
||||
<livewire:destination.new.docker />
|
||||
</x-modal-input>
|
||||
@endif
|
||||
</div>
|
||||
<div class="subtitle">Network endpoints to deploy your resources.</div>
|
||||
<div class="grid gap-2 lg:grid-cols-1">
|
||||
@forelse ($servers as $server)
|
||||
@forelse ($server->destinations() as $destination)
|
||||
@if ($destination->getMorphClass() === 'App\Models\StandaloneDocker')
|
||||
<a class="box group"
|
||||
href="{{ route('destination.show', ['destination_uuid' => data_get($destination, 'uuid')]) }}"
|
||||
wire:navigate>
|
||||
<div class="flex flex-col mx-6">
|
||||
<div class="box-title">{{ $destination->name }}</div>
|
||||
<div class="box-description">Server: {{ $destination->server->name }}</div>
|
||||
</div>
|
||||
</a>
|
||||
@endif
|
||||
@if ($destination->getMorphClass() === 'App\Models\SwarmDocker')
|
||||
<a class="box group"
|
||||
href="{{ route('destination.show', ['destination_uuid' => data_get($destination, 'uuid')]) }}"
|
||||
wire:navigate>
|
||||
<div class="flex flex-col mx-6">
|
||||
<div class="box-title">{{ $destination->name }}</div>
|
||||
<div class="box-description">server: {{ $destination->server->name }}</div>
|
||||
</div>
|
||||
</a>
|
||||
@endif
|
||||
@empty
|
||||
<div>No destinations found.</div>
|
||||
@endforelse
|
||||
@empty
|
||||
<div>No servers found.</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,42 +1,29 @@
|
||||
<div>
|
||||
@if ($server->isFunctional())
|
||||
<div class="flex items-end gap-2">
|
||||
<h2>Destinations</h2>
|
||||
<x-modal-input buttonTitle="+ Add" title="New Destination">
|
||||
<livewire:destination.new.docker :server_id="$server->id" />
|
||||
</x-modal-input>
|
||||
<x-forms.button wire:click='scan'>Scan for Destinations</x-forms.button>
|
||||
</div>
|
||||
<div>Destinations are used to segregate resources by network.</div>
|
||||
<div class="flex gap-2 pt-6">
|
||||
Available for using:
|
||||
@forelse ($server->standaloneDockers as $docker)
|
||||
<a href="{{ route('destination.show', ['destination_uuid' => data_get($docker, 'uuid')]) }}">
|
||||
<button class="dark:text-white btn-link">{{ data_get($docker, 'network') }} </button>
|
||||
</a>
|
||||
@empty
|
||||
@endforelse
|
||||
@forelse ($server->swarmDockers as $docker)
|
||||
<a href="{{ route('destination.show', ['destination_uuid' => data_get($docker, 'uuid')]) }}">
|
||||
<button class="dark:text-white btn-link">{{ data_get($docker, 'network') }} </button>
|
||||
</a>
|
||||
@empty
|
||||
@endforelse
|
||||
</div>
|
||||
<div class="pt-2">
|
||||
@if (count($networks) > 0)
|
||||
<h3 class="pb-4">Found Destinations</h3>
|
||||
<form class="flex flex-col">
|
||||
<div class="flex items-center gap-2">
|
||||
<h1>Destination</h1>
|
||||
<x-forms.button wire:click.prevent='submit' type="submit">
|
||||
Save
|
||||
</x-forms.button>
|
||||
@if ($network !== 'coolify')
|
||||
<x-modal-confirmation title="Confirm Destination Deletion?" buttonTitle="Delete Destination" isErrorButton
|
||||
submitAction="delete" :actions="['This will delete the selected destination/network.']" confirmationText="{{ $destination->name }}"
|
||||
confirmationLabel="Please confirm the execution of the actions by entering the Destination Name below"
|
||||
shortConfirmationLabel="Destination Name" :confirmWithPassword="false" step2ButtonText="Permanently Delete" />
|
||||
@endif
|
||||
<div class="flex flex-wrap gap-2 ">
|
||||
@foreach ($networks as $network)
|
||||
<div class="min-w-fit">
|
||||
<x-forms.button wire:click="add('{{ data_get($network, 'Name') }}')">Add
|
||||
{{ data_get($network, 'Name') }}</x-forms.button>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div>Server is not validated. Validate first.</div>
|
||||
@endif
|
||||
|
||||
@if ($destination->getMorphClass() === 'App\Models\StandaloneDocker')
|
||||
<div class="subtitle ">A Docker network in a non-swarm environment.</div>
|
||||
@else
|
||||
<div class="subtitle ">Your swarm docker network. WIP</div>
|
||||
@endif
|
||||
<div class="flex gap-2">
|
||||
<x-forms.input id="name" label="Name" />
|
||||
<x-forms.input id="serverIp" label="Server IP" readonly />
|
||||
@if ($destination->getMorphClass() === 'App\Models\StandaloneDocker')
|
||||
<x-forms.input id="network" label="Docker Network" readonly />
|
||||
@endif
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
49
resources/views/livewire/server/destinations.blade.php
Normal file
49
resources/views/livewire/server/destinations.blade.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<div>
|
||||
<x-slot:title>
|
||||
{{ data_get_str($server, 'name')->limit(10) }} > Destinations | Coolify
|
||||
</x-slot>
|
||||
<x-server.navbar :server="$server" />
|
||||
<div class="flex flex-col h-full gap-8 sm:flex-row">
|
||||
<x-server.sidebar :server="$server" activeMenu="destinations" />
|
||||
<div class="w-full">
|
||||
@if ($server->isFunctional())
|
||||
<div class="flex items-end gap-2">
|
||||
<h2>Destinations</h2>
|
||||
<x-modal-input buttonTitle="+ Add" title="New Destination">
|
||||
<livewire:destination.new.docker :server_id="$server->id" />
|
||||
</x-modal-input>
|
||||
<x-forms.button isHighlighted wire:click='scan'>Scan for Destinations</x-forms.button>
|
||||
</div>
|
||||
<div>Destinations are used to segregate resources by network.</div>
|
||||
<h4 class="pt-4 pb-2">Available Destinations</h4>
|
||||
<div class="flex gap-2">
|
||||
@foreach ($server->standaloneDockers as $docker)
|
||||
<a href="{{ route('destination.show', ['destination_uuid' => data_get($docker, 'uuid')]) }}">
|
||||
<x-forms.button>{{ data_get($docker, 'network') }} </x-forms.button>
|
||||
</a>
|
||||
@endforeach
|
||||
@foreach ($server->swarmDockers as $docker)
|
||||
<a href="{{ route('destination.show', ['destination_uuid' => data_get($docker, 'uuid')]) }}">
|
||||
<x-forms.button>{{ data_get($docker, 'network') }} </x-forms.button>
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
@if ($networks->count() > 0)
|
||||
<div class="pt-2">
|
||||
<h3 class="pb-4">Found Destinations</h3>
|
||||
<div class="flex flex-wrap gap-2 ">
|
||||
@foreach ($networks as $network)
|
||||
<div class="min-w-fit">
|
||||
<x-forms.button wire:click="add('{{ data_get($network, 'Name') }}')">Add
|
||||
{{ data_get($network, 'Name') }}</x-forms.button>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@else
|
||||
<div>Server is not validated. Validate first.</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user