feat: add support for selecting additional SSH keys from Hetzner in server creation form

This commit is contained in:
Andras Bacsai
2025-10-10 12:17:05 +02:00
parent ee211526ea
commit ac3af8a882
7 changed files with 413 additions and 34 deletions

View File

@@ -4,7 +4,7 @@ namespace App\View\Components\Forms;
use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Gate;
use Illuminate\View\Component;
use Visus\Cuid2\Cuid2;
@@ -19,9 +19,27 @@ class Datalist extends Component
public ?string $label = null,
public ?string $helper = null,
public bool $required = false,
public string $defaultClass = 'input'
public bool $disabled = false,
public bool $readonly = false,
public bool $multiple = false,
public string|bool $instantSave = false,
public ?string $value = null,
public ?string $placeholder = null,
public bool $autofocus = false,
public string $defaultClass = 'input',
public ?string $canGate = null,
public mixed $canResource = null,
public bool $autoDisable = true,
) {
//
// Handle authorization-based disabling
if ($this->canGate && $this->canResource && $this->autoDisable) {
$hasPermission = Gate::allows($this->canGate, $this->canResource);
if (! $hasPermission) {
$this->disabled = true;
$this->instantSave = false; // Disable instant save for unauthorized users
}
}
}
/**
@@ -36,8 +54,6 @@ class Datalist extends Component
$this->name = $this->id;
}
$this->label = Str::title($this->label);
return view('components.forms.datalist');
}
}