feat: preselect server and destination if only one found
This commit is contained in:
parent
c17079e045
commit
18bab41605
@ -176,10 +176,12 @@ class Select extends Component
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if (count($this->servers) === 1) {
|
if (count($this->servers) === 1) {
|
||||||
// $server = $this->servers->first();
|
$server = $this->servers->first();
|
||||||
// $this->setServer($server);
|
if ($server instanceof Server) {
|
||||||
// }
|
$this->setServer($server);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (! is_null($this->server)) {
|
if (! is_null($this->server)) {
|
||||||
$foundServer = $this->servers->where('id', $this->server->id)->first();
|
$foundServer = $this->servers->where('id', $this->server->id)->first();
|
||||||
if ($foundServer) {
|
if ($foundServer) {
|
||||||
@ -195,6 +197,13 @@ class Select extends Component
|
|||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
$this->standaloneDockers = $server->standaloneDockers;
|
$this->standaloneDockers = $server->standaloneDockers;
|
||||||
$this->swarmDockers = $server->swarmDockers;
|
$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';
|
$this->current_step = 'destinations';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div class="flex flex-col gap-4 lg:flex-row ">
|
<div class="flex flex-col gap-4 lg:flex-row ">
|
||||||
<h1>New Resource</h1>
|
<h1>New Resource</h1>
|
||||||
<div class="w-full pb-4 lg:w-96 lg:pb-0">
|
<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)
|
@foreach ($environments as $environment)
|
||||||
<option value="{{ $environment->name }}">Environment: {{ $environment->name }}</option>
|
<option value="{{ $environment->name }}">Environment: {{ $environment->name }}</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
@ -533,7 +533,6 @@
|
|||||||
@if (file_exists(public_path(data_get($service, 'logo'))))
|
@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"
|
<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')) }}">
|
src="{{ asset(data_get($service, 'logo')) }}">
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
</x-slot:logo>
|
</x-slot:logo>
|
||||||
<x-slot:documentation>
|
<x-slot:documentation>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user