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 bool $onlyBuildServerAvailable = false;
public ?Collection $standaloneDockers;
public ?Collection $swarmDockers;
@@ -325,5 +327,11 @@ class Select extends Component
{
$this->servers = Server::isUsable()->get()->sortBy('name');
$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>
<div class="pb-5"></div>
<div class="flex flex-col justify-center gap-4 text-left xl:flex-row xl:flex-wrap">
@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 }}
@if ($onlyBuildServerAvailable)
<div> Only build servers are available, you need at least one server that is not set as build
server. <a class="underline dark:text-white" href="/servers">
Go to servers page
</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 class="box-description">
{{ $server->description }}</div>
</div>
</div>
@empty
<div>
<div>No validated & reachable servers found. <a class="underline dark:text-white" href="/servers">
Go to servers page
</a></div>
</div>
@endforelse
@empty
<div>
<div>No validated & reachable servers found. <a class="underline dark:text-white"
href="/servers">
Go to servers page
</a></div>
</div>
@endforelse
@endif
</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
@if ($current_step === 'destinations')
<h2>Select a destination</h2>