proejct wildcard domain

This commit is contained in:
Andras Bacsai 2023-06-22 15:08:02 +02:00
parent d8adea734f
commit 6aa7cbade0
4 changed files with 33 additions and 20 deletions

View File

@ -105,6 +105,7 @@ class General extends Component
$scheme = $url->getScheme(); $scheme = $url->getScheme();
$this->application->fqdn = $scheme . '://' . $this->application->uuid . '.' . $host . $path; $this->application->fqdn = $scheme . '://' . $this->application->uuid . '.' . $host . $path;
$this->application->save(); $this->application->save();
$this->emit('success', 'Application settings updated!');
} }
public function generateProjectRandomDomain() public function generateProjectRandomDomain()
{ {
@ -115,6 +116,7 @@ class General extends Component
$scheme = $url->getScheme(); $scheme = $url->getScheme();
$this->application->fqdn = $scheme . '://' . $this->application->uuid . '.' . $host . $path; $this->application->fqdn = $scheme . '://' . $this->application->uuid . '.' . $host . $path;
$this->application->save(); $this->application->save();
$this->emit('success', 'Application settings updated!');
} }
public function submit() public function submit()
{ {

View File

@ -8,14 +8,22 @@ use Livewire\Component;
class Edit extends Component class Edit extends Component
{ {
public Project $project; public Project $project;
public string|null $wildcard_domain = null;
protected $rules = [ protected $rules = [
'project.name' => 'required|min:3|max:255', 'project.name' => 'required|min:3|max:255',
'project.description' => 'nullable|string|max:255', 'project.description' => 'nullable|string|max:255',
'wildcard_domain' => 'nullable|string|max:255',
]; ];
public function mount()
{
$this->wildcard_domain = $this->project->settings->wildcard_domain;
}
public function submit() public function submit()
{ {
$this->validate(); $this->validate();
try { try {
$this->project->settings->wildcard_domain = $this->wildcard_domain;
$this->project->settings->save();
$this->project->save(); $this->project->save();
$this->emit('saved'); $this->emit('saved');
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -12,21 +12,19 @@
<x-forms.input id="application.name" label="Name" required /> <x-forms.input id="application.name" label="Name" required />
<x-forms.input placeholder="https://coolify.io" id="application.fqdn" label="Domains" <x-forms.input placeholder="https://coolify.io" id="application.fqdn" label="Domains"
helper="You can specify one domain with path or more with comma.<br><span class='text-helper'>Example</span>- http://app.coolify.io, https://cloud.coolify.io/dashboard<br>- http://app.coolify.io/api/v3" /> helper="You can specify one domain with path or more with comma.<br><span class='text-helper'>Example</span>- http://app.coolify.io, https://cloud.coolify.io/dashboard<br>- http://app.coolify.io/api/v3" />
@if ($wildcard_domain)
<div class="flex flex-row gap-2">
@if ($global_wildcard_domain)
<x-forms.button wire:click="generateGlobalRandomDomain">Global Wildcard
</x-forms.button>
@endif
@if ($project_wildcard_domain)
<x-forms.button wire:click="generateProjectRandomDomain">Project Wildcard
</x-forms.button>
@endif
</div>
@endif
</div> </div>
@if ($wildcard_domain)
<div class="pb-6">
<div class="">Set Random Domain</div>
@if ($global_wildcard_domain)
<x-forms.button wire:click="generateGlobalRandomDomain">Global Wildcard
</x-forms.button>
@endif
@if ($project_wildcard_domain)
<x-forms.button wire:click="generateProjectRandomDomain">Project Wildcard
</x-forms.button>
@endif
</div>
@endif
<x-forms.select id="application.build_pack" label="Build Pack" required> <x-forms.select id="application.build_pack" label="Build Pack" required>
<option value="nixpacks">Nixpacks</option> <option value="nixpacks">Nixpacks</option>
<option disabled value="docker">Docker</option> <option disabled value="docker">Docker</option>

View File

@ -1,9 +1,14 @@
<div> <div>
<h1>{{ data_get($project, 'name') }}</h1> <form wire:submit.prevent='submit' class="flex flex-col gap-2 ">
<div class="pt-2 pb-10">Edit project details</div> <div class="flex items-end gap-2">
<form wire:submit.prevent='submit' class="flex items-end gap-2 "> <h1>Project: {{ data_get($project, 'name') }}</h1>
<x-forms.input label="Name" id="project.name" /> <x-forms.button type="submit">Save</x-forms.button>
<x-forms.input label="Description" id="project.description" /> </div>
<x-forms.button type="submit">Save</x-forms.button> <div class="pb-10">Edit project details here.</div>
<div class="flex gap-2">
<x-forms.input label="Name" id="project.name" />
<x-forms.input label="Description" id="project.description" />
<x-forms.input label="Wildcard Domain" id="wildcard_domain" />
</div>
</form> </form>
</div> </div>