2023-11-21 15:31:46 +01:00
|
|
|
<?php
|
|
|
|
|
|
2023-12-07 19:06:32 +01:00
|
|
|
namespace App\Livewire\Project\Application;
|
2023-11-21 15:31:46 +01:00
|
|
|
|
|
|
|
|
use App\Models\Application;
|
|
|
|
|
use Livewire\Component;
|
|
|
|
|
|
|
|
|
|
class Configuration extends Component
|
|
|
|
|
{
|
2024-12-16 14:11:45 +01:00
|
|
|
public $currentRoute;
|
|
|
|
|
|
2023-11-21 15:31:46 +01:00
|
|
|
public Application $application;
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2024-12-16 14:11:45 +01:00
|
|
|
public $project;
|
|
|
|
|
|
|
|
|
|
public $environment;
|
|
|
|
|
|
2023-11-21 15:31:46 +01:00
|
|
|
public $servers;
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2026-05-20 19:04:43 +00:00
|
|
|
protected $listeners = [
|
|
|
|
|
'buildPackUpdated' => '$refresh',
|
|
|
|
|
'refresh' => '$refresh',
|
|
|
|
|
];
|
2024-01-10 11:07:53 +01:00
|
|
|
|
2023-11-21 15:31:46 +01:00
|
|
|
public function mount()
|
|
|
|
|
{
|
2024-12-16 14:11:45 +01:00
|
|
|
$this->currentRoute = request()->route()->getName();
|
2025-03-17 11:28:43 +01:00
|
|
|
|
2024-12-03 14:02:12 +01:00
|
|
|
$project = currentTeam()
|
|
|
|
|
->projects()
|
2026-04-23 14:53:31 +05:30
|
|
|
->select('id', 'uuid', 'name', 'team_id')
|
2024-12-03 14:02:12 +01:00
|
|
|
->where('uuid', request()->route('project_uuid'))
|
|
|
|
|
->firstOrFail();
|
|
|
|
|
$environment = $project->environments()
|
2024-12-17 13:42:16 +01:00
|
|
|
->select('id', 'uuid', 'name', 'project_id')
|
2024-12-17 12:17:50 +01:00
|
|
|
->where('uuid', request()->route('environment_uuid'))
|
2024-12-03 14:02:12 +01:00
|
|
|
->firstOrFail();
|
|
|
|
|
$application = $environment->applications()
|
|
|
|
|
->with(['destination'])
|
2024-11-27 08:07:54 +01:00
|
|
|
->where('uuid', request()->route('application_uuid'))
|
|
|
|
|
->firstOrFail();
|
|
|
|
|
|
2024-12-16 14:11:45 +01:00
|
|
|
$this->project = $project;
|
|
|
|
|
$this->environment = $environment;
|
2023-11-21 15:31:46 +01:00
|
|
|
$this->application = $application;
|
2025-05-30 14:15:07 +02:00
|
|
|
|
2025-03-17 11:28:43 +01:00
|
|
|
if ($this->application->build_pack === 'dockercompose' && $this->currentRoute === 'project.application.healthcheck') {
|
|
|
|
|
return redirect()->route('project.application.configuration', ['project_uuid' => $project->uuid, 'environment_uuid' => $environment->uuid, 'application_uuid' => $application->uuid]);
|
|
|
|
|
}
|
2023-11-21 15:31:46 +01:00
|
|
|
}
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2023-11-21 15:31:46 +01:00
|
|
|
public function render()
|
|
|
|
|
{
|
|
|
|
|
return view('livewire.project.application.configuration');
|
|
|
|
|
}
|
|
|
|
|
}
|