fix
This commit is contained in:
parent
c9c56c915c
commit
f828cd813b
@ -24,16 +24,18 @@ class StandaloneDocker extends Component
|
||||
];
|
||||
public function mount()
|
||||
{
|
||||
if (!$this->server_id) {
|
||||
if (request()->query('server_id')) {
|
||||
$this->server_id = request()->query('server_id');
|
||||
} else {
|
||||
if ($this->servers->count() > 0) {
|
||||
$this->server_id = $this->servers->first()->id;
|
||||
}
|
||||
if (request()->query('server_id')) {
|
||||
$this->server_id = request()->query('server_id');
|
||||
} else {
|
||||
if ($this->servers->count() > 0) {
|
||||
$this->server_id = $this->servers->first()->id;
|
||||
}
|
||||
}
|
||||
$this->network = new Cuid2(7);
|
||||
if (request()->query('network_name')) {
|
||||
$this->network = request()->query('network_name');
|
||||
} else {
|
||||
$this->network = new Cuid2(7);
|
||||
}
|
||||
$this->name = generate_random_name();
|
||||
}
|
||||
private function createNetworkAndAttachToProxy()
|
||||
|
24
app/Http/Livewire/Destination/Show.php
Normal file
24
app/Http/Livewire/Destination/Show.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Destination;
|
||||
|
||||
use App\Models\Server;
|
||||
use Illuminate\Support\Collection;
|
||||
use Livewire\Component;
|
||||
|
||||
class Show extends Component
|
||||
{
|
||||
public Server $server;
|
||||
public Collection|array $networks = [];
|
||||
public function scan()
|
||||
{
|
||||
$alreadyAddedNetworks = $this->server->standaloneDockers;
|
||||
ray($alreadyAddedNetworks);
|
||||
$networks = instant_remote_process(['docker network ls --format "{{json .}}"'], $this->server, false);
|
||||
$this->networks = format_docker_command_output_to_json($networks)->filter(function ($network) {
|
||||
return $network['Name'] !== 'bridge' && $network['Name'] !== 'host' && $network['Name'] !== 'none';
|
||||
})->filter(function ($network) use ($alreadyAddedNetworks) {
|
||||
return !$alreadyAddedNetworks->contains('network', $network['Name']);
|
||||
});
|
||||
}
|
||||
}
|
34
resources/views/livewire/destination/show.blade.php
Normal file
34
resources/views/livewire/destination/show.blade.php
Normal file
@ -0,0 +1,34 @@
|
||||
<div>
|
||||
<div class="flex items-end gap-2">
|
||||
<h1>Destinations</h1>
|
||||
<a href="{{ route('destination.new', ['server_id' => $server->id]) }}">
|
||||
<x-forms.button>Add a new destination</x-forms.button>
|
||||
</a>
|
||||
<x-forms.button wire:click='scan'>Scan destinations on the server</x-forms.button>
|
||||
</div>
|
||||
<div class="pt-2 pb-6 text-sm">Destinations are used to segregate resources by network.</div>
|
||||
<div class="flex gap-2 text-sm">
|
||||
Docker Networks added to the server:
|
||||
@forelse ($server->standaloneDockers as $docker)
|
||||
<a href="{{ route('destination.show', ['destination_uuid' => data_get($docker, 'uuid')]) }}">
|
||||
<button class="text-white btn-link">{{ data_get($docker, 'network') }} </button>
|
||||
</a>
|
||||
@empty
|
||||
<div class="text-sm">No destinations added</div>
|
||||
@endforelse
|
||||
</div>
|
||||
<div class="grid gap-2 pt-2">
|
||||
@if (count($networks) > 0)
|
||||
<h3>Scanned available destinations</h3>
|
||||
@endif
|
||||
@foreach ($networks as $network)
|
||||
<div class="flex gap-2 text-sm w-96">
|
||||
<div class="w-32">{{ data_get($network, 'Name') }}</div>
|
||||
<a
|
||||
href="{{ route('destination.new', ['server_id' => $server->id, 'network_name' => data_get($network, 'Name')]) }}">
|
||||
<x-forms.button>Add to Coolify</x-forms.button>
|
||||
</a>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
@ -1,6 +1,16 @@
|
||||
<div x-data="{ deletePrivateKey: false, showPrivateKey: false }">
|
||||
<x-naked-modal show="deletePrivateKey" message='Are you sure you would like to delete this private key?' />
|
||||
<form class="flex flex-col gap-2" wire:submit.prevent='changePrivateKey'>
|
||||
<div class="flex items-end gap-2">
|
||||
<h1>Private Key</h1>
|
||||
<x-forms.button type="submit">
|
||||
Save
|
||||
</x-forms.button>
|
||||
<x-forms.button x-on:click.prevent="deletePrivateKey = true">
|
||||
Delete
|
||||
</x-forms.button>
|
||||
</div>
|
||||
<div class="pt-2 pb-8 text-sm">Private Key used for SSH connection</div>
|
||||
<x-forms.input id="private_key.name" label="Name" required />
|
||||
<x-forms.input id="private_key.description" label="Description" />
|
||||
<div>
|
||||
@ -23,13 +33,6 @@
|
||||
<x-forms.textarea rows="10" id="private_key.private_key" required />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<x-forms.button type="submit">
|
||||
Save
|
||||
</x-forms.button>
|
||||
<x-forms.button x-on:click.prevent="deletePrivateKey = true">
|
||||
Delete
|
||||
</x-forms.button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<x-forms.button>Add a new Private Key</x-forms.button>
|
||||
</a>
|
||||
</div>
|
||||
<div class="pt-2 pb-8 text-sm">Selected Private Key for SSH connection</div>
|
||||
<div class="pt-2 pb-6 text-sm">Selected Private Key for SSH connection</div>
|
||||
<div class="pb-10 text-sm">
|
||||
@if (data_get($server, 'privateKey.uuid'))
|
||||
Currently attached Private Key:
|
||||
|
@ -1,5 +1,4 @@
|
||||
<x-layout>
|
||||
<h1>Private Key</h1>
|
||||
<div class="pt-2 pb-10 text-sm">Sssh, it is private</div>
|
||||
|
||||
<livewire:private-key.change :private_key_uuid="$private_key->uuid" />
|
||||
</x-layout>
|
||||
|
@ -1,20 +1,4 @@
|
||||
<x-layout>
|
||||
<x-server.navbar :server="$server" />
|
||||
<div class="flex items-end gap-2">
|
||||
<h1>Destinations</h1>
|
||||
<a href="{{ route('destination.new', ['server_id' => $server->id]) }}">
|
||||
<x-forms.button>Add a new destination</x-forms.button>
|
||||
</a>
|
||||
</div>
|
||||
<div class="pt-2 pb-6 text-sm">Destinations are used to segregate resources by network.</div>
|
||||
<div class="flex gap-2 text-sm">
|
||||
Docker Networks available on the server:
|
||||
@forelse ($server->standaloneDockers as $docker)
|
||||
<a href="{{ route('destination.show', ['destination_uuid' => data_get($docker, 'uuid')]) }}">
|
||||
<button class="text-white btn-link">{{ data_get($docker, 'network') }} </button>
|
||||
</a>
|
||||
@empty
|
||||
<div class="text-sm">No destinations added</div>
|
||||
@endforelse
|
||||
</div>
|
||||
<livewire:destination.show :server="$server" />
|
||||
</x-layout>
|
||||
|
Loading…
x
Reference in New Issue
Block a user