Skip to content

Commit

Permalink
Udpate usage of notifiers to fix alert and report (#4522)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaHegde authored Apr 5, 2024
1 parent 8a1adda commit 3577f32
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions admin/server/alerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ func (s *Server) yamlForManagedAlert(opts *adminv1.AlertOptions, ownerUserID str
// Notification options
res.Renotify = opts.Renotify
res.RenotifyAfter = opts.RenotifyAfterSeconds
res.Notify.Email.Emails = opts.EmailRecipients
res.Notify.Email.Recipients = opts.EmailRecipients
res.Notify.Slack.Channels = opts.SlackChannels
res.Notify.Slack.Users = opts.SlackUsers
res.Notify.Slack.Webhooks = opts.SlackWebhooks
Expand Down Expand Up @@ -496,7 +496,7 @@ func (s *Server) yamlForCommittedAlert(opts *adminv1.AlertOptions) ([]byte, erro
// Notification options
res.Renotify = opts.Renotify
res.RenotifyAfter = opts.RenotifyAfterSeconds
res.Notify.Email.Emails = opts.EmailRecipients
res.Notify.Email.Recipients = opts.EmailRecipients
res.Notify.Slack.Channels = opts.SlackChannels
res.Notify.Slack.Users = opts.SlackUsers
res.Notify.Slack.Webhooks = opts.SlackWebhooks
Expand Down Expand Up @@ -589,7 +589,7 @@ type alertYAML struct {
RenotifyAfter uint32 `yaml:"renotify_after"`
Notify struct {
Email struct {
Emails []string `yaml:"emails"`
Recipients []string `yaml:"emails"`
}
Slack struct {
Users []string `yaml:"users"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
<EmailRecipients
emailRecipients={$alertQuery.data.resource.alert.spec.notifiers.find(
(n) => n.connector === "email",
)?.properties?.email?.recipients ?? []}
)?.properties?.recipients ?? []}
/>
</div>
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
<EmailRecipients
emailRecipients={$reportQuery.data.resource.report.spec.notifiers.find(
(n) => n.connector === "email",
)?.properties?.email?.recipients ?? []}
)?.properties?.recipients ?? []}
/>
</div>
{/if}
Expand Down
2 changes: 1 addition & 1 deletion web-common/src/features/alerts/EditAlertDialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
recipients:
alertSpec?.notifiers
?.find((n) => n.connector === "email")
?.properties?.email?.recipients?.map((r) => ({ email: r })) ?? [],
?.properties?.recipients?.map((r) => ({ email: r })) ?? [],
evaluationInterval: alertSpec.intervalsIsoDuration ?? "",
...extractAlertFormValues(
queryArgsJson,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
recipients:
reportSpec.notifiers
?.find((n) => n.connector === "email")
?.properties?.email?.recipients?.map((email) => ({
?.properties?.recipients?.map((email) => ({
email: email,
})) ?? [],
},
Expand Down

1 comment on commit 3577f32

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.