diff --git a/app/Http/Controllers/ServerController.php b/app/Http/Controllers/ServerController.php index e7f9feb57..2c2a34363 100644 --- a/app/Http/Controllers/ServerController.php +++ b/app/Http/Controllers/ServerController.php @@ -20,8 +20,8 @@ public function new_server() } $servers = auth()->user()->currentTeam()->servers->count(); $subscription = auth()->user()->currentTeam()?->subscription->type(); - $limits = config('constants.limits.server')[strtolower($subscription)]; - $limit_reached = true ?? $servers >= $limits[$subscription]; + $your_limit = config('constants.limits.server')[strtolower($subscription)]; + $limit_reached = $servers >= $your_limit; return view('server.create', [ 'limit_reached' => $limit_reached, diff --git a/app/Http/Livewire/Project/New/Select.php b/app/Http/Livewire/Project/New/Select.php index f95599154..e2271ab53 100644 --- a/app/Http/Livewire/Project/New/Select.php +++ b/app/Http/Livewire/Project/New/Select.php @@ -46,6 +46,6 @@ public function set_destination(string $destination_uuid) public function load_servers() { - $this->servers = Server::ownedByCurrentTeam()->get(); + $this->servers = Server::isUsable()->get(); } } diff --git a/app/Models/Server.php b/app/Models/Server.php index 91adb6b9b..1d8ea0f77 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -33,8 +33,9 @@ static public function isReachable() static public function ownedByCurrentTeam(array $select = ['*']) { + $teamId = auth()->user()->currentTeam()->id; $selectArray = collect($select)->concat(['id']); - return Server::whereTeamId(auth()->user()->currentTeam()->id)->with('settings')->select($selectArray->all())->orderBy('name'); + return Server::whereTeamId($teamId)->with('settings')->select($selectArray->all())->orderBy('name'); } static public function isUsable() diff --git a/resources/views/livewire/project/new/select.blade.php b/resources/views/livewire/project/new/select.blade.php index fa07a0ec1..c187a98fc 100644 --- a/resources/views/livewire/project/new/select.blade.php +++ b/resources/views/livewire/project/new/select.blade.php @@ -80,7 +80,7 @@
  • Select a Destination
  • - @foreach ($servers as $server) + @forelse($servers as $server)
    @@ -91,7 +91,15 @@ {{ $server->description }}
    - @endforeach + @empty +
    +
    No validated & reachable servers found. + Go to servers page +
    + + +
    + @endforelse @endif @if ($current_step === 'destinations') diff --git a/resources/views/server/all.blade.php b/resources/views/server/all.blade.php index afa223b91..048fb311c 100644 --- a/resources/views/server/all.blade.php +++ b/resources/views/server/all.blade.php @@ -1,5 +1,9 @@ -

    Servers

    +
    +

    Servers

    + + Add + +
    All Servers
    @forelse ($servers as $server)