fix: application view loading
This commit is contained in:
@@ -16,24 +16,33 @@ class Configuration extends Component
|
|||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
$project = currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
|
$project = currentTeam()
|
||||||
if (! $project) {
|
->projects()
|
||||||
return redirect()->route('dashboard');
|
->select('id', 'uuid', 'team_id')
|
||||||
}
|
->where('uuid', request()->route('project_uuid'))
|
||||||
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
|
->firstOrFail();
|
||||||
if (! $environment) {
|
|
||||||
return redirect()->route('dashboard');
|
$environment = $project->environments()
|
||||||
}
|
->select('id', 'name', 'project_id')
|
||||||
$application = $environment->applications->where('uuid', request()->route('application_uuid'))->first();
|
->where('name', request()->route('environment_name'))
|
||||||
if (! $application) {
|
->firstOrFail();
|
||||||
return redirect()->route('dashboard');
|
|
||||||
}
|
$application = $environment->applications()
|
||||||
|
->with(['destination'])
|
||||||
|
->where('uuid', request()->route('application_uuid'))
|
||||||
|
->firstOrFail();
|
||||||
|
|
||||||
$this->application = $application;
|
$this->application = $application;
|
||||||
$mainServer = $this->application->destination->server;
|
|
||||||
$servers = Server::ownedByCurrentTeam()->get();
|
if ($application->destination && $application->destination->server) {
|
||||||
$this->servers = $servers->filter(function ($server) use ($mainServer) {
|
$mainServer = $application->destination->server;
|
||||||
return $server->id != $mainServer->id;
|
$this->servers = Server::ownedByCurrentTeam()
|
||||||
});
|
->select('id', 'name')
|
||||||
|
->where('id', '!=', $mainServer->id)
|
||||||
|
->get();
|
||||||
|
} else {
|
||||||
|
$this->servers = collect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
|
Reference in New Issue
Block a user