testing php storm code cleanup and styling

This commit is contained in:
Andras Bacsai
2023-08-08 11:51:36 +02:00
parent a8ee779b31
commit f2228cec7b
368 changed files with 23834 additions and 2623 deletions

View File

@@ -10,10 +10,12 @@ class DeploymentLogs extends Component
public ApplicationDeploymentQueue $application_deployment_queue;
public $isKeepAliveOn = true;
protected $listeners = ['refreshQueue'];
public function refreshQueue()
{
$this->application_deployment_queue->refresh();
}
public function polling()
{
$this->emit('deploymentFinished');

View File

@@ -8,17 +8,16 @@ use App\Models\ApplicationDeploymentQueue;
use App\Models\Server;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Process;
use Livewire\Component;
use Illuminate\Support\Str;
use Livewire\Component;
class DeploymentNavbar extends Component
{
protected $listeners = ['deploymentFinished'];
public ApplicationDeploymentQueue $application_deployment_queue;
public Application $application;
public Server $server;
public bool $is_debug_enabled = false;
protected $listeners = ['deploymentFinished'];
public function mount()
{
@@ -26,10 +25,12 @@ class DeploymentNavbar extends Component
$this->server = $this->application->destination->server;
$this->is_debug_enabled = $this->application->settings->is_debug_enabled;
}
public function deploymentFinished()
{
$this->application_deployment_queue->refresh();
}
public function show_debug()
{
$this->application->settings->is_debug_enabled = !$this->application->settings->is_debug_enabled;
@@ -37,6 +38,7 @@ class DeploymentNavbar extends Component
$this->is_debug_enabled = $this->application->settings->is_debug_enabled;
$this->emit('refreshQueue');
}
public function cancel()
{
try {
@@ -66,4 +68,4 @@ class DeploymentNavbar extends Component
return general_error_handler(err: $e, that: $this);
}
}
}
}

View File

@@ -20,6 +20,7 @@ class Deployments extends Component
$this->current_url = url()->current();
$this->show_more();
}
private function show_more()
{
if (count($this->deployments) !== 0) {
@@ -30,10 +31,12 @@ class Deployments extends Component
return;
}
}
public function reload_deployments()
{
$this->load_deployments();
}
public function load_deployments(int|null $take = null)
{
if ($take) {

View File

@@ -4,8 +4,8 @@ namespace App\Http\Livewire\Project\Application;
use App\Models\Application;
use App\Models\InstanceSettings;
use Livewire\Component;
use Illuminate\Support\Str;
use Livewire\Component;
use Spatie\Url\Url;
class General extends Component
@@ -65,6 +65,7 @@ class General extends Component
'application.ports_exposes' => 'Ports exposes',
'application.ports_mappings' => 'Ports mappings',
];
public function instantSave()
{
// @TODO: find another way - if possible
@@ -86,6 +87,7 @@ class General extends Component
$this->emit('success', 'Application settings updated!');
$this->checkWildCardDomain();
}
protected function checkWildCardDomain()
{
$coolify_instance_settings = InstanceSettings::get();
@@ -93,6 +95,7 @@ class General extends Component
$this->global_wildcard_domain = data_get($coolify_instance_settings, 'wildcard_domain');
$this->wildcard_domain = $this->server_wildcard_domain ?? $this->global_wildcard_domain ?? null;
}
public function mount()
{
$this->is_static = $this->application->settings->is_static;
@@ -104,6 +107,7 @@ class General extends Component
$this->is_force_https_enabled = $this->application->settings->is_force_https_enabled;
$this->checkWildCardDomain();
}
public function generateGlobalRandomDomain()
{
// Set wildcard domain based on Global wildcard domain
@@ -115,6 +119,7 @@ class General extends Component
$this->application->save();
$this->emit('success', 'Application settings updated!');
}
public function generateServerRandomDomain()
{
// Set wildcard domain based on Server wildcard domain
@@ -126,6 +131,7 @@ class General extends Component
$this->application->save();
$this->emit('success', 'Application settings updated!');
}
public function submit()
{
try {

View File

@@ -28,6 +28,12 @@ class Heading extends Component
));
$this->application->refresh();
}
public function force_deploy_without_cache()
{
$this->deploy(force_rebuild: true);
}
public function deploy(bool $force_rebuild = false)
{
$this->setDeploymentUuid();
@@ -43,10 +49,13 @@ class Heading extends Component
'environment_name' => $this->parameters['environment_name'],
]);
}
public function force_deploy_without_cache()
protected function setDeploymentUuid()
{
$this->deploy(force_rebuild: true);
$this->deploymentUuid = new Cuid2(7);
$this->parameters['deployment_uuid'] = $this->deploymentUuid;
}
public function stop()
{
remote_process(
@@ -57,9 +66,4 @@ class Heading extends Component
$this->application->save();
$this->application->environment->project->team->notify(new StatusChanged($this->application));
}
protected function setDeploymentUuid()
{
$this->deploymentUuid = new Cuid2(7);
$this->parameters['deployment_uuid'] = $this->deploymentUuid;
}
}

View File

@@ -17,6 +17,7 @@ class Form extends Component
protected $validationAttributes = [
'application.preview_url_template' => 'preview url template',
];
public function resetToDefault()
{
$this->application->preview_url_template = '{{pr_id}}.{{domain}}';
@@ -24,6 +25,7 @@ class Form extends Component
$this->application->save();
$this->generate_real_url();
}
public function generate_real_url()
{
if (data_get($this->application, 'fqdn')) {
@@ -32,10 +34,12 @@ class Form extends Component
$this->preview_url_template = Str::of($this->application->preview_url_template)->replace('{{domain}}', $host);
}
}
public function mount()
{
$this->generate_real_url();
}
public function submit()
{
$this->validate();

View File

@@ -22,6 +22,7 @@ class Previews extends Component
$this->pull_requests = collect();
$this->parameters = getRouteParameters();
}
public function loadStatus($pull_request_id)
{
dispatch(new ContainerStatusJob(
@@ -30,11 +31,7 @@ class Previews extends Component
pull_request_id: $pull_request_id
));
}
protected function setDeploymentUuid()
{
$this->deployment_uuid = new Cuid2(7);
$this->parameters['deployment_uuid'] = $this->deployment_uuid;
}
public function load_prs()
{
try {
@@ -46,6 +43,7 @@ class Previews extends Component
return general_error_handler(err: $e, that: $this);
}
}
public function deploy(int $pull_request_id, string|null $pull_request_html_url = null)
{
try {
@@ -74,6 +72,13 @@ class Previews extends Component
return general_error_handler(err: $e, that: $this);
}
}
protected function setDeploymentUuid()
{
$this->deployment_uuid = new Cuid2(7);
$this->parameters['deployment_uuid'] = $this->deployment_uuid;
}
public function stop(int $pull_request_id)
{
try {
@@ -87,6 +92,7 @@ class Previews extends Component
return general_error_handler(err: $e, that: $this);
}
}
public function previewRefresh()
{
$this->application->previews->each(function ($preview) {

View File

@@ -3,8 +3,8 @@
namespace App\Http\Livewire\Project\Application;
use App\Models\Application;
use Livewire\Component;
use Illuminate\Support\Str;
use Livewire\Component;
use Visus\Cuid2\Cuid2;
class Rollback extends Component
@@ -18,6 +18,7 @@ class Rollback extends Component
{
$this->parameters = getRouteParameters();
}
public function rollbackImage($commit)
{
$deployment_uuid = new Cuid2(7);
@@ -36,6 +37,7 @@ class Rollback extends Component
'environment_name' => $this->parameters['environment_name'],
]);
}
public function loadImages()
{
try {

View File

@@ -21,16 +21,19 @@ class Source extends Component
'application.git_branch' => 'branch',
'application.git_commit_sha' => 'commit sha',
];
public function mount()
{
$this->get_private_keys();
}
private function get_private_keys()
{
$this->private_keys = PrivateKey::whereTeamId(session('currentTeam')->id)->get()->reject(function ($key) {
return $key->id == $this->application->private_key_id;
});
}
public function mount()
{
$this->get_private_keys();
}
public function setPrivateKey(int $private_key_id)
{
$this->application->private_key_id = $private_key_id;
@@ -38,6 +41,7 @@ class Source extends Component
$this->application->refresh();
$this->get_private_keys();
}
public function submit()
{
$this->validate();