From b7748479d4c1b7a12dc72eb10a45b765167e0e1f Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 17 Dec 2024 11:13:13 +0100 Subject: [PATCH] fix: service ui structure --- .../Project/Service/Configuration.php | 28 ++++- .../project/application/heading.blade.php | 12 +- .../project/service/configuration.blade.php | 111 ++++++++---------- .../livewire/project/service/navbar.blade.php | 6 +- .../livewire/project/shared/logs.blade.php | 12 +- routes/web.php | 8 ++ 6 files changed, 93 insertions(+), 84 deletions(-) diff --git a/app/Livewire/Project/Service/Configuration.php b/app/Livewire/Project/Service/Configuration.php index 319ead3619..99a0dea7f8 100644 --- a/app/Livewire/Project/Service/Configuration.php +++ b/app/Livewire/Project/Service/Configuration.php @@ -9,16 +9,22 @@ class Configuration extends Component { + public $currentRoute; + + public $project; + + public $environment; + public ?Service $service = null; public $applications; public $databases; - public array $parameters; - public array $query; + public array $parameters; + public function getListeners() { $userId = Auth::id(); @@ -38,11 +44,21 @@ public function render() public function mount() { $this->parameters = get_route_parameters(); + $this->currentRoute = request()->route()->getName(); $this->query = request()->query(); - $this->service = Service::whereUuid($this->parameters['service_uuid'])->first(); - if (! $this->service) { - return redirect()->route('dashboard'); - } + $project = currentTeam() + ->projects() + ->select('id', 'uuid', 'team_id') + ->where('uuid', request()->route('project_uuid')) + ->firstOrFail(); + $environment = $project->environments() + ->select('id', 'name', 'project_id') + ->where('name', request()->route('environment_name')) + ->firstOrFail(); + $this->service = $environment->services()->whereUuid(request()->route('service_uuid'))->firstOrFail(); + + $this->project = $project; + $this->environment = $environment; $this->applications = $this->service->applications->sort(); $this->databases = $this->service->databases->sort(); } diff --git a/resources/views/livewire/project/application/heading.blade.php b/resources/views/livewire/project/application/heading.blade.php index 8f3d1d15c8..aecab02650 100644 --- a/resources/views/livewire/project/application/heading.blade.php +++ b/resources/views/livewire/project/application/heading.blade.php @@ -2,17 +2,21 @@