From f7853ee174974579196a585809aa1c67034798bf Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 29 Jan 2024 13:26:50 +0100 Subject: [PATCH] Refactor deployments_per_server variable and update dashboard view This commit refactors the `deployments_per_server` variable in the `Dashboard` class to remove the type hint and updates the corresponding view file to handle the changes. The `deployments_per_server` variable is now grouped by `server_name` and converted to an array. This improves the organization and readability of the code. --- app/Livewire/Dashboard.php | 4 +- resources/views/livewire/dashboard.blade.php | 48 +++++++++++--------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/app/Livewire/Dashboard.php b/app/Livewire/Dashboard.php index a4bcbe8f6..b282cb175 100644 --- a/app/Livewire/Dashboard.php +++ b/app/Livewire/Dashboard.php @@ -12,7 +12,7 @@ class Dashboard extends Component { public $projects = []; public Collection $servers; - public Collection $deployments_per_server; + public $deployments_per_server; public function mount() { $this->servers = Server::ownedByCurrentTeam()->get(); @@ -30,7 +30,7 @@ class Dashboard extends Component "server_name", "server_id", "status" - ])->sortBy('id'); + ])->sortBy('id')->groupBy('server_name')->toArray(); } // public function getIptables() // { diff --git a/resources/views/livewire/dashboard.blade.php b/resources/views/livewire/dashboard.blade.php index 7a482c92b..04d4918b4 100644 --- a/resources/views/livewire/dashboard.blade.php +++ b/resources/views/livewire/dashboard.blade.php @@ -103,32 +103,38 @@

Deployments

- @if ($deployments_per_server->count() > 0) + @if (count($deployments_per_server) > 0) @endif
-
- @forelse ($deployments_per_server as $deployment) - $deployment->status === 'queued', - 'border-yellow-500' => $deployment->status === 'in_progress', - ])> -