Refactor code and update destination component

This commit is contained in:
Andras Bacsai
2023-11-21 15:31:46 +01:00
parent f58e6766e1
commit ef7fc1b260
12 changed files with 162 additions and 53 deletions

View File

@@ -1,4 +1,4 @@
<x-layout>
<div>
<h1>Configuration</h1>
<livewire:project.application.heading :application="$application" />
<div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'general' }" class="flex h-full pt-6">
@@ -66,7 +66,7 @@
</div>
@endif
<div x-cloak x-show="activeTab === 'server'">
<livewire:project.shared.destination :destination="$application->destination" />
<livewire:project.shared.destination :resource="$application" :servers="$servers" />
</div>
<div x-cloak x-show="activeTab === 'storages'">
<livewire:project.service.storage :resource="$application" />
@@ -91,4 +91,4 @@
</div>
</div>
</div>
</x-layout>
</div>

View File

@@ -3,7 +3,34 @@
<div class="">The destination server where your application will be deployed to.</div>
<div class="py-4 ">
<a class="box"
href="{{ route('server.show', ['server_uuid' => data_get($destination, 'server.uuid')]) }}">On server <span class="px-1 text-warning">{{ data_get($destination, 'server.name') }}</span>
in <span class="px-1 text-warning"> {{ data_get($destination, 'network') }} </span> network.</a>
href="{{ route('server.show', ['server_uuid' => data_get($resource, 'destination.server.uuid')]) }}">On
server <span class="px-1 text-warning">{{ data_get($resource, 'destination.server.name') }}</span>
in <span class="px-1 text-warning"> {{ data_get($resource, 'destination.network') }} </span> network.</a>
</div>
{{-- {{$resource->additional_destinations}} --}}
{{-- @if (count($servers) > 0)
<div>
<h3>Additional Servers</h3>
@foreach ($servers as $server)
<form wire:submit.prevent='submit' class="p-2 border border-coolgray-400">
<h4>{{ $server->name }}</h4>
<div class="text-sm text-coolgray-600">{{ $server->description }}</div>
<x-forms.checkbox id="additionalServers.{{ $loop->index }}.enabled" label="Enabled">
</x-forms.checkbox>
<x-forms.select label="Destination" id="additionalServers.{{ $loop->index }}.destination" required>
@foreach ($server->destinations() as $destination)
@if ($loop->first)
<option selected value="{{ $destination->uuid }}">{{ $destination->name }}</option>
<option value="{{ $destination->uuid }}">{{ $destination->name }}</option>
@else
<option value="{{ $destination->uuid }}">{{ $destination->name }}</option>
<option value="{{ $destination->uuid }}">{{ $destination->name }}</option>
@endif
@endforeach
</x-forms.select>
<x-forms.button type="submit">Save</x-forms.button>
</form>
@endforeach
</div>
@endif --}}
</div>

View File

@@ -63,7 +63,7 @@
<livewire:project.shared.environment-variable.all :resource="$database" />
</div>
<div x-cloak x-show="activeTab === 'server'">
<livewire:project.shared.destination :destination="$database->destination" />
<livewire:project.shared.destination :resource="$database" />
</div>
<div x-cloak x-show="activeTab === 'storages'">
<livewire:project.service.storage :resource="$database" />