diff --git a/components/notification_form.templ b/components/notification_form.templ index ae59bf4..2b16590 100644 --- a/components/notification_form.templ +++ b/components/notification_form.templ @@ -7,24 +7,65 @@ import ( type NotificationFormData struct { NotificationService *struct { - ID uint - Name string - Description string - Type string - IsEnabled bool - EventTriggers []string - RetryPolicy string - WebhookURL string - Method string - Headers string - PayloadTemplate string - SecretKey string + ID uint + Name string + Description string + Type string + IsEnabled bool + EventTriggers []string + RetryPolicy string + WebhookURL string + Method string + Headers string + PayloadTemplate string + SecretKey string + PushbulletAPIKey string + PushbulletDeviceID string + PushbulletTitleTemplate string + PushbulletBodyTemplate string + NtfyServer string + NtfyTopic string + NtfyPriority string + NtfyUsername string + NtfyPassword string + NtfyTitleTemplate string + NtfyMessageTemplate string + GotifyURL string + GotifyToken string + GotifyPriority string + GotifyTitleTemplate string + GotifyMessageTemplate string + PushoverAPIToken string + PushoverUserKey string + PushoverDevice string + PushoverPriority string + PushoverSound string + PushoverTitleTemplate string + PushoverMessageTemplate string } IsNew bool SuccessMessage string ErrorMessage string } +// Helper function to check if a string is in a slice +func contains(slice []string, str string) bool { + for _, s := range slice { + if s == str { + return true + } + } + return false +} + +// Helper function to convert bool to string for HTML attributes +func boolToString(b bool) string { + if b { + return "true" + } + return "" +} + func getNotificationFormTitle(isNew bool) string { if isNew { return "Add Notification Service" @@ -179,21 +220,49 @@ templ NotificationForm(ctx context.Context, data NotificationFormData) { @@ -222,18 +291,39 @@ templ NotificationForm(ctx context.Context, data NotificationFormData) {