From c620bb58edc1767a8c52f8f04d2a8562f12a9099 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 17 Jan 2024 15:41:32 +0100 Subject: [PATCH] Add build pack selection and show/hide static site options --- .../Project/New/PublicGitRepository.php | 21 ++++++++++-- .../new/public-git-repository.blade.php | 33 ++++++++++++++----- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/app/Livewire/Project/New/PublicGitRepository.php b/app/Livewire/Project/New/PublicGitRepository.php index 6599d1188..840a5bd78 100644 --- a/app/Livewire/Project/New/PublicGitRepository.php +++ b/app/Livewire/Project/New/PublicGitRepository.php @@ -30,18 +30,22 @@ class PublicGitRepository extends Component public GithubApp|GitlabApp|string $git_source = 'other'; public string $git_host; public string $git_repository; + public $build_pack; + public bool $show_is_static = true; protected $rules = [ 'repository_url' => 'required|url', 'port' => 'required|numeric', 'is_static' => 'required|boolean', 'publish_directory' => 'nullable|string', + 'build_pack' => 'required|string', ]; protected $validationAttributes = [ 'repository_url' => 'repository', 'port' => 'port', 'is_static' => 'static', 'publish_directory' => 'publish directory', + 'build_pack' => 'build pack', ]; public function mount() @@ -53,7 +57,18 @@ public function mount() $this->parameters = get_route_parameters(); $this->query = request()->query(); } - + public function updatedBuildPack() + { + if ($this->build_pack === 'nixpacks') { + $this->show_is_static = true; + } else if ($this->build_pack === 'static') { + $this->show_is_static = false; + $this->is_static = false; + } else { + $this->show_is_static = false; + $this->is_static = false; + } + } public function instantSave() { if ($this->is_static) { @@ -157,6 +172,7 @@ public function submit() 'environment_id' => $environment->id, 'destination_id' => $destination->id, 'destination_type' => $destination_class, + 'build_pack' => $this->build_pack, ]; } else { $application_init = [ @@ -170,7 +186,8 @@ public function submit() 'destination_id' => $destination->id, 'destination_type' => $destination_class, 'source_id' => $this->git_source->id, - 'source_type' => $this->git_source->getMorphClass() + 'source_type' => $this->git_source->getMorphClass(), + 'build_pack' => $this->build_pack, ]; } diff --git a/resources/views/livewire/project/new/public-git-repository.blade.php b/resources/views/livewire/project/new/public-git-repository.blade.php index 08a886777..5efeaa392 100644 --- a/resources/views/livewire/project/new/public-git-repository.blade.php +++ b/resources/views/livewire/project/new/public-git-repository.blade.php @@ -10,6 +10,15 @@ Check repository + @if (!$branch_found) +
+

Public repositories: https://...

+

Private repositories: git@...

+

Preselect branch: https://github.com/coollabsio/coolify-examples/tree/static to + select 'static' branch.

+
+ @endif @if ($branch_found) @if ($rate_limit_remaining && $rate_limit_reset)
@@ -21,12 +30,20 @@
@if ($git_source === 'other') - @else - @endif + + + + + + +
+ @if ($show_is_static) @if ($is_static) @@ -34,14 +51,14 @@ @endif -
-
- -
+
+ +
+ @endif
- Save New Application + Continue @endif