2023-04-19 10:42:15 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Livewire\Application;
|
|
|
|
|
|
|
|
use App\Models\Application;
|
|
|
|
use Livewire\Component;
|
|
|
|
|
|
|
|
class General extends Component
|
|
|
|
{
|
|
|
|
public string $applicationId;
|
|
|
|
|
|
|
|
public Application $application;
|
|
|
|
public string $name;
|
|
|
|
public string|null $fqdn;
|
|
|
|
public string $git_repository;
|
|
|
|
public string $git_branch;
|
|
|
|
public string|null $git_commit_sha;
|
|
|
|
public string $build_pack;
|
|
|
|
|
2023-04-19 12:00:31 +00:00
|
|
|
public bool $is_git_submodules_allowed;
|
|
|
|
public bool $is_git_lfs_allowed;
|
|
|
|
public bool $is_debug;
|
|
|
|
public bool $is_previews;
|
|
|
|
public bool $is_bot;
|
|
|
|
public bool $is_custom_ssl;
|
|
|
|
public bool $is_http2;
|
|
|
|
public bool $is_auto_deploy;
|
|
|
|
public bool $is_dual_cert;
|
|
|
|
|
2023-04-19 10:42:15 +00:00
|
|
|
protected $rules = [
|
|
|
|
'application.name' => 'required|min:6',
|
|
|
|
'application.fqdn' => 'nullable',
|
|
|
|
'application.git_repository' => 'required',
|
|
|
|
'application.git_branch' => 'required',
|
|
|
|
'application.git_commit_sha' => 'nullable',
|
|
|
|
'application.build_pack' => 'required',
|
|
|
|
'application.base_directory' => 'required',
|
|
|
|
'application.publish_directory' => 'nullable',
|
2023-04-24 11:25:02 +00:00
|
|
|
'application.ports_exposes' => 'nullable',
|
2023-04-19 10:42:15 +00:00
|
|
|
];
|
2023-04-19 12:00:31 +00:00
|
|
|
public function instantSave()
|
|
|
|
{
|
|
|
|
// @TODO: find another way
|
|
|
|
$this->application->settings->is_git_submodules_allowed = $this->is_git_submodules_allowed;
|
|
|
|
$this->application->settings->is_git_lfs_allowed = $this->is_git_lfs_allowed;
|
|
|
|
$this->application->settings->is_debug = $this->is_debug;
|
|
|
|
$this->application->settings->is_previews = $this->is_previews;
|
|
|
|
$this->application->settings->is_bot = $this->is_bot;
|
|
|
|
$this->application->settings->is_custom_ssl = $this->is_custom_ssl;
|
|
|
|
$this->application->settings->is_http2 = $this->is_http2;
|
|
|
|
$this->application->settings->is_auto_deploy = $this->is_auto_deploy;
|
|
|
|
$this->application->settings->is_dual_cert = $this->is_dual_cert;
|
|
|
|
$this->application->settings->save();
|
|
|
|
}
|
2023-04-19 10:42:15 +00:00
|
|
|
public function mount()
|
|
|
|
{
|
2023-04-19 12:00:31 +00:00
|
|
|
$this->application = Application::find($this->applicationId)->with('destination', 'settings')->first();
|
|
|
|
$this->is_git_submodules_allowed = $this->application->settings->is_git_submodules_allowed;
|
|
|
|
$this->is_git_lfs_allowed = $this->application->settings->is_git_lfs_allowed;
|
|
|
|
$this->is_debug = $this->application->settings->is_debug;
|
|
|
|
$this->is_previews = $this->application->settings->is_previews;
|
|
|
|
$this->is_bot = $this->application->settings->is_bot;
|
|
|
|
$this->is_custom_ssl = $this->application->settings->is_custom_ssl;
|
|
|
|
$this->is_http2 = $this->application->settings->is_http2;
|
|
|
|
$this->is_auto_deploy = $this->application->settings->is_auto_deploy;
|
|
|
|
$this->is_dual_cert = $this->application->settings->is_dual_cert;
|
|
|
|
|
2023-04-19 10:42:15 +00:00
|
|
|
}
|
|
|
|
public function submit()
|
|
|
|
{
|
|
|
|
$this->application->save();
|
|
|
|
}
|
|
|
|
}
|