fix(onboarding): auto-select first SSH key for better UX

- Auto-select first SSH key when available instead of requiring explicit selection
- Remove disabled placeholder option from dropdown
- Prevents confusing error when user clicks "Use Selected Key" without changing dropdown
- Improves onboarding flow by having a sensible default selection

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai 2025-10-12 18:54:12 +02:00
parent 04625591ea
commit de24489aa7
2 changed files with 4 additions and 2 deletions

View file

@ -187,7 +187,10 @@ public function setServerType(string $type)
return $this->validateServer('localhost');
} elseif ($this->selectedServerType === 'remote') {
$this->privateKeys = PrivateKey::ownedByCurrentTeam(['name'])->where('id', '!=', 0)->get();
// Don't auto-select - let user explicitly choose from dropdown
// Auto-select first key if available for better UX
if ($this->privateKeys->count() > 0) {
$this->selectedExistingPrivateKey = $this->privateKeys->first()->id;
}
// Onboarding always creates new servers, skip existing server selection
$this->currentState = 'private-key';
}

View file

@ -264,7 +264,6 @@ class="bg-red-200 dark:bg-red-900 px-1 rounded-sm">~/.ssh/authorized_keys</code>
<div class="p-4 rounded-lg border border-neutral-200 dark:border-coolgray-400">
<form wire:submit='selectExistingPrivateKey' class="flex flex-col gap-4">
<x-forms.select label="Existing SSH Keys" id='selectedExistingPrivateKey'>
<option disabled selected value="">-- Select a Private Key --</option>
@foreach ($privateKeys as $privateKey)
<option wire:key="{{ $loop->index }}" value="{{ $privateKey->id }}">
{{ $privateKey->name }}