fix: show if only build servers are added to your team

This commit is contained in:
Andras Bacsai
2025-01-07 10:43:21 +01:00
parent 2710b2a7bb
commit af482f0572
2 changed files with 32 additions and 19 deletions

View File

@@ -23,6 +23,8 @@ class Select extends Component
public Collection|null|Server $servers; public Collection|null|Server $servers;
public bool $onlyBuildServerAvailable = false;
public ?Collection $standaloneDockers; public ?Collection $standaloneDockers;
public ?Collection $swarmDockers; public ?Collection $swarmDockers;
@@ -325,5 +327,11 @@ class Select extends Component
{ {
$this->servers = Server::isUsable()->get()->sortBy('name'); $this->servers = Server::isUsable()->get()->sortBy('name');
$this->allServers = $this->servers; $this->allServers = $this->servers;
if ($this->allServers && $this->allServers->isNotEmpty()) {
$this->onlyBuildServerAvailable = $this->allServers->every(function ($server) {
return $server->isBuildServer();
});
}
} }
} }

View File

@@ -216,28 +216,33 @@
<h2>Select a server</h2> <h2>Select a server</h2>
<div class="pb-5"></div> <div class="pb-5"></div>
<div class="flex flex-col justify-center gap-4 text-left xl:flex-row xl:flex-wrap"> <div class="flex flex-col justify-center gap-4 text-left xl:flex-row xl:flex-wrap">
@forelse($servers as $server) @if ($onlyBuildServerAvailable)
<div class="w-full box group" wire:click="setServer({{ $server }})"> <div> Only build servers are available, you need at least one server that is not set as build
<div class="flex flex-col mx-6"> server. <a class="underline dark:text-white" href="/servers">
<div class="box-title"> Go to servers page
{{ $server->name }} </a> </div>
@else
@forelse($servers as $server)
<div class="w-full box group" wire:click="setServer({{ $server }})">
<div class="flex flex-col mx-6">
<div class="box-title">
{{ $server->name }}
</div>
<div class="box-description">
{{ $server->description }}</div>
</div> </div>
<div class="box-description">
{{ $server->description }}</div>
</div> </div>
</div> @empty
@empty <div>
<div>
<div>No validated & reachable servers found. <a class="underline dark:text-white" href="/servers"> <div>No validated & reachable servers found. <a class="underline dark:text-white"
Go to servers page href="/servers">
</a></div> Go to servers page
</div> </a></div>
@endforelse </div>
@endforelse
@endif
</div> </div>
{{-- @if ($isDatabase)
<div class="text-center">Swarm clusters are excluded from this type of resource at the moment. It will
be activated soon. Stay tuned.</div>
@endif --}}
@endif @endif
@if ($current_step === 'destinations') @if ($current_step === 'destinations')
<h2>Select a destination</h2> <h2>Select a destination</h2>