package components import ( "context" "fmt" ) // Dialog component for confirmation dialogs using Flowbite modal templ NotificationDialog(id string, title string, message string, confirmClass string, confirmText string, action string, serviceID uint, serviceName string) { } script triggerServiceDelete(dialogId string, serviceID uint, serviceName string) { // Hide the dialog document.getElementById(dialogId).classList.add("hidden"); document.getElementById(dialogId).classList.remove("flex"); // Add debugging info console.log(`Notification service deletion triggered for: ${serviceName} (ID: ${serviceID})`); // Store data in a way that's accessible to event handlers window.lastDeletedService = { id: serviceID, name: serviceName }; // Add custom marker to track this deletion window.currentlyDeletingService = true; } templ Notifications(ctx context.Context, data SettingsNotificationsData) { @LayoutWithContext("Notification Services", ctx) {
if data.SuccessMessage != "" { } if data.ErrorMessage != "" { }

Notification Services

Add Notification Service
if len(data.NotificationServices) == 0 {

No notification services configured

Add a notification service to receive alerts for job events.

Add First Notification Service
} else {
    for _, service := range data.NotificationServices {
  • if service.Type == "email" {
    } else if service.Type == "webhook" {
    } else {
    }

    { service.Name }

    { service.Description }

    @NotificationDialog( fmt.Sprintf("delete-notification-dialog-%d", service.ID), "Delete Notification Service", fmt.Sprintf("Are you sure you want to delete the notification service '%s'? This cannot be undone.", service.Name), "text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-red-600 dark:hover:bg-red-700 focus:outline-none dark:focus:ring-red-800", "Delete", "delete", service.ID, service.Name, )
    if service.IsEnabled { Active } else { Disabled } { service.Type } if len(service.EventTriggers) > 0 && service.Type == "webhook" { { fmt.Sprintf("%d triggers", len(service.EventTriggers)) } } if service.SuccessCount > 0 || service.FailureCount > 0 { { fmt.Sprintf("%d/%d", service.SuccessCount, service.SuccessCount + service.FailureCount) } }
    if service.Type == "webhook" {
    Events: if len(service.EventTriggers) == 0 { None } else { for i, trigger := range service.EventTriggers { if i > 0 { , } { trigger } } }
    Retry: if service.RetryPolicy == "" { Default } else { { service.RetryPolicy } }
    } else {

    Last sent: if service.SuccessCount > 0 { "Recently" } else { "Never" }

    }
  • }
}

Notification services allow the system to send alerts for job events such as completion, errors, or when jobs start.

} }