An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
flow to add new destinations
Andras Bacsai4eb1c0412b5a
diff --git a/app/Http/Livewire/Project/New/PublicGitRepository.php b/app/Http/Livewire/Project/New/PublicGitRepository.phpindex 0f00ccf385..bd7f18a416 100644--- a/app/Http/Livewire/Project/New/PublicGitRepository.php+++ b/app/Http/Livewire/Project/New/PublicGitRepository.php@@ -43,17 +43,13 @@ class PublicGitRepository extends Component$this->port = 3000;}$this->parameters = Route::current()->parameters();- $this->servers = session('currentTeam')->load(['servers'])->servers->reject(function ($server) {- if ($server->standaloneDockers->count() === 0 && $server->swarmDockers->count() === 0) {- return true;- }- });+ $this->servers = session('currentTeam')->load(['servers'])->servers;}- public function chooseServer($server_id)+ public function chooseServer($server){- $this->chosenServer = $server_id;- $this->standalone_docker = StandaloneDocker::where('server_id', $server_id)->get();- $this->swarm_docker = SwarmDocker::where('server_id', $server_id)->get();+ $this->chosenServer = $server;+ $this->standalone_docker = StandaloneDocker::where('server_id', $server['id'])->get();+ $this->swarm_docker = SwarmDocker::where('server_id', $server['id'])->get();}public function setDestination($destination_uuid, $destination_type){diff --git a/resources/views/destination/new.blade.php b/resources/views/destination/new.blade.phpindex a3be8a53b7..55bb270e27 100644--- a/resources/views/destination/new.blade.php+++ b/resources/views/destination/new.blade.php@@ -1,4 +1,4 @@<x-layout><h1>New Destination</h1>- <livewire:destination.new.standalone-docker />+ <livewire:destination.new.standalone-docker :server_id="$server_id" /></x-layout>diff --git a/resources/views/livewire/project/new/public-git-repository.blade.php b/resources/views/livewire/project/new/public-git-repository.blade.phpindex b1da74fe8b..c340e0a822 100644--- a/resources/views/livewire/project/new/public-git-repository.blade.php+++ b/resources/views/livewire/project/new/public-git-repository.blade.php@@ -4,24 +4,37 @@@endif@forelse ($servers as $server)<button @if ($chosenServer == $server->id) class="bg-blue-500" @endif- wire:click="chooseServer({{ $server->id }})">{{ $server->name }}</button>+ wire:click="chooseServer({{ $server }})">{{ $server->name }}</button>@emptyNo servers found.<p>Did you forget to add a destination on the server?</p>@endforelse@isset($chosenServer)- <h1>Choose a destination</h1>- <div>- @foreach ($standalone_docker as $standalone)- <button @if ($chosenDestination?->uuid == $standalone->uuid) class="bg-blue-500" @endif- wire:click="setDestination('{{ $standalone->uuid }}','StandaloneDocker')">{{ $standalone->network }}</button>- @endforeach- @foreach ($swarm_docker as $standalone)- <button @if ($chosenDestination?->uuid == $standalone->uuid) class="bg-blue-500" @endif- wire:click="setDestination('{{ $standalone->uuid }}','SwarmDocker')">{{ $standalone->uuid }}</button>- @endforeach- </div>+ @if ($standalone_docker->count() > 0 || $swarm_docker->count() > 0)+ <h1>Choose a destination</h1>+ <div>+ @foreach ($standalone_docker as $standalone)+ <button @if ($chosenDestination?->uuid == $standalone->uuid) class="bg-blue-500" @endif+ wire:click="setDestination('{{ $standalone->uuid }}','StandaloneDocker')">{{ $standalone->network }}</button>+ @endforeach+ @foreach ($swarm_docker as $standalone)+ <button @if ($chosenDestination?->uuid == $standalone->uuid) class="bg-blue-500" @endif+ wire:click="setDestination('{{ $standalone->uuid }}','SwarmDocker')">{{ $standalone->uuid }}</button>+ @endforeach+ </div>+ <div>+ <a href="{{ route('destination.new', ['server_id' => $chosenServer['id']]) }}">Add+ a new+ destination</a>+ </div>+ @else+ <h1>No destinations found on this server.</h1>+ <a href="{{ route('destination.new', ['server_id' => $chosenServer['id']]) }}">Add+ a+ destination</a>+ @endif+@endisset@isset($chosenDestination)diff --git a/resources/views/server/show.blade.php b/resources/views/server/show.blade.phpindex 1fb710c423..3cf9c8cf3f 100644--- a/resources/views/server/show.blade.php+++ b/resources/views/server/show.blade.php@@ -1,7 +1,7 @@<x-layout><h1>Server</h1><livewire:server.form :server_id="$server->id" />- <h2>Destinations</h2>+ <h2>Destinations <a href="{{ route('destination.new') }}"><button>New</button></h2>@if ($server->standaloneDockers)@foreach ($server->standaloneDockers as $docker)<p>Network: {{ data_get($docker, 'network') }}</p>diff --git a/routes/web.php b/routes/web.phpindex deb7be6f06..d50f74e04e 100644--- a/routes/web.php+++ b/routes/web.php@@ -74,7 +74,16 @@ Route::middleware(['auth'])->group(function () {});Route::middleware(['auth'])->group(function () {- Route::get('/destination/new', fn () => view('destination.new'))->name('destination.new');+ Route::get('/destination/new', function () {+ $query_params = request()->query();+ $server_id = null;+ if (isset($query_params['server_id'])) {+ $server_id = $query_params['server_id'];+ }+ return view('destination.new', [+ 'server_id' => $server_id,+ ]);+ })->name('destination.new');Route::get('/destination/{destination_uuid}', function () {$standalone_dockers = StandaloneDocker::where('uuid', request()->destination_uuid)->first();$swarm_dockers = SwarmDocker::where('uuid', request()->destination_uuid)->first();