package components import ( "fmt" "context" ) type NotificationService struct { ID uint Name string Type string // "email", "slack", "webhook", etc. IsEnabled bool Config map[string]string Description string EventTriggers []string PayloadTemplate string SecretKey string RetryPolicy string SuccessCount int FailureCount int } type SettingsData struct { NotificationServices []NotificationService ErrorMessage string SuccessMessage string } templ Settings(ctx context.Context, data SettingsData) { @LayoutWithContext("Application Settings", ctx) {

Application Settings

Configure global settings for your GoMFT instance.

if data.SuccessMessage != "" { } if data.ErrorMessage != "" { }

Notification Services

if len(data.NotificationServices) == 0 {

No notification services configured

Add your first notification service to start receiving alerts about jobs and system events.

} else {
for _, service := range data.NotificationServices {
if service.Type == "email" {
} else if service.Type == "slack" {
} else if service.Type == "webhook" {
} else {
}

{ 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) } }

{ service.Description }

if service.Type == "webhook" {

Webhook Configuration

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 } }
Secret Key: if service.SecretKey == "" { None } else { Configured }
Custom Payload: if service.PayloadTemplate == "" { Default } else { Custom }
}
}
}
} } script toggleNotificationFields() { document.addEventListener('DOMContentLoaded', function() { const typeSelector = document.getElementById('notification_type'); const allFields = document.querySelectorAll('.notification-fields'); typeSelector.addEventListener('change', function() { // Hide all fields first allFields.forEach(field => field.classList.add('hidden')); // Show the selected type's fields const selectedType = this.value; if (selectedType) { const fieldsToShow = document.getElementById(`${selectedType}_fields`); if (fieldsToShow) { fieldsToShow.classList.remove('hidden'); } } }); }); }