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 <?php
namespace App\Http\Livewire\Boarding; namespace App\Http\Livewire\Boarding;
use App\Actions\Server\InstallDocker; use App\Actions\Server\InstallDocker;
use App\Models\PrivateKey; use App\Models\PrivateKey;
use App\Models\Project; use App\Models\Project;
use App\Models\Server; use App\Models\Server;
use Illuminate\Database\Eloquent\Collection;
use Livewire\Component; use Livewire\Component;
class Index extends 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 $privateKeyType = null;
public ?string $privateKey = null; public ?string $privateKey = null;
public ?string $publicKey = null; public ?string $publicKey = null;
@ -70,9 +75,14 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
} }
$this->currentState = 'select-proxy'; $this->currentState = 'select-proxy';
} elseif ($type === 'remote') { } elseif ($type === 'remote') {
$this->privateKeys = PrivateKey::ownedByCurrentTeam(['name'])->get();
$this->currentState = 'private-key'; $this->currentState = 'private-key';
} }
} }
public function selectExistingPrivateKey()
{
ray($this->selectedExistingPrivateKey);
}
public function setPrivateKey(string $type) public function setPrivateKey(string $type)
{ {
$this->privateKeyType = $type; $this->privateKeyType = $type;

View File

@ -41,6 +41,14 @@
</div> </div>
<div class="justify-center box" wire:click="setPrivateKey('create')">No (create one for me) <div class="justify-center box" wire:click="setPrivateKey('create')">No (create one for me)
</div> </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:actions>
<x-slot:explanation> <x-slot:explanation>
<p>SSH Keys are used to connect to a remote server through a secure shell, called SSH.</p> <p>SSH Keys are used to connect to a remote server through a secure shell, called SSH.</p>