Skip to content

Commit

Permalink
Fix broken template for slack reports notifier (#6005)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaHegde authored Oct 30, 2024
1 parent 92d3b7a commit 61624cd
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion runtime/drivers/slack/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,17 @@ func newNotifier(token string, propsMap map[string]any) (*notifier, error) {
}

func (n *notifier) SendScheduledReport(s *drivers.ScheduledReport) error {
d := ReportStatusData{
DisplayName: s.DisplayName,
ReportTimeString: s.ReportTime.Format(time.RFC1123),
DownloadFormat: s.DownloadFormat,
OpenLink: s.OpenLink,
DownloadLink: s.DownloadLink,
EditLink: s.EditLink,
}

buf := new(bytes.Buffer)
err := n.templates.Lookup("scheduled_report.slack").Execute(buf, s)
err := n.templates.Lookup("scheduled_report.slack").Execute(buf, d)
if err != nil {
return fmt.Errorf("slack template error: %w", err)
}
Expand Down Expand Up @@ -209,6 +218,15 @@ func DecodeProps(propsMap map[string]any) (*NotifierProperties, error) {
return props, nil
}

type ReportStatusData struct {
DisplayName string
ReportTimeString string
DownloadFormat string
OpenLink string
DownloadLink string
EditLink string
}

type AlertStatusData struct {
Subject string
DisplayName string
Expand Down

0 comments on commit 61624cd

Please sign in to comment.