fix: ui + migrations

This commit is contained in:
Andras Bacsai
2024-12-11 10:14:12 +01:00
parent 368c88829a
commit 1257ab6ff4
10 changed files with 532 additions and 413 deletions

View File

@@ -12,6 +12,8 @@ use Livewire\Component;
class Email extends Component class Email extends Component
{ {
protected $listeners = ['refresh' => '$refresh'];
public Team $team; public Team $team;
public EmailNotificationSettings $settings; public EmailNotificationSettings $settings;
@@ -141,9 +143,8 @@ class Email extends Component
$this->settings->server_disk_usage_email_notifications = $this->serverDiskUsageEmailNotifications; $this->settings->server_disk_usage_email_notifications = $this->serverDiskUsageEmailNotifications;
$this->settings->server_reachable_email_notifications = $this->serverReachableEmailNotifications; $this->settings->server_reachable_email_notifications = $this->serverReachableEmailNotifications;
$this->settings->server_unreachable_email_notifications = $this->serverUnreachableEmailNotifications; $this->settings->server_unreachable_email_notifications = $this->serverUnreachableEmailNotifications;
$this->settings->save(); $this->settings->save();
refreshSession();
} else { } else {
$this->smtpEnabled = $this->settings->smtp_enabled; $this->smtpEnabled = $this->settings->smtp_enabled;
$this->smtpFromAddress = $this->settings->smtp_from_address; $this->smtpFromAddress = $this->settings->smtp_from_address;
@@ -173,7 +174,6 @@ class Email extends Component
$this->serverDiskUsageEmailNotifications = $this->settings->server_disk_usage_email_notifications; $this->serverDiskUsageEmailNotifications = $this->settings->server_disk_usage_email_notifications;
$this->serverReachableEmailNotifications = $this->settings->server_reachable_email_notifications; $this->serverReachableEmailNotifications = $this->settings->server_reachable_email_notifications;
$this->serverUnreachableEmailNotifications = $this->settings->server_unreachable_email_notifications; $this->serverUnreachableEmailNotifications = $this->settings->server_unreachable_email_notifications;
} }
} }
@@ -190,7 +190,6 @@ class Email extends Component
public function saveModel() public function saveModel()
{ {
$this->syncData(true); $this->syncData(true);
refreshSession();
$this->dispatch('success', 'Email notifications settings updated.'); $this->dispatch('success', 'Email notifications settings updated.');
} }
@@ -218,6 +217,8 @@ class Email extends Component
} }
return handleError($e, $this); return handleError($e, $this);
} finally {
$this->dispatch('refresh');
} }
} }
@@ -261,7 +262,6 @@ class Email extends Component
$this->settings->smtp_timeout = $this->smtpTimeout; $this->settings->smtp_timeout = $this->smtpTimeout;
$this->settings->save(); $this->settings->save();
refreshSession();
$this->dispatch('success', 'SMTP settings updated.'); $this->dispatch('success', 'SMTP settings updated.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
$this->smtpEnabled = false; $this->smtpEnabled = false;
@@ -297,7 +297,6 @@ class Email extends Component
$this->settings->smtp_from_name = $this->smtpFromName; $this->settings->smtp_from_name = $this->smtpFromName;
$this->settings->save(); $this->settings->save();
refreshSession();
$this->dispatch('success', 'Resend settings updated.'); $this->dispatch('success', 'Resend settings updated.');
} catch (\Throwable $e) { } catch (\Throwable $e) {
return handleError($e, $this); return handleError($e, $this);

View File

@@ -13,35 +13,39 @@ return new class extends Migration
$teams = DB::table('teams')->get(); $teams = DB::table('teams')->get();
foreach ($teams as $team) { foreach ($teams as $team) {
DB::table('email_notification_settings')->updateOrInsert( try {
['team_id' => $team->id], DB::table('email_notification_settings')->updateOrInsert(
[ ['team_id' => $team->id],
'smtp_enabled' => $team->smtp_enabled ?? false, [
'smtp_from_address' => Crypt::encryptString($team->smtp_from_address), 'smtp_enabled' => $team->smtp_enabled ?? false,
'smtp_from_name' => Crypt::encryptString($team->smtp_from_name), 'smtp_from_address' => Crypt::encryptString($team->smtp_from_address),
'smtp_recipients' => Crypt::encryptString($team->smtp_recipients), 'smtp_from_name' => Crypt::encryptString($team->smtp_from_name),
'smtp_host' => Crypt::encryptString($team->smtp_host), 'smtp_recipients' => Crypt::encryptString($team->smtp_recipients),
'smtp_port' => $team->smtp_port, 'smtp_host' => Crypt::encryptString($team->smtp_host),
'smtp_encryption' => $team->smtp_encryption, 'smtp_port' => $team->smtp_port,
'smtp_username' => Crypt::encryptString($team->smtp_username), 'smtp_encryption' => $team->smtp_encryption,
'smtp_password' => $team->smtp_password, 'smtp_username' => Crypt::encryptString($team->smtp_username),
'smtp_timeout' => $team->smtp_timeout, 'smtp_password' => $team->smtp_password,
'smtp_timeout' => $team->smtp_timeout,
'use_instance_email_settings' => $team->use_instance_email_settings ?? false, 'use_instance_email_settings' => $team->use_instance_email_settings ?? false,
'resend_enabled' => $team->resend_enabled ?? false, 'resend_enabled' => $team->resend_enabled ?? false,
'resend_api_key' => $team->resend_api_key, 'resend_api_key' => $team->resend_api_key,
'deployment_success_email_notifications' => $team->smtp_notifications_deployments ?? false, 'deployment_success_email_notifications' => $team->smtp_notifications_deployments ?? false,
'deployment_failure_email_notifications' => $team->smtp_notifications_deployments ?? true, 'deployment_failure_email_notifications' => $team->smtp_notifications_deployments ?? true,
'backup_success_email_notifications' => $team->smtp_notifications_database_backups ?? false, 'backup_success_email_notifications' => $team->smtp_notifications_database_backups ?? false,
'backup_failure_email_notifications' => $team->smtp_notifications_database_backups ?? true, 'backup_failure_email_notifications' => $team->smtp_notifications_database_backups ?? true,
'scheduled_task_success_email_notifications' => $team->smtp_notifications_scheduled_tasks ?? false, 'scheduled_task_success_email_notifications' => $team->smtp_notifications_scheduled_tasks ?? false,
'scheduled_task_failure_email_notifications' => $team->smtp_notifications_scheduled_tasks ?? true, 'scheduled_task_failure_email_notifications' => $team->smtp_notifications_scheduled_tasks ?? true,
'status_change_email_notifications' => $team->smtp_notifications_status_changes ?? false, 'status_change_email_notifications' => $team->smtp_notifications_status_changes ?? false,
'server_disk_usage_email_notifications' => $team->smtp_notifications_server_disk_usage ?? true, 'server_disk_usage_email_notifications' => $team->smtp_notifications_server_disk_usage ?? true,
] ]
); );
} catch (Exception $e) {
\Log::error('Error migrating email notification settings from teams table: '.$e->getMessage());
}
} }
Schema::table('teams', function (Blueprint $table) { Schema::table('teams', function (Blueprint $table) {
@@ -97,30 +101,34 @@ return new class extends Migration
$settings = DB::table('email_notification_settings')->get(); $settings = DB::table('email_notification_settings')->get();
foreach ($settings as $setting) { foreach ($settings as $setting) {
DB::table('teams') try {
->where('id', $setting->team_id) DB::table('teams')
->update([ ->where('id', $setting->team_id)
'smtp_enabled' => $setting->smtp_enabled, ->update([
'smtp_from_address' => Crypt::decryptString($setting->smtp_from_address), 'smtp_enabled' => $setting->smtp_enabled,
'smtp_from_name' => Crypt::decryptString($setting->smtp_from_name), 'smtp_from_address' => $setting->smtp_from_address ? Crypt::decryptString($setting->smtp_from_address) : null,
'smtp_recipients' => Crypt::decryptString($setting->smtp_recipients), 'smtp_from_name' => $setting->smtp_from_name ? Crypt::decryptString($setting->smtp_from_name) : null,
'smtp_host' => Crypt::decryptString($setting->smtp_host), 'smtp_recipients' => $setting->smtp_recipients ? Crypt::decryptString($setting->smtp_recipients) : null,
'smtp_port' => $setting->smtp_port, 'smtp_host' => $setting->smtp_host ? Crypt::decryptString($setting->smtp_host) : null,
'smtp_encryption' => $setting->smtp_encryption, 'smtp_port' => $setting->smtp_port,
'smtp_username' => Crypt::decryptString($setting->smtp_username), 'smtp_encryption' => $setting->smtp_encryption,
'smtp_password' => $setting->smtp_password, 'smtp_username' => $setting->smtp_username ? Crypt::decryptString($setting->smtp_username) : null,
'smtp_timeout' => $setting->smtp_timeout, 'smtp_password' => $setting->smtp_password,
'smtp_timeout' => $setting->smtp_timeout,
'use_instance_email_settings' => $setting->use_instance_email_settings, 'use_instance_email_settings' => $setting->use_instance_email_settings,
'resend_enabled' => $setting->resend_enabled, 'resend_enabled' => $setting->resend_enabled,
'resend_api_key' => $setting->resend_api_key, 'resend_api_key' => $setting->resend_api_key,
'smtp_notifications_deployments' => $setting->deployment_success_email_notifications || $setting->deployment_failure_email_notifications, 'smtp_notifications_deployments' => $setting->deployment_success_email_notifications || $setting->deployment_failure_email_notifications,
'smtp_notifications_database_backups' => $setting->backup_success_email_notifications || $setting->backup_failure_email_notifications, 'smtp_notifications_database_backups' => $setting->backup_success_email_notifications || $setting->backup_failure_email_notifications,
'smtp_notifications_scheduled_tasks' => $setting->scheduled_task_success_email_notifications || $setting->scheduled_task_failure_email_notifications, 'smtp_notifications_scheduled_tasks' => $setting->scheduled_task_success_email_notifications || $setting->scheduled_task_failure_email_notifications,
'smtp_notifications_status_changes' => $setting->status_change_email_notifications, 'smtp_notifications_status_changes' => $setting->status_change_email_notifications,
]); ]);
} catch (Exception $e) {
\Log::error('Error migrating email notification settings from teams table: '.$e->getMessage());
}
} }
} }
}; };

View File

@@ -16,22 +16,26 @@ return new class extends Migration
$teams = DB::table('teams')->get(); $teams = DB::table('teams')->get();
foreach ($teams as $team) { foreach ($teams as $team) {
DB::table('discord_notification_settings')->updateOrInsert( try {
['team_id' => $team->id], DB::table('discord_notification_settings')->updateOrInsert(
[ ['team_id' => $team->id],
'discord_enabled' => $team->discord_enabled ?? false, [
'discord_webhook_url' => Crypt::encryptString($team->discord_webhook_url), 'discord_enabled' => $team->discord_enabled ?? false,
'discord_webhook_url' => $team->discord_webhook_url ? Crypt::encryptString($team->discord_webhook_url) : null,
'deployment_success_discord_notifications' => $team->discord_notifications_deployments ?? false, 'deployment_success_discord_notifications' => $team->discord_notifications_deployments ?? false,
'deployment_failure_discord_notifications' => $team->discord_notifications_deployments ?? true, 'deployment_failure_discord_notifications' => $team->discord_notifications_deployments ?? true,
'backup_success_discord_notifications' => $team->discord_notifications_database_backups ?? false, 'backup_success_discord_notifications' => $team->discord_notifications_database_backups ?? false,
'backup_failure_discord_notifications' => $team->discord_notifications_database_backups ?? true, 'backup_failure_discord_notifications' => $team->discord_notifications_database_backups ?? true,
'scheduled_task_success_discord_notifications' => $team->discord_notifications_scheduled_tasks ?? false, 'scheduled_task_success_discord_notifications' => $team->discord_notifications_scheduled_tasks ?? false,
'scheduled_task_failure_discord_notifications' => $team->discord_notifications_scheduled_tasks ?? true, 'scheduled_task_failure_discord_notifications' => $team->discord_notifications_scheduled_tasks ?? true,
'status_change_discord_notifications' => $team->discord_notifications_status_changes ?? false, 'status_change_discord_notifications' => $team->discord_notifications_status_changes ?? false,
'server_disk_usage_discord_notifications' => $team->discord_notifications_server_disk_usage ?? true, 'server_disk_usage_discord_notifications' => $team->discord_notifications_server_disk_usage ?? true,
] ]
); );
} catch (Exception $e) {
\Log::error('Error migrating discord notification settings from teams table: '.$e->getMessage());
}
} }
Schema::table('teams', function (Blueprint $table) { Schema::table('teams', function (Blueprint $table) {
@@ -67,18 +71,22 @@ return new class extends Migration
$settings = DB::table('discord_notification_settings')->get(); $settings = DB::table('discord_notification_settings')->get();
foreach ($settings as $setting) { foreach ($settings as $setting) {
DB::table('teams') try {
->where('id', $setting->team_id) DB::table('teams')
->update([ ->where('id', $setting->team_id)
'discord_enabled' => $setting->discord_enabled, ->update([
'discord_webhook_url' => Crypt::decryptString($setting->discord_webhook_url), 'discord_enabled' => $setting->discord_enabled,
'discord_webhook_url' => Crypt::decryptString($setting->discord_webhook_url),
'discord_notifications_deployments' => $setting->deployment_success_discord_notifications || $setting->deployment_failure_discord_notifications, 'discord_notifications_deployments' => $setting->deployment_success_discord_notifications || $setting->deployment_failure_discord_notifications,
'discord_notifications_status_changes' => $setting->status_change_discord_notifications, 'discord_notifications_status_changes' => $setting->status_change_discord_notifications,
'discord_notifications_database_backups' => $setting->backup_success_discord_notifications || $setting->backup_failure_discord_notifications, 'discord_notifications_database_backups' => $setting->backup_success_discord_notifications || $setting->backup_failure_discord_notifications,
'discord_notifications_scheduled_tasks' => $setting->scheduled_task_success_discord_notifications || $setting->scheduled_task_failure_discord_notifications, 'discord_notifications_scheduled_tasks' => $setting->scheduled_task_success_discord_notifications || $setting->scheduled_task_failure_discord_notifications,
'discord_notifications_server_disk_usage' => $setting->server_disk_usage_discord_notifications, 'discord_notifications_server_disk_usage' => $setting->server_disk_usage_discord_notifications,
]); ]);
} catch (Exception $e) {
\Log::error('Error migrating discord notification settings from teams table: '.$e->getMessage());
}
} }
} }
}; };

View File

@@ -13,31 +13,35 @@ return new class extends Migration
$teams = DB::table('teams')->get(); $teams = DB::table('teams')->get();
foreach ($teams as $team) { foreach ($teams as $team) {
DB::table('telegram_notification_settings')->updateOrInsert( try {
['team_id' => $team->id], DB::table('telegram_notification_settings')->updateOrInsert(
[ ['team_id' => $team->id],
'telegram_enabled' => $team->telegram_enabled ?? false, [
'telegram_token' => Crypt::encryptString($team->telegram_token), 'telegram_enabled' => $team->telegram_enabled ?? false,
'telegram_chat_id' => Crypt::encryptString($team->telegram_chat_id), 'telegram_token' => $team->telegram_token ? Crypt::encryptString($team->telegram_token) : null,
'telegram_chat_id' => $team->telegram_chat_id ? Crypt::encryptString($team->telegram_chat_id) : null,
'deployment_success_telegram_notifications' => $team->telegram_notifications_deployments ?? false, 'deployment_success_telegram_notifications' => $team->telegram_notifications_deployments ?? false,
'deployment_failure_telegram_notifications' => $team->telegram_notifications_deployments ?? true, 'deployment_failure_telegram_notifications' => $team->telegram_notifications_deployments ?? true,
'backup_success_telegram_notifications' => $team->telegram_notifications_database_backups ?? false, 'backup_success_telegram_notifications' => $team->telegram_notifications_database_backups ?? false,
'backup_failure_telegram_notifications' => $team->telegram_notifications_database_backups ?? true, 'backup_failure_telegram_notifications' => $team->telegram_notifications_database_backups ?? true,
'scheduled_task_success_telegram_notifications' => $team->telegram_notifications_scheduled_tasks ?? false, 'scheduled_task_success_telegram_notifications' => $team->telegram_notifications_scheduled_tasks ?? false,
'scheduled_task_failure_telegram_notifications' => $team->telegram_notifications_scheduled_tasks ?? true, 'scheduled_task_failure_telegram_notifications' => $team->telegram_notifications_scheduled_tasks ?? true,
'status_change_telegram_notifications' => $team->telegram_notifications_status_changes ?? false, 'status_change_telegram_notifications' => $team->telegram_notifications_status_changes ?? false,
'server_disk_usage_telegram_notifications' => $team->telegram_notifications_server_disk_usage ?? true, 'server_disk_usage_telegram_notifications' => $team->telegram_notifications_server_disk_usage ?? true,
'telegram_notifications_deployment_success_topic_id' => Crypt::encryptString($team->telegram_notifications_deployments_message_thread_id), 'telegram_notifications_deployment_success_topic_id' => $team->telegram_notifications_deployments_message_thread_id ? Crypt::encryptString($team->telegram_notifications_deployments_message_thread_id) : null,
'telegram_notifications_deployment_failure_topic_id' => Crypt::encryptString($team->telegram_notifications_deployments_message_thread_id), 'telegram_notifications_deployment_failure_topic_id' => $team->telegram_notifications_deployments_message_thread_id ? Crypt::encryptString($team->telegram_notifications_deployments_message_thread_id) : null,
'telegram_notifications_backup_success_topic_id' => Crypt::encryptString($team->telegram_notifications_database_backups_message_thread_id), 'telegram_notifications_backup_success_topic_id' => $team->telegram_notifications_database_backups_message_thread_id ? Crypt::encryptString($team->telegram_notifications_database_backups_message_thread_id) : null,
'telegram_notifications_backup_failure_topic_id' => Crypt::encryptString($team->telegram_notifications_database_backups_message_thread_id), 'telegram_notifications_backup_failure_topic_id' => $team->telegram_notifications_database_backups_message_thread_id ? Crypt::encryptString($team->telegram_notifications_database_backups_message_thread_id) : null,
'telegram_notifications_scheduled_task_success_topic_id' => Crypt::encryptString($team->telegram_notifications_scheduled_tasks_thread_id), 'telegram_notifications_scheduled_task_success_topic_id' => $team->telegram_notifications_scheduled_tasks_thread_id ? Crypt::encryptString($team->telegram_notifications_scheduled_tasks_thread_id) : null,
'telegram_notifications_scheduled_task_failure_topic_id' => Crypt::encryptString($team->telegram_notifications_scheduled_tasks_thread_id), 'telegram_notifications_scheduled_task_failure_topic_id' => $team->telegram_notifications_scheduled_tasks_thread_id ? Crypt::encryptString($team->telegram_notifications_scheduled_tasks_thread_id) : null,
'telegram_notifications_status_change_topic_id' => Crypt::encryptString($team->telegram_notifications_status_changes_message_thread_id), 'telegram_notifications_status_change_topic_id' => $team->telegram_notifications_status_changes_message_thread_id ? Crypt::encryptString($team->telegram_notifications_status_changes_message_thread_id) : null,
] ]
); );
} catch (Exception $e) {
\Log::error('Error migrating telegram notification settings from teams table: '.$e->getMessage());
}
} }
Schema::table('teams', function (Blueprint $table) { Schema::table('teams', function (Blueprint $table) {
@@ -83,24 +87,28 @@ return new class extends Migration
$settings = DB::table('telegram_notification_settings')->get(); $settings = DB::table('telegram_notification_settings')->get();
foreach ($settings as $setting) { foreach ($settings as $setting) {
DB::table('teams') try {
->where('id', $setting->team_id) DB::table('teams')
->update([ ->where('id', $setting->team_id)
'telegram_enabled' => $setting->telegram_enabled, ->update([
'telegram_token' => Crypt::decryptString($setting->telegram_token), 'telegram_enabled' => $setting->telegram_enabled,
'telegram_chat_id' => Crypt::decryptString($setting->telegram_chat_id), 'telegram_token' => Crypt::decryptString($setting->telegram_token),
'telegram_chat_id' => Crypt::decryptString($setting->telegram_chat_id),
'telegram_notifications_deployments' => $setting->deployment_success_telegram_notifications || $setting->deployment_failure_telegram_notifications, 'telegram_notifications_deployments' => $setting->deployment_success_telegram_notifications || $setting->deployment_failure_telegram_notifications,
'telegram_notifications_status_changes' => $setting->status_change_telegram_notifications, 'telegram_notifications_status_changes' => $setting->status_change_telegram_notifications,
'telegram_notifications_database_backups' => $setting->backup_success_telegram_notifications || $setting->backup_failure_telegram_notifications, 'telegram_notifications_database_backups' => $setting->backup_success_telegram_notifications || $setting->backup_failure_telegram_notifications,
'telegram_notifications_scheduled_tasks' => $setting->scheduled_task_success_telegram_notifications || $setting->scheduled_task_failure_telegram_notifications, 'telegram_notifications_scheduled_tasks' => $setting->scheduled_task_success_telegram_notifications || $setting->scheduled_task_failure_telegram_notifications,
'telegram_notifications_server_disk_usage' => $setting->server_disk_usage_telegram_notifications, 'telegram_notifications_server_disk_usage' => $setting->server_disk_usage_telegram_notifications,
'telegram_notifications_deployments_message_thread_id' => Crypt::decryptString($setting->telegram_notifications_deployment_success_topic_id), 'telegram_notifications_deployments_message_thread_id' => Crypt::decryptString($setting->telegram_notifications_deployment_success_topic_id),
'telegram_notifications_status_changes_message_thread_id' => Crypt::decryptString($setting->telegram_notifications_status_change_topic_id), 'telegram_notifications_status_changes_message_thread_id' => Crypt::decryptString($setting->telegram_notifications_status_change_topic_id),
'telegram_notifications_database_backups_message_thread_id' => Crypt::decryptString($setting->telegram_notifications_backup_success_topic_id), 'telegram_notifications_database_backups_message_thread_id' => Crypt::decryptString($setting->telegram_notifications_backup_success_topic_id),
'telegram_notifications_scheduled_tasks_thread_id' => Crypt::decryptString($setting->telegram_notifications_scheduled_task_success_topic_id), 'telegram_notifications_scheduled_tasks_thread_id' => Crypt::decryptString($setting->telegram_notifications_scheduled_task_success_topic_id),
]); ]);
} catch (Exception $e) {
\Log::error('Error migrating telegram notification settings from teams table: '.$e->getMessage());
}
} }
} }
}; };

View File

@@ -15,22 +15,26 @@ return new class extends Migration
{ {
if (DB::table('instance_settings')->exists()) { if (DB::table('instance_settings')->exists()) {
Schema::table('instance_settings', function (Blueprint $table) { Schema::table('instance_settings', function (Blueprint $table) {
$table->text('smtp_from_address')->change(); $table->text('smtp_from_address')->nullable()->change();
$table->text('smtp_from_name')->change(); $table->text('smtp_from_name')->nullable()->change();
$table->text('smtp_recipients')->change(); $table->text('smtp_recipients')->nullable()->change();
$table->text('smtp_host')->change(); $table->text('smtp_host')->nullable()->change();
$table->text('smtp_username')->change(); $table->text('smtp_username')->nullable()->change();
}); });
$settings = DB::table('instance_settings')->get(); $settings = DB::table('instance_settings')->get();
foreach ($settings as $setting) { foreach ($settings as $setting) {
DB::table('instance_settings')->where('id', $setting->id)->update([ try {
'smtp_from_address' => Crypt::encryptString($setting->smtp_from_address), DB::table('instance_settings')->where('id', $setting->id)->update([
'smtp_from_name' => Crypt::encryptString($setting->smtp_from_name), 'smtp_from_address' => $setting->smtp_from_address ? Crypt::encryptString($setting->smtp_from_address) : null,
'smtp_recipients' => Crypt::encryptString($setting->smtp_recipients), 'smtp_from_name' => $setting->smtp_from_name ? Crypt::encryptString($setting->smtp_from_name) : null,
'smtp_host' => Crypt::encryptString($setting->smtp_host), 'smtp_recipients' => $setting->smtp_recipients ? Crypt::encryptString($setting->smtp_recipients) : null,
'smtp_username' => Crypt::encryptString($setting->smtp_username), 'smtp_host' => $setting->smtp_host ? Crypt::encryptString($setting->smtp_host) : null,
]); 'smtp_username' => $setting->smtp_username ? Crypt::encryptString($setting->smtp_username) : null,
]);
} catch (Exception $e) {
\Log::error('Error encrypting instance settings email columns: '.$e->getMessage());
}
} }
} }
} }
@@ -51,13 +55,17 @@ return new class extends Migration
if (DB::table('instance_settings')->exists()) { if (DB::table('instance_settings')->exists()) {
$settings = DB::table('instance_settings')->get(); $settings = DB::table('instance_settings')->get();
foreach ($settings as $setting) { foreach ($settings as $setting) {
DB::table('instance_settings')->where('id', $setting->id)->update([ try {
'smtp_from_address' => Crypt::decryptString($setting->smtp_from_address), DB::table('instance_settings')->where('id', $setting->id)->update([
'smtp_from_name' => Crypt::decryptString($setting->smtp_from_name), 'smtp_from_address' => $setting->smtp_from_address ? Crypt::decryptString($setting->smtp_from_address) : null,
'smtp_recipients' => Crypt::decryptString($setting->smtp_recipients), 'smtp_from_name' => $setting->smtp_from_name ? Crypt::decryptString($setting->smtp_from_name) : null,
'smtp_host' => Crypt::decryptString($setting->smtp_host), 'smtp_recipients' => $setting->smtp_recipients ? Crypt::decryptString($setting->smtp_recipients) : null,
'smtp_username' => Crypt::decryptString($setting->smtp_username), 'smtp_host' => $setting->smtp_host ? Crypt::decryptString($setting->smtp_host) : null,
]); 'smtp_username' => $setting->smtp_username ? Crypt::decryptString($setting->smtp_username) : null,
]);
} catch (Exception $e) {
\Log::error('Error decrypting instance settings email columns: '.$e->getMessage());
}
} }
} }
} }

View File

@@ -14,6 +14,10 @@
wire:click="sendTestNotification"> wire:click="sendTestNotification">
Send Test Notification Send Test Notification
</x-forms.button> </x-forms.button>
@else
<x-forms.button disabled class="normal-case dark:text-white btn btn-xs no-animation btn-primary">
Send Test Notification
</x-forms.button>
@endif @endif
</div> </div>
<div class="w-32"> <div class="w-32">
@@ -23,44 +27,53 @@
helper="Generate a webhook in Discord.<br>Example: https://discord.com/api/webhooks/...." required helper="Generate a webhook in Discord.<br>Example: https://discord.com/api/webhooks/...." required
id="discordWebhookUrl" label="Webhook" /> id="discordWebhookUrl" label="Webhook" />
</form> </form>
@if ($discordEnabled) <h2 class="mt-4">Notification Settings</h2>
<h2 class="mt-8 mb-4">Notification Settings</h2> <p class="mb-4">
<p class="mb-4"> Select events for which you would like to receive Discord notifications.
Select events for which you would like to receive Discord notifications. </p>
</p> <div class="flex flex-col gap-4 max-w-2xl">
<div class="flex flex-col gap-4 max-w-2xl"> <div class="border dark:border-coolgray-300 p-4 rounded-lg">
<div class="border dark:border-coolgray-300 p-4 rounded-lg"> <h3 class="font-medium mb-3">Deployments</h3>
<h3 class="font-medium mb-3">Deployments</h3> <div class="flex flex-col gap-1.5 pl-1">
<div class="flex flex-col gap-1.5 pl-1"> <x-forms.checkbox instantSave="saveModel" id="deploymentSuccessDiscordNotifications"
<x-forms.checkbox instantSave="saveModel" id="deploymentSuccessDiscordNotifications" label="Deployment Success" /> label="Deployment Success" />
<x-forms.checkbox instantSave="saveModel" id="deploymentFailureDiscordNotifications" label="Deployment Failure" /> <x-forms.checkbox instantSave="saveModel" id="deploymentFailureDiscordNotifications"
{{-- <x-forms.checkbox instantSave="saveModel" helper="Send a notification when a container status changes. It will notify for Stopped and Restarted events of a container." id="statusChangeDiscordNotifications" label="Container Status Changes" /> --}} label="Deployment Failure" />
</div> {{-- <x-forms.checkbox instantSave="saveModel" helper="Send a notification when a container status changes. It will notify for Stopped and Restarted events of a container." id="statusChangeDiscordNotifications" label="Container Status Changes" /> --}}
</div> </div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg"> </div>
<h3 class="font-medium mb-3">Backups</h3> <div class="border dark:border-coolgray-300 p-4 rounded-lg">
<div class="flex flex-col gap-1.5 pl-1"> <h3 class="font-medium mb-3">Backups</h3>
<x-forms.checkbox instantSave="saveModel" id="backupSuccessDiscordNotifications" label="Backup Success" /> <div class="flex flex-col gap-1.5 pl-1">
<x-forms.checkbox instantSave="saveModel" id="backupFailureDiscordNotifications" label="Backup Failure" /> <x-forms.checkbox instantSave="saveModel" id="backupSuccessDiscordNotifications"
</div> label="Backup Success" />
<x-forms.checkbox instantSave="saveModel" id="backupFailureDiscordNotifications"
label="Backup Failure" />
</div> </div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg"> </div>
<h3 class="font-medium mb-3">Scheduled Tasks</h3> <div class="border dark:border-coolgray-300 p-4 rounded-lg">
<div class="flex flex-col gap-1.5 pl-1"> <h3 class="font-medium mb-3">Scheduled Tasks</h3>
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskSuccessDiscordNotifications" label="Scheduled Task Success" /> <div class="flex flex-col gap-1.5 pl-1">
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskFailureDiscordNotifications" label="Scheduled Task Failure" /> <x-forms.checkbox instantSave="saveModel" id="scheduledTaskSuccessDiscordNotifications"
</div> label="Scheduled Task Success" />
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskFailureDiscordNotifications"
label="Scheduled Task Failure" />
</div> </div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg"> </div>
<h3 class="font-medium mb-3">Server</h3> <div class="border dark:border-coolgray-300 p-4 rounded-lg">
<div class="flex flex-col gap-1.5 pl-1"> <h3 class="font-medium mb-3">Server</h3>
<x-forms.checkbox instantSave="saveModel" helper="Send a notification when Docker Cleanup is run on a server." id="dockerCleanupSuccessDiscordNotifications" label="Docker Cleanup Success" /> <div class="flex flex-col gap-1.5 pl-1">
<x-forms.checkbox instantSave="saveModel" helper="Send a notification when Docker Cleanup fails on a server." id="dockerCleanupFailureDiscordNotifications" label="Docker Cleanup Failure" /> <x-forms.checkbox instantSave="saveModel" id="dockerCleanupSuccessDiscordNotifications"
<x-forms.checkbox instantSave="saveModel" helper="Send a notification when server disk usage is high." id="serverDiskUsageDiscordNotifications" label="Server Disk Usage" /> label="Docker Cleanup Success" />
<x-forms.checkbox instantSave="saveModel" id="serverReachableDiscordNotifications" label="Server Reachable" /> <x-forms.checkbox instantSave="saveModel" id="dockerCleanupFailureDiscordNotifications"
<x-forms.checkbox instantSave="saveModel" id="serverUnreachableDiscordNotifications" label="Server Unreachable" /> label="Docker Cleanup Failure" />
</div> <x-forms.checkbox instantSave="saveModel" id="serverDiskUsageDiscordNotifications"
label="Server Disk Usage" />
<x-forms.checkbox instantSave="saveModel" id="serverReachableDiscordNotifications"
label="Server Reachable" />
<x-forms.checkbox instantSave="saveModel" id="serverUnreachableDiscordNotifications"
label="Server Unreachable" />
</div> </div>
</div> </div>
@endif </div>
</div> </div>

View File

@@ -1,48 +1,58 @@
<div> <div>
<x-slot:title> <x-slot:title>
Notifications | Coolify Notifications | Coolify
</x-slot> </x-slot>
<x-notification.navbar /> <x-notification.navbar />
<form wire:submit='submit' class="flex flex-col gap-4 pb-4"> <form wire:submit='submit' class="flex flex-col gap-4 pb-4">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<h2>Email</h2> <h2>Email</h2>
<x-forms.button type="submit"> <x-forms.button type="submit">
Save Save
</x-forms.button> </x-forms.button>
@if ($team->isNotificationEnabled('email') && auth()->user()->isAdminFromSession()) @if (auth()->user()->isAdminFromSession())
<x-modal-input buttonTitle="Send Test Email" title="Send Test Email"> @if ($team->isNotificationEnabled('email'))
<form wire:submit.prevent="sendTestEmail" class="flex flex-col w-full gap-2"> <x-modal-input buttonTitle="Send Test Email" title="Send Test Email">
<x-forms.input wire:model="testEmailAddress" placeholder="test@example.com" id="testEmailAddress" label="Recipients" required /> <form wire:submit.prevent="sendTestEmail" class="flex flex-col w-full gap-2">
<x-forms.button type="submit" @click="modalOpen=false"> <x-forms.input wire:model="testEmailAddress" placeholder="test@example.com"
Send Email id="testEmailAddress" label="Recipients" required />
</x-forms.button> <x-forms.button type="submit" @click="modalOpen=false">
</form> Send Email
</x-modal-input> </x-forms.button>
</form>
</x-modal-input>
@else
<x-forms.button disabled class="normal-case dark:text-white btn btn-xs no-animation btn-primary">
Send Test Email
</x-forms.button>
@endif @endif
@if (isInstanceAdmin() && !$useInstanceEmailSettings) @endif
</div>
@if (!isCloud())
<div class="w-96">
<x-forms.checkbox instantSave="instantSave()" id="useInstanceEmailSettings"
label="Use system wide (transactional) email settings" />
</div>
@endif
@if (!$useInstanceEmailSettings)
<div class="flex gap-4">
<x-forms.input required id="smtpFromName" helper="Name used in emails." label="From Name" />
<x-forms.input required id="smtpFromAddress" helper="Email address used in emails."
label="From Address" />
</div>
@if (isInstanceAdmin() && !$useInstanceEmailSettings)
<x-forms.button wire:click='copyFromInstanceSettings'> <x-forms.button wire:click='copyFromInstanceSettings'>
Copy from Instance Settings Copy from Instance Settings
</x-forms.button> </x-forms.button>
@endif
</div>
@if (!isCloud())
<div class="w-96">
<x-forms.checkbox instantSave="instantSave()" id="useInstanceEmailSettings" label="Use system wide (transactional) email settings" />
</div>
@endif @endif
@if (!$useInstanceEmailSettings)
<div class="flex gap-4">
<x-forms.input required id="smtpFromName" helper="Name used in emails." label="From Name" />
<x-forms.input required id="smtpFromAddress" helper="Email address used in emails." label="From Address" />
</div>
@endif
</form>
@if (isCloud())
<div class="w-64 py-4">
<x-forms.checkbox instantSave="instantSave()" id="useInstanceEmailSettings" label="Use Hosted Email Service" />
</div>
@endif @endif
@if (!$useInstanceEmailSettings) </form>
@if (isCloud())
<div class="w-64 py-4">
<x-forms.checkbox instantSave="instantSave()" id="useInstanceEmailSettings"
label="Use Hosted Email Service" />
</div>
@endif
@if (!$useInstanceEmailSettings)
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
<form wire:submit='submitSmtp' class="p-4 border dark:border-coolgray-300 flex flex-col gap-2"> <form wire:submit='submitSmtp' class="p-4 border dark:border-coolgray-300 flex flex-col gap-2">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
@@ -52,7 +62,8 @@
</x-forms.button> </x-forms.button>
</div> </div>
<div class="w-32"> <div class="w-32">
<x-forms.checkbox wire:model="smtpEnabled" instantSave="instantSave('SMTP')" id="smtpEnabled" label="Enabled" /> <x-forms.checkbox wire:model="smtpEnabled" instantSave="instantSave('SMTP')" id="smtpEnabled"
label="Enabled" />
</div> </div>
<div class="flex flex-col"> <div class="flex flex-col">
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
@@ -68,7 +79,8 @@
<div class="flex flex-col w-full gap-2 xl:flex-row"> <div class="flex flex-col w-full gap-2 xl:flex-row">
<x-forms.input id="smtpUsername" label="SMTP Username" /> <x-forms.input id="smtpUsername" label="SMTP Username" />
<x-forms.input id="smtpPassword" type="password" label="SMTP Password" /> <x-forms.input id="smtpPassword" type="password" label="SMTP Password" />
<x-forms.input id="smtpTimeout" helper="Timeout value for sending emails." label="Timeout" /> <x-forms.input id="smtpTimeout" helper="Timeout value for sending emails."
label="Timeout" />
</div> </div>
</div> </div>
</div> </div>
@@ -81,56 +93,68 @@
</x-forms.button> </x-forms.button>
</div> </div>
<div class="w-32"> <div class="w-32">
<x-forms.checkbox wire:model="resendEnabled" instantSave="instantSave('Resend')" id="resendEnabled" label="Enabled" /> <x-forms.checkbox wire:model="resendEnabled" instantSave="instantSave('Resend')" id="resendEnabled"
label="Enabled" />
</div> </div>
<div class="flex flex-col"> <div class="flex flex-col">
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
<div class="flex flex-col w-full gap-2 xl:flex-row"> <div class="flex flex-col w-full gap-2 xl:flex-row">
<x-forms.input required type="password" id="resendApiKey" placeholder="API key" label="API Key" /> <x-forms.input required type="password" id="resendApiKey" placeholder="API key"
label="API Key" />
</div> </div>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
@endif @endif
@if ($team->isNotificationEnabled('email') || $useInstanceEmailSettings) <h2 class="mt-4">Notification Settings</h2>
<h2 class="mt-8 mb-4">Notification Settings</h2> <p class="mb-4">
<p class="mb-4"> Select events for which you would like to receive email notifications.
Select events for which you would like to receive email notifications. </p>
</p> <div class="flex flex-col gap-4 max-w-2xl">
<div class="flex flex-col gap-4 max-w-2xl"> <div class="border dark:border-coolgray-300 p-4 rounded-lg">
<div class="border dark:border-coolgray-300 p-4 rounded-lg"> <h3 class="font-medium mb-3">Deployments</h3>
<h3 class="font-medium mb-3">Deployments</h3> <div class="flex flex-col gap-1.5 pl-1">
<div class="flex flex-col gap-1.5 pl-1"> <x-forms.checkbox instantSave="saveModel" id="deploymentSuccessEmailNotifications"
<x-forms.checkbox instantSave="saveModel" id="deploymentSuccessEmailNotifications" label="Deployment Success" /> label="Deployment Success" />
<x-forms.checkbox instantSave="saveModel" id="deploymentFailureEmailNotifications" label="Deployment Failure" /> <x-forms.checkbox instantSave="saveModel" id="deploymentFailureEmailNotifications"
{{-- <x-forms.checkbox instantSave="saveModel" helper="Send an email when a container status changes. It will send and email for Stopped and Restarted events of a container." id="statusChangeEmailNotifications" label="Container Status Changes" /> --}} label="Deployment Failure" />
</div> {{-- <x-forms.checkbox instantSave="saveModel" helper="Send an email when a container status changes. It will send and email for Stopped and Restarted events of a container." id="statusChangeEmailNotifications" label="Container Status Changes" /> --}}
</div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="font-medium mb-3">Backups</h3>
<div class="flex flex-col gap-1.5 pl-1">
<x-forms.checkbox instantSave="saveModel" id="backupSuccessEmailNotifications" label="Backup Success" />
<x-forms.checkbox instantSave="saveModel" id="backupFailureEmailNotifications" label="Backup Failure" />
</div>
</div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="font-medium mb-3">Scheduled Tasks</h3>
<div class="flex flex-col gap-1.5 pl-1">
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskSuccessEmailNotifications" label="Scheduled Task Success" />
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskFailureEmailNotifications" label="Scheduled Task Failure" />
</div>
</div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="font-medium mb-3">Server</h3>
<div class="flex flex-col gap-1.5 pl-1">
<x-forms.checkbox instantSave="saveModel" helper="Send an email when Docker Cleanup is run on a server." id="dockerCleanupSuccessEmailNotifications" label="Docker Cleanup Success" />
<x-forms.checkbox instantSave="saveModel" helper="Send an email when Docker Cleanup fails on a server." id="dockerCleanupFailureEmailNotifications" label="Docker Cleanup Failure" />
<x-forms.checkbox instantSave="saveModel" helper="Send an email when server disk usage is high." id="serverDiskUsageEmailNotifications" label="Server Disk Usage" />
<x-forms.checkbox instantSave="saveModel" id="serverReachableEmailNotifications" label="Server Reachable" />
<x-forms.checkbox instantSave="saveModel" id="serverUnreachableEmailNotifications" label="Server Unreachable" />
</div>
</div> </div>
</div> </div>
@endif <div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="font-medium mb-3">Backups</h3>
<div class="flex flex-col gap-1.5 pl-1">
<x-forms.checkbox instantSave="saveModel" id="backupSuccessEmailNotifications" label="Backup Success" />
<x-forms.checkbox instantSave="saveModel" id="backupFailureEmailNotifications"
label="Backup Failure" />
</div>
</div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="font-medium mb-3">Scheduled Tasks</h3>
<div class="flex flex-col gap-1.5 pl-1">
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskSuccessEmailNotifications"
label="Scheduled Task Success" />
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskFailureEmailNotifications"
label="Scheduled Task Failure" />
</div>
</div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="font-medium mb-3">Server</h3>
<div class="flex flex-col gap-1.5 pl-1">
<x-forms.checkbox instantSave="saveModel"
helper="Send an email when Docker Cleanup is run on a server."
id="dockerCleanupSuccessEmailNotifications" label="Docker Cleanup Success" />
<x-forms.checkbox instantSave="saveModel"
helper="Send an email when Docker Cleanup fails on a server."
id="dockerCleanupFailureEmailNotifications" label="Docker Cleanup Failure" />
<x-forms.checkbox instantSave="saveModel" helper="Send an email when server disk usage is high."
id="serverDiskUsageEmailNotifications" label="Server Disk Usage" />
<x-forms.checkbox instantSave="saveModel" id="serverReachableEmailNotifications"
label="Server Reachable" />
<x-forms.checkbox instantSave="saveModel" id="serverUnreachableEmailNotifications"
label="Server Unreachable" />
</div>
</div>
</div>
</div> </div>

View File

@@ -3,7 +3,7 @@
Notifications | Coolify Notifications | Coolify
</x-slot> </x-slot>
<x-notification.navbar /> <x-notification.navbar />
<form wire:submit='submit' class="flex flex-col gap-4"> <form wire:submit='submit' class="flex flex-col gap-4 pb-4">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<h2>Slack</h2> <h2>Slack</h2>
<x-forms.button type="submit"> <x-forms.button type="submit">
@@ -14,6 +14,10 @@
wire:click="sendTestNotification"> wire:click="sendTestNotification">
Send Test Notification Send Test Notification
</x-forms.button> </x-forms.button>
@else
<x-forms.button disabled class="normal-case dark:text-white btn btn-xs no-animation btn-primary">
Send Test Notification
</x-forms.button>
@endif @endif
</div> </div>
<div class="w-32"> <div class="w-32">
@@ -23,44 +27,51 @@
helper="Generate a webhook in Slack.<br>Example: https://hooks.slack.com/services/...." required helper="Generate a webhook in Slack.<br>Example: https://hooks.slack.com/services/...." required
id="slackWebhookUrl" label="Webhook" /> id="slackWebhookUrl" label="Webhook" />
</form> </form>
@if ($slackEnabled) <h2 class="mt-4">Notification Settings</h2>
<h2 class="mt-8 mb-4">Notification Settings</h2> <p class="mb-4">
<p class="mb-4"> Select events for which you would like to receive Slack notifications.
Select events for which you would like to receive Slack notifications. </p>
</p> <div class="flex flex-col gap-4 max-w-2xl">
<div class="flex flex-col gap-4 max-w-2xl"> <div class="border dark:border-coolgray-300 p-4 rounded-lg">
<div class="border dark:border-coolgray-300 p-4 rounded-lg"> <h3 class="font-medium mb-3">Deployments</h3>
<h3 class="font-medium mb-3">Deployments</h3> <div class="flex flex-col gap-1.5 pl-1">
<div class="flex flex-col gap-1.5 pl-1"> <x-forms.checkbox instantSave="saveModel" id="deploymentSuccessSlackNotifications"
<x-forms.checkbox instantSave="saveModel" id="deploymentSuccessSlackNotifications" label="Deployment Success" /> label="Deployment Success" />
<x-forms.checkbox instantSave="saveModel" id="deploymentFailureSlackNotifications" label="Deployment Failure" /> <x-forms.checkbox instantSave="saveModel" id="deploymentFailureSlackNotifications"
{{-- <x-forms.checkbox instantSave="saveModel" helper="Send a notification when a container status changes. It will notify for Stopped and Restarted events of a container." id="statusChangeSlackNotifications" label="Container Status Changes" /> --}} label="Deployment Failure" />
</div> {{-- <x-forms.checkbox instantSave="saveModel" helper="Send a notification when a container status changes. It will notify for Stopped and Restarted events of a container." id="statusChangeSlackNotifications" label="Container Status Changes" /> --}}
</div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="font-medium mb-3">Backups</h3>
<div class="flex flex-col gap-1.5 pl-1">
<x-forms.checkbox instantSave="saveModel" id="backupSuccessSlackNotifications" label="Backup Success" />
<x-forms.checkbox instantSave="saveModel" id="backupFailureSlackNotifications" label="Backup Failure" />
</div>
</div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="font-medium mb-3">Scheduled Tasks</h3>
<div class="flex flex-col gap-1.5 pl-1">
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskSuccessSlackNotifications" label="Scheduled Task Success" />
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskFailureSlackNotifications" label="Scheduled Task Failure" />
</div>
</div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="font-medium mb-3">Server</h3>
<div class="flex flex-col gap-1.5 pl-1">
<x-forms.checkbox instantSave="saveModel" helper="Send a notification when Docker Cleanup is run on a server." id="dockerCleanupSuccessSlackNotifications" label="Docker Cleanup Success" />
<x-forms.checkbox instantSave="saveModel" helper="Send a notification when Docker Cleanup fails on a server." id="dockerCleanupFailureSlackNotifications" label="Docker Cleanup Failure" />
<x-forms.checkbox instantSave="saveModel" helper="Send a notification when server disk usage is high." id="serverDiskUsageSlackNotifications" label="Server Disk Usage" />
<x-forms.checkbox instantSave="saveModel" id="serverReachableSlackNotifications" label="Server Reachable" />
<x-forms.checkbox instantSave="saveModel" id="serverUnreachableSlackNotifications" label="Server Unreachable" />
</div>
</div> </div>
</div> </div>
@endif <div class="border dark:border-coolgray-300 p-4 rounded-lg">
</div> <h3 class="font-medium mb-3">Backups</h3>
<div class="flex flex-col gap-1.5 pl-1">
<x-forms.checkbox instantSave="saveModel" id="backupSuccessSlackNotifications" label="Backup Success" />
<x-forms.checkbox instantSave="saveModel" id="backupFailureSlackNotifications" label="Backup Failure" />
</div>
</div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="font-medium mb-3">Scheduled Tasks</h3>
<div class="flex flex-col gap-1.5 pl-1">
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskSuccessSlackNotifications"
label="Scheduled Task Success" />
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskFailureSlackNotifications"
label="Scheduled Task Failure" />
</div>
</div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="font-medium mb-3">Server</h3>
<div class="flex flex-col gap-1.5 pl-1">
<x-forms.checkbox instantSave="saveModel" id="dockerCleanupSuccessSlackNotifications"
label="Docker Cleanup Success" />
<x-forms.checkbox instantSave="saveModel" id="dockerCleanupFailureSlackNotifications"
label="Docker Cleanup Failure" />
<x-forms.checkbox instantSave="saveModel" id="serverDiskUsageSlackNotifications"
label="Server Disk Usage" />
<x-forms.checkbox instantSave="saveModel" id="serverReachableSlackNotifications"
label="Server Reachable" />
<x-forms.checkbox instantSave="saveModel" id="serverUnreachableSlackNotifications"
label="Server Unreachable" />
</div>
</div>
</div>
</div>

View File

@@ -1,122 +1,162 @@
<div> <div>
<x-slot:title> <x-slot:title>
Notifications | Coolify Notifications | Coolify
</x-slot> </x-slot>
<x-notification.navbar /> <x-notification.navbar />
<form wire:submit='submit' class="flex flex-col gap-4"> <form wire:submit='submit' class="flex flex-col gap-4 pb-4">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<h2>Telegram</h2> <h2>Telegram</h2>
<x-forms.button type="submit"> <x-forms.button type="submit">
Save Save
</x-forms.button> </x-forms.button>
@if ($telegramEnabled) @if ($telegramEnabled)
<x-forms.button class="normal-case dark:text-white btn btn-xs no-animation btn-primary" wire:click="sendTestNotification"> <x-forms.button class="normal-case dark:text-white btn btn-xs no-animation btn-primary"
wire:click="sendTestNotification">
Send Test Notification
</x-forms.button>
@else
<x-forms.button disabled class="normal-case dark:text-white btn btn-xs no-animation btn-primary">
Send Test Notification Send Test Notification
</x-forms.button> </x-forms.button>
@endif
</div>
<div class="w-32">
<x-forms.checkbox instantSave="instantSaveTelegramEnabled" id="telegramEnabled" label="Enabled" />
</div>
<div class="flex gap-2">
<x-forms.input type="password" autocomplete="new-password" helper="Get it from the <a class='inline-block underline dark:text-white' href='https://t.me/botfather' target='_blank'>BotFather Bot</a> on Telegram." required id="telegramToken" label="Token" />
<x-forms.input helper="Recommended to add your bot to a group chat and add its Chat ID here." required id="telegramChatId" label="Chat ID" />
</div>
@if ($telegramEnabled)
<h2 class="mt-8 mb-4">Notification Settings</h2>
<p class="mb-4">
Select events for which you would like to receive Telegram notifications.
</p>
<div class="flex flex-col gap-4 max-w-2xl">
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="text-lg font-medium mb-3">Deployment</h3>
<div class="flex flex-col gap-1.5 pl-1">
<h4 class="font-medium mt-2">Deployment Success</h4>
<div class="pl-1">
<x-forms.checkbox instantSave="saveModel" id="deploymentSuccessTelegramNotifications" label="Enabled" />
<x-forms.input helper="Topic ID for deployment success notifications" id="telegramNotificationsDeploymentSuccessTopicId" label="Success Topic ID" />
</div>
<h4 class="font-medium mt-3">Deployment Failure</h4>
<div class="pl-1">
<x-forms.checkbox instantSave="saveModel" id="deploymentFailureTelegramNotifications" label="Enabled" />
<x-forms.input helper="Topic ID for deployment failure notifications" id="telegramNotificationsDeploymentFailureTopicId" label="Failure Topic ID" />
</div>
{{-- <h4 class="font-medium mt-3">Container Status Changes</h4>
<div class="pl-1">
<x-forms.checkbox instantSave="saveModel" id="statusChangeTelegramNotifications" label="Enabled" helper="Send a notification when a container status changes. It will send a notification for Stopped and Restarted events of a container." />
<x-forms.input helper="Topic ID for container status notifications" id="telegramNotificationsStatusChangeTopicId" label="Container Status Topic ID" />
</div> --}}
</div>
</div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="text-lg font-medium mb-3">Backups</h3>
<div class="flex flex-col gap-1.5 pl-1">
<h4 class="font-medium mt-2">Backup Success</h4>
<div class="pl-1">
<x-forms.checkbox instantSave="saveModel" id="backupSuccessTelegramNotifications" label="Enabled" />
<x-forms.input helper="Topic ID for backup success notifications" id="telegramNotificationsBackupSuccessTopicId" label="Success Topic ID" />
</div>
<h4 class="font-medium mt-3">Backup Failure</h4>
<div class="pl-1">
<x-forms.checkbox instantSave="saveModel" id="backupFailureTelegramNotifications" label="Enabled" />
<x-forms.input helper="Topic ID for backup failure notifications" id="telegramNotificationsBackupFailureTopicId" label="Failure Topic ID" />
</div>
</div>
</div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="text-lg font-medium mb-3">Scheduled Tasks</h3>
<div class="flex flex-col gap-1.5 pl-1">
<h4 class="font-medium mt-2">Scheduled Task Success</h4>
<div class="pl-1">
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskSuccessTelegramNotifications" label="Enabled" />
<x-forms.input helper="Topic ID for scheduled task success notifications" id="telegramNotificationsScheduledTaskSuccessTopicId" label="Success Topic ID" />
</div>
<h4 class="font-medium mt-3">Scheduled Task Failure</h4>
<div class="pl-1">
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskFailureTelegramNotifications" label="Enabled" />
<x-forms.input helper="Topic ID for scheduled task failure notifications" id="telegramNotificationsScheduledTaskFailureTopicId" label="Failure Topic ID" />
</div>
</div>
</div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="text-lg font-medium mb-3">Server</h3>
<div class="flex flex-col gap-1.5 pl-1">
<h4 class="font-medium mt-2">Docker Cleanup Success</h4>
<div class="pl-1">
<x-forms.checkbox instantSave="saveModel" helper="Send a notification when Docker Cleanup is run on a server." id="dockerCleanupSuccessTelegramNotifications" label="Enabled" />
<x-forms.input helper="Topic ID for Docker cleanup success notifications" id="telegramNotificationsDockerCleanupSuccessTopicId" label="Docker Cleanup Success Topic ID" />
</div>
<h4 class="font-medium mt-3">Docker Cleanup Failure</h4>
<div class="pl-1">
<x-forms.checkbox instantSave="saveModel" helper="Send a notification when Docker Cleanup fails on a server." id="dockerCleanupFailureTelegramNotifications" label="Enabled" />
<x-forms.input helper="Topic ID for Docker cleanup failure notifications" id="telegramNotificationsDockerCleanupFailureTopicId" label="Docker Cleanup Failure Topic ID" />
</div>
<h4 class="font-medium mt-3">Server Disk Usage</h4>
<div class="pl-1">
<x-forms.checkbox instantSave="saveModel" id="serverDiskUsageTelegramNotifications" label="Enabled" />
<x-forms.input helper="Topic ID for disk usage notifications" id="telegramNotificationsServerDiskUsageTopicId" label="Disk Usage Topic ID" />
</div>
<h4 class="font-medium mt-3">Server Reachable</h4>
<div class="pl-1">
<x-forms.checkbox instantSave="saveModel" id="serverReachableTelegramNotifications" label="Enabled" />
<x-forms.input helper="Topic ID for server reachable notifications" id="telegramNotificationsServerReachableTopicId" label="Server Reachable Topic ID" />
</div>
<h4 class="font-medium mt-3">Server Unreachable</h4>
<div class="pl-1">
<x-forms.checkbox instantSave="saveModel" id="serverUnreachableTelegramNotifications" label="Enabled" />
<x-forms.input helper="Topic ID for server unreachable notifications" id="telegramNotificationsServerUnreachableTopicId" label="Server Unreachable Topic ID" />
</div>
</div>
</div>
</div>
@endif @endif
</form> </div>
<div class="w-32">
<x-forms.checkbox instantSave="instantSaveTelegramEnabled" id="telegramEnabled" label="Enabled" />
</div>
<div class="flex gap-2">
<x-forms.input type="password" autocomplete="new-password"
helper="Get it from the <a class='inline-block underline dark:text-white' href='https://t.me/botfather' target='_blank'>BotFather Bot</a> on Telegram."
required id="telegramToken" label="Token" />
<x-forms.input helper="Recommended to add your bot to a group chat and add its Chat ID here." required
id="telegramChatId" label="Chat ID" />
</div>
</form>
<h2 class="mt-4">Notification Settings</h2>
<p class="mb-4">
Select events for which you would like to receive Telegram notifications.
</p>
<div class="flex flex-col gap-4 ">
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="text-lg font-medium mb-3">Deployments</h3>
<div class="flex flex-col gap-1.5 pl-1">
<div class="pl-1 flex gap-2">
<div class="w-96">
<x-forms.checkbox instantSave="saveModel" id="deploymentSuccessTelegramNotifications"
label="Deployment Success" />
</div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID"
id="telegramNotificationsDeploymentSuccessTopicId" />
</div>
<div class="pl-1 flex gap-2">
<div class="w-96">
<x-forms.checkbox instantSave="saveModel" id="deploymentFailureTelegramNotifications"
label="Deployment Failure" />
</div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID"
id="telegramNotificationsDeploymentFailureTopicId" />
</div>
{{-- <h4 class="font-medium mt-3">Container Status Changes</h4>
<div class="pl-1">
<x-forms.checkbox instantSave="saveModel" id="statusChangeTelegramNotifications" label="Enabled" helper="Send a notification when a container status changes. It will send a notification for Stopped and Restarted events of a container." />
<x-forms.input helper="Topic ID for container status notifications" id="telegramNotificationsStatusChangeTopicId" label="Container Status Topic ID" />
</div> --}}
</div>
</div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="text-lg font-medium mb-3">Backups</h3>
<div class="flex flex-col gap-1.5 pl-1">
<div class="pl-1 flex gap-2">
<div class="w-96">
<x-forms.checkbox instantSave="saveModel" id="backupSuccessTelegramNotifications"
label="Backup Success" />
</div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID"
id="telegramNotificationsBackupSuccessTopicId" />
</div>
<div class="pl-1 flex gap-2">
<div class="w-96">
<x-forms.checkbox instantSave="saveModel" id="backupFailureTelegramNotifications"
label="Backup Failure" />
</div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID"
id="telegramNotificationsBackupFailureTopicId" />
</div>
</div>
</div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="text-lg font-medium mb-3">Scheduled Tasks</h3>
<div class="flex flex-col gap-1.5 pl-1">
<div class="pl-1 flex gap-2">
<div class="w-96">
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskSuccessTelegramNotifications"
label="Scheduled Task Success" />
</div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID"
id="telegramNotificationsScheduledTaskSuccessTopicId" />
</div>
<div class="pl-1 flex gap-2">
<div class="w-96">
<x-forms.checkbox instantSave="saveModel" id="scheduledTaskFailureTelegramNotifications"
label="Scheduled Task Failure" />
</div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID"
id="telegramNotificationsScheduledTaskFailureTopicId" />
</div>
</div>
</div>
<div class="border dark:border-coolgray-300 p-4 rounded-lg">
<h3 class="text-lg font-medium mb-3">Server</h3>
<div class="flex flex-col gap-1.5 pl-1">
<div class="pl-1 flex gap-2">
<div class="w-96">
<x-forms.checkbox instantSave="saveModel" id="dockerCleanupSuccessTelegramNotifications"
label="Docker Cleanup Success" />
</div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID"
id="telegramNotificationsDockerCleanupSuccessTopicId" />
</div>
<div class="pl-1 flex gap-2">
<div class="w-96">
<x-forms.checkbox instantSave="saveModel" id="dockerCleanupFailureTelegramNotifications"
label="Docker Cleanup Failure" />
</div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID"
id="telegramNotificationsDockerCleanupFailureTopicId" />
</div>
<div class="pl-1 flex gap-2">
<div class="w-96">
<x-forms.checkbox instantSave="saveModel" id="serverDiskUsageTelegramNotifications"
label="Server Disk Usage" />
</div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID"
id="telegramNotificationsServerDiskUsageTopicId" />
</div>
<div class="pl-1 flex gap-2">
<div class="w-96">
<x-forms.checkbox instantSave="saveModel" id="serverReachableTelegramNotifications"
label="Server Reachable" />
</div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID"
id="telegramNotificationsServerReachableTopicId" />
</div>
<div class="pl-1 flex gap-2">
<div class="w-96">
<x-forms.checkbox instantSave="saveModel" id="serverUnreachableTelegramNotifications"
label="Server Unreachable" />
</div>
<x-forms.input type="password" placeholder="Custom Telegram Topic ID"
id="telegramNotificationsServerUnreachableTopicId" />
</div>
</div>
</div>
</div>
</div> </div>

View File

@@ -32,18 +32,18 @@ function sync:bunny {
} }
function db:reset { function db:reset {
bash spin exec -u webuser coolify php artisan migrate:fresh --seed bash spin exec -u www-data coolify php artisan migrate:fresh --seed
} }
function db:reset-prod { function db:reset-prod {
bash spin exec -u webuser coolify php artisan migrate:fresh --force --seed --seeder=ProductionSeeder || bash spin exec -u www-data coolify php artisan migrate:fresh --force --seed --seeder=ProductionSeeder ||
php artisan migrate:fresh --force --seed --seeder=ProductionSeeder php artisan migrate:fresh --force --seed --seeder=ProductionSeeder
} }
function coolify { function coolify {
bash spin exec -u webuser coolify bash bash spin exec -u www-data coolify sh
} }
function coolify:root { function coolify:root {
bash spin exec coolify bash bash spin exec coolify sh
} }
function coolify:proxy { function coolify:proxy {
docker exec -ti coolify-proxy sh docker exec -ti coolify-proxy sh
@@ -58,7 +58,7 @@ function vite {
} }
function tinker { function tinker {
bash spin exec -u webuser coolify php artisan tinker bash spin exec -u www-data coolify php artisan tinker
} }
function default { function default {
@@ -66,4 +66,4 @@ function default {
} }
TIMEFORMAT="Task completed in %3lR" TIMEFORMAT="Task completed in %3lR"
time "${@:-default}" time "${@:-default}"