feat: preselect server and destination if only one found
This commit is contained in:
parent
c17079e045
commit
18bab41605
@ -176,10 +176,12 @@ public function setType(string $type)
|
||||
|
||||
return;
|
||||
}
|
||||
// if (count($this->servers) === 1) {
|
||||
// $server = $this->servers->first();
|
||||
// $this->setServer($server);
|
||||
// }
|
||||
if (count($this->servers) === 1) {
|
||||
$server = $this->servers->first();
|
||||
if ($server instanceof Server) {
|
||||
$this->setServer($server);
|
||||
}
|
||||
}
|
||||
if (! is_null($this->server)) {
|
||||
$foundServer = $this->servers->where('id', $this->server->id)->first();
|
||||
if ($foundServer) {
|
||||
@ -195,6 +197,13 @@ public function setServer(Server $server)
|
||||
$this->server = $server;
|
||||
$this->standaloneDockers = $server->standaloneDockers;
|
||||
$this->swarmDockers = $server->swarmDockers;
|
||||
$count = count($this->standaloneDockers) + count($this->swarmDockers);
|
||||
if ($count === 1) {
|
||||
$docker = $this->standaloneDockers->first() ?? $this->swarmDockers->first();
|
||||
if ($docker) {
|
||||
$this->setDestination($docker->uuid);
|
||||
}
|
||||
}
|
||||
$this->current_step = 'destinations';
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="flex flex-col gap-4 lg:flex-row ">
|
||||
<h1>New Resource</h1>
|
||||
<div class="w-full pb-4 lg:w-96 lg:pb-0">
|
||||
<x-forms.select wire:model="selectedEnvironment">
|
||||
<x-forms.select wire:model.live="selectedEnvironment">
|
||||
@foreach ($environments as $environment)
|
||||
<option value="{{ $environment->name }}">Environment: {{ $environment->name }}</option>
|
||||
@endforeach
|
||||
@ -533,7 +533,6 @@ class="w-[4.5rem] aspect-square h-[4.5rem] p-2 transition-all duration-200 opaci
|
||||
@if (file_exists(public_path(data_get($service, 'logo'))))
|
||||
<img class="w-[4.5rem] aspect-square h-[4.5rem] p-2 transition-all duration-200 opacity-30 grayscale group-hover:grayscale-0 group-hover:opacity-100 bg-neutral-300 dark:bg-transparent hover:bg-neutral-800"
|
||||
src="{{ asset(data_get($service, 'logo')) }}">
|
||||
|
||||
@endif
|
||||
</x-slot:logo>
|
||||
<x-slot:documentation>
|
||||
|
Loading…
Reference in New Issue
Block a user