Update success messages

This commit is contained in:
Andras Bacsai 2024-02-22 14:53:42 +01:00
parent 592221b4bf
commit c7218f2856
32 changed files with 67 additions and 57 deletions

View File

@ -63,7 +63,7 @@ public function submitFromFields()
]);
$this->team->save();
refreshSession();
$this->dispatch('success', 'Settings saved successfully.');
$this->dispatch('success', 'Settings saved.');
} 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->dispatch('success', 'Test Email sent successfully.');
$this->dispatch('success', 'Test Email sent.');
}
public function instantSaveInstance()
{
@ -83,7 +83,7 @@ public function instantSaveInstance()
$this->team->resend_enabled = false;
$this->team->save();
refreshSession();
$this->dispatch('success', 'Settings saved successfully.');
$this->dispatch('success', 'Settings saved.');
} catch (\Throwable $e) {
return handleError($e, $this);
}
@ -131,7 +131,7 @@ public function submit()
]);
$this->team->save();
refreshSession();
$this->dispatch('success', 'Settings saved successfully.');
$this->dispatch('success', 'Settings saved.');
} catch (\Throwable $e) {
$this->team->smtp_enabled = false;
return handleError($e, $this);
@ -148,7 +148,7 @@ public function submitResend()
]);
$this->team->save();
refreshSession();
$this->dispatch('success', 'Settings saved successfully.');
$this->dispatch('success', 'Settings saved.');
} catch (\Throwable $e) {
$this->team->resend_enabled = false;
return handleError($e, $this);

View File

@ -27,7 +27,7 @@ public function submit()
'name' => $this->name,
]);
$this->dispatch('success', 'Profile updated successfully.');
$this->dispatch('success', 'Profile updated');
} catch (\Throwable $e) {
return handleError($e, $this);
}

View File

@ -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->dispatch('success', 'Preview url template updated successfully.');
$this->dispatch('success', 'Preview url template updated.');
$this->generate_real_url();
}
}

View File

@ -33,7 +33,7 @@ public function deleteBackup($exeuctionId)
delete_backup_locally($execution->filename, $execution->scheduledDatabaseBackup->database->destination->server);
}
$execution->delete();
$this->dispatch('success', 'Backup deleted successfully.');
$this->dispatch('success', 'Backup deleted.');
$this->dispatch('refreshBackupExecutions');
}
public function download($exeuctionId)

View File

@ -38,7 +38,7 @@ public function check_status($showNotification = false)
{
dispatch_sync(new ContainerStatusJob($this->database->destination->server));
$this->database->refresh();
if ($showNotification) $this->dispatch('success', 'Success', 'Database status updated.');
if ($showNotification) $this->dispatch('success', 'Database status updated.');
}
public function mount()

View File

@ -59,7 +59,7 @@ public function instantSaveAdvanced() {
return;
}
$this->database->save();
$this->dispatch('success', 'Database updated successfully.');
$this->dispatch('success', 'Database updated.');
$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->dispatch('success', 'Database updated successfully.');
$this->dispatch('success', 'Database updated.');
} catch (Exception $e) {
return handleError($e, $this);
}

View File

@ -58,7 +58,7 @@ public function instantSaveAdvanced()
return;
}
$this->database->save();
$this->dispatch('success', 'Database updated successfully.');
$this->dispatch('success', 'Database updated.');
$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->dispatch('success', 'Database updated successfully.');
$this->dispatch('success', 'Database updated.');
} catch (Exception $e) {
return handleError($e, $this);
}

View File

@ -60,7 +60,7 @@ public function instantSaveAdvanced()
return;
}
$this->database->save();
$this->dispatch('success', 'Database updated successfully.');
$this->dispatch('success', 'Database updated.');
$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->dispatch('success', 'Database updated successfully.');
$this->dispatch('success', 'Database updated.');
} catch (Exception $e) {
return handleError($e, $this);
}

View File

@ -66,7 +66,7 @@ public function instantSaveAdvanced() {
return;
}
$this->database->save();
$this->dispatch('success', 'Database updated successfully.');
$this->dispatch('success', 'Database updated.');
$this->dispatch('success', 'You need to restart the service for the changes to take effect.');
} catch (Exception $e) {
return handleError($e, $this);
@ -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->dispatch('success', 'Init script saved successfully.');
$this->dispatch('success', 'Init script saved.');
}
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->dispatch('success', 'Init script deleted successfully.');
$this->dispatch('success', 'Init script deleted.');
return;
}
}
@ -148,7 +148,7 @@ public function save_new_init_script()
]
]);
$this->database->save();
$this->dispatch('success', 'Init script added successfully.');
$this->dispatch('success', 'Init script added.');
$this->new_content = '';
$this->new_filename = '';
}
@ -161,7 +161,7 @@ public function submit()
}
$this->validate();
$this->database->save();
$this->dispatch('success', 'Database updated successfully.');
$this->dispatch('success', 'Database updated.');
} catch (Exception $e) {
return handleError($e, $this);
}

View File

@ -52,7 +52,7 @@ public function instantSaveAdvanced() {
return;
}
$this->database->save();
$this->dispatch('success', 'Database updated successfully.');
$this->dispatch('success', 'Database updated.');
$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->dispatch('success', 'Database updated successfully.');
$this->dispatch('success', 'Database updated.');
} catch (Exception $e) {
return handleError($e, $this);
}

View File

@ -38,7 +38,7 @@ public function setSelectedBackup($backupId) {
public function delete($scheduled_backup_id): void
{
$this->database->scheduledBackups->find($scheduled_backup_id)->delete();
$this->dispatch('success', 'Scheduled backup deleted successfully.');
$this->dispatch('success', 'Scheduled backup deleted.');
$this->refreshScheduledBackups();
}

View File

@ -77,7 +77,7 @@ public function submit()
$this->validate();
$this->database->save();
updateCompose($this->database);
$this->dispatch('success', 'Database saved successfully.');
$this->dispatch('success', 'Database saved.');
} catch (\Throwable $e) {
ray($e);
} finally {

View File

@ -42,7 +42,7 @@ public function submit()
}
$this->fileStorage->save();
$this->fileStorage->saveStorageOnServer();
$this->dispatch('success', 'File updated successfully.');
$this->dispatch('success', 'File updated.');
} catch (\Throwable $e) {
$this->fileStorage->setRawAttributes($original);
$this->fileStorage->save();

View File

@ -64,9 +64,9 @@ public function stop(bool $forceCleanup = false)
StopService::run($this->service);
$this->service->refresh();
if ($forceCleanup) {
$this->dispatch('success', 'Force cleanup service successfully.');
$this->dispatch('success', 'Force cleanup service.');
} else {
$this->dispatch('success', 'Service stopped successfully.');
$this->dispatch('success', 'Service stopped.');
}
ServiceStatusChanged::dispatch();
}

View File

@ -41,7 +41,7 @@ public function delete()
{
try {
$this->application->delete();
$this->dispatch('success', 'Application deleted successfully.');
$this->dispatch('success', 'Application deleted.');
return redirect()->route('project.service.configuration', $this->parameters);
} catch (\Throwable $e) {
return handleError($e, $this);
@ -58,7 +58,7 @@ public function submit()
$this->validate();
$this->application->save();
updateCompose($this->application);
$this->dispatch('success', 'Application saved successfully.');
$this->dispatch('success', 'Application saved.');
} catch (\Throwable $e) {
return handleError($e, $this);
} finally {

View File

@ -48,7 +48,7 @@ public function saveCompose($raw)
public function instantSave()
{
$this->service->save();
$this->dispatch('success', 'Service settings saved successfully.');
$this->dispatch('success', 'Service settings saved.');
}
public function submit()
@ -62,7 +62,7 @@ public function submit()
$this->service->saveComposeConfigs();
$this->dispatch('refreshStacks');
$this->dispatch('refreshEnvs');
$this->dispatch('success', 'Service saved successfully.');
$this->dispatch('success', 'Service saved.');
} catch (\Throwable $e) {
return handleError($e, $this);
}

View File

@ -120,9 +120,9 @@ public function saveVariables($isPreview)
}
}
if ($isPreview) {
$this->dispatch('success', 'Preview environment variables updated successfully.');
$this->dispatch('success', 'Preview environment variables updated.');
} else {
$this->dispatch('success', 'Environment variables updated successfully.');
$this->dispatch('success', 'Environment variables updated.');
}
$this->refreshEnvs();
}

View File

@ -90,7 +90,7 @@ public function submit()
}
$this->serialize();
$this->env->save();
$this->dispatch('success', 'Environment variable updated successfully.');
$this->dispatch('success', 'Environment variable updated.');
$this->dispatch('refreshEnvs');
} catch (\Exception $e) {
return handleError($e);

View File

@ -52,7 +52,7 @@ public function submit()
}
$this->validate();
$this->resource->save();
$this->dispatch('success', 'Resource limits updated successfully.');
$this->dispatch('success', 'Resource limits updated.');
} catch (\Throwable $e) {
return handleError($e, $this);
}

View File

@ -48,7 +48,7 @@ public function submit($data)
}
$task->save();
$this->refreshTasks();
$this->dispatch('success', 'Scheduled task added successfully.');
$this->dispatch('success', 'Scheduled task added.');
} catch (\Throwable $e) {
return handleError($e, $this);
}

View File

@ -49,7 +49,7 @@ public function submit()
{
$this->validate();
$this->task->save();
$this->dispatch('success', 'Scheduled task updated successfully.');
$this->dispatch('success', 'Scheduled task updated.');
$this->dispatch('refreshTasks');
}

View File

@ -64,7 +64,7 @@ public function instantSave()
refresh_server_connection($this->server->privateKey);
$this->validateServer(false);
$this->server->settings->save();
$this->dispatch('success', 'Server updated successfully.');
$this->dispatch('success', 'Server updated.');
} catch (\Throwable $e) {
return handleError($e, $this);
}
@ -113,6 +113,6 @@ public function submit()
$this->server->settings->cleanup_after_percentage = $this->cleanup_after_percentage;
$this->server->settings->save();
$this->server->save();
$this->dispatch('success', 'Server updated successfully.');
$this->dispatch('success', 'Server updated.');
}
}

View File

@ -60,7 +60,7 @@ public function configureLogDrain()
return;
}
$this->dispatch('serverRefresh');
$this->dispatch('success', 'Log drain service started successfully.');
$this->dispatch('success', 'Log drain service started.');
} catch (\Throwable $e) {
return handleError($e, $this);
}
@ -126,7 +126,7 @@ public function submit(string $type)
]);
}
$this->server->settings->save();
$this->dispatch('success', 'Settings saved successfully.');
$this->dispatch('success', 'Settings saved.');
return true;
} catch (\Throwable $e) {
if ($type === 'newrelic') {

View File

@ -17,7 +17,7 @@ public function delete(string $fileName)
$proxy_path = get_proxy_path();
$file = str_replace('|', '.', $fileName);
instant_remote_process(["rm -f {$proxy_path}/dynamic/{$file}"], $server);
$this->dispatch('success', 'Success', 'File deleted.');
$this->dispatch('success', 'File deleted.');
$this->dispatch('loadDynamicConfigurations');
$this->dispatch('refresh');
}

View File

@ -43,7 +43,7 @@ public function addDynamicConfiguration()
$this->fileName = "{$this->fileName}.yaml";
}
if ($this->fileName === 'coolify.yaml') {
$this->dispatch('error', 'Error', 'File name is reserved.');
$this->dispatch('error', 'File name is reserved.');
return;
}
$proxy_path = get_proxy_path();
@ -51,7 +51,7 @@ public function addDynamicConfiguration()
if ($this->newFile) {
$exists = instant_remote_process(["test -f $file && echo 1 || echo 0"], $this->server);
if ($exists == 1) {
$this->dispatch('error', 'Error', 'File already exists');
$this->dispatch('error', 'File already exists');
return;
}
}
@ -62,7 +62,7 @@ public function addDynamicConfiguration()
instant_remote_process(["echo '{$base64_value}' | base64 -d > {$file}"], $this->server);
$this->dispatch('loadDynamicConfigurations');
$this->dispatch('dynamic-configuration-added');
$this->dispatch('success', 'Success', 'Dynamic configuration saved.');
$this->dispatch('success', 'Dynamic configuration saved.');
} catch (\Throwable $e) {
return handleError($e, $this);
}

View File

@ -124,7 +124,7 @@ public function validateDockerVersion()
$this->docker_version = $this->server->validateDockerEngineVersion();
if ($this->docker_version) {
$this->dispatch('serverInstalled');
$this->dispatch('success', 'Server validated successfully.');
$this->dispatch('success', 'Server validated.');
} else {
$this->error = 'Docker Engine version is not 22+. Please install Docker manually before continuing: <a target="_blank" class="underline" href="https://docs.docker.com/engine/install/#server">documentation</a>.';
return;

View File

@ -81,6 +81,6 @@ public function backup_now()
}
public function submit()
{
$this->dispatch('success', 'Backup updated successfully.');
$this->dispatch('success', 'Backup updated.');
}
}

View File

@ -49,7 +49,7 @@ public function submitFromFields() {
'settings.smtp_from_name' => 'required',
]);
$this->settings->save();
$this->dispatch('success', 'Settings saved successfully.');
$this->dispatch('success', 'Settings saved.');
} catch (\Throwable $e) {
return handleError($e, $this);
}
@ -61,7 +61,7 @@ public function submitResend() {
'settings.resend_api_key' => 'required'
]);
$this->settings->save();
$this->dispatch('success', 'Settings saved successfully.');
$this->dispatch('success', 'Settings saved.');
} 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->dispatch('success', 'Settings saved successfully.');
$this->dispatch('success', 'Settings saved.');
} catch (\Throwable $e) {
return handleError($e, $this);
}

View File

@ -47,7 +47,7 @@ public function checkPermissions()
{
GithubAppPermissionJob::dispatchSync($this->github_app);
$this->github_app->refresh()->makeVisible('client_secret')->makeVisible('webhook_secret');
$this->dispatch('success', 'Success', 'Github App permissions updated.');
$this->dispatch('success', 'Github App permissions updated.');
}
// public function check()
// {
@ -150,7 +150,7 @@ public function submit()
'github_app.is_system_wide' => 'required|bool',
]);
$this->github_app->save();
$this->dispatch('success', 'Success', 'Github App updated.');
$this->dispatch('success', 'Github App updated.');
} catch (\Throwable $e) {
return handleError($e, $this);
}
@ -161,7 +161,7 @@ public function instantSave()
try {
$this->github_app->makeVisible('client_secret')->makeVisible('webhook_secret');
$this->github_app->save();
$this->dispatch('success', 'Success', 'Github App updated.');
$this->dispatch('success', 'Github App updated.');
} catch (\Throwable $e) {
return handleError($e, $this);
}

View File

@ -37,7 +37,7 @@ public function submit()
try {
$this->team->save();
refreshSession();
$this->dispatch('success', 'Team updated successfully.');
$this->dispatch('success', 'Team updated.');
} catch (\Throwable $e) {
return handleError($e, $this);
}

View File

@ -79,7 +79,7 @@ private function generate_invite_link(bool $sendEmail = false)
]);
$mail->subject('You have been invited to ' . currentTeam()->name . ' on ' . config('app.name') . '.');
send_user_an_email($mail, $this->email);
$this->dispatch('success', 'Invitation sent via email successfully.');
$this->dispatch('success', 'Invitation sent via email.');
$this->dispatch('refreshInvitations');
return;
} else {

View File

@ -146,7 +146,12 @@ function copyToClipboard(text) {
}
})
window.Livewire.on('error', (message) => {
if (message.length > 0) {
if (message.length == 1) {
window.toast('Error', {
type: 'danger',
description: message[0],
})
} else if (message.length == 2) {
window.toast(message[0], {
type: 'danger',
description: message[1],
@ -162,7 +167,12 @@ function copyToClipboard(text) {
}
})
window.Livewire.on('success', (message) => {
if (message.length > 0) {
if (message.length == 1) {
window.toast('Success', {
type: 'success',
description: message[0],
})
} else if (message.length == 2) {
window.toast(message[0], {
type: 'success',
description: message[1],