2023-03-28 20:13:08 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
2023-03-29 10:27:02 +00:00
|
|
|
use Illuminate\Support\Facades\DB;
|
2023-03-28 20:13:08 +00:00
|
|
|
|
|
|
|
class ProjectController extends Controller
|
|
|
|
{
|
|
|
|
public function environments()
|
|
|
|
{
|
|
|
|
$project_uuid = request()->route('project_uuid');
|
|
|
|
$project = session('currentTeam')->projects->where('uuid', $project_uuid)->first();
|
|
|
|
if (!$project) {
|
|
|
|
return redirect()->route('home');
|
|
|
|
}
|
|
|
|
return view('project.environments', ['project' => $project]);
|
|
|
|
}
|
|
|
|
public function resources()
|
|
|
|
{
|
|
|
|
$project_uuid = request()->route('project_uuid');
|
|
|
|
$project = session('currentTeam')->projects->where('uuid', $project_uuid)->first();
|
|
|
|
if (!$project) {
|
|
|
|
return redirect()->route('home');
|
|
|
|
}
|
2023-03-29 11:13:27 +00:00
|
|
|
$environment = $project->environments->where('name', request()->route('environment_name'))->first();
|
|
|
|
return view('project.resources', ['project' => $project, 'environment' => $environment]);
|
2023-03-28 20:13:08 +00:00
|
|
|
}
|
|
|
|
public function application()
|
|
|
|
{
|
|
|
|
$project_uuid = request()->route('project_uuid');
|
|
|
|
$environment_name = request()->route('environment_name');
|
|
|
|
$application_uuid = request()->route('application_uuid');
|
|
|
|
$project = session('currentTeam')->projects->where('uuid', $project_uuid)->first();
|
|
|
|
if (!$project) {
|
|
|
|
return redirect()->route('home');
|
|
|
|
}
|
|
|
|
$environment = $project->environments->where('name', $environment_name)->first();
|
|
|
|
if (!$environment) {
|
|
|
|
return redirect()->route('home');
|
|
|
|
}
|
|
|
|
$application = $environment->applications->where('uuid', $application_uuid)->first();
|
|
|
|
if (!$application) {
|
|
|
|
return redirect()->route('home');
|
|
|
|
}
|
2023-03-29 10:52:22 +00:00
|
|
|
return view('project.application', ['project' => $project, 'application' => $application, 'deployments' => $application->deployments()]);
|
2023-03-28 20:13:08 +00:00
|
|
|
}
|
|
|
|
public function database()
|
|
|
|
{
|
|
|
|
$project_uuid = request()->route('project_uuid');
|
|
|
|
$environment_name = request()->route('environment_name');
|
|
|
|
$database_uuid = request()->route('database_uuid');
|
|
|
|
$project = session('currentTeam')->projects->where('uuid', $project_uuid)->first();
|
|
|
|
if (!$project) {
|
|
|
|
return redirect()->route('home');
|
|
|
|
}
|
|
|
|
$environment = $project->environments->where('name', $environment_name)->first();
|
|
|
|
if (!$environment) {
|
|
|
|
return redirect()->route('home');
|
|
|
|
}
|
|
|
|
$database = $environment->databases->where('uuid', $database_uuid)->first();
|
|
|
|
if (!$database) {
|
|
|
|
return redirect()->route('home');
|
|
|
|
}
|
|
|
|
|
|
|
|
return view('project.database', ['project' => $project, 'database' => $database]);
|
|
|
|
}
|
|
|
|
public function service()
|
|
|
|
{
|
|
|
|
$project_uuid = request()->route('project_uuid');
|
|
|
|
$environment_name = request()->route('environment_name');
|
|
|
|
$service_uuid = request()->route('service_uuid');
|
|
|
|
|
|
|
|
$project = session('currentTeam')->projects->where('uuid', $project_uuid)->first();
|
|
|
|
if (!$project) {
|
|
|
|
return redirect()->route('home');
|
|
|
|
}
|
|
|
|
$environment = $project->environments->where('name', $environment_name)->first();
|
|
|
|
if (!$environment) {
|
|
|
|
return redirect()->route('home');
|
|
|
|
}
|
|
|
|
$service = $environment->services->where('uuid', $service_uuid)->first();
|
|
|
|
if (!$service) {
|
|
|
|
return redirect()->route('home');
|
|
|
|
}
|
|
|
|
|
|
|
|
return view('project.service', ['project' => $project, 'service' => $service]);
|
|
|
|
}
|
|
|
|
public function deployment()
|
|
|
|
{
|
|
|
|
$project_uuid = request()->route('project_uuid');
|
|
|
|
$environment_name = request()->route('environment_name');
|
|
|
|
$application_uuid = request()->route('application_uuid');
|
|
|
|
$deployment_uuid = request()->route('deployment_uuid');
|
|
|
|
|
|
|
|
$project = session('currentTeam')->projects->where('uuid', $project_uuid)->first();
|
|
|
|
if (!$project) {
|
|
|
|
return redirect()->route('home');
|
|
|
|
}
|
|
|
|
$environment = $project->environments->where('name', $environment_name)->first();
|
|
|
|
if (!$environment) {
|
|
|
|
return redirect()->route('home');
|
|
|
|
}
|
|
|
|
$application = $environment->applications->where('uuid', $application_uuid)->first();
|
|
|
|
if (!$application) {
|
|
|
|
return redirect()->route('home');
|
|
|
|
}
|
2023-03-29 10:27:02 +00:00
|
|
|
$activity = $application->get_deployment($deployment_uuid);
|
|
|
|
return view('project.deployment', ['project' => $project, 'activity' => $activity]);
|
2023-03-28 20:13:08 +00:00
|
|
|
}
|
|
|
|
}
|