fix boarding

This commit is contained in:
Andras Bacsai 2023-08-29 20:34:01 +02:00
parent 4a4837d9f5
commit 5eb41e1a15
2 changed files with 20 additions and 2 deletions

View File

@ -1,15 +1,20 @@
<?php
namespace App\Http\Livewire\Boarding;
use App\Actions\Server\InstallDocker;
use App\Models\PrivateKey;
use App\Models\Project;
use App\Models\Server;
use Illuminate\Database\Eloquent\Collection;
use Livewire\Component;
class Index extends Component
{ public string $currentState = 'welcome';
{
public string $currentState = 'welcome';
public ?Collection $privateKeys = null;
public ?int $selectedExistingPrivateKey = null;
public ?string $privateKeyType = null;
public ?string $privateKey = null;
public ?string $publicKey = null;
@ -70,9 +75,14 @@ public function setServer(string $type)
}
$this->currentState = 'select-proxy';
} elseif ($type === 'remote') {
$this->privateKeys = PrivateKey::ownedByCurrentTeam(['name'])->get();
$this->currentState = 'private-key';
}
}
public function selectExistingPrivateKey()
{
ray($this->selectedExistingPrivateKey);
}
public function setPrivateKey(string $type)
{
$this->privateKeyType = $type;
@ -174,7 +184,7 @@ private function createNewPrivateKey()
{
$this->privateKeyName = generate_random_name();
$this->privateKeyDescription = 'Created by Coolify';
['private' => $this->privateKey, 'public'=> $this->publicKey] = generateSSHKey();
['private' => $this->privateKey, 'public' => $this->publicKey] = generateSSHKey();
}
public function render()
{

View File

@ -41,6 +41,14 @@
</div>
<div class="justify-center box" wire:click="setPrivateKey('create')">No (create one for me)
</div>
<form wire:submit.prevent='selectExistingPrivateKey'>
<x-forms.select wire:model.defer='selectedExistingPrivateKey'>
@foreach ($privateKeys as $privateKey)
<option value="{{ $privateKey->id }}">{{ $privateKey->name }}</option>
@endforeach
</x-forms.select>
<x-forms.button type="submit">Select this</x-forms.button>
</form>
</x-slot:actions>
<x-slot:explanation>
<p>SSH Keys are used to connect to a remote server through a secure shell, called SSH.</p>