wip: migrate to livewire 3

This commit is contained in:
Andras Bacsai 2023-12-07 19:06:32 +01:00
parent 2f286a6595
commit 718603e37e
254 changed files with 930 additions and 936 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire; namespace App\Livewire;
use App\Enums\ProcessStatus; use App\Enums\ProcessStatus;
use Livewire\Component; use Livewire\Component;
@ -42,7 +42,7 @@ public function polling()
$this->setStatus(ProcessStatus::ERROR); $this->setStatus(ProcessStatus::ERROR);
} }
$this->isPollingActive = false; $this->isPollingActive = false;
$this->emit('activityFinished'); $this->dispatch('activityFinished');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Boarding; namespace App\Livewire\Boarding;
use App\Actions\Server\InstallDocker; use App\Actions\Server\InstallDocker;
use App\Models\PrivateKey; use App\Models\PrivateKey;
@ -88,7 +88,7 @@ public function setServerType(string $type)
if ($this->selectedServerType === 'localhost') { if ($this->selectedServerType === 'localhost') {
$this->createdServer = Server::find(0); $this->createdServer = Server::find(0);
if (!$this->createdServer) { if (!$this->createdServer) {
return $this->emit('error', 'Localhost server is not found. Something went wrong during installation. Please try to reinstall or contact support.'); return $this->dispatch('error', 'Localhost server is not found. Something went wrong during installation. Please try to reinstall or contact support.');
} }
$this->serverPublicKey = $this->createdServer->privateKey->publicKey(); $this->serverPublicKey = $this->createdServer->privateKey->publicKey();
return $this->validateServer('localhost'); return $this->validateServer('localhost');
@ -110,7 +110,7 @@ public function selectExistingServer()
{ {
$this->createdServer = Server::find($this->selectedExistingServer); $this->createdServer = Server::find($this->selectedExistingServer);
if (!$this->createdServer) { if (!$this->createdServer) {
$this->emit('error', 'Server is not found.'); $this->dispatch('error', 'Server is not found.');
$this->currentState = 'private-key'; $this->currentState = 'private-key';
return; return;
} }
@ -173,7 +173,7 @@ public function saveServer()
$this->privateKey = formatPrivateKey($this->privateKey); $this->privateKey = formatPrivateKey($this->privateKey);
$foundServer = Server::whereIp($this->remoteServerHost)->first(); $foundServer = Server::whereIp($this->remoteServerHost)->first();
if ($foundServer) { if ($foundServer) {
return $this->emit('error', 'IP address is already in use by another team.'); return $this->dispatch('error', 'IP address is already in use by another team.');
} }
$this->createdServer = Server::create([ $this->createdServer = Server::create([
'name' => $this->remoteServerName, 'name' => $this->remoteServerName,
@ -227,8 +227,8 @@ public function installDocker()
try { try {
$this->dockerInstallationStarted = true; $this->dockerInstallationStarted = true;
$activity = InstallDocker::run($this->createdServer); $activity = InstallDocker::run($this->createdServer);
$this->emit('installDocker'); $this->dispatch('installDocker');
$this->emit('newMonitorActivity', $activity->id); $this->dispatch('newMonitorActivity', $activity->id);
} catch (\Throwable $e) { } catch (\Throwable $e) {
$this->dockerInstallationStarted = false; $this->dockerInstallationStarted = false;
return handleError(error: $e, livewire: $this); return handleError(error: $e, livewire: $this);

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire; namespace App\Livewire;
use App\Actions\License\CheckResaleLicense; use App\Actions\License\CheckResaleLicense;
use App\Models\InstanceSettings; use App\Models\InstanceSettings;
@ -33,7 +33,7 @@ public function submit()
if ($this->settings->resale_license) { if ($this->settings->resale_license) {
try { try {
CheckResaleLicense::run(); CheckResaleLicense::run();
$this->emit('reloadWindow'); $this->dispatch('reloadWindow');
} catch (\Throwable $e) { } catch (\Throwable $e) {
session()->flash('error', 'Something went wrong. Please contact support. <br>Error: ' . $e->getMessage()); session()->flash('error', 'Something went wrong. Please contact support. <br>Error: ' . $e->getMessage());
ray($e->getMessage()); ray($e->getMessage());

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire; namespace App\Livewire;
use App\Models\Project; use App\Models\Project;
use App\Models\Server; use App\Models\Server;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Destination; namespace App\Livewire\Destination;
use Livewire\Component; use Livewire\Component;
@ -30,7 +30,7 @@ public function delete()
try { try {
if ($this->destination->getMorphClass() === 'App\Models\StandaloneDocker') { if ($this->destination->getMorphClass() === 'App\Models\StandaloneDocker') {
if ($this->destination->attachedTo()) { if ($this->destination->attachedTo()) {
return $this->emit('error', 'You must delete all resources before deleting this destination.'); return $this->dispatch('error', 'You must delete all resources before deleting this destination.');
} }
instant_remote_process(["docker network disconnect {$this->destination->network} coolify-proxy"], $this->destination->server, throwError: false); instant_remote_process(["docker network disconnect {$this->destination->network} coolify-proxy"], $this->destination->server, throwError: false);
instant_remote_process(['docker network rm -f ' . $this->destination->network], $this->destination->server); instant_remote_process(['docker network rm -f ' . $this->destination->network], $this->destination->server);

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Destination\New; namespace App\Livewire\Destination\New;
use App\Models\Server; use App\Models\Server;
use App\Models\StandaloneDocker as ModelsStandaloneDocker; use App\Models\StandaloneDocker as ModelsStandaloneDocker;
@ -60,7 +60,7 @@ public function submit()
$found = $this->server->standaloneDockers()->where('network', $this->network)->first(); $found = $this->server->standaloneDockers()->where('network', $this->network)->first();
if ($found) { if ($found) {
$this->createNetworkAndAttachToProxy(); $this->createNetworkAndAttachToProxy();
$this->emit('error', 'Network already added to this server.'); $this->dispatch('error', 'Network already added to this server.');
return; return;
} else { } else {
$docker = ModelsStandaloneDocker::create([ $docker = ModelsStandaloneDocker::create([

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Destination; namespace App\Livewire\Destination;
use App\Models\Server; use App\Models\Server;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
@ -21,7 +21,7 @@ public function scan()
return !$alreadyAddedNetworks->contains('network', $network['Name']); return !$alreadyAddedNetworks->contains('network', $network['Name']);
}); });
if ($this->networks->count() === 0) { if ($this->networks->count() === 0) {
$this->emit('success', 'No new networks found.'); $this->dispatch('success', 'No new networks found.');
} }
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Dev; namespace App\Livewire\Dev;
use Livewire\Component; use Livewire\Component;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire; namespace App\Livewire;
use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Hash;
use DanHarrin\LivewireRateLimiting\WithRateLimiting; use DanHarrin\LivewireRateLimiting\WithRateLimiting;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire; namespace App\Livewire;
use DanHarrin\LivewireRateLimiting\WithRateLimiting; use DanHarrin\LivewireRateLimiting\WithRateLimiting;
use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\MailMessage;
@ -42,7 +42,7 @@ public function submit()
); );
$mail->subject("[HELP - {$subscriptionType}]: {$this->subject}"); $mail->subject("[HELP - {$subscriptionType}]: {$this->subject}");
send_user_an_email($mail, auth()->user()?->email, 'hi@coollabs.io'); send_user_an_email($mail, auth()->user()?->email, 'hi@coollabs.io');
$this->emit('success', 'Your message has been sent successfully. <br>We will get in touch with you as soon as possible.'); $this->dispatch('success', 'Your message has been sent successfully. <br>We will get in touch with you as soon as possible.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Modal; namespace App\Livewire\Modal;
use App\Models\Service; use App\Models\Service;
use Livewire\Component; use Livewire\Component;
@ -22,8 +22,8 @@ public function render()
return view('livewire.modal.edit-compose'); return view('livewire.modal.edit-compose');
} }
public function submit() { public function submit() {
$this->emit('warning', "Saving new docker compose..."); $this->dispatch('warning', "Saving new docker compose...");
$this->emit('saveCompose', $this->service->docker_compose_raw); $this->dispatch('saveCompose', $this->service->docker_compose_raw);
$this->closeModal(); $this->closeModal();
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Notifications; namespace App\Livewire\Notifications;
use App\Models\Team; use App\Models\Team;
use App\Notifications\Test; use App\Notifications\Test;
@ -47,12 +47,12 @@ public function saveModel()
{ {
$this->team->save(); $this->team->save();
refreshSession(); refreshSession();
$this->emit('success', 'Settings saved.'); $this->dispatch('success', 'Settings saved.');
} }
public function sendTestNotification() public function sendTestNotification()
{ {
$this->team->notify(new Test()); $this->team->notify(new Test());
$this->emit('success', 'Test notification sent.'); $this->dispatch('success', 'Test notification sent.');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Notifications; namespace App\Livewire\Notifications;
use App\Models\InstanceSettings; use App\Models\InstanceSettings;
use App\Models\Team; use App\Models\Team;
@ -63,7 +63,7 @@ public function submitFromFields()
]); ]);
$this->team->save(); $this->team->save();
refreshSession(); refreshSession();
$this->emit('success', 'Settings saved successfully.'); $this->dispatch('success', 'Settings saved successfully.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -71,7 +71,7 @@ public function submitFromFields()
public function sendTestNotification() public function sendTestNotification()
{ {
$this->team->notify(new Test($this->emails)); $this->team->notify(new Test($this->emails));
$this->emit('success', 'Test Email sent successfully.'); $this->dispatch('success', 'Test Email sent successfully.');
} }
public function instantSaveInstance() public function instantSaveInstance()
{ {
@ -83,7 +83,7 @@ public function instantSaveInstance()
$this->team->resend_enabled = false; $this->team->resend_enabled = false;
$this->team->save(); $this->team->save();
refreshSession(); refreshSession();
$this->emit('success', 'Settings saved successfully.'); $this->dispatch('success', 'Settings saved successfully.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -113,7 +113,7 @@ public function saveModel()
{ {
$this->team->save(); $this->team->save();
refreshSession(); refreshSession();
$this->emit('success', 'Settings saved.'); $this->dispatch('success', 'Settings saved.');
} }
public function submit() public function submit()
{ {
@ -131,7 +131,7 @@ public function submit()
]); ]);
$this->team->save(); $this->team->save();
refreshSession(); refreshSession();
$this->emit('success', 'Settings saved successfully.'); $this->dispatch('success', 'Settings saved successfully.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
$this->team->smtp_enabled = false; $this->team->smtp_enabled = false;
return handleError($e, $this); return handleError($e, $this);
@ -148,7 +148,7 @@ public function submitResend()
]); ]);
$this->team->save(); $this->team->save();
refreshSession(); refreshSession();
$this->emit('success', 'Settings saved successfully.'); $this->dispatch('success', 'Settings saved successfully.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
$this->team->resend_enabled = false; $this->team->resend_enabled = false;
return handleError($e, $this); return handleError($e, $this);
@ -173,7 +173,7 @@ public function copyFromInstanceSettings()
]); ]);
refreshSession(); refreshSession();
$this->team = $team; $this->team = $team;
$this->emit('success', 'Settings saved.'); $this->dispatch('success', 'Settings saved.');
return; return;
} }
if ($settings->resend_enabled) { if ($settings->resend_enabled) {
@ -184,9 +184,9 @@ public function copyFromInstanceSettings()
]); ]);
refreshSession(); refreshSession();
$this->team = $team; $this->team = $team;
$this->emit('success', 'Settings saved.'); $this->dispatch('success', 'Settings saved.');
return; return;
} }
$this->emit('error', 'Instance SMTP/Resend settings are not enabled.'); $this->dispatch('error', 'Instance SMTP/Resend settings are not enabled.');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Notifications; namespace App\Livewire\Notifications;
use App\Models\Team; use App\Models\Team;
use App\Notifications\Test; use App\Notifications\Test;
@ -53,12 +53,12 @@ public function saveModel()
{ {
$this->team->save(); $this->team->save();
refreshSession(); refreshSession();
$this->emit('success', 'Settings saved.'); $this->dispatch('success', 'Settings saved.');
} }
public function sendTestNotification() public function sendTestNotification()
{ {
$this->team->notify(new Test()); $this->team->notify(new Test());
$this->emit('success', 'Test notification sent.'); $this->dispatch('success', 'Test notification sent.');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\PrivateKey; namespace App\Livewire\PrivateKey;
use App\Models\PrivateKey; use App\Models\PrivateKey;
use Livewire\Component; use Livewire\Component;
@ -37,7 +37,7 @@ public function delete()
currentTeam()->privateKeys = PrivateKey::where('team_id', currentTeam()->id)->get(); currentTeam()->privateKeys = PrivateKey::where('team_id', currentTeam()->id)->get();
return redirect()->route('security.private-key.index'); return redirect()->route('security.private-key.index');
} }
$this->emit('error', 'This private key is in use and cannot be deleted. Please delete all servers, applications, and GitHub/GitLab apps that use this private key before deleting it.'); $this->dispatch('error', 'This private key is in use and cannot be deleted. Please delete all servers, applications, and GitHub/GitLab apps that use this private key before deleting it.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\PrivateKey; namespace App\Livewire\PrivateKey;
use App\Models\PrivateKey; use App\Models\PrivateKey;
use DanHarrin\LivewireRateLimiting\WithRateLimiting; use DanHarrin\LivewireRateLimiting\WithRateLimiting;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Profile; namespace App\Livewire\Profile;
use App\Models\User; use App\Models\User;
use Livewire\Component; use Livewire\Component;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project; namespace App\Livewire\Project;
use App\Models\Project; use App\Models\Project;
use Livewire\Component; use Livewire\Component;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project; namespace App\Livewire\Project;
use App\Models\Environment; use App\Models\Environment;
use App\Models\Project; use App\Models\Project;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Application; namespace App\Livewire\Project\Application;
use App\Models\Application; use App\Models\Application;
use Livewire\Component; use Livewire\Component;
@ -26,26 +26,26 @@ public function instantSave()
if ($this->application->isLogDrainEnabled()) { if ($this->application->isLogDrainEnabled()) {
if (!$this->application->destination->server->isLogDrainEnabled()) { if (!$this->application->destination->server->isLogDrainEnabled()) {
$this->application->settings->is_log_drain_enabled = false; $this->application->settings->is_log_drain_enabled = false;
$this->emit('error', 'Log drain is not enabled on this server.'); $this->dispatch('error', 'Log drain is not enabled on this server.');
return; return;
} }
} }
if ($this->application->settings->is_force_https_enabled) { if ($this->application->settings->is_force_https_enabled) {
$this->emit('resetDefaultLabels', false); $this->dispatch('resetDefaultLabels', false);
} }
$this->application->settings->save(); $this->application->settings->save();
$this->emit('success', 'Settings saved.'); $this->dispatch('success', 'Settings saved.');
} }
public function submit() { public function submit() {
if ($this->application->settings->gpu_count && $this->application->settings->gpu_device_ids) { if ($this->application->settings->gpu_count && $this->application->settings->gpu_device_ids) {
$this->emit('error', 'You cannot set both GPU count and GPU device IDs.'); $this->dispatch('error', 'You cannot set both GPU count and GPU device IDs.');
$this->application->settings->gpu_count = null; $this->application->settings->gpu_count = null;
$this->application->settings->gpu_device_ids = null; $this->application->settings->gpu_device_ids = null;
$this->application->settings->save(); $this->application->settings->save();
return; return;
} }
$this->application->settings->save(); $this->application->settings->save();
$this->emit('success', 'Settings saved.'); $this->dispatch('success', 'Settings saved.');
} }
public function render() public function render()
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Application; namespace App\Livewire\Project\Application;
use App\Models\Application; use App\Models\Application;
use App\Models\Server; use App\Models\Server;
@ -98,7 +98,7 @@ public function runCommand()
$exec = "docker exec {$this->container} {$this->command}"; $exec = "docker exec {$this->container} {$this->command}";
} }
$activity = remote_process([$exec], $this->server, ignore_errors: true); $activity = remote_process([$exec], $this->server, ignore_errors: true);
$this->emit('newMonitorActivity', $activity->id); $this->dispatch('newMonitorActivity', $activity->id);
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Application; namespace App\Livewire\Project\Application;
use App\Models\Application; use App\Models\Application;
use App\Models\Server; use App\Models\Server;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Application; namespace App\Livewire\Project\Application;
use App\Models\ApplicationDeploymentQueue; use App\Models\ApplicationDeploymentQueue;
use Livewire\Component; use Livewire\Component;
@ -18,7 +18,7 @@ public function refreshQueue()
public function polling() public function polling()
{ {
$this->emit('deploymentFinished'); $this->dispatch('deploymentFinished');
$this->application_deployment_queue->refresh(); $this->application_deployment_queue->refresh();
if (data_get($this->application_deployment_queue, 'status') == 'finished' || data_get($this->application_deployment_queue, 'status') == 'failed') { if (data_get($this->application_deployment_queue, 'status') == 'finished' || data_get($this->application_deployment_queue, 'status') == 'failed') {
$this->isKeepAliveOn = false; $this->isKeepAliveOn = false;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Application; namespace App\Livewire\Project\Application;
use App\Enums\ApplicationDeploymentStatus; use App\Enums\ApplicationDeploymentStatus;
use App\Models\Application; use App\Models\Application;
@ -35,7 +35,7 @@ public function show_debug()
$this->application->settings->is_debug_enabled = !$this->application->settings->is_debug_enabled; $this->application->settings->is_debug_enabled = !$this->application->settings->is_debug_enabled;
$this->application->settings->save(); $this->application->settings->save();
$this->is_debug_enabled = $this->application->settings->is_debug_enabled; $this->is_debug_enabled = $this->application->settings->is_debug_enabled;
$this->emit('refreshQueue'); $this->dispatch('refreshQueue');
} }
public function cancel() public function cancel()

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Application; namespace App\Livewire\Project\Application;
use App\Models\Application; use App\Models\Application;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Application; namespace App\Livewire\Project\Application;
use App\Models\Application; use App\Models\Application;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
@ -101,7 +101,7 @@ public function mount()
try { try {
$this->parsedServices = $this->application->parseCompose(); $this->parsedServices = $this->application->parseCompose();
} catch (\Throwable $e) { } catch (\Throwable $e) {
$this->emit('error', $e->getMessage()); $this->dispatch('error', $e->getMessage());
} }
$this->parsedServiceDomains = $this->application->docker_compose_domains ? json_decode($this->application->docker_compose_domains, true) : []; $this->parsedServiceDomains = $this->application->docker_compose_domains ? json_decode($this->application->docker_compose_domains, true) : [];
@ -121,7 +121,7 @@ public function mount()
public function instantSave() public function instantSave()
{ {
$this->application->settings->save(); $this->application->settings->save();
$this->emit('success', 'Settings saved.'); $this->dispatch('success', 'Settings saved.');
$this->application->refresh(); $this->application->refresh();
if ($this->ports_exposes !== $this->application->ports_exposes) { if ($this->ports_exposes !== $this->application->ports_exposes) {
$this->resetDefaultLabels(false); $this->resetDefaultLabels(false);
@ -134,7 +134,7 @@ public function loadComposeFile($isInit = false)
return; return;
} }
['parsedServices' => $this->parsedServices, 'initialDockerComposeLocation' => $this->initialDockerComposeLocation, 'initialDockerComposePrLocation' => $this->initialDockerComposePrLocation] = $this->application->loadComposeFile($isInit); ['parsedServices' => $this->parsedServices, 'initialDockerComposeLocation' => $this->initialDockerComposeLocation, 'initialDockerComposePrLocation' => $this->initialDockerComposePrLocation] = $this->application->loadComposeFile($isInit);
$this->emit('success', 'Docker compose file loaded.'); $this->dispatch('success', 'Docker compose file loaded.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
$this->application->docker_compose_location = $this->initialDockerComposeLocation; $this->application->docker_compose_location = $this->initialDockerComposeLocation;
$this->application->docker_compose_pr_location = $this->initialDockerComposePrLocation; $this->application->docker_compose_pr_location = $this->initialDockerComposePrLocation;
@ -151,7 +151,7 @@ public function generateDomain(string $serviceName)
$this->parsedServiceDomains[$serviceName]['domain'] = $domain; $this->parsedServiceDomains[$serviceName]['domain'] = $domain;
$this->application->docker_compose_domains = json_encode($this->parsedServiceDomains); $this->application->docker_compose_domains = json_encode($this->parsedServiceDomains);
$this->application->save(); $this->application->save();
$this->emit('success', 'Domain generated.'); $this->dispatch('success', 'Domain generated.');
} }
return $domain; return $domain;
} }
@ -196,7 +196,7 @@ public function resetDefaultLabels($showToaster = true)
public function updatedApplicationFqdn() public function updatedApplicationFqdn()
{ {
$this->resetDefaultLabels(false); $this->resetDefaultLabels(false);
$this->emit('success', 'Labels reseted to default!'); $this->dispatch('success', 'Labels reseted to default!');
} }
public function submit($showToaster = true) public function submit($showToaster = true)
{ {
@ -220,6 +220,7 @@ public function submit($showToaster = true)
}); });
$this->application->fqdn = $domains->implode(','); $this->application->fqdn = $domains->implode(',');
} }
if (data_get($this->application, 'dockerfile')) { if (data_get($this->application, 'dockerfile')) {
$port = get_port_from_dockerfile($this->application->dockerfile); $port = get_port_from_dockerfile($this->application->dockerfile);
if ($port && !$this->application->ports_exposes) { if ($port && !$this->application->ports_exposes) {
@ -241,7 +242,7 @@ public function submit($showToaster = true)
$this->parsedServices = $this->application->parseCompose(); $this->parsedServices = $this->application->parseCompose();
} }
$this->application->save(); $this->application->save();
$showToaster && $this->emit('success', 'Application settings updated!'); $showToaster && $this->dispatch('success', 'Application settings updated!');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} finally { } finally {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Application; namespace App\Livewire\Project\Application;
use App\Actions\Application\StopApplication; use App\Actions\Application\StopApplication;
use App\Jobs\ContainerStatusJob; use App\Jobs\ContainerStatusJob;
@ -42,7 +42,7 @@ public function force_deploy_without_cache()
public function deployNew() public function deployNew()
{ {
if ($this->application->build_pack === 'dockercompose' && is_null($this->application->docker_compose_raw)) { if ($this->application->build_pack === 'dockercompose' && is_null($this->application->docker_compose_raw)) {
$this->emit('error', 'Please load a Compose file first.'); $this->dispatch('error', 'Please load a Compose file first.');
return; return;
} }
$this->setDeploymentUuid(); $this->setDeploymentUuid();
@ -62,7 +62,7 @@ public function deployNew()
public function deploy(bool $force_rebuild = false) public function deploy(bool $force_rebuild = false)
{ {
if ($this->application->build_pack === 'dockercompose' && is_null($this->application->docker_compose_raw)) { if ($this->application->build_pack === 'dockercompose' && is_null($this->application->docker_compose_raw)) {
$this->emit('error', 'Please load a Compose file first.'); $this->dispatch('error', 'Please load a Compose file first.');
return; return;
} }
$this->setDeploymentUuid(); $this->setDeploymentUuid();
@ -71,12 +71,12 @@ public function deploy(bool $force_rebuild = false)
deployment_uuid: $this->deploymentUuid, deployment_uuid: $this->deploymentUuid,
force_rebuild: $force_rebuild, force_rebuild: $force_rebuild,
); );
return redirect()->route('project.application.deployment', [ $this->redirectRoute('project.application.deployment', [
'project_uuid' => $this->parameters['project_uuid'], 'project_uuid' => $this->parameters['project_uuid'],
'application_uuid' => $this->parameters['application_uuid'], 'application_uuid' => $this->parameters['application_uuid'],
'deployment_uuid' => $this->deploymentUuid, 'deployment_uuid' => $this->deploymentUuid,
'environment_name' => $this->parameters['environment_name'], 'environment_name' => $this->parameters['environment_name'],
]); ], navigate: true);
} }
protected function setDeploymentUuid() protected function setDeploymentUuid()

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Application\Preview; namespace App\Livewire\Project\Application\Preview;
use App\Models\Application; use App\Models\Application;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@ -46,7 +46,7 @@ public function submit()
$this->validate(); $this->validate();
$this->application->preview_url_template = str_replace(' ', '', $this->application->preview_url_template); $this->application->preview_url_template = str_replace(' ', '', $this->application->preview_url_template);
$this->application->save(); $this->application->save();
$this->emit('success', 'Preview url template updated successfully.'); $this->dispatch('success', 'Preview url template updated successfully.');
$this->generate_real_url(); $this->generate_real_url();
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Application; namespace App\Livewire\Project\Application;
use App\Models\Application; use App\Models\Application;
use App\Models\ApplicationPreview; use App\Models\ApplicationPreview;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Application; namespace App\Livewire\Project\Application;
use App\Models\Application; use App\Models\Application;
use Illuminate\Support\Str; use Illuminate\Support\Str;
@ -66,7 +66,7 @@ public function loadImages($showToast = false)
]; ];
})->toArray(); })->toArray();
} }
$showToast && $this->emit('success', 'Images loaded.'); $showToast && $this->dispatch('success', 'Images loaded.');
return []; return [];
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Application; namespace App\Livewire\Project\Application;
use App\Models\Application; use App\Models\Application;
use App\Models\PrivateKey; use App\Models\PrivateKey;
@ -49,6 +49,6 @@ public function submit()
$this->application->git_commit_sha = 'HEAD'; $this->application->git_commit_sha = 'HEAD';
} }
$this->application->save(); $this->application->save();
$this->emit('success', 'Application source updated!'); $this->dispatch('success', 'Application source updated!');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project; namespace App\Livewire\Project;
use App\Models\Environment; use App\Models\Environment;
use App\Models\Project; use App\Models\Project;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Database; namespace App\Livewire\Project\Database;
use Livewire\Component; use Livewire\Component;
use Spatie\Url\Url; use Spatie\Url\Url;
@ -63,9 +63,9 @@ public function instantSave()
$this->custom_validate(); $this->custom_validate();
$this->backup->save(); $this->backup->save();
$this->backup->refresh(); $this->backup->refresh();
$this->emit('success', 'Backup updated successfully'); $this->dispatch('success', 'Backup updated successfully');
} catch (\Throwable $e) { } catch (\Throwable $e) {
$this->emit('error', $e->getMessage()); $this->dispatch('error', $e->getMessage());
} }
} }
@ -90,9 +90,9 @@ public function submit()
} }
$this->backup->save(); $this->backup->save();
$this->backup->refresh(); $this->backup->refresh();
$this->emit('success', 'Backup updated successfully'); $this->dispatch('success', 'Backup updated successfully');
} catch (\Throwable $e) { } catch (\Throwable $e) {
$this->emit('error', $e->getMessage()); $this->dispatch('error', $e->getMessage());
} }
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Database; namespace App\Livewire\Project\Database;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Livewire\Component; use Livewire\Component;
@ -16,7 +16,7 @@ public function deleteBackup($exeuctionId)
{ {
$execution = $this->backup->executions()->where('id', $exeuctionId)->first(); $execution = $this->backup->executions()->where('id', $exeuctionId)->first();
if (is_null($execution)) { if (is_null($execution)) {
$this->emit('error', 'Backup execution not found.'); $this->dispatch('error', 'Backup execution not found.');
return; return;
} }
if ($execution->scheduledDatabaseBackup->database->getMorphClass() === 'App\Models\ServiceDatabase') { if ($execution->scheduledDatabaseBackup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
@ -25,15 +25,15 @@ public function deleteBackup($exeuctionId)
delete_backup_locally($execution->filename, $execution->scheduledDatabaseBackup->database->destination->server); delete_backup_locally($execution->filename, $execution->scheduledDatabaseBackup->database->destination->server);
} }
$execution->delete(); $execution->delete();
$this->emit('success', 'Backup deleted successfully.'); $this->dispatch('success', 'Backup deleted successfully.');
$this->emit('refreshBackupExecutions'); $this->dispatch('refreshBackupExecutions');
} }
public function download($exeuctionId) public function download($exeuctionId)
{ {
try { try {
$execution = $this->backup->executions()->where('id', $exeuctionId)->first(); $execution = $this->backup->executions()->where('id', $exeuctionId)->first();
if (is_null($execution)) { if (is_null($execution)) {
$this->emit('error', 'Backup execution not found.'); $this->dispatch('error', 'Backup execution not found.');
return; return;
} }
$filename = data_get($execution, 'filename'); $filename = data_get($execution, 'filename');

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Database; namespace App\Livewire\Project\Database;
use App\Jobs\DatabaseBackupJob; use App\Jobs\DatabaseBackupJob;
use Livewire\Component; use Livewire\Component;
@ -13,6 +13,6 @@ public function backup_now()
dispatch(new DatabaseBackupJob( dispatch(new DatabaseBackupJob(
backup: $this->backup backup: $this->backup
)); ));
$this->emit('success', 'Backup queued. It will be available in a few minutes.'); $this->dispatch('success', 'Backup queued. It will be available in a few minutes.');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Database; namespace App\Livewire\Project\Database;
use App\Models\ScheduledDatabaseBackup; use App\Models\ScheduledDatabaseBackup;
use Livewire\Component; use Livewire\Component;
@ -35,7 +35,7 @@ public function submit(): void
$this->validate(); $this->validate();
$isValid = validate_cron_expression($this->frequency); $isValid = validate_cron_expression($this->frequency);
if (!$isValid) { if (!$isValid) {
$this->emit('error', 'Invalid Cron / Human expression.'); $this->dispatch('error', 'Invalid Cron / Human expression.');
return; return;
} }
$payload = [ $payload = [
@ -57,9 +57,9 @@ public function submit(): void
$databaseBackup = ScheduledDatabaseBackup::create($payload); $databaseBackup = ScheduledDatabaseBackup::create($payload);
if ($this->database->getMorphClass() === 'App\Models\ServiceDatabase') { if ($this->database->getMorphClass() === 'App\Models\ServiceDatabase') {
$this->emit('refreshScheduledBackups', $databaseBackup->id); $this->dispatch('refreshScheduledBackups', $databaseBackup->id);
} else { } else {
$this->emit('refreshScheduledBackups'); $this->dispatch('refreshScheduledBackups');
} }
} catch (\Throwable $e) { } catch (\Throwable $e) {
handleError($e, $this); handleError($e, $this);

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Database; namespace App\Livewire\Project\Database;
use App\Actions\Database\StartMariadb; use App\Actions\Database\StartMariadb;
use App\Actions\Database\StartMongodb; use App\Actions\Database\StartMongodb;
@ -23,7 +23,7 @@ public function activityFinished()
$this->database->update([ $this->database->update([
'started_at' => now(), 'started_at' => now(),
]); ]);
$this->emit('refresh'); $this->dispatch('refresh');
$this->check_status(); $this->check_status();
} }
@ -50,19 +50,19 @@ public function start()
{ {
if ($this->database->type() === 'standalone-postgresql') { if ($this->database->type() === 'standalone-postgresql') {
$activity = StartPostgresql::run($this->database); $activity = StartPostgresql::run($this->database);
$this->emit('newMonitorActivity', $activity->id); $this->dispatch('newMonitorActivity', $activity->id);
} else if ($this->database->type() === 'standalone-redis') { } else if ($this->database->type() === 'standalone-redis') {
$activity = StartRedis::run($this->database); $activity = StartRedis::run($this->database);
$this->emit('newMonitorActivity', $activity->id); $this->dispatch('newMonitorActivity', $activity->id);
} else if ($this->database->type() === 'standalone-mongodb') { } else if ($this->database->type() === 'standalone-mongodb') {
$activity = StartMongodb::run($this->database); $activity = StartMongodb::run($this->database);
$this->emit('newMonitorActivity', $activity->id); $this->dispatch('newMonitorActivity', $activity->id);
} else if ($this->database->type() === 'standalone-mysql') { } else if ($this->database->type() === 'standalone-mysql') {
$activity = StartMysql::run($this->database); $activity = StartMysql::run($this->database);
$this->emit('newMonitorActivity', $activity->id); $this->dispatch('newMonitorActivity', $activity->id);
} else if ($this->database->type() === 'standalone-mariadb') { } else if ($this->database->type() === 'standalone-mariadb') {
$activity = StartMariadb::run($this->database); $activity = StartMariadb::run($this->database);
$this->emit('newMonitorActivity', $activity->id); $this->dispatch('newMonitorActivity', $activity->id);
} }
} }
} }

View File

@ -1,7 +1,8 @@
<?php <?php
namespace App\Http\Livewire\Project\Database; namespace App\Livewire\Project\Database;
use Exception;
use Livewire\Component; use Livewire\Component;
class InitScript extends Component class InitScript extends Component
@ -34,7 +35,7 @@ public function submit()
$this->script['index'] = $this->index; $this->script['index'] = $this->index;
$this->script['content'] = $this->content; $this->script['content'] = $this->content;
$this->script['filename'] = $this->filename; $this->script['filename'] = $this->filename;
$this->emitUp('save_init_script', $this->script); $this->dispatch('save_init_script', $this->script);
} catch (Exception $e) { } catch (Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -42,6 +43,6 @@ public function submit()
public function delete() public function delete()
{ {
$this->emitUp('delete_init_script', $this->script); $this->dispatch('delete_init_script', $this->script);
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Database\Mariadb; namespace App\Livewire\Project\Database\Mariadb;
use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StartDatabaseProxy;
use App\Actions\Database\StopDatabaseProxy; use App\Actions\Database\StopDatabaseProxy;
@ -55,12 +55,12 @@ public function instantSaveAdvanced() {
try { try {
if (!$this->database->destination->server->isLogDrainEnabled()) { if (!$this->database->destination->server->isLogDrainEnabled()) {
$this->database->is_log_drain_enabled = false; $this->database->is_log_drain_enabled = false;
$this->emit('error', 'Log drain is not enabled on the server. Please enable it first.'); $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');
return; return;
} }
$this->database->save(); $this->database->save();
$this->emit('success', 'Database updated successfully.'); $this->dispatch('success', 'Database updated successfully.');
$this->emit('success', 'You need to restart the service for the changes to take effect.'); $this->dispatch('success', 'You need to restart the service for the changes to take effect.');
} catch (Exception $e) { } catch (Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -73,7 +73,7 @@ public function submit()
} }
$this->validate(); $this->validate();
$this->database->save(); $this->database->save();
$this->emit('success', 'Database updated successfully.'); $this->dispatch('success', 'Database updated successfully.');
} catch (Exception $e) { } catch (Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -82,23 +82,23 @@ public function instantSave()
{ {
try { try {
if ($this->database->is_public && !$this->database->public_port) { if ($this->database->is_public && !$this->database->public_port) {
$this->emit('error', 'Public port is required.'); $this->dispatch('error', 'Public port is required.');
$this->database->is_public = false; $this->database->is_public = false;
return; return;
} }
if ($this->database->is_public) { if ($this->database->is_public) {
if (!str($this->database->status)->startsWith('running')) { if (!str($this->database->status)->startsWith('running')) {
$this->emit('error', 'Database must be started to be publicly accessible.'); $this->dispatch('error', 'Database must be started to be publicly accessible.');
$this->database->is_public = false; $this->database->is_public = false;
return; return;
} }
StartDatabaseProxy::run($this->database); StartDatabaseProxy::run($this->database);
$this->db_url_public = $this->database->getDbUrl(); $this->db_url_public = $this->database->getDbUrl();
$this->emit('success', 'Database is now publicly accessible.'); $this->dispatch('success', 'Database is now publicly accessible.');
} else { } else {
StopDatabaseProxy::run($this->database); StopDatabaseProxy::run($this->database);
$this->db_url_public = null; $this->db_url_public = null;
$this->emit('success', 'Database is no longer publicly accessible.'); $this->dispatch('success', 'Database is no longer publicly accessible.');
} }
$this->database->save(); $this->database->save();
} catch (\Throwable $e) { } catch (\Throwable $e) {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Database\Mongodb; namespace App\Livewire\Project\Database\Mongodb;
use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StartDatabaseProxy;
use App\Actions\Database\StopDatabaseProxy; use App\Actions\Database\StopDatabaseProxy;
@ -54,12 +54,12 @@ public function instantSaveAdvanced()
try { try {
if (!$this->database->destination->server->isLogDrainEnabled()) { if (!$this->database->destination->server->isLogDrainEnabled()) {
$this->database->is_log_drain_enabled = false; $this->database->is_log_drain_enabled = false;
$this->emit('error', 'Log drain is not enabled on the server. Please enable it first.'); $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');
return; return;
} }
$this->database->save(); $this->database->save();
$this->emit('success', 'Database updated successfully.'); $this->dispatch('success', 'Database updated successfully.');
$this->emit('success', 'You need to restart the service for the changes to take effect.'); $this->dispatch('success', 'You need to restart the service for the changes to take effect.');
} catch (Exception $e) { } catch (Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -75,7 +75,7 @@ public function submit()
} }
$this->validate(); $this->validate();
$this->database->save(); $this->database->save();
$this->emit('success', 'Database updated successfully.'); $this->dispatch('success', 'Database updated successfully.');
} catch (Exception $e) { } catch (Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -84,23 +84,23 @@ public function instantSave()
{ {
try { try {
if ($this->database->is_public && !$this->database->public_port) { if ($this->database->is_public && !$this->database->public_port) {
$this->emit('error', 'Public port is required.'); $this->dispatch('error', 'Public port is required.');
$this->database->is_public = false; $this->database->is_public = false;
return; return;
} }
if ($this->database->is_public) { if ($this->database->is_public) {
if (!str($this->database->status)->startsWith('running')) { if (!str($this->database->status)->startsWith('running')) {
$this->emit('error', 'Database must be started to be publicly accessible.'); $this->dispatch('error', 'Database must be started to be publicly accessible.');
$this->database->is_public = false; $this->database->is_public = false;
return; return;
} }
StartDatabaseProxy::run($this->database); StartDatabaseProxy::run($this->database);
$this->db_url_public = $this->database->getDbUrl(); $this->db_url_public = $this->database->getDbUrl();
$this->emit('success', 'Database is now publicly accessible.'); $this->dispatch('success', 'Database is now publicly accessible.');
} else { } else {
StopDatabaseProxy::run($this->database); StopDatabaseProxy::run($this->database);
$this->db_url_public = null; $this->db_url_public = null;
$this->emit('success', 'Database is no longer publicly accessible.'); $this->dispatch('success', 'Database is no longer publicly accessible.');
} }
$this->database->save(); $this->database->save();
} catch (\Throwable $e) { } catch (\Throwable $e) {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Database\Mysql; namespace App\Livewire\Project\Database\Mysql;
use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StartDatabaseProxy;
use App\Actions\Database\StopDatabaseProxy; use App\Actions\Database\StopDatabaseProxy;
@ -56,12 +56,12 @@ public function instantSaveAdvanced()
try { try {
if (!$this->database->destination->server->isLogDrainEnabled()) { if (!$this->database->destination->server->isLogDrainEnabled()) {
$this->database->is_log_drain_enabled = false; $this->database->is_log_drain_enabled = false;
$this->emit('error', 'Log drain is not enabled on the server. Please enable it first.'); $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');
return; return;
} }
$this->database->save(); $this->database->save();
$this->emit('success', 'Database updated successfully.'); $this->dispatch('success', 'Database updated successfully.');
$this->emit('success', 'You need to restart the service for the changes to take effect.'); $this->dispatch('success', 'You need to restart the service for the changes to take effect.');
} catch (Exception $e) { } catch (Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -74,7 +74,7 @@ public function submit()
} }
$this->validate(); $this->validate();
$this->database->save(); $this->database->save();
$this->emit('success', 'Database updated successfully.'); $this->dispatch('success', 'Database updated successfully.');
} catch (Exception $e) { } catch (Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -83,23 +83,23 @@ public function instantSave()
{ {
try { try {
if ($this->database->is_public && !$this->database->public_port) { if ($this->database->is_public && !$this->database->public_port) {
$this->emit('error', 'Public port is required.'); $this->dispatch('error', 'Public port is required.');
$this->database->is_public = false; $this->database->is_public = false;
return; return;
} }
if ($this->database->is_public) { if ($this->database->is_public) {
if (!str($this->database->status)->startsWith('running')) { if (!str($this->database->status)->startsWith('running')) {
$this->emit('error', 'Database must be started to be publicly accessible.'); $this->dispatch('error', 'Database must be started to be publicly accessible.');
$this->database->is_public = false; $this->database->is_public = false;
return; return;
} }
StartDatabaseProxy::run($this->database); StartDatabaseProxy::run($this->database);
$this->db_url_public = $this->database->getDbUrl(); $this->db_url_public = $this->database->getDbUrl();
$this->emit('success', 'Database is now publicly accessible.'); $this->dispatch('success', 'Database is now publicly accessible.');
} else { } else {
StopDatabaseProxy::run($this->database); StopDatabaseProxy::run($this->database);
$this->db_url_public = null; $this->db_url_public = null;
$this->emit('success', 'Database is no longer publicly accessible.'); $this->dispatch('success', 'Database is no longer publicly accessible.');
} }
$this->database->save(); $this->database->save();
} catch (\Throwable $e) { } catch (\Throwable $e) {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Database\Postgresql; namespace App\Livewire\Project\Database\Postgresql;
use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StartDatabaseProxy;
use App\Actions\Database\StopDatabaseProxy; use App\Actions\Database\StopDatabaseProxy;
@ -62,12 +62,12 @@ public function instantSaveAdvanced() {
try { try {
if (!$this->database->destination->server->isLogDrainEnabled()) { if (!$this->database->destination->server->isLogDrainEnabled()) {
$this->database->is_log_drain_enabled = false; $this->database->is_log_drain_enabled = false;
$this->emit('error', 'Log drain is not enabled on the server. Please enable it first.'); $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');
return; return;
} }
$this->database->save(); $this->database->save();
$this->emit('success', 'Database updated successfully.'); $this->dispatch('success', 'Database updated successfully.');
$this->emit('success', 'You need to restart the service for the changes to take effect.'); $this->dispatch('success', 'You need to restart the service for the changes to take effect.');
} catch (Exception $e) { } catch (Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -76,23 +76,23 @@ public function instantSave()
{ {
try { try {
if ($this->database->is_public && !$this->database->public_port) { if ($this->database->is_public && !$this->database->public_port) {
$this->emit('error', 'Public port is required.'); $this->dispatch('error', 'Public port is required.');
$this->database->is_public = false; $this->database->is_public = false;
return; return;
} }
if ($this->database->is_public) { if ($this->database->is_public) {
if (!str($this->database->status)->startsWith('running')) { if (!str($this->database->status)->startsWith('running')) {
$this->emit('error', 'Database must be started to be publicly accessible.'); $this->dispatch('error', 'Database must be started to be publicly accessible.');
$this->database->is_public = false; $this->database->is_public = false;
return; return;
} }
StartDatabaseProxy::run($this->database); StartDatabaseProxy::run($this->database);
$this->db_url_public = $this->database->getDbUrl(); $this->db_url_public = $this->database->getDbUrl();
$this->emit('success', 'Database is now publicly accessible.'); $this->dispatch('success', 'Database is now publicly accessible.');
} else { } else {
StopDatabaseProxy::run($this->database); StopDatabaseProxy::run($this->database);
$this->db_url_public = null; $this->db_url_public = null;
$this->emit('success', 'Database is no longer publicly accessible.'); $this->dispatch('success', 'Database is no longer publicly accessible.');
} }
$this->database->save(); $this->database->save();
} catch (\Throwable $e) { } catch (\Throwable $e) {
@ -105,7 +105,7 @@ public function save_init_script($script)
$this->database->init_scripts = filter($this->database->init_scripts, fn ($s) => $s['filename'] !== $script['filename']); $this->database->init_scripts = filter($this->database->init_scripts, fn ($s) => $s['filename'] !== $script['filename']);
$this->database->init_scripts = array_merge($this->database->init_scripts, [$script]); $this->database->init_scripts = array_merge($this->database->init_scripts, [$script]);
$this->database->save(); $this->database->save();
$this->emit('success', 'Init script saved successfully.'); $this->dispatch('success', 'Init script saved successfully.');
} }
public function delete_init_script($script) public function delete_init_script($script)
@ -116,7 +116,7 @@ public function delete_init_script($script)
$this->database->init_scripts = $collection->filter(fn ($s) => $s['filename'] !== $script['filename'])->toArray(); $this->database->init_scripts = $collection->filter(fn ($s) => $s['filename'] !== $script['filename'])->toArray();
$this->database->save(); $this->database->save();
$this->refresh(); $this->refresh();
$this->emit('success', 'Init script deleted successfully.'); $this->dispatch('success', 'Init script deleted successfully.');
return; return;
} }
} }
@ -134,7 +134,7 @@ public function save_new_init_script()
]); ]);
$found = collect($this->database->init_scripts)->firstWhere('filename', $this->new_filename); $found = collect($this->database->init_scripts)->firstWhere('filename', $this->new_filename);
if ($found) { if ($found) {
$this->emit('error', 'Filename already exists.'); $this->dispatch('error', 'Filename already exists.');
return; return;
} }
if (!isset($this->database->init_scripts)) { if (!isset($this->database->init_scripts)) {
@ -148,7 +148,7 @@ public function save_new_init_script()
] ]
]); ]);
$this->database->save(); $this->database->save();
$this->emit('success', 'Init script added successfully.'); $this->dispatch('success', 'Init script added successfully.');
$this->new_content = ''; $this->new_content = '';
$this->new_filename = ''; $this->new_filename = '';
} }
@ -161,7 +161,7 @@ public function submit()
} }
$this->validate(); $this->validate();
$this->database->save(); $this->database->save();
$this->emit('success', 'Database updated successfully.'); $this->dispatch('success', 'Database updated successfully.');
} catch (Exception $e) { } catch (Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Database\Redis; namespace App\Livewire\Project\Database\Redis;
use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StartDatabaseProxy;
use App\Actions\Database\StopDatabaseProxy; use App\Actions\Database\StopDatabaseProxy;
@ -48,12 +48,12 @@ public function instantSaveAdvanced() {
try { try {
if (!$this->database->destination->server->isLogDrainEnabled()) { if (!$this->database->destination->server->isLogDrainEnabled()) {
$this->database->is_log_drain_enabled = false; $this->database->is_log_drain_enabled = false;
$this->emit('error', 'Log drain is not enabled on the server. Please enable it first.'); $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');
return; return;
} }
$this->database->save(); $this->database->save();
$this->emit('success', 'Database updated successfully.'); $this->dispatch('success', 'Database updated successfully.');
$this->emit('success', 'You need to restart the service for the changes to take effect.'); $this->dispatch('success', 'You need to restart the service for the changes to take effect.');
} catch (Exception $e) { } catch (Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -66,7 +66,7 @@ public function submit()
$this->database->redis_conf = null; $this->database->redis_conf = null;
} }
$this->database->save(); $this->database->save();
$this->emit('success', 'Database updated successfully.'); $this->dispatch('success', 'Database updated successfully.');
} catch (Exception $e) { } catch (Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -75,23 +75,23 @@ public function instantSave()
{ {
try { try {
if ($this->database->is_public && !$this->database->public_port) { if ($this->database->is_public && !$this->database->public_port) {
$this->emit('error', 'Public port is required.'); $this->dispatch('error', 'Public port is required.');
$this->database->is_public = false; $this->database->is_public = false;
return; return;
} }
if ($this->database->is_public) { if ($this->database->is_public) {
if (!str($this->database->status)->startsWith('running')) { if (!str($this->database->status)->startsWith('running')) {
$this->emit('error', 'Database must be started to be publicly accessible.'); $this->dispatch('error', 'Database must be started to be publicly accessible.');
$this->database->is_public = false; $this->database->is_public = false;
return; return;
} }
StartDatabaseProxy::run($this->database); StartDatabaseProxy::run($this->database);
$this->db_url_public = $this->database->getDbUrl(); $this->db_url_public = $this->database->getDbUrl();
$this->emit('success', 'Database is now publicly accessible.'); $this->dispatch('success', 'Database is now publicly accessible.');
} else { } else {
StopDatabaseProxy::run($this->database); StopDatabaseProxy::run($this->database);
$this->db_url_public = null; $this->db_url_public = null;
$this->emit('success', 'Database is no longer publicly accessible.'); $this->dispatch('success', 'Database is no longer publicly accessible.');
} }
$this->database->save(); $this->database->save();
} catch (\Throwable $e) { } catch (\Throwable $e) {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Database; namespace App\Livewire\Project\Database;
use Livewire\Component; use Livewire\Component;
@ -38,7 +38,7 @@ public function setSelectedBackup($backupId) {
public function delete($scheduled_backup_id): void public function delete($scheduled_backup_id): void
{ {
$this->database->scheduledBackups->find($scheduled_backup_id)->delete(); $this->database->scheduledBackups->find($scheduled_backup_id)->delete();
$this->emit('success', 'Scheduled backup deleted successfully.'); $this->dispatch('success', 'Scheduled backup deleted successfully.');
$this->refreshScheduledBackups(); $this->refreshScheduledBackups();
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project; namespace App\Livewire\Project;
use App\Models\Environment; use App\Models\Environment;
use Livewire\Component; use Livewire\Component;
@ -25,6 +25,6 @@ public function delete()
$environment->delete(); $environment->delete();
return redirect()->route('project.show', ['project_uuid' => $this->parameters['project_uuid']]); return redirect()->route('project.show', ['project_uuid' => $this->parameters['project_uuid']]);
} }
return $this->emit('error', 'Environment has defined resources, please delete them first.'); return $this->dispatch('error', 'Environment has defined resources, please delete them first.');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project; namespace App\Livewire\Project;
use App\Models\Project; use App\Models\Project;
use Livewire\Component; use Livewire\Component;
@ -22,7 +22,7 @@ public function delete()
]); ]);
$project = Project::findOrFail($this->project_id); $project = Project::findOrFail($this->project_id);
if ($project->applications->count() > 0) { if ($project->applications->count() > 0) {
return $this->emit('error', 'Project has resources defined, please delete them first.'); return $this->dispatch('error', 'Project has resources defined, please delete them first.');
} }
$project->delete(); $project->delete();
return redirect()->route('projects'); return redirect()->route('projects');

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project; namespace App\Livewire\Project;
use App\Models\Project; use App\Models\Project;
use Livewire\Component; use Livewire\Component;
@ -18,7 +18,7 @@ public function submit()
$this->validate(); $this->validate();
try { try {
$this->project->save(); $this->project->save();
$this->emit('saved'); $this->dispatch('saved');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\New; namespace App\Livewire\Project\New;
use App\Models\EnvironmentVariable; use App\Models\EnvironmentVariable;
use App\Models\Project; use App\Models\Project;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\New; namespace App\Livewire\Project\New;
use App\Models\Application; use App\Models\Application;
use App\Models\Project; use App\Models\Project;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\New; namespace App\Livewire\Project\New;
use App\Models\Project; use App\Models\Project;
use Livewire\Component; use Livewire\Component;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\New; namespace App\Livewire\Project\New;
use App\Models\Application; use App\Models\Application;
use App\Models\GithubApp; use App\Models\GithubApp;
@ -72,7 +72,7 @@ protected function loadRepositoryByPage()
$response = Http::withToken($this->token)->get("{$this->github_app->api_url}/installation/repositories?per_page=100&page={$this->page}"); $response = Http::withToken($this->token)->get("{$this->github_app->api_url}/installation/repositories?per_page=100&page={$this->page}");
$json = $response->json(); $json = $response->json();
if ($response->status() !== 200) { if ($response->status() !== 200) {
return $this->emit('error', $json['message']); return $this->dispatch('error', $json['message']);
} }
if ($json['total_count'] === 0) { if ($json['total_count'] === 0) {
@ -104,7 +104,7 @@ protected function loadBranchByPage()
$response = Http::withToken($this->token)->get("{$this->github_app->api_url}/repos/{$this->selected_repository_owner}/{$this->selected_repository_repo}/branches?per_page=100&page={$this->page}"); $response = Http::withToken($this->token)->get("{$this->github_app->api_url}/repos/{$this->selected_repository_owner}/{$this->selected_repository_repo}/branches?per_page=100&page={$this->page}");
$json = $response->json(); $json = $response->json();
if ($response->status() !== 200) { if ($response->status() !== 200) {
return $this->emit('error', $json['message']); return $this->dispatch('error', $json['message']);
} }
$this->total_branches_count = count($json); $this->total_branches_count = count($json);
@ -170,6 +170,6 @@ public function instantSave()
$this->port = 3000; $this->port = 3000;
$this->publish_directory = null; $this->publish_directory = null;
} }
$this->emit('success', 'Application settings updated!'); $this->dispatch('success', 'Application settings updated!');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\New; namespace App\Livewire\Project\New;
use App\Models\Application; use App\Models\Application;
use App\Models\GithubApp; use App\Models\GithubApp;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\New; namespace App\Livewire\Project\New;
use App\Models\Application; use App\Models\Application;
use App\Models\GithubApp; use App\Models\GithubApp;
@ -63,7 +63,7 @@ public function instantSave()
$this->port = 3000; $this->port = 3000;
$this->publish_directory = null; $this->publish_directory = null;
} }
$this->emit('success', 'Application settings updated!'); $this->dispatch('success', 'Application settings updated!');
} }
public function load_any_git() public function load_any_git()
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\New; namespace App\Livewire\Project\New;
use App\Models\Project; use App\Models\Project;
use App\Models\Server; use App\Models\Server;
@ -63,7 +63,7 @@ public function updatedSelectedEnvironment()
// { // {
// try { // try {
// instantCommand("psql {$this->existingPostgresqlUrl} -c 'SELECT 1'"); // instantCommand("psql {$this->existingPostgresqlUrl} -c 'SELECT 1'");
// $this->emit('success', 'Successfully connected to the database.'); // $this->dispatch('success', 'Successfully connected to the database.');
// } catch (\Throwable $e) { // } catch (\Throwable $e) {
// return handleError($e, $this); // return handleError($e, $this);
// } // }
@ -89,7 +89,7 @@ public function loadServices()
$this->services = $this->allServices->filter(function ($service, $key) { $this->services = $this->allServices->filter(function ($service, $key) {
return str_contains(strtolower($key), strtolower($this->search)); return str_contains(strtolower($key), strtolower($this->search));
});; });;
$this->emit('success', 'Successfully loaded services.'); $this->dispatch('success', 'Successfully loaded services.');
} }
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\New; namespace App\Livewire\Project\New;
use App\Models\Application; use App\Models\Application;
use App\Models\GithubApp; use App\Models\GithubApp;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Service; namespace App\Livewire\Project\Service;
use App\Models\ServiceApplication; use App\Models\ServiceApplication;
use Livewire\Component; use Livewire\Component;
@ -30,17 +30,17 @@ public function instantSaveAdvanced()
{ {
if (!$this->application->service->destination->server->isLogDrainEnabled()) { if (!$this->application->service->destination->server->isLogDrainEnabled()) {
$this->application->is_log_drain_enabled = false; $this->application->is_log_drain_enabled = false;
$this->emit('error', 'Log drain is not enabled on the server. Please enable it first.'); $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');
return; return;
} }
$this->application->save(); $this->application->save();
$this->emit('success', 'You need to restart the service for the changes to take effect.'); $this->dispatch('success', 'You need to restart the service for the changes to take effect.');
} }
public function delete() public function delete()
{ {
try { try {
$this->application->delete(); $this->application->delete();
$this->emit('success', 'Application deleted successfully.'); $this->dispatch('success', 'Application deleted successfully.');
return redirect()->route('project.service.configuration', $this->parameters); return redirect()->route('project.service.configuration', $this->parameters);
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
@ -56,11 +56,11 @@ public function submit()
$this->validate(); $this->validate();
$this->application->save(); $this->application->save();
updateCompose($this->application); updateCompose($this->application);
$this->emit('success', 'Application saved successfully.'); $this->dispatch('success', 'Application saved successfully.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} finally { } finally {
$this->emit('generateDockerCompose'); $this->dispatch('generateDockerCompose');
} }
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Service; namespace App\Livewire\Project\Service;
use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StartDatabaseProxy;
use App\Actions\Database\StopDatabaseProxy; use App\Actions\Database\StopDatabaseProxy;
@ -38,32 +38,32 @@ public function instantSaveAdvanced()
{ {
if (!$this->database->service->destination->server->isLogDrainEnabled()) { if (!$this->database->service->destination->server->isLogDrainEnabled()) {
$this->database->is_log_drain_enabled = false; $this->database->is_log_drain_enabled = false;
$this->emit('error', 'Log drain is not enabled on the server. Please enable it first.'); $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');
return; return;
} }
$this->submit(); $this->submit();
$this->emit('success', 'You need to restart the service for the changes to take effect.'); $this->dispatch('success', 'You need to restart the service for the changes to take effect.');
} }
public function instantSave() public function instantSave()
{ {
if ($this->database->is_public && !$this->database->public_port) { if ($this->database->is_public && !$this->database->public_port) {
$this->emit('error', 'Public port is required.'); $this->dispatch('error', 'Public port is required.');
$this->database->is_public = false; $this->database->is_public = false;
return; return;
} }
if ($this->database->is_public) { if ($this->database->is_public) {
if (!str($this->database->status)->startsWith('running')) { if (!str($this->database->status)->startsWith('running')) {
$this->emit('error', 'Database must be started to be publicly accessible.'); $this->dispatch('error', 'Database must be started to be publicly accessible.');
$this->database->is_public = false; $this->database->is_public = false;
return; return;
} }
StartDatabaseProxy::run($this->database); StartDatabaseProxy::run($this->database);
$this->db_url_public = $this->database->getServiceDatabaseUrl(); $this->db_url_public = $this->database->getServiceDatabaseUrl();
$this->emit('success', 'Database is now publicly accessible.'); $this->dispatch('success', 'Database is now publicly accessible.');
} else { } else {
StopDatabaseProxy::run($this->database); StopDatabaseProxy::run($this->database);
$this->db_url_public = null; $this->db_url_public = null;
$this->emit('success', 'Database is no longer publicly accessible.'); $this->dispatch('success', 'Database is no longer publicly accessible.');
} }
$this->submit(); $this->submit();
} }
@ -77,11 +77,11 @@ public function submit()
$this->validate(); $this->validate();
$this->database->save(); $this->database->save();
updateCompose($this->database); updateCompose($this->database);
$this->emit('success', 'Database saved successfully.'); $this->dispatch('success', 'Database saved successfully.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
ray($e); ray($e);
} finally { } finally {
$this->emit('generateDockerCompose'); $this->dispatch('generateDockerCompose');
} }
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Service; namespace App\Livewire\Project\Service;
use App\Models\LocalFileVolume; use App\Models\LocalFileVolume;
use App\Models\ServiceApplication; use App\Models\ServiceApplication;
@ -42,7 +42,7 @@ public function submit()
} }
$this->fileStorage->save(); $this->fileStorage->save();
$this->fileStorage->saveStorageOnServer($this->service); $this->fileStorage->saveStorageOnServer($this->service);
$this->emit('success', 'File updated successfully.'); $this->dispatch('success', 'File updated successfully.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
$this->fileStorage->setRawAttributes($original); $this->fileStorage->setRawAttributes($original);
$this->fileStorage->save(); $this->fileStorage->save();

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Service; namespace App\Livewire\Project\Service;
use App\Jobs\ContainerStatusJob; use App\Jobs\ContainerStatusJob;
use App\Models\Service; use App\Models\Service;

View File

@ -1,13 +1,13 @@
<?php <?php
namespace App\Http\Livewire\Project\Service; namespace App\Livewire\Project\Service;
use Livewire\Component; use Livewire\Component;
class Modal extends Component class Modal extends Component
{ {
public function checkStatus() { public function checkStatus() {
$this->emit('checkStatus'); $this->dispatch('checkStatus');
} }
public function render() public function render()
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Service; namespace App\Livewire\Project\Service;
use App\Actions\Service\StartService; use App\Actions\Service\StartService;
use App\Actions\Service\StopService; use App\Actions\Service\StopService;
@ -25,17 +25,17 @@ public function deploy()
{ {
$this->service->parse(); $this->service->parse();
$activity = StartService::run($this->service); $activity = StartService::run($this->service);
$this->emit('newMonitorActivity', $activity->id); $this->dispatch('newMonitorActivity', $activity->id);
} }
public function stop(bool $forceCleanup = false) public function stop(bool $forceCleanup = false)
{ {
StopService::run($this->service); StopService::run($this->service);
$this->service->refresh(); $this->service->refresh();
if ($forceCleanup) { if ($forceCleanup) {
$this->emit('success', 'Force cleanup service successfully.'); $this->dispatch('success', 'Force cleanup service successfully.');
} else { } else {
$this->emit('success', 'Service stopped successfully.'); $this->dispatch('success', 'Service stopped successfully.');
} }
$this->emit('checkStatus'); $this->dispatch('checkStatus');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Service; namespace App\Livewire\Project\Service;
use App\Models\Service; use App\Models\Service;
use App\Models\ServiceApplication; use App\Models\ServiceApplication;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Service; namespace App\Livewire\Project\Service;
use Livewire\Component; use Livewire\Component;
@ -54,9 +54,9 @@ public function submit()
$this->service->parse(); $this->service->parse();
$this->service->refresh(); $this->service->refresh();
$this->service->saveComposeConfigs(); $this->service->saveComposeConfigs();
$this->emit('refreshStacks'); $this->dispatch('refreshStacks');
$this->emit('refreshEnvs'); $this->dispatch('refreshEnvs');
$this->emit('success', 'Service saved successfully.'); $this->dispatch('success', 'Service saved successfully.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Service; namespace App\Livewire\Project\Service;
use App\Models\LocalPersistentVolume; use App\Models\LocalPersistentVolume;
use Livewire\Component; use Livewire\Component;
@ -25,9 +25,9 @@ public function addNewVolume($data)
'resource_type' => $this->resource->getMorphClass(), 'resource_type' => $this->resource->getMorphClass(),
]); ]);
$this->resource->refresh(); $this->resource->refresh();
$this->emit('success', 'Storage added successfully'); $this->dispatch('success', 'Storage added successfully');
$this->emit('clearAddStorage'); $this->dispatch('clearAddStorage');
$this->emit('refreshStorages'); $this->dispatch('refreshStorages');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Shared; namespace App\Livewire\Project\Shared;
use App\Jobs\DeleteResourceJob; use App\Jobs\DeleteResourceJob;
use Livewire\Component; use Livewire\Component;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Shared; namespace App\Livewire\Project\Shared;
use Livewire\Component; use Livewire\Component;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Shared\EnvironmentVariable; namespace App\Livewire\Project\Shared\EnvironmentVariable;
use Livewire\Component; use Livewire\Component;
@ -33,7 +33,7 @@ public function submit()
{ {
$this->validate(); $this->validate();
ray($this->key, $this->value, $this->is_build_time); ray($this->key, $this->value, $this->is_build_time);
$this->emitUp('submit', [ $this->dispatch('saveKey', [
'key' => $this->key, 'key' => $this->key,
'value' => $this->value, 'value' => $this->value,
'is_build_time' => $this->is_build_time, 'is_build_time' => $this->is_build_time,

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Shared\EnvironmentVariable; namespace App\Livewire\Project\Shared\EnvironmentVariable;
use App\Models\EnvironmentVariable; use App\Models\EnvironmentVariable;
use Livewire\Component; use Livewire\Component;
@ -15,7 +15,7 @@ class All extends Component
public ?string $variables = null; public ?string $variables = null;
public ?string $variablesPreview = null; public ?string $variablesPreview = null;
public string $view = 'normal'; public string $view = 'normal';
protected $listeners = ['refreshEnvs', 'submit']; protected $listeners = ['refreshEnvs', 'saveKey' => 'submit'];
public function mount() public function mount()
{ {
@ -106,9 +106,9 @@ public function saveVariables($isPreview)
} }
} }
if ($isPreview) { if ($isPreview) {
$this->emit('success', 'Preview environment variables updated successfully.'); $this->dispatch('success', 'Preview environment variables updated successfully.');
} else { } else {
$this->emit('success', 'Environment variables updated successfully.'); $this->dispatch('success', 'Environment variables updated successfully.');
} }
$this->refreshEnvs(); $this->refreshEnvs();
} }
@ -123,7 +123,7 @@ public function submit($data)
try { try {
$found = $this->resource->environment_variables()->where('key', $data['key'])->first(); $found = $this->resource->environment_variables()->where('key', $data['key'])->first();
if ($found) { if ($found) {
$this->emit('error', 'Environment variable already exists.'); $this->dispatch('error', 'Environment variable already exists.');
return; return;
} }
$environment = new EnvironmentVariable(); $environment = new EnvironmentVariable();
@ -145,7 +145,7 @@ public function submit($data)
} }
$environment->save(); $environment->save();
$this->refreshEnvs(); $this->refreshEnvs();
$this->emit('success', 'Environment variable added successfully.'); $this->dispatch('success', 'Environment variable added successfully.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Shared\EnvironmentVariable; namespace App\Livewire\Project\Shared\EnvironmentVariable;
use App\Models\EnvironmentVariable as ModelsEnvironmentVariable; use App\Models\EnvironmentVariable as ModelsEnvironmentVariable;
use Livewire\Component; use Livewire\Component;
@ -49,7 +49,7 @@ public function lock()
$this->env->is_shown_once = true; $this->env->is_shown_once = true;
$this->env->save(); $this->env->save();
$this->checkEnvs(); $this->checkEnvs();
$this->emit('refreshEnvs'); $this->dispatch('refreshEnvs');
} }
public function instantSave() public function instantSave()
{ {
@ -59,13 +59,13 @@ public function submit()
{ {
$this->validate(); $this->validate();
$this->env->save(); $this->env->save();
$this->emit('success', 'Environment variable updated successfully.'); $this->dispatch('success', 'Environment variable updated successfully.');
$this->emit('refreshEnvs'); $this->dispatch('refreshEnvs');
} }
public function delete() public function delete()
{ {
$this->env->delete(); $this->env->delete();
$this->emit('refreshEnvs'); $this->dispatch('refreshEnvs');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Shared; namespace App\Livewire\Project\Shared;
use App\Models\Application; use App\Models\Application;
use App\Models\Server; use App\Models\Server;
@ -98,7 +98,7 @@ public function runCommand()
$exec = "docker exec {$this->container} {$this->command}"; $exec = "docker exec {$this->container} {$this->command}";
} }
$activity = remote_process([$exec], $this->server, ignore_errors: true); $activity = remote_process([$exec], $this->server, ignore_errors: true);
$this->emit('newMonitorActivity', $activity->id); $this->dispatch('newMonitorActivity', $activity->id);
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Shared; namespace App\Livewire\Project\Shared;
use App\Models\Application; use App\Models\Application;
use App\Models\Server; use App\Models\Server;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Shared; namespace App\Livewire\Project\Shared;
use Livewire\Component; use Livewire\Component;
@ -26,7 +26,7 @@ class HealthChecks extends Component
public function instantSave() public function instantSave()
{ {
$this->resource->save(); $this->resource->save();
$this->emit('success', 'Health check updated.'); $this->dispatch('success', 'Health check updated.');
} }
@ -35,7 +35,7 @@ public function submit()
try { try {
$this->validate(); $this->validate();
$this->resource->save(); $this->resource->save();
$this->emit('success', 'Health check updated.'); $this->dispatch('success', 'Health check updated.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Shared; namespace App\Livewire\Project\Shared;
use App\Models\Application; use App\Models\Application;
use App\Models\Server; use App\Models\Server;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Shared; namespace App\Livewire\Project\Shared;
use Livewire\Component; use Livewire\Component;
@ -52,7 +52,7 @@ public function submit()
} }
$this->validate(); $this->validate();
$this->resource->save(); $this->resource->save();
$this->emit('success', 'Resource limits updated successfully.'); $this->dispatch('success', 'Resource limits updated successfully.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Shared\Storages; namespace App\Livewire\Project\Shared\Storages;
use Livewire\Component; use Livewire\Component;
@ -33,7 +33,7 @@ public function submit()
{ {
$this->validate(); $this->validate();
$name = $this->uuid . '-' . $this->name; $name = $this->uuid . '-' . $this->name;
$this->emit('addNewVolume', [ $this->dispatch('addNewVolume', [
'name' => $name, 'name' => $name,
'mount_path' => $this->mount_path, 'mount_path' => $this->mount_path,
'host_path' => $this->host_path, 'host_path' => $this->host_path,

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Shared\Storages; namespace App\Livewire\Project\Shared\Storages;
use App\Models\LocalPersistentVolume; use App\Models\LocalPersistentVolume;
use Livewire\Component; use Livewire\Component;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Shared\Storages; namespace App\Livewire\Project\Shared\Storages;
use App\Models\LocalPersistentVolume; use App\Models\LocalPersistentVolume;
use Livewire\Component; use Livewire\Component;
@ -33,12 +33,12 @@ public function submit()
{ {
$this->validate(); $this->validate();
$this->storage->save(); $this->storage->save();
$this->emit('success', 'Storage updated successfully'); $this->dispatch('success', 'Storage updated successfully');
} }
public function delete() public function delete()
{ {
$this->storage->delete(); $this->storage->delete();
$this->emit('refreshStorages'); $this->dispatch('refreshStorages');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Project\Shared; namespace App\Livewire\Project\Shared;
use Livewire\Component; use Livewire\Component;
@ -19,7 +19,7 @@ public function saveSecret()
try { try {
$this->validate(); $this->validate();
$this->resource->save(); $this->resource->save();
$this->emit('success','Secret Saved.'); $this->dispatch('success','Secret Saved.');
} catch (\Exception $e) { } catch (\Exception $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire; namespace App\Livewire;
use App\Models\Server; use App\Models\Server;
use Livewire\Component; use Livewire\Component;
@ -31,7 +31,7 @@ public function runCommand()
$this->validate(); $this->validate();
try { try {
$activity = remote_process([$this->command], Server::where('uuid', $this->server)->first(), ignore_errors: true); $activity = remote_process([$this->command], Server::where('uuid', $this->server)->first(), ignore_errors: true);
$this->emit('newMonitorActivity', $activity->id); $this->dispatch('newMonitorActivity', $activity->id);
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Security; namespace App\Livewire\Security;
use Livewire\Component; use Livewire\Component;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Server; namespace App\Livewire\Server;
use App\Models\Server; use App\Models\Server;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Server; namespace App\Livewire\Server;
use App\Models\PrivateKey; use App\Models\PrivateKey;
use Livewire\Component; use Livewire\Component;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Server; namespace App\Livewire\Server;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Livewire\Component; use Livewire\Component;
@ -15,7 +15,7 @@ public function delete()
try { try {
$this->authorize('delete', $this->server); $this->authorize('delete', $this->server);
if ($this->server->hasDefinedResources()) { if ($this->server->hasDefinedResources()) {
$this->emit('error', 'Server has defined resources. Please delete them first.'); $this->dispatch('error', 'Server has defined resources. Please delete them first.');
return; return;
} }
$this->server->delete(); $this->server->delete();

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Server\Destination; namespace App\Livewire\Server\Destination;
use App\Models\Server; use App\Models\Server;
use Livewire\Component; use Livewire\Component;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Server; namespace App\Livewire\Server;
use App\Actions\Server\InstallDocker; use App\Actions\Server\InstallDocker;
use App\Models\Server; use App\Models\Server;
@ -56,28 +56,28 @@ public function instantSave()
refresh_server_connection($this->server->privateKey); refresh_server_connection($this->server->privateKey);
$this->validateServer(false); $this->validateServer(false);
$this->server->settings->save(); $this->server->settings->save();
$this->emit('success', 'Server updated successfully.'); $this->dispatch('success', 'Server updated successfully.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }
} }
public function installDocker() public function installDocker()
{ {
$this->emit('installDocker'); $this->dispatch('installDocker');
$this->dockerInstallationStarted = true; $this->dockerInstallationStarted = true;
$activity = InstallDocker::run($this->server); $activity = InstallDocker::run($this->server);
$this->emit('newMonitorActivity', $activity->id); $this->dispatch('newMonitorActivity', $activity->id);
} }
public function checkLocalhostConnection() public function checkLocalhostConnection()
{ {
$uptime = $this->server->validateConnection(); $uptime = $this->server->validateConnection();
if ($uptime) { if ($uptime) {
$this->emit('success', 'Server is reachable.'); $this->dispatch('success', 'Server is reachable.');
$this->server->settings->is_reachable = true; $this->server->settings->is_reachable = true;
$this->server->settings->is_usable = true; $this->server->settings->is_usable = true;
$this->server->settings->save(); $this->server->settings->save();
} else { } else {
$this->emit('error', 'Server is not reachable. Please check your connection and configuration.'); $this->dispatch('error', 'Server is not reachable. Please check your connection and configuration.');
return; return;
} }
} }
@ -86,24 +86,24 @@ public function validateServer($install = true)
try { try {
$uptime = $this->server->validateConnection(); $uptime = $this->server->validateConnection();
if (!$uptime) { if (!$uptime) {
$install && $this->emit('error', 'Server is not reachable. Please check your connection and configuration.'); $install && $this->dispatch('error', 'Server is not reachable. Please check your connection and configuration.');
return; return;
} }
$supported_os_type = $this->server->validateOS(); $supported_os_type = $this->server->validateOS();
if (!$supported_os_type) { if (!$supported_os_type) {
$install && $this->emit('error', 'Server OS type is not supported for automated installation. Please install Docker manually before continuing: <a target="_blank" class="underline" href="https://coolify.io/docs/servers#install-docker-engine-manually">documentation</a>.'); $install && $this->dispatch('error', 'Server OS type is not supported for automated installation. Please install Docker manually before continuing: <a target="_blank" class="underline" href="https://coolify.io/docs/servers#install-docker-engine-manually">documentation</a>.');
return; return;
} }
$dockerInstalled = $this->server->validateDockerEngine(); $dockerInstalled = $this->server->validateDockerEngine();
if ($dockerInstalled) { if ($dockerInstalled) {
$install && $this->emit('success', 'Docker Engine is installed.<br> Checking version.'); $install && $this->dispatch('success', 'Docker Engine is installed.<br> Checking version.');
} else { } else {
$install && $this->installDocker(); $install && $this->installDocker();
return; return;
} }
$dockerVersion = $this->server->validateDockerEngineVersion(); $dockerVersion = $this->server->validateDockerEngineVersion();
if ($dockerVersion) { if ($dockerVersion) {
$install && $this->emit('success', 'Docker Engine version is 22+.'); $install && $this->dispatch('success', 'Docker Engine version is 22+.');
} else { } else {
$install && $this->installDocker(); $install && $this->installDocker();
return; return;
@ -111,13 +111,13 @@ public function validateServer($install = true)
if ($this->server->isSwarm()) { if ($this->server->isSwarm()) {
$swarmInstalled = $this->server->validateDockerSwarm(); $swarmInstalled = $this->server->validateDockerSwarm();
if ($swarmInstalled) { if ($swarmInstalled) {
$install && $this->emit('success', 'Docker Swarm is initiated.'); $install && $this->dispatch('success', 'Docker Swarm is initiated.');
} }
} }
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} finally { } finally {
$this->emit('proxyStatusUpdated'); $this->dispatch('proxyStatusUpdated');
} }
} }
@ -135,7 +135,7 @@ public function submit()
return $server->id === $this->server->id; return $server->id === $this->server->id;
})->pluck('ip')->toArray(); })->pluck('ip')->toArray();
if (in_array($this->server->ip, $uniqueIPs)) { if (in_array($this->server->ip, $uniqueIPs)) {
$this->emit('error', 'IP address is already in use by another team.'); $this->dispatch('error', 'IP address is already in use by another team.');
return; return;
} }
refresh_server_connection($this->server->privateKey); refresh_server_connection($this->server->privateKey);
@ -143,6 +143,6 @@ public function submit()
$this->server->settings->cleanup_after_percentage = $this->cleanup_after_percentage; $this->server->settings->cleanup_after_percentage = $this->cleanup_after_percentage;
$this->server->settings->save(); $this->server->settings->save();
$this->server->save(); $this->server->save();
$this->emit('success', 'Server updated successfully.'); $this->dispatch('success', 'Server updated successfully.');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Server; namespace App\Livewire\Server;
use App\Actions\Server\InstallLogDrain; use App\Actions\Server\InstallLogDrain;
use App\Models\Server; use App\Models\Server;
@ -55,12 +55,12 @@ public function configureLogDrain()
try { try {
InstallLogDrain::run($this->server); InstallLogDrain::run($this->server);
if (!$this->server->isLogDrainEnabled()) { if (!$this->server->isLogDrainEnabled()) {
$this->emit('serverRefresh'); $this->dispatch('serverRefresh');
$this->emit('success', 'Log drain service stopped.'); $this->dispatch('success', 'Log drain service stopped.');
return; return;
} }
$this->emit('serverRefresh'); $this->dispatch('serverRefresh');
$this->emit('success', 'Log drain service started successfully.'); $this->dispatch('success', 'Log drain service started successfully.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -126,7 +126,7 @@ public function submit(string $type)
]); ]);
} }
$this->server->settings->save(); $this->server->settings->save();
$this->emit('success', 'Settings saved successfully.'); $this->dispatch('success', 'Settings saved successfully.');
return true; return true;
} catch (\Throwable $e) { } catch (\Throwable $e) {
if ($type === 'newrelic') { if ($type === 'newrelic') {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Server\New; namespace App\Livewire\Server\New;
use App\Enums\ProxyStatus; use App\Enums\ProxyStatus;
use App\Enums\ProxyTypes; use App\Enums\ProxyTypes;
@ -53,7 +53,7 @@ public function setPrivateKey(string $private_key_id)
public function instantSave() public function instantSave()
{ {
$this->emit('success', 'Application settings updated!'); $this->dispatch('success', 'Application settings updated!');
} }
public function submit() public function submit()
@ -61,7 +61,7 @@ public function submit()
$this->validate(); $this->validate();
try { try {
if (is_null($this->private_key_id)) { if (is_null($this->private_key_id)) {
return $this->emit('error', 'You must select a private key'); return $this->dispatch('error', 'You must select a private key');
} }
$server = Server::create([ $server = Server::create([
'name' => $this->name, 'name' => $this->name,

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Server\PrivateKey; namespace App\Livewire\Server\PrivateKey;
use App\Models\PrivateKey; use App\Models\PrivateKey;
use App\Models\Server; use App\Models\Server;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Server; namespace App\Livewire\Server;
use App\Actions\Proxy\CheckConfiguration; use App\Actions\Proxy\CheckConfiguration;
use App\Actions\Proxy\SaveConfiguration; use App\Actions\Proxy\SaveConfiguration;
@ -33,7 +33,7 @@ public function change_proxy()
{ {
$this->server->proxy = null; $this->server->proxy = null;
$this->server->save(); $this->server->save();
$this->emit('proxyStatusUpdated'); $this->dispatch('proxyStatusUpdated');
} }
public function select_proxy($proxy_type) public function select_proxy($proxy_type)
@ -42,7 +42,7 @@ public function select_proxy($proxy_type)
$this->server->proxy->set('type', $proxy_type); $this->server->proxy->set('type', $proxy_type);
$this->server->save(); $this->server->save();
$this->selectedProxy = $this->server->proxy->type; $this->selectedProxy = $this->server->proxy->type;
$this->emit('proxyStatusUpdated'); $this->dispatch('proxyStatusUpdated');
} }
public function submit() public function submit()
@ -53,7 +53,7 @@ public function submit()
$this->server->save(); $this->server->save();
setup_default_redirect_404(redirect_url: $this->server->proxy->redirect_url, server: $this->server); setup_default_redirect_404(redirect_url: $this->server->proxy->redirect_url, server: $this->server);
$this->emit('success', 'Proxy configuration saved.'); $this->dispatch('success', 'Proxy configuration saved.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -73,9 +73,9 @@ public function loadProxyConfiguration()
try { try {
$this->proxy_settings = CheckConfiguration::run($this->server); $this->proxy_settings = CheckConfiguration::run($this->server);
if (Str::of($this->proxy_settings)->contains('--api.dashboard=true') && Str::of($this->proxy_settings)->contains('--api.insecure=true')) { if (Str::of($this->proxy_settings)->contains('--api.dashboard=true') && Str::of($this->proxy_settings)->contains('--api.insecure=true')) {
$this->emit('traefikDashboardAvailable', true); $this->dispatch('traefikDashboardAvailable', true);
} else { } else {
$this->emit('traefikDashboardAvailable', false); $this->dispatch('traefikDashboardAvailable', false);
} }
} catch (\Throwable $e) { } catch (\Throwable $e) {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Server\Proxy; namespace App\Livewire\Server\Proxy;
use App\Actions\Proxy\CheckProxy; use App\Actions\Proxy\CheckProxy;
use App\Actions\Proxy\StartProxy; use App\Actions\Proxy\StartProxy;
@ -40,8 +40,8 @@ public function checkProxy()
{ {
try { try {
CheckProxy::run($this->server, true); CheckProxy::run($this->server, true);
$this->emit('startProxyPolling'); $this->dispatch('startProxyPolling');
$this->emit('proxyChecked'); $this->dispatch('proxyChecked');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -50,7 +50,7 @@ public function startProxy()
{ {
try { try {
$activity = StartProxy::run($this->server); $activity = StartProxy::run($this->server);
$this->emit('newMonitorActivity', $activity->id); $this->dispatch('newMonitorActivity', $activity->id);
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -65,14 +65,14 @@ public function stop()
], $this->server); ], $this->server);
$this->server->proxy->status = 'exited'; $this->server->proxy->status = 'exited';
$this->server->save(); $this->server->save();
$this->emit('proxyStatusUpdated'); $this->dispatch('proxyStatusUpdated');
} else { } else {
instant_remote_process([ instant_remote_process([
"docker rm -f coolify-proxy", "docker rm -f coolify-proxy",
], $this->server); ], $this->server);
$this->server->proxy->status = 'exited'; $this->server->proxy->status = 'exited';
$this->server->save(); $this->server->save();
$this->emit('proxyStatusUpdated'); $this->dispatch('proxyStatusUpdated');
} }
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Server\Proxy; namespace App\Livewire\Server\Proxy;
use App\Models\Server; use App\Models\Server;
use Livewire\Component; use Livewire\Component;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Server\Proxy; namespace App\Livewire\Server\Proxy;
use App\Models\Server; use App\Models\Server;
use Livewire\Component; use Livewire\Component;
@ -11,6 +11,6 @@ class Modal extends Component
public function proxyStatusUpdated() public function proxyStatusUpdated()
{ {
$this->emit('proxyStatusUpdated'); $this->dispatch('proxyStatusUpdated');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Server\Proxy; namespace App\Livewire\Server\Proxy;
use App\Models\Server; use App\Models\Server;
use Livewire\Component; use Livewire\Component;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Server\Proxy; namespace App\Livewire\Server\Proxy;
use App\Actions\Proxy\CheckProxy; use App\Actions\Proxy\CheckProxy;
use App\Jobs\ContainerStatusJob; use App\Jobs\ContainerStatusJob;
@ -32,18 +32,18 @@ public function checkProxy(bool $notification = false)
if ($this->numberOfPolls >= 10) { if ($this->numberOfPolls >= 10) {
$this->polling = false; $this->polling = false;
$this->numberOfPolls = 0; $this->numberOfPolls = 0;
$notification && $this->emit('error', 'Proxy is not running.'); $notification && $this->dispatch('error', 'Proxy is not running.');
return; return;
} }
$this->numberOfPolls++; $this->numberOfPolls++;
} }
CheckProxy::run($this->server, true); CheckProxy::run($this->server, true);
$this->emit('proxyStatusUpdated'); $this->dispatch('proxyStatusUpdated');
if ($this->server->proxy->status === 'running') { if ($this->server->proxy->status === 'running') {
$this->polling = false; $this->polling = false;
$notification && $this->emit('success', 'Proxy is running.'); $notification && $this->dispatch('success', 'Proxy is running.');
} else { } else {
$notification && $this->emit('error', 'Proxy is not running.'); $notification && $this->dispatch('error', 'Proxy is not running.');
} }
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
@ -53,7 +53,7 @@ public function getProxyStatus()
{ {
try { try {
dispatch_sync(new ContainerStatusJob($this->server)); dispatch_sync(new ContainerStatusJob($this->server));
$this->emit('proxyStatusUpdated'); $this->dispatch('proxyStatusUpdated');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Server; namespace App\Livewire\Server;
use App\Models\Server; use App\Models\Server;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
@ -26,7 +26,7 @@ public function mount()
} }
public function submit() public function submit()
{ {
$this->emit('serverRefresh',false); $this->dispatch('serverRefresh',false);
} }
public function render() public function render()
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Server; namespace App\Livewire\Server;
use App\Models\Server; use App\Models\Server;
use Livewire\Component; use Livewire\Component;
@ -37,9 +37,9 @@ public function checkConnection()
try { try {
$uptime = $this->server->validateConnection(); $uptime = $this->server->validateConnection();
if ($uptime) { if ($uptime) {
$this->emit('success', 'Server is reachable.'); $this->dispatch('success', 'Server is reachable.');
} else { } else {
$this->emit('error', 'Server is not reachable. Please check your connection and private key configuration.'); $this->dispatch('error', 'Server is not reachable. Please check your connection and private key configuration.');
return; return;
} }
} catch (\Throwable $e) { } catch (\Throwable $e) {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Settings; namespace App\Livewire\Settings;
use App\Jobs\DatabaseBackupJob; use App\Jobs\DatabaseBackupJob;
use App\Models\InstanceSettings; use App\Models\InstanceSettings;
@ -77,10 +77,10 @@ public function backup_now()
dispatch(new DatabaseBackupJob( dispatch(new DatabaseBackupJob(
backup: $this->backup backup: $this->backup
)); ));
$this->emit('success', 'Backup queued. It will be available in a few minutes.'); $this->dispatch('success', 'Backup queued. It will be available in a few minutes.');
} }
public function submit() public function submit()
{ {
$this->emit('success', 'Backup updated successfully.'); $this->dispatch('success', 'Backup updated successfully.');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Settings; namespace App\Livewire\Settings;
use App\Jobs\ContainerStatusJob; use App\Jobs\ContainerStatusJob;
use App\Models\InstanceSettings as ModelsInstanceSettings; use App\Models\InstanceSettings as ModelsInstanceSettings;
@ -52,7 +52,7 @@ public function instantSave()
$this->settings->next_channel = $this->next_channel; $this->settings->next_channel = $this->next_channel;
} }
$this->settings->save(); $this->settings->save();
$this->emit('success', 'Settings updated!'); $this->dispatch('success', 'Settings updated!');
} }
public function submit() public function submit()
@ -66,7 +66,7 @@ public function submit()
$this->settings->save(); $this->settings->save();
$this->server = Server::findOrFail(0); $this->server = Server::findOrFail(0);
$this->setup_instance_fqdn(); $this->setup_instance_fqdn();
$this->emit('success', 'Instance settings updated successfully!'); $this->dispatch('success', 'Instance settings updated successfully!');
} }
private function setup_instance_fqdn() private function setup_instance_fqdn()

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Settings; namespace App\Livewire\Settings;
use App\Models\InstanceSettings; use App\Models\InstanceSettings;
use App\Notifications\TransactionalEmails\Test; use App\Notifications\TransactionalEmails\Test;
@ -49,7 +49,7 @@ public function submitFromFields() {
'settings.smtp_from_name' => 'required', 'settings.smtp_from_name' => 'required',
]); ]);
$this->settings->save(); $this->settings->save();
$this->emit('success', 'Settings saved successfully.'); $this->dispatch('success', 'Settings saved successfully.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -61,7 +61,7 @@ public function submitResend() {
'settings.resend_api_key' => 'required' 'settings.resend_api_key' => 'required'
]); ]);
$this->settings->save(); $this->settings->save();
$this->emit('success', 'Settings saved successfully.'); $this->dispatch('success', 'Settings saved successfully.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
$this->settings->resend_enabled = false; $this->settings->resend_enabled = false;
return handleError($e, $this); return handleError($e, $this);
@ -98,7 +98,7 @@ public function submit()
'settings.smtp_timeout' => 'nullable', 'settings.smtp_timeout' => 'nullable',
]); ]);
$this->settings->save(); $this->settings->save();
$this->emit('success', 'Settings saved successfully.'); $this->dispatch('success', 'Settings saved successfully.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }
@ -107,6 +107,6 @@ public function submit()
public function sendTestNotification() public function sendTestNotification()
{ {
$this->settings->notify(new Test($this->emails)); $this->settings->notify(new Test($this->emails));
$this->emit('success', 'Test email sent.'); $this->dispatch('success', 'Test email sent.');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Http\Livewire\Source\Github; namespace App\Livewire\Source\Github;
use App\Models\GithubApp; use App\Models\GithubApp;
use App\Models\InstanceSettings; use App\Models\InstanceSettings;
@ -90,7 +90,7 @@ public function submit()
$this->github_app->makeVisible('client_secret')->makeVisible('webhook_secret'); $this->github_app->makeVisible('client_secret')->makeVisible('webhook_secret');
$this->validate(); $this->validate();
$this->github_app->save(); $this->github_app->save();
$this->emit('success', 'Github App updated successfully.'); $this->dispatch('success', 'Github App updated successfully.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);
} }

Some files were not shown because too many files have changed in this diff Show More