wip
This commit is contained in:
parent
6aa7cbade0
commit
ee211aba51
@ -20,7 +20,7 @@ class General extends Component
|
||||
public string|null $git_commit_sha;
|
||||
public string $build_pack;
|
||||
public string|null $wildcard_domain = null;
|
||||
public string|null $project_wildcard_domain = null;
|
||||
public string|null $server_wildcard_domain = null;
|
||||
public string|null $global_wildcard_domain = null;
|
||||
|
||||
public bool $is_static;
|
||||
@ -81,9 +81,9 @@ public function instantSave()
|
||||
protected function checkWildCardDomain()
|
||||
{
|
||||
$coolify_instance_settings = InstanceSettings::get();
|
||||
$this->project_wildcard_domain = data_get($this->application, 'environment.project.settings.wildcard_domain');
|
||||
$this->server_wildcard_domain = data_get($this->application, 'destination.server.settings.wildcard_domain');
|
||||
$this->global_wildcard_domain = data_get($coolify_instance_settings, 'wildcard_domain');
|
||||
$this->wildcard_domain = $this->project_wildcard_domain ?? $this->global_wildcard_domain ?? null;
|
||||
$this->wildcard_domain = $this->server_wildcard_domain ?? $this->global_wildcard_domain ?? null;
|
||||
}
|
||||
public function mount()
|
||||
{
|
||||
@ -107,10 +107,10 @@ public function generateGlobalRandomDomain()
|
||||
$this->application->save();
|
||||
$this->emit('success', 'Application settings updated!');
|
||||
}
|
||||
public function generateProjectRandomDomain()
|
||||
public function generateServerRandomDomain()
|
||||
{
|
||||
// Set wildcard domain based on Project wildcard domain
|
||||
$url = Url::fromString($this->project_wildcard_domain);
|
||||
// Set wildcard domain based on Server wildcard domain
|
||||
$url = Url::fromString($this->server_wildcard_domain);
|
||||
$host = $url->getHost();
|
||||
$path = $url->getPath() === '/' ? '' : $url->getPath();
|
||||
$scheme = $url->getScheme();
|
||||
|
@ -8,22 +8,15 @@
|
||||
class Edit extends Component
|
||||
{
|
||||
public Project $project;
|
||||
public string|null $wildcard_domain = null;
|
||||
protected $rules = [
|
||||
'project.name' => 'required|min:3|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()
|
||||
{
|
||||
$this->validate();
|
||||
try {
|
||||
$this->project->settings->wildcard_domain = $this->wildcard_domain;
|
||||
$this->project->settings->save();
|
||||
$this->project->save();
|
||||
$this->emit('saved');
|
||||
} catch (\Exception $e) {
|
||||
|
@ -11,6 +11,7 @@ class Form extends Component
|
||||
public Server $server;
|
||||
public $uptime;
|
||||
public $dockerVersion;
|
||||
public string|null $wildcard_domain = null;
|
||||
|
||||
protected $rules = [
|
||||
'server.name' => 'required|min:6',
|
||||
@ -19,7 +20,8 @@ class Form extends Component
|
||||
'server.user' => 'required',
|
||||
'server.port' => 'required',
|
||||
'server.settings.is_reachable' => 'required',
|
||||
'server.settings.is_part_of_swarm' => 'required'
|
||||
'server.settings.is_part_of_swarm' => 'required',
|
||||
'wildcard_domain' => 'nullable|string'
|
||||
];
|
||||
protected $validationAttributes = [
|
||||
'server.name' => 'name',
|
||||
@ -30,6 +32,10 @@ class Form extends Component
|
||||
'server.settings.is_reachable' => 'is reachable',
|
||||
'server.settings.is_part_of_swarm' => 'is part of swarm'
|
||||
];
|
||||
public function mount()
|
||||
{
|
||||
$this->wildcard_domain = $this->server->settings->wildcard_domain;
|
||||
}
|
||||
public function installDocker()
|
||||
{
|
||||
$activity = resolve(InstallDocker::class)($this->server);
|
||||
@ -81,6 +87,8 @@ public function submit()
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
$this->server->settings->wildcard_domain = $this->wildcard_domain;
|
||||
$this->server->settings->save();
|
||||
$this->server->save();
|
||||
$this->emit('success', 'Server updated successfully.');
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('project_settings', function (Blueprint $table) {
|
||||
$table->dropColumn('wildcard_domain');
|
||||
});
|
||||
Schema::table('server_settings', function (Blueprint $table) {
|
||||
$table->string('wildcard_domain')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('project_settings', function (Blueprint $table) {
|
||||
$table->string('wildcard_domain')->nullable();
|
||||
});
|
||||
Schema::table('server_settings', function (Blueprint $table) {
|
||||
$table->dropColumn('wildcard_domain');
|
||||
});
|
||||
}
|
||||
};
|
@ -15,11 +15,11 @@
|
||||
@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 wire:click="generateGlobalRandomDomain">Set Global Wildcard
|
||||
</x-forms.button>
|
||||
@endif
|
||||
@if ($project_wildcard_domain)
|
||||
<x-forms.button wire:click="generateProjectRandomDomain">Project Wildcard
|
||||
@if ($server_wildcard_domain)
|
||||
<x-forms.button wire:click="generateServerRandomDomain">Set Server Wildcard
|
||||
</x-forms.button>
|
||||
@endif
|
||||
</div>
|
||||
|
@ -8,7 +8,6 @@
|
||||
<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>
|
||||
</div>
|
||||
|
@ -15,6 +15,8 @@
|
||||
<x-forms.input id="server.name" label="Name" required />
|
||||
<x-forms.input id="server.description" label="Description" />
|
||||
@endif
|
||||
<x-forms.input id="wildcard_domain" label="Wildcard Domain"
|
||||
helper="Wildcard domain for your applications. If you set this, you will get a random generated domain for your new applications.<br><span class='font-bold text-white'>Example</span>In case you set:<span class='text-helper'>https://example.com</span>your applications will get: <span class='text-helper'>https://randomId.example.com</span>" />
|
||||
|
||||
{{-- <x-forms.checkbox disabled type="checkbox" id="server.settings.is_part_of_swarm"
|
||||
label="Is it part of a Swarm cluster?" /> --}}
|
||||
|
@ -52,9 +52,7 @@
|
||||
Route::get('/project/{project_uuid}/{environment_name}/new', [ProjectController::class, 'new'])->name('project.resources.new');
|
||||
Route::get('/project/{project_uuid}/{environment_name}', [ProjectController::class, 'resources'])->name('project.resources');
|
||||
Route::get('/project/{project_uuid}/{environment_name}/application/{application_uuid}', [ApplicationController::class, 'configuration'])->name('project.application.configuration');
|
||||
|
||||
Route::get('/project/{project_uuid}/{environment_name}/application/{application_uuid}/deployment', [ApplicationController::class, 'deployments'])->name('project.application.deployments');
|
||||
|
||||
Route::get('/project/{project_uuid}/{environment_name}/application/{application_uuid}/deployment', [ApplicationController::class, 'deployments'])->name('project.application.deployments');
|
||||
Route::get(
|
||||
'/project/{project_uuid}/{environment_name}/application/{application_uuid}/deployment/{deployment_uuid}',
|
||||
[ApplicationController::class, 'deployment']
|
||||
|
Loading…
Reference in New Issue
Block a user