Add build pack selection and update related fields
This commit is contained in:
parent
ae4b263810
commit
39647367a5
@ -39,6 +39,8 @@ class GithubPrivateRepository extends Component
|
||||
public bool $is_static = false;
|
||||
public string|null $publish_directory = null;
|
||||
protected int $page = 1;
|
||||
public $build_pack = 'nixpacks';
|
||||
public bool $show_is_static = true;
|
||||
|
||||
|
||||
public function mount()
|
||||
@ -49,6 +51,20 @@ public function mount()
|
||||
$this->repositories = $this->branches = collect();
|
||||
$this->github_apps = GithubApp::private();
|
||||
}
|
||||
public function updatedBuildPack()
|
||||
{
|
||||
if ($this->build_pack === 'nixpacks') {
|
||||
$this->show_is_static = true;
|
||||
$this->port = 3000;
|
||||
} else if ($this->build_pack === 'static') {
|
||||
$this->show_is_static = false;
|
||||
$this->is_static = false;
|
||||
$this->port = 80;
|
||||
} else {
|
||||
$this->show_is_static = false;
|
||||
$this->is_static = false;
|
||||
}
|
||||
}
|
||||
public function loadRepositories($github_app_id)
|
||||
{
|
||||
$this->repositories = collect();
|
||||
|
@ -29,12 +29,17 @@ class GithubPrivateRepositoryDeployKey extends Component
|
||||
|
||||
public string $repository_url;
|
||||
public string $branch;
|
||||
|
||||
public $build_pack = 'nixpacks';
|
||||
public bool $show_is_static = true;
|
||||
|
||||
protected $rules = [
|
||||
'repository_url' => 'required',
|
||||
'branch' => 'required|string',
|
||||
'port' => 'required|numeric',
|
||||
'is_static' => 'required|boolean',
|
||||
'publish_directory' => 'nullable|string',
|
||||
'build_pack' => 'required|string',
|
||||
];
|
||||
protected $validationAttributes = [
|
||||
'repository_url' => 'Repository',
|
||||
@ -42,6 +47,7 @@ class GithubPrivateRepositoryDeployKey extends Component
|
||||
'port' => 'Port',
|
||||
'is_static' => 'Is static',
|
||||
'publish_directory' => 'Publish directory',
|
||||
'build_pack' => 'Build pack',
|
||||
];
|
||||
private object $repository_url_parsed;
|
||||
private GithubApp|GitlabApp|string $git_source = 'other';
|
||||
@ -62,6 +68,20 @@ public function mount()
|
||||
}
|
||||
}
|
||||
|
||||
public function updatedBuildPack()
|
||||
{
|
||||
if ($this->build_pack === 'nixpacks') {
|
||||
$this->show_is_static = true;
|
||||
$this->port = 3000;
|
||||
} else if ($this->build_pack === 'static') {
|
||||
$this->show_is_static = false;
|
||||
$this->is_static = false;
|
||||
$this->port = 80;
|
||||
} else {
|
||||
$this->show_is_static = false;
|
||||
$this->is_static = false;
|
||||
}
|
||||
}
|
||||
public function instantSave()
|
||||
{
|
||||
if ($this->is_static) {
|
||||
|
@ -40,23 +40,29 @@ class="loading loading-xs text-warning loading-spinner"></span>
|
||||
<li class="step step-secondary">Select a Private Key</li>
|
||||
<li class="step step-secondary">Select a Repository, Branch & Save</li>
|
||||
</ul>
|
||||
<form class="flex flex-col gap-2 pb-6" wire:submit='submit'>
|
||||
<form class="flex flex-col gap-2 pt-2" wire:submit='submit'>
|
||||
<x-forms.input id="repository_url" required label="Repository Url" helper="{!! __('repository.url') !!}" />
|
||||
<div class="flex gap-2">
|
||||
<x-forms.input id="repository_url" required label="Repository URL"
|
||||
helper="{!! __('repository.url') !!}" />
|
||||
<x-forms.input id="branch" required label="Branch" />
|
||||
<x-forms.select wire:model.live="build_pack" label="Build Pack" required>
|
||||
<option value="nixpacks">Nixpacks</option>
|
||||
<option value="static">Static</option>
|
||||
<option value="dockerfile">Dockerfile</option>
|
||||
<option value="dockercompose">Docker Compose</option>
|
||||
</x-forms.select>
|
||||
@if ($is_static)
|
||||
<x-forms.input id="publish_directory" required label="Publish Directory" />
|
||||
@else
|
||||
<x-forms.input type="number" required id="port" label="Port" :readonly="$is_static" />
|
||||
@endif
|
||||
</div>
|
||||
<div class="w-52">
|
||||
<x-forms.checkbox instantSave id="is_static" label="Is it a static site?"
|
||||
helper="If your application is a static site or the final build assets should be served as a static site, enable this." />
|
||||
</div>
|
||||
<x-forms.button type="submit">
|
||||
Save New Application
|
||||
<x-forms.input type="number" required id="port" label="Port" :readonly="$is_static || $build_pack === 'static'" />
|
||||
@if ($show_is_static)
|
||||
<div class="w-52">
|
||||
<x-forms.checkbox instantSave id="is_static" label="Is it a static site?"
|
||||
helper="If your application is a static site or the final build assets should be served as a static site, enable this." />
|
||||
</div>
|
||||
@endif
|
||||
<x-forms.button type="submit" class="mt-4">
|
||||
Continue
|
||||
</x-forms.button>
|
||||
</form>
|
||||
@endif
|
||||
|
@ -4,8 +4,16 @@
|
||||
<x-forms.button wire:click="saveFromRedirect('source.new')" class="group-hover:text-white">
|
||||
+ Add New GitHub App
|
||||
</x-forms.button>
|
||||
@if ($repositories->count() > 0)
|
||||
<a target="_blank" class="flex hover:no-underline" href="{{ get_installation_path($github_app) }}">
|
||||
<x-forms.button>
|
||||
Change Repositories on GitHub
|
||||
<x-external-link />
|
||||
</x-forms.button>
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
<div class="pb-4">Deploy any public or private git repositories through a GitHub App.</div>
|
||||
<div class="pb-4">Deploy any public or private Git repositories through a GitHub App.</div>
|
||||
@if ($github_apps->count() !== 0)
|
||||
<div class="flex flex-col gap-2 pt-10">
|
||||
@if ($current_step === 'github_apps')
|
||||
@ -53,14 +61,8 @@ class="loading loading-xs text-warning loading-spinner"></span>
|
||||
@endif
|
||||
@endforeach
|
||||
</x-forms.select>
|
||||
<x-forms.button wire:click.prevent="loadBranches"> Load Repository Details </x-forms.button>
|
||||
<a target="_blank" class="flex hover:no-underline"
|
||||
href="{{ get_installation_path($github_app) }}">
|
||||
<x-forms.button>
|
||||
Change Repositories on GitHub
|
||||
<x-external-link />
|
||||
</x-forms.button>
|
||||
</a>
|
||||
<x-forms.button wire:click.prevent="loadBranches"> Load Repository </x-forms.button>
|
||||
|
||||
</div>
|
||||
@else
|
||||
<div>No repositories found. Check your GitHub App configuration.</div>
|
||||
@ -84,21 +86,28 @@ class="loading loading-xs text-warning loading-spinner"></span>
|
||||
@endif
|
||||
@endforeach
|
||||
</x-forms.select>
|
||||
<x-forms.select wire:model.live="build_pack" label="Build Pack" required>
|
||||
<option value="nixpacks">Nixpacks</option>
|
||||
<option value="static">Static</option>
|
||||
<option value="dockerfile">Dockerfile</option>
|
||||
<option value="dockercompose">Docker Compose</option>
|
||||
</x-forms.select>
|
||||
@if ($is_static)
|
||||
<x-forms.input id="publish_directory" label="Publish Directory"
|
||||
helper="If there is a build process involved (like Svelte, React, Next, etc..), please specify the output directory for the build assets." />
|
||||
@else
|
||||
<x-forms.input type="number" id="port" label="Port" :readonly="$is_static"
|
||||
helper="The port your application listens on." />
|
||||
@endif
|
||||
</div>
|
||||
<div class="w-52">
|
||||
<x-forms.checkbox instantSave id="is_static" label="Is it a static site?"
|
||||
helper="If your application is a static site or the final build assets should be served as a static site, enable this." />
|
||||
</div>
|
||||
<x-forms.input type="number" id="port" label="Port" :readonly="$is_static || $build_pack === 'static'"
|
||||
helper="The port your application listens on." />
|
||||
@if ($show_is_static)
|
||||
<div class="w-52">
|
||||
<x-forms.checkbox instantSave id="is_static" label="Is it a static site?"
|
||||
helper="If your application is a static site or the final build assets should be served as a static site, enable this." />
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<x-forms.button type="submit">
|
||||
Save New Application
|
||||
Continue
|
||||
</x-forms.button>
|
||||
@endif
|
||||
@endif
|
||||
|
@ -11,7 +11,7 @@
|
||||
</x-forms.button>
|
||||
</div>
|
||||
@if (!$branch_found)
|
||||
<div>
|
||||
<div class="px-2 pt-4">
|
||||
<p>Public repositories: <span class='text-helper'>https://...</span></p>
|
||||
<p>Private repositories: <span class='text-helper'>git@...</span></p>
|
||||
<p>Preselect branch: <span
|
||||
@ -42,15 +42,14 @@ class='text-helper'>https://github.com/coollabsio/coolify-examples/tree/static</
|
||||
<option value="dockerfile">Dockerfile</option>
|
||||
<option value="dockercompose">Docker Compose</option>
|
||||
</x-forms.select>
|
||||
</div>
|
||||
@if ($show_is_static)
|
||||
@if ($is_static)
|
||||
<x-forms.input id="publish_directory" label="Publish Directory"
|
||||
helper="If there is a build process involved (like Svelte, React, Next, etc..), please specify the output directory for the build assets." />
|
||||
@else
|
||||
<x-forms.input type="number" id="port" label="Port" :readonly="$is_static"
|
||||
helper="The port your application listens on." />
|
||||
@endif
|
||||
</div>
|
||||
<x-forms.input type="number" id="port" label="Port" :readonly="$is_static || $build_pack === 'static'"
|
||||
helper="The port your application listens on." />
|
||||
@if ($show_is_static)
|
||||
<div class="w-52">
|
||||
<x-forms.checkbox instantSave id="is_static" label="Is it a static site?"
|
||||
helper="If your application is a static site or the final build assets should be served as a static site, enable this." />
|
||||
|
Loading…
Reference in New Issue
Block a user