This commit is contained in:
Andras Bacsai
2023-06-15 09:15:41 +02:00
parent 384ab2dd18
commit f79b3841c7
40 changed files with 119 additions and 197 deletions

View File

@@ -46,7 +46,7 @@ class ApplicationController extends Controller
public function deployment()
{
$deployment_uuid = request()->route('deployment_uuid');
$deploymentUuid = request()->route('deployment_uuid');
$project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
if (!$project) {
@@ -60,7 +60,7 @@ class ApplicationController extends Controller
if (!$application) {
return redirect()->route('dashboard');
}
$activity = Activity::where('properties->type_uuid', '=', $deployment_uuid)->first();
$activity = Activity::where('properties->type_uuid', '=', $deploymentUuid)->first();
if (!$activity) {
return redirect()->route('project.application.deployments', [
'project_uuid' => $project->uuid,
@@ -68,7 +68,7 @@ class ApplicationController extends Controller
'application_uuid' => $application->uuid,
]);
}
$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $deployment_uuid)->first();
$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $deploymentUuid)->first();
if (!$deployment) {
return redirect()->route('project.application.deployments', [
'project_uuid' => $project->uuid,
@@ -80,7 +80,7 @@ class ApplicationController extends Controller
'application' => $application,
'activity' => $activity,
'deployment' => $deployment,
'deployment_uuid' => $deployment_uuid,
'deployment_uuid' => $deploymentUuid,
]);
}
}

View File

@@ -64,7 +64,7 @@ class Controller extends BaseController
'invitations' => $invitations,
]);
}
public function accept_invitation()
public function acceptInvitation()
{
try {
$invitation = TeamInvitation::whereUuid(request()->route('uuid'))->firstOrFail();
@@ -76,8 +76,8 @@ class Controller extends BaseController
abort(401);
}
$created_at = $invitation->created_at;
$diff = $created_at->diffInMinutes(now());
$createdAt = $invitation->created_at;
$diff = $createdAt->diffInMinutes(now());
if ($diff <= config('constants.invitation.link.expiration')) {
$user->teams()->attach($invitation->team->id, ['role' => $invitation->role]);
$invitation->delete();
@@ -90,7 +90,7 @@ class Controller extends BaseController
throw $th;
}
}
public function revoke_invitation()
public function revokeInvitation()
{
try {
$invitation = TeamInvitation::whereUuid(request()->route('uuid'))->firstOrFail();

View File

@@ -33,7 +33,7 @@ class MagicController extends Controller
'environments' => Project::ownedByCurrentTeam()->whereUuid(request()->query('project_uuid'))->first()->environments
]);
}
public function new_project()
public function newProject()
{
$project = Project::firstOrCreate(
['name' => request()->query('name') ?? generate_random_name()],
@@ -43,7 +43,7 @@ class MagicController extends Controller
'project_uuid' => $project->uuid
]);
}
public function new_environment()
public function newEnvironment()
{
$environment = Environment::firstOrCreate(
['name' => request()->query('name') ?? generate_random_name()],

View File

@@ -8,18 +8,18 @@ class ProjectController extends Controller
{
public function all()
{
$team_id = session('currentTeam')->id;
$teamId = session('currentTeam')->id;
$projects = Project::where('team_id', $team_id)->get();
$projects = Project::where('team_id', $teamId)->get();
return view('projects', ['projects' => $projects]);
}
public function show()
{
$project_uuid = request()->route('project_uuid');
$team_id = session('currentTeam')->id;
$projectUuid = request()->route('project_uuid');
$teamId = session('currentTeam')->id;
$project = Project::where('team_id', $team_id)->where('uuid', $project_uuid)->first();
$project = Project::where('team_id', $teamId)->where('uuid', $projectUuid)->first();
if (!$project) {
return redirect()->route('dashboard');
}

View File

@@ -1,34 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Models\PrivateKey;
use App\Models\Server;
class ServerController extends Controller
{
public function all()
{
return view('server.all', [
'servers' => Server::ownedByCurrentTeam()->get()
]);
}
public function create()
{
return view('server.create', [
'private_keys' => PrivateKey::ownedByCurrentTeam()->get(),
]);
}
public function show()
{
return view('server.show', [
'server' => Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail(),
]);
}
public function proxy()
{
return view('server.proxy', [
'server' => Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail(),
]);
}
}

View File

@@ -12,7 +12,7 @@ class Danger extends Component
public function mount()
{
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
}
public function delete()
{

View File

@@ -3,7 +3,6 @@
namespace App\Http\Livewire\Project\Application;
use App\Jobs\ApplicationContainerStatusJob;
use App\Jobs\ContainerStopJob;
use App\Models\Application;
use Livewire\Component;
use Visus\Cuid2\Cuid2;
@@ -17,7 +16,7 @@ class Deploy extends Component
public $destination;
public array $parameters;
protected string $deployment_uuid;
protected string $deploymentUuid;
protected array $command = [];
protected $source;
@@ -27,7 +26,7 @@ class Deploy extends Component
public function mount()
{
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
$this->application = Application::where('id', $this->applicationId)->first();
$this->destination = $this->application->destination->getMorphClass()::where('id', $this->application->destination->id)->first();
}
@@ -35,10 +34,9 @@ class Deploy extends Component
{
$this->application->refresh();
}
protected function set_deployment_uuid()
protected function setDeploymentUuid()
{
// Create Deployment ID
$this->deployment_uuid = new Cuid2(7);
$this->deploymentUuid = new Cuid2(7);
$this->parameters['deployment_uuid'] = $this->deployment_uuid;
}
public function deploy(bool $force = false, bool|null $debug = null)
@@ -47,7 +45,7 @@ class Deploy extends Component
$this->application->settings->is_debug_enabled = true;
$this->application->settings->save();
}
$this->set_deployment_uuid();
$this->setDeploymentUuid();
queue_application_deployment(
application_id: $this->application->id,
@@ -65,7 +63,7 @@ class Deploy extends Component
public function stop()
{
instant_remote_process(["docker rm -f {$this->application->uuid}"], $this->application->destination->server);
$this->application->status = get_container_status(server: $this->application->destination->server, container_id: $this->application->uuid);
$this->application->status = 'stopped';
$this->application->save();
$this->emit('applicationStatusChanged');
}

View File

@@ -20,7 +20,7 @@ class Add extends Component
];
public function mount()
{
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
}
public function submit()
{

View File

@@ -17,7 +17,7 @@ class Show extends Component
];
public function mount()
{
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
}
public function submit()
{

View File

@@ -20,7 +20,7 @@ class Previews extends Component
public function mount()
{
$this->pull_requests = collect();
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
}
public function loadStatus($pull_request_id)
{
@@ -30,7 +30,7 @@ class Previews extends Component
pull_request_id: $pull_request_id
));
}
protected function set_deployment_uuid()
protected function setDeploymentUuid()
{
$this->deployment_uuid = new Cuid2(7);
$this->parameters['deployment_uuid'] = $this->deployment_uuid;
@@ -49,7 +49,7 @@ class Previews extends Component
public function deploy(int $pull_request_id, string|null $pull_request_html_url = null)
{
try {
$this->set_deployment_uuid();
$this->setDeploymentUuid();
$found = ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->first();
if (!$found && !is_null($pull_request_html_url)) {
ApplicationPreview::create([

View File

@@ -16,7 +16,7 @@ class Rollback extends Component
public function mount()
{
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
}
public function rollbackImage($commit)
{

View File

@@ -2,10 +2,6 @@
namespace App\Http\Livewire\Project\Application\Storages;
use App\Models\Application;
use App\Models\LocalPersistentVolume;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Route;
use Livewire\Component;
class Add extends Component
@@ -23,7 +19,7 @@ class Add extends Component
];
public function mount()
{
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
}
public function submit()
{

View File

@@ -14,7 +14,7 @@ class DeleteEnvironment extends Component
public function mount()
{
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
}
public function delete()
{

View File

@@ -13,7 +13,7 @@ class DeleteProject extends Component
public function mount()
{
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
}
public function delete()
{

View File

@@ -44,7 +44,7 @@ class GithubPrivateRepository extends Component
public function mount()
{
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
$this->query = request()->query();
$this->repositories = $this->branches = collect();
$this->github_apps = GithubApp::private();

View File

@@ -53,7 +53,7 @@ class GithubPrivateRepositoryDeployKey extends Component
if (config('app.env') === 'local') {
$this->repository_url = 'https://github.com/coollabsio/coolify-examples';
}
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
$this->query = request()->query();
$this->private_keys = PrivateKey::where('team_id', session('currentTeam')->id)->get();
}

View File

@@ -43,7 +43,7 @@ class PublicGitRepository extends Component
$this->repository_url = 'https://github.com/coollabsio/coolify-examples';
$this->port = 3000;
}
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
$this->query = request()->query();
}

View File

@@ -23,7 +23,7 @@ class PrivateKey extends Component
}
public function mount()
{
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
$this->private_keys = ModelsPrivateKey::where('team_id', session('currentTeam')->id)->get();
}
}

View File

@@ -38,7 +38,7 @@ class Change extends Component
public function mount()
{
$this->webhook_endpoint = $this->ipv4;
$this->parameters = get_parameters();
$this->parameters = getRouteParameters();
$this->is_system_wide = $this->github_app->is_system_wide;
}
public function submit()