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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Boarding;
namespace App\Livewire\Boarding;
use App\Actions\Server\InstallDocker;
use App\Models\PrivateKey;
@ -88,7 +88,7 @@ public function setServerType(string $type)
if ($this->selectedServerType === 'localhost') {
$this->createdServer = Server::find(0);
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();
return $this->validateServer('localhost');
@ -110,7 +110,7 @@ public function selectExistingServer()
{
$this->createdServer = Server::find($this->selectedExistingServer);
if (!$this->createdServer) {
$this->emit('error', 'Server is not found.');
$this->dispatch('error', 'Server is not found.');
$this->currentState = 'private-key';
return;
}
@ -173,7 +173,7 @@ public function saveServer()
$this->privateKey = formatPrivateKey($this->privateKey);
$foundServer = Server::whereIp($this->remoteServerHost)->first();
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([
'name' => $this->remoteServerName,
@ -227,8 +227,8 @@ public function installDocker()
try {
$this->dockerInstallationStarted = true;
$activity = InstallDocker::run($this->createdServer);
$this->emit('installDocker');
$this->emit('newMonitorActivity', $activity->id);
$this->dispatch('installDocker');
$this->dispatch('newMonitorActivity', $activity->id);
} catch (\Throwable $e) {
$this->dockerInstallationStarted = false;
return handleError(error: $e, livewire: $this);

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Destination;
namespace App\Livewire\Destination;
use Livewire\Component;
@ -30,7 +30,7 @@ public function delete()
try {
if ($this->destination->getMorphClass() === 'App\Models\StandaloneDocker') {
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 rm -f ' . $this->destination->network], $this->destination->server);

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Destination;
namespace App\Livewire\Destination;
use App\Models\Server;
use Illuminate\Support\Collection;
@ -21,7 +21,7 @@ public function scan()
return !$alreadyAddedNetworks->contains('network', $network['Name']);
});
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
namespace App\Http\Livewire\Dev;
namespace App\Livewire\Dev;
use Livewire\Component;

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire;
namespace App\Livewire;
use DanHarrin\LivewireRateLimiting\WithRateLimiting;
use Illuminate\Notifications\Messages\MailMessage;
@ -42,7 +42,7 @@ public function submit()
);
$mail->subject("[HELP - {$subscriptionType}]: {$this->subject}");
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) {
return handleError($e, $this);
}

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\PrivateKey;
namespace App\Livewire\PrivateKey;
use App\Models\PrivateKey;
use Livewire\Component;
@ -37,7 +37,7 @@ public function delete()
currentTeam()->privateKeys = PrivateKey::where('team_id', currentTeam()->id)->get();
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) {
return handleError($e, $this);
}

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Project\Application;
namespace App\Livewire\Project\Application;
use App\Models\Application;
use Livewire\Component;
@ -26,26 +26,26 @@ public function instantSave()
if ($this->application->isLogDrainEnabled()) {
if (!$this->application->destination->server->isLogDrainEnabled()) {
$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;
}
}
if ($this->application->settings->is_force_https_enabled) {
$this->emit('resetDefaultLabels', false);
$this->dispatch('resetDefaultLabels', false);
}
$this->application->settings->save();
$this->emit('success', 'Settings saved.');
$this->dispatch('success', 'Settings saved.');
}
public function submit() {
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_device_ids = null;
$this->application->settings->save();
return;
}
$this->application->settings->save();
$this->emit('success', 'Settings saved.');
$this->dispatch('success', 'Settings saved.');
}
public function render()
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Project\Application;
namespace App\Livewire\Project\Application;
use App\Actions\Application\StopApplication;
use App\Jobs\ContainerStatusJob;
@ -42,7 +42,7 @@ public function force_deploy_without_cache()
public function deployNew()
{
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;
}
$this->setDeploymentUuid();
@ -62,7 +62,7 @@ public function deployNew()
public function deploy(bool $force_rebuild = false)
{
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;
}
$this->setDeploymentUuid();
@ -71,12 +71,12 @@ public function deploy(bool $force_rebuild = false)
deployment_uuid: $this->deploymentUuid,
force_rebuild: $force_rebuild,
);
return redirect()->route('project.application.deployment', [
$this->redirectRoute('project.application.deployment', [
'project_uuid' => $this->parameters['project_uuid'],
'application_uuid' => $this->parameters['application_uuid'],
'deployment_uuid' => $this->deploymentUuid,
'environment_name' => $this->parameters['environment_name'],
]);
], navigate: true);
}
protected function setDeploymentUuid()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Project\Database\Mariadb;
namespace App\Livewire\Project\Database\Mariadb;
use App\Actions\Database\StartDatabaseProxy;
use App\Actions\Database\StopDatabaseProxy;
@ -55,12 +55,12 @@ public function instantSaveAdvanced() {
try {
if (!$this->database->destination->server->isLogDrainEnabled()) {
$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;
}
$this->database->save();
$this->emit('success', 'Database updated successfully.');
$this->emit('success', 'You need to restart the service for the changes to take effect.');
$this->dispatch('success', 'Database updated successfully.');
$this->dispatch('success', 'You need to restart the service for the changes to take effect.');
} catch (Exception $e) {
return handleError($e, $this);
}
@ -73,7 +73,7 @@ public function submit()
}
$this->validate();
$this->database->save();
$this->emit('success', 'Database updated successfully.');
$this->dispatch('success', 'Database updated successfully.');
} catch (Exception $e) {
return handleError($e, $this);
}
@ -82,23 +82,23 @@ public function instantSave()
{
try {
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;
return;
}
if ($this->database->is_public) {
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;
return;
}
StartDatabaseProxy::run($this->database);
$this->db_url_public = $this->database->getDbUrl();
$this->emit('success', 'Database is now publicly accessible.');
$this->dispatch('success', 'Database is now publicly accessible.');
} else {
StopDatabaseProxy::run($this->database);
$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();
} catch (\Throwable $e) {

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Project\Database\Mongodb;
namespace App\Livewire\Project\Database\Mongodb;
use App\Actions\Database\StartDatabaseProxy;
use App\Actions\Database\StopDatabaseProxy;
@ -54,12 +54,12 @@ public function instantSaveAdvanced()
try {
if (!$this->database->destination->server->isLogDrainEnabled()) {
$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;
}
$this->database->save();
$this->emit('success', 'Database updated successfully.');
$this->emit('success', 'You need to restart the service for the changes to take effect.');
$this->dispatch('success', 'Database updated successfully.');
$this->dispatch('success', 'You need to restart the service for the changes to take effect.');
} catch (Exception $e) {
return handleError($e, $this);
}
@ -75,7 +75,7 @@ public function submit()
}
$this->validate();
$this->database->save();
$this->emit('success', 'Database updated successfully.');
$this->dispatch('success', 'Database updated successfully.');
} catch (Exception $e) {
return handleError($e, $this);
}
@ -84,23 +84,23 @@ public function instantSave()
{
try {
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;
return;
}
if ($this->database->is_public) {
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;
return;
}
StartDatabaseProxy::run($this->database);
$this->db_url_public = $this->database->getDbUrl();
$this->emit('success', 'Database is now publicly accessible.');
$this->dispatch('success', 'Database is now publicly accessible.');
} else {
StopDatabaseProxy::run($this->database);
$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();
} catch (\Throwable $e) {

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Project\Database\Mysql;
namespace App\Livewire\Project\Database\Mysql;
use App\Actions\Database\StartDatabaseProxy;
use App\Actions\Database\StopDatabaseProxy;
@ -56,12 +56,12 @@ public function instantSaveAdvanced()
try {
if (!$this->database->destination->server->isLogDrainEnabled()) {
$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;
}
$this->database->save();
$this->emit('success', 'Database updated successfully.');
$this->emit('success', 'You need to restart the service for the changes to take effect.');
$this->dispatch('success', 'Database updated successfully.');
$this->dispatch('success', 'You need to restart the service for the changes to take effect.');
} catch (Exception $e) {
return handleError($e, $this);
}
@ -74,7 +74,7 @@ public function submit()
}
$this->validate();
$this->database->save();
$this->emit('success', 'Database updated successfully.');
$this->dispatch('success', 'Database updated successfully.');
} catch (Exception $e) {
return handleError($e, $this);
}
@ -83,23 +83,23 @@ public function instantSave()
{
try {
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;
return;
}
if ($this->database->is_public) {
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;
return;
}
StartDatabaseProxy::run($this->database);
$this->db_url_public = $this->database->getDbUrl();
$this->emit('success', 'Database is now publicly accessible.');
$this->dispatch('success', 'Database is now publicly accessible.');
} else {
StopDatabaseProxy::run($this->database);
$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();
} catch (\Throwable $e) {

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Project\Database\Postgresql;
namespace App\Livewire\Project\Database\Postgresql;
use App\Actions\Database\StartDatabaseProxy;
use App\Actions\Database\StopDatabaseProxy;
@ -62,12 +62,12 @@ public function instantSaveAdvanced() {
try {
if (!$this->database->destination->server->isLogDrainEnabled()) {
$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;
}
$this->database->save();
$this->emit('success', 'Database updated successfully.');
$this->emit('success', 'You need to restart the service for the changes to take effect.');
$this->dispatch('success', 'Database updated successfully.');
$this->dispatch('success', 'You need to restart the service for the changes to take effect.');
} catch (Exception $e) {
return handleError($e, $this);
}
@ -76,23 +76,23 @@ public function instantSave()
{
try {
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;
return;
}
if ($this->database->is_public) {
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;
return;
}
StartDatabaseProxy::run($this->database);
$this->db_url_public = $this->database->getDbUrl();
$this->emit('success', 'Database is now publicly accessible.');
$this->dispatch('success', 'Database is now publicly accessible.');
} else {
StopDatabaseProxy::run($this->database);
$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();
} 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 = array_merge($this->database->init_scripts, [$script]);
$this->database->save();
$this->emit('success', 'Init script saved successfully.');
$this->dispatch('success', 'Init script saved successfully.');
}
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->save();
$this->refresh();
$this->emit('success', 'Init script deleted successfully.');
$this->dispatch('success', 'Init script deleted successfully.');
return;
}
}
@ -134,7 +134,7 @@ public function save_new_init_script()
]);
$found = collect($this->database->init_scripts)->firstWhere('filename', $this->new_filename);
if ($found) {
$this->emit('error', 'Filename already exists.');
$this->dispatch('error', 'Filename already exists.');
return;
}
if (!isset($this->database->init_scripts)) {
@ -148,7 +148,7 @@ public function save_new_init_script()
]
]);
$this->database->save();
$this->emit('success', 'Init script added successfully.');
$this->dispatch('success', 'Init script added successfully.');
$this->new_content = '';
$this->new_filename = '';
}
@ -161,7 +161,7 @@ public function submit()
}
$this->validate();
$this->database->save();
$this->emit('success', 'Database updated successfully.');
$this->dispatch('success', 'Database updated successfully.');
} catch (Exception $e) {
return handleError($e, $this);
}

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Project\Database\Redis;
namespace App\Livewire\Project\Database\Redis;
use App\Actions\Database\StartDatabaseProxy;
use App\Actions\Database\StopDatabaseProxy;
@ -48,12 +48,12 @@ public function instantSaveAdvanced() {
try {
if (!$this->database->destination->server->isLogDrainEnabled()) {
$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;
}
$this->database->save();
$this->emit('success', 'Database updated successfully.');
$this->emit('success', 'You need to restart the service for the changes to take effect.');
$this->dispatch('success', 'Database updated successfully.');
$this->dispatch('success', 'You need to restart the service for the changes to take effect.');
} catch (Exception $e) {
return handleError($e, $this);
}
@ -66,7 +66,7 @@ public function submit()
$this->database->redis_conf = null;
}
$this->database->save();
$this->emit('success', 'Database updated successfully.');
$this->dispatch('success', 'Database updated successfully.');
} catch (Exception $e) {
return handleError($e, $this);
}
@ -75,23 +75,23 @@ public function instantSave()
{
try {
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;
return;
}
if ($this->database->is_public) {
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;
return;
}
StartDatabaseProxy::run($this->database);
$this->db_url_public = $this->database->getDbUrl();
$this->emit('success', 'Database is now publicly accessible.');
$this->dispatch('success', 'Database is now publicly accessible.');
} else {
StopDatabaseProxy::run($this->database);
$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();
} catch (\Throwable $e) {

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Project;
namespace App\Livewire\Project;
use App\Models\Environment;
use Livewire\Component;
@ -25,6 +25,6 @@ public function delete()
$environment->delete();
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
namespace App\Http\Livewire\Project;
namespace App\Livewire\Project;
use App\Models\Project;
use Livewire\Component;
@ -22,7 +22,7 @@ public function delete()
]);
$project = Project::findOrFail($this->project_id);
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();
return redirect()->route('projects');

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Project\New;
namespace App\Livewire\Project\New;
use App\Models\Application;
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}");
$json = $response->json();
if ($response->status() !== 200) {
return $this->emit('error', $json['message']);
return $this->dispatch('error', $json['message']);
}
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}");
$json = $response->json();
if ($response->status() !== 200) {
return $this->emit('error', $json['message']);
return $this->dispatch('error', $json['message']);
}
$this->total_branches_count = count($json);
@ -170,6 +170,6 @@ public function instantSave()
$this->port = 3000;
$this->publish_directory = null;
}
$this->emit('success', 'Application settings updated!');
$this->dispatch('success', 'Application settings updated!');
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Project\Service;
namespace App\Livewire\Project\Service;
use App\Models\ServiceApplication;
use Livewire\Component;
@ -30,17 +30,17 @@ public function instantSaveAdvanced()
{
if (!$this->application->service->destination->server->isLogDrainEnabled()) {
$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;
}
$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()
{
try {
$this->application->delete();
$this->emit('success', 'Application deleted successfully.');
$this->dispatch('success', 'Application deleted successfully.');
return redirect()->route('project.service.configuration', $this->parameters);
} catch (\Throwable $e) {
return handleError($e, $this);
@ -56,11 +56,11 @@ public function submit()
$this->validate();
$this->application->save();
updateCompose($this->application);
$this->emit('success', 'Application saved successfully.');
$this->dispatch('success', 'Application saved successfully.');
} catch (\Throwable $e) {
return handleError($e, $this);
} finally {
$this->emit('generateDockerCompose');
$this->dispatch('generateDockerCompose');
}
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Project\Service;
namespace App\Livewire\Project\Service;
use App\Actions\Database\StartDatabaseProxy;
use App\Actions\Database\StopDatabaseProxy;
@ -38,32 +38,32 @@ public function instantSaveAdvanced()
{
if (!$this->database->service->destination->server->isLogDrainEnabled()) {
$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;
}
$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()
{
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;
return;
}
if ($this->database->is_public) {
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;
return;
}
StartDatabaseProxy::run($this->database);
$this->db_url_public = $this->database->getServiceDatabaseUrl();
$this->emit('success', 'Database is now publicly accessible.');
$this->dispatch('success', 'Database is now publicly accessible.');
} else {
StopDatabaseProxy::run($this->database);
$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();
}
@ -77,11 +77,11 @@ public function submit()
$this->validate();
$this->database->save();
updateCompose($this->database);
$this->emit('success', 'Database saved successfully.');
$this->dispatch('success', 'Database saved successfully.');
} catch (\Throwable $e) {
ray($e);
} finally {
$this->emit('generateDockerCompose');
$this->dispatch('generateDockerCompose');
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire;
namespace App\Livewire;
use App\Models\Server;
use Livewire\Component;
@ -31,7 +31,7 @@ public function runCommand()
$this->validate();
try {
$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) {
return handleError($e, $this);
}

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Server;
namespace App\Livewire\Server;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Livewire\Component;
@ -15,7 +15,7 @@ public function delete()
try {
$this->authorize('delete', $this->server);
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;
}
$this->server->delete();

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Server;
namespace App\Livewire\Server;
use App\Actions\Server\InstallDocker;
use App\Models\Server;
@ -56,28 +56,28 @@ public function instantSave()
refresh_server_connection($this->server->privateKey);
$this->validateServer(false);
$this->server->settings->save();
$this->emit('success', 'Server updated successfully.');
$this->dispatch('success', 'Server updated successfully.');
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function installDocker()
{
$this->emit('installDocker');
$this->dispatch('installDocker');
$this->dockerInstallationStarted = true;
$activity = InstallDocker::run($this->server);
$this->emit('newMonitorActivity', $activity->id);
$this->dispatch('newMonitorActivity', $activity->id);
}
public function checkLocalhostConnection()
{
$uptime = $this->server->validateConnection();
if ($uptime) {
$this->emit('success', 'Server is reachable.');
$this->dispatch('success', 'Server is reachable.');
$this->server->settings->is_reachable = true;
$this->server->settings->is_usable = true;
$this->server->settings->save();
} 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;
}
}
@ -86,24 +86,24 @@ public function validateServer($install = true)
try {
$uptime = $this->server->validateConnection();
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;
}
$supported_os_type = $this->server->validateOS();
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;
}
$dockerInstalled = $this->server->validateDockerEngine();
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 {
$install && $this->installDocker();
return;
}
$dockerVersion = $this->server->validateDockerEngineVersion();
if ($dockerVersion) {
$install && $this->emit('success', 'Docker Engine version is 22+.');
$install && $this->dispatch('success', 'Docker Engine version is 22+.');
} else {
$install && $this->installDocker();
return;
@ -111,13 +111,13 @@ public function validateServer($install = true)
if ($this->server->isSwarm()) {
$swarmInstalled = $this->server->validateDockerSwarm();
if ($swarmInstalled) {
$install && $this->emit('success', 'Docker Swarm is initiated.');
$install && $this->dispatch('success', 'Docker Swarm is initiated.');
}
}
} catch (\Throwable $e) {
return handleError($e, $this);
} finally {
$this->emit('proxyStatusUpdated');
$this->dispatch('proxyStatusUpdated');
}
}
@ -135,7 +135,7 @@ public function submit()
return $server->id === $this->server->id;
})->pluck('ip')->toArray();
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;
}
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->save();
$this->server->save();
$this->emit('success', 'Server updated successfully.');
$this->dispatch('success', 'Server updated successfully.');
}
}

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Server\New;
namespace App\Livewire\Server\New;
use App\Enums\ProxyStatus;
use App\Enums\ProxyTypes;
@ -53,7 +53,7 @@ public function setPrivateKey(string $private_key_id)
public function instantSave()
{
$this->emit('success', 'Application settings updated!');
$this->dispatch('success', 'Application settings updated!');
}
public function submit()
@ -61,7 +61,7 @@ public function submit()
$this->validate();
try {
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([
'name' => $this->name,

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Server;
namespace App\Livewire\Server;
use App\Actions\Proxy\CheckConfiguration;
use App\Actions\Proxy\SaveConfiguration;
@ -33,7 +33,7 @@ public function change_proxy()
{
$this->server->proxy = null;
$this->server->save();
$this->emit('proxyStatusUpdated');
$this->dispatch('proxyStatusUpdated');
}
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->save();
$this->selectedProxy = $this->server->proxy->type;
$this->emit('proxyStatusUpdated');
$this->dispatch('proxyStatusUpdated');
}
public function submit()
@ -53,7 +53,7 @@ public function submit()
$this->server->save();
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) {
return handleError($e, $this);
}
@ -73,9 +73,9 @@ public function loadProxyConfiguration()
try {
$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')) {
$this->emit('traefikDashboardAvailable', true);
$this->dispatch('traefikDashboardAvailable', true);
} else {
$this->emit('traefikDashboardAvailable', false);
$this->dispatch('traefikDashboardAvailable', false);
}
} catch (\Throwable $e) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Server;
namespace App\Livewire\Server;
use App\Models\Server;
use Livewire\Component;
@ -37,9 +37,9 @@ public function checkConnection()
try {
$uptime = $this->server->validateConnection();
if ($uptime) {
$this->emit('success', 'Server is reachable.');
$this->dispatch('success', 'Server is reachable.');
} 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;
}
} catch (\Throwable $e) {

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Settings;
namespace App\Livewire\Settings;
use App\Jobs\DatabaseBackupJob;
use App\Models\InstanceSettings;
@ -77,10 +77,10 @@ public function backup_now()
dispatch(new DatabaseBackupJob(
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()
{
$this->emit('success', 'Backup updated successfully.');
$this->dispatch('success', 'Backup updated successfully.');
}
}

View File

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

View File

@ -1,6 +1,6 @@
<?php
namespace App\Http\Livewire\Settings;
namespace App\Livewire\Settings;
use App\Models\InstanceSettings;
use App\Notifications\TransactionalEmails\Test;
@ -49,7 +49,7 @@ public function submitFromFields() {
'settings.smtp_from_name' => 'required',
]);
$this->settings->save();
$this->emit('success', 'Settings saved successfully.');
$this->dispatch('success', 'Settings saved successfully.');
} catch (\Throwable $e) {
return handleError($e, $this);
}
@ -61,7 +61,7 @@ public function submitResend() {
'settings.resend_api_key' => 'required'
]);
$this->settings->save();
$this->emit('success', 'Settings saved successfully.');
$this->dispatch('success', 'Settings saved successfully.');
} catch (\Throwable $e) {
$this->settings->resend_enabled = false;
return handleError($e, $this);
@ -98,7 +98,7 @@ public function submit()
'settings.smtp_timeout' => 'nullable',
]);
$this->settings->save();
$this->emit('success', 'Settings saved successfully.');
$this->dispatch('success', 'Settings saved successfully.');
} catch (\Throwable $e) {
return handleError($e, $this);
}
@ -107,6 +107,6 @@ public function submit()
public function sendTestNotification()
{
$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
namespace App\Http\Livewire\Source\Github;
namespace App\Livewire\Source\Github;
use App\Models\GithubApp;
use App\Models\InstanceSettings;
@ -90,7 +90,7 @@ public function submit()
$this->github_app->makeVisible('client_secret')->makeVisible('webhook_secret');
$this->validate();
$this->github_app->save();
$this->emit('success', 'Github App updated successfully.');
$this->dispatch('success', 'Github App updated successfully.');
} catch (\Throwable $e) {
return handleError($e, $this);
}

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