Alerting: Adding color option for slack receiver (#99615)

This commit is contained in:
Garret Wyman
2025-01-30 00:12:16 +02:00
committed by GitHub
parent b820fd6bef
commit cf177776bf
11 changed files with 22 additions and 10 deletions
@@ -227,6 +227,7 @@ type SlackIntegration struct {
MentionChannel *string `json:"mentionChannel,omitempty" yaml:"mentionChannel,omitempty" hcl:"mention_channel"`
MentionUsers *string `json:"mentionUsers,omitempty" yaml:"mentionUsers,omitempty" hcl:"mention_users"`
MentionGroups *string `json:"mentionGroups,omitempty" yaml:"mentionGroups,omitempty" hcl:"mention_groups"`
Color *string `json:"color,omitempty" yaml:"color,omitempty" hcl:"color"`
}
type TelegramIntegration struct {
@@ -331,7 +331,7 @@ func TestReceiver_Fingerprint(t *testing.T) {
completelyDifferentReceiver.Integrations[0].Config = IntegrationConfig{Type: completelyDifferentReceiver.Integrations[0].Config.Type} // Remove all fields except Type.
t.Run("stable across code changes", func(t *testing.T) {
expectedFingerprint := "a3402fdaba03030c" // If this is a valid fingerprint generation change, update the expected value.
expectedFingerprint := "c0c82936be34b183" // If this is a valid fingerprint generation change, update the expected value.
assert.Equal(t, expectedFingerprint, baseReceiver.Fingerprint())
})
t.Run("stable across clones", func(t *testing.T) {
@@ -691,6 +691,14 @@ func GetAvailableNotifiers() []*NotifierPlugin {
Placeholder: "Slack endpoint url",
PropertyName: "endpointUrl",
},
{
Label: "Color",
Element: ElementTypeInput,
InputType: InputTypeText,
Description: "Templated color of the slack message",
Placeholder: alertingTemplates.DefaultMessageColor,
PropertyName: "color",
},
{ // New in 8.0.
Label: "Title",
Element: ElementTypeInput,