utils

package
v0.2.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToString

func BoolToString(b bool) string

BoolToString converts a boolean to its string representation "true" or "false". Useful for setting HTML attributes that expect string values.

func Contains

func Contains(slice []string, item string) bool

Contains checks if a string slice contains a specific string.

func FormatEventTriggerName

func FormatEventTriggerName(event string) string

FormatEventTriggerName converts event trigger keys to human-readable names.

func GetNotificationFormTitle

func GetNotificationFormTitle(isNew bool) string

GetNotificationFormTitle returns the title for the notification form page.

func IsEventTriggerSelected

func IsEventTriggerSelected(service *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
	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
}, event string, isNew bool) bool

IsEventTriggerSelected checks if a specific event trigger should be pre-selected. It now accepts the anonymous struct type defined in types.NotificationFormData. Defaults to checking 'job_complete' and 'job_error' when creating a new service.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL