fix
This commit is contained in:
parent
0d45d9980c
commit
42d12e36e5
@ -8,7 +8,6 @@
|
||||
|
||||
class Form extends Component
|
||||
{
|
||||
public $server_id;
|
||||
public Server $server;
|
||||
public $uptime;
|
||||
public $dockerVersion;
|
||||
@ -22,10 +21,6 @@ class Form extends Component
|
||||
'server.settings.is_reachable' => 'required',
|
||||
'server.settings.is_part_of_swarm' => 'required'
|
||||
];
|
||||
public function mount()
|
||||
{
|
||||
$this->server = Server::find($this->server_id)->load(['settings']);
|
||||
}
|
||||
public function installDocker()
|
||||
{
|
||||
$activity = resolve(InstallDocker::class)($this->server);
|
||||
|
@ -2,28 +2,27 @@
|
||||
|
||||
namespace App\Http\Livewire\Server;
|
||||
|
||||
use App\Models\PrivateKey as ModelsPrivateKey;
|
||||
use App\Models\Server;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Livewire\Component;
|
||||
|
||||
class PrivateKey extends Component
|
||||
{
|
||||
public $private_keys;
|
||||
public Server $server;
|
||||
public $privateKeys;
|
||||
public $parameters;
|
||||
public function setPrivateKey($private_key_id)
|
||||
{
|
||||
$server = Server::where('uuid', $this->parameters['server_uuid']);
|
||||
$server->update([
|
||||
$this->server->update([
|
||||
'private_key_id' => $private_key_id
|
||||
]);
|
||||
|
||||
// Delete the old ssh mux file to force a new one to be created
|
||||
Storage::disk('ssh-mux')->delete("{$server->first()->ip}_{$server->first()->port}_{$server->first()->user}");
|
||||
return redirect()->route('server.show', $this->parameters['server_uuid']);
|
||||
Storage::disk('ssh-mux')->delete("{$this->server->first()->ip}_{$this->server->first()->port}_{$this->server->first()->user}");
|
||||
$this->server->refresh();
|
||||
}
|
||||
public function mount()
|
||||
{
|
||||
$this->parameters = getRouteParameters();
|
||||
$this->private_keys = ModelsPrivateKey::where('team_id', session('currentTeam')->id)->get();
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,18 @@
|
||||
]) }}">
|
||||
<button>Proxy</button>
|
||||
</a>
|
||||
<a class="{{ request()->routeIs('server.private-key') ? 'text-white' : '' }}"
|
||||
href="{{ route('server.private-key', [
|
||||
'server_uuid' => Route::current()->parameters()['server_uuid'],
|
||||
]) }}">
|
||||
<button>Private Key</button>
|
||||
</a>
|
||||
<a class="{{ request()->routeIs('server.destinations') ? 'text-white' : '' }}"
|
||||
href="{{ route('server.destinations', [
|
||||
'server_uuid' => Route::current()->parameters()['server_uuid'],
|
||||
]) }}">
|
||||
<button>Destinations</button>
|
||||
</a>
|
||||
@if (request()->routeIs('server.proxy'))
|
||||
<div class="flex-1"></div>
|
||||
<livewire:server.proxy.deploy :server="$server" />
|
||||
|
@ -6,9 +6,11 @@
|
||||
<x-forms.button wire:click.prevent='submit' type="submit">
|
||||
Save
|
||||
</x-forms.button>
|
||||
<x-forms.button x-on:click.prevent="deleteDestination = true">
|
||||
Delete
|
||||
</x-forms.button>
|
||||
@if ($destination->network !== 'coolify')
|
||||
<x-forms.button x-on:click.prevent="deleteDestination = true">
|
||||
Delete
|
||||
</x-forms.button>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if ($destination->getMorphClass() === 'App\Models\StandaloneDocker')
|
||||
|
@ -4,18 +4,11 @@
|
||||
<div class="flex gap-2">
|
||||
<h2>General</h2>
|
||||
<x-forms.button type="submit">Save</x-forms.button>
|
||||
@if ($server_id !== 0)
|
||||
@if ($server->id !== 0)
|
||||
<x-forms.button x-on:click.prevent="deleteServer = true">
|
||||
Delete
|
||||
</x-forms.button>
|
||||
@endif
|
||||
@if (!$server->settings->is_reachable)
|
||||
<div class="w-full">
|
||||
<x-forms.button isHighlighted wire:click.prevent='validateServer'>
|
||||
Validate Server
|
||||
</x-forms.button>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="flex flex-col gap-2 xl:flex-row">
|
||||
<div class="flex flex-col w-full">
|
||||
@ -44,9 +37,8 @@
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 class="pb-4">Actions</h3>
|
||||
@if ($server->settings->is_reachable)
|
||||
<h3 class="pt-8 pb-4">Quick Actions</h3>
|
||||
<div class="flex items-center gap-2">
|
||||
<x-forms.button wire:click.prevent='validateServer'>
|
||||
Check Server Details
|
||||
@ -58,14 +50,19 @@
|
||||
Install Docker Engine
|
||||
@endif
|
||||
</x-forms.button>
|
||||
{{-- <x-forms.button wire:click.prevent='installDocker'>Install Docker</x-forms.button> --}}
|
||||
</div>
|
||||
@else
|
||||
<div class="w-full">
|
||||
<x-forms.button isHighlighted wire:click.prevent='validateServer'>
|
||||
Validate Server
|
||||
</x-forms.button>
|
||||
</div>
|
||||
@endif
|
||||
<div class="container w-full py-4 mx-auto">
|
||||
<livewire:activity-monitor :header="true" />
|
||||
</div>
|
||||
@isset($uptime)
|
||||
<h3 class="pb-3">Server Info</h3>
|
||||
<h4 class="pb-3">Server Info</h4>
|
||||
<div class="text-sm">
|
||||
<p>Uptime: {{ $uptime }}</p>
|
||||
@isset($dockerVersion)
|
||||
@ -74,38 +71,4 @@
|
||||
</div>
|
||||
@endisset
|
||||
</form>
|
||||
<div class="flex items-center gap-2 py-4">
|
||||
<h3>Private Key</h3>
|
||||
<a href="{{ route('server.private-key', ['server_uuid' => $server->uuid]) }}">
|
||||
<x-forms.button>
|
||||
@if (data_get($server, 'privateKey.uuid'))
|
||||
Change
|
||||
@else
|
||||
Add
|
||||
@endif
|
||||
</x-forms.button>
|
||||
</a>
|
||||
</div>
|
||||
@if (data_get($server, 'privateKey.uuid'))
|
||||
<a href="{{ route('private-key.show', ['private_key_uuid' => data_get($server, 'privateKey.uuid')]) }}">
|
||||
<button class="text-white btn-link">{{ data_get($server, 'privateKey.name') }}</button>
|
||||
</a>
|
||||
@else
|
||||
<div class="text-sm">No private key attached.</div>
|
||||
@endif
|
||||
<div class="flex items-center gap-2 py-4">
|
||||
<h3>Destinations</h3>
|
||||
<a href="{{ route('destination.new', ['server_id' => $server->id]) }}">
|
||||
<x-forms.button>Add</x-forms.button>
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
@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>
|
||||
|
@ -22,8 +22,8 @@
|
||||
@endif
|
||||
@endforeach
|
||||
</x-forms.select>
|
||||
<x-forms.checkbox class="pb-8" disabled instantSave noDirty id="is_part_of_swarm"
|
||||
label="Is it part of a Swarm cluster?" />
|
||||
{{-- <x-forms.checkbox class="pb-8" disabled instantSave noDirty id="is_part_of_swarm"
|
||||
label="Is it part of a Swarm cluster?" /> --}}
|
||||
<x-forms.button type="submit">
|
||||
Save New Server
|
||||
</x-forms.button>
|
||||
|
@ -1,10 +1,30 @@
|
||||
<div class="grid lg:grid-cols-2 gap-2">
|
||||
@forelse ($private_keys as $private_key)
|
||||
<x-forms.button wire:click='setPrivateKey({{ $private_key->id }})'>{{ $private_key->name }}
|
||||
</x-forms.button>
|
||||
@empty
|
||||
<div>No private keys found.
|
||||
<x-use-magic-bar />
|
||||
</div>
|
||||
@endforelse
|
||||
<div>
|
||||
<div class="flex items-end gap-2">
|
||||
<h1>Private Key</h1>
|
||||
<a href="{{ route('private-key.new') }}">
|
||||
<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="pb-10 text-sm">
|
||||
@if (data_get($server, 'privateKey.uuid'))
|
||||
Currently attached Private Key:
|
||||
<a href="{{ route('private-key.show', ['private_key_uuid' => data_get($server, 'privateKey.uuid')]) }}">
|
||||
<button class="text-white btn-link">{{ data_get($server, 'privateKey.name') }}</button>
|
||||
</a>
|
||||
@else
|
||||
<div class="text-sm">No private key attached.</div>
|
||||
@endif
|
||||
</div>
|
||||
<h3 class="pb-4">Select a different Private Key</h3>
|
||||
<div class="grid gap-2">
|
||||
@forelse ($privateKeys as $private_key)
|
||||
<x-forms.button wire:click='setPrivateKey({{ $private_key->id }})'>{{ $private_key->name }}
|
||||
</x-forms.button>
|
||||
@empty
|
||||
<div>No private keys found.
|
||||
<x-use-magic-bar />
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
|
@ -19,7 +19,7 @@
|
||||
@endif
|
||||
<livewire:server.proxy.status :server="$server" />
|
||||
</div>
|
||||
<div class="pb-4 text-sm">Traefik v2</div>
|
||||
<div class="pt-3 pb-4 text-sm">Traefik v2</div>
|
||||
@if (
|
||||
$server->extra_attributes->proxy_last_applied_settings &&
|
||||
$server->extra_attributes->proxy_last_saved_settings !== $server->extra_attributes->proxy_last_applied_settings)
|
||||
|
19
resources/views/server/destinations.blade.php
Normal file
19
resources/views/server/destinations.blade.php
Normal file
@ -0,0 +1,19 @@
|
||||
<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-8 text-sm">Docker Networks available on the server</div>
|
||||
<div class="pb-10 text-sm">
|
||||
@forelse ($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>
|
||||
@empty
|
||||
<div class="text-sm">No destinations added</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</x-layout>
|
@ -1,4 +1,4 @@
|
||||
<x-layout>
|
||||
<h1 class="pb-2">Select a private Key</h1>
|
||||
<livewire:server.private-key />
|
||||
<x-server.navbar :server="$server" />
|
||||
<livewire:server.private-key :server="$server" :privateKeys="$privateKeys" />
|
||||
</x-layout>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<x-layout>
|
||||
<x-server.navbar :server="$server" />
|
||||
<livewire:server.form :server_id="$server->id" />
|
||||
<livewire:server.form :server="$server" />
|
||||
</x-layout>
|
||||
|
@ -75,7 +75,13 @@
|
||||
Route::get('/server/{server_uuid}/proxy', fn () => view('server.proxy', [
|
||||
'server' => Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail(),
|
||||
]))->name('server.proxy');
|
||||
Route::get('/server/{server_uuid}/private-key', fn () => view('server.private-key'))->name('server.private-key');
|
||||
Route::get('/server/{server_uuid}/private-key', fn () => view('server.private-key', [
|
||||
'server' => Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail(),
|
||||
'privateKeys' => PrivateKey::ownedByCurrentTeam()->get(),
|
||||
]))->name('server.private-key');
|
||||
Route::get('/server/{server_uuid}/destinations', fn () => view('server.destinations', [
|
||||
'server' => Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail()
|
||||
]))->name('server.destinations');
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user