mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 07:35:45 -06:00
Merge pull request #16116 from SGI495/master
Don't include non-existing image in MS Teams alert
This commit is contained in:
commit
46a75099d8
@ -78,6 +78,13 @@ func (this *TeamsNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
message = evalContext.Rule.Message
|
||||
}
|
||||
|
||||
images := make([]map[string]interface{}, 0)
|
||||
if evalContext.ImagePublicUrl != "" {
|
||||
images = append(images, map[string]interface{}{
|
||||
"image": evalContext.ImagePublicUrl,
|
||||
})
|
||||
}
|
||||
|
||||
body := map[string]interface{}{
|
||||
"@type": "MessageCard",
|
||||
"@context": "http://schema.org/extensions",
|
||||
@ -88,14 +95,10 @@ func (this *TeamsNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
"themeColor": evalContext.GetStateModel().Color,
|
||||
"sections": []map[string]interface{}{
|
||||
{
|
||||
"title": "Details",
|
||||
"facts": fields,
|
||||
"images": []map[string]interface{}{
|
||||
{
|
||||
"image": evalContext.ImagePublicUrl,
|
||||
},
|
||||
},
|
||||
"text": message,
|
||||
"title": "Details",
|
||||
"facts": fields,
|
||||
"images": images,
|
||||
"text": message,
|
||||
},
|
||||
},
|
||||
"potentialAction": []map[string]interface{}{
|
||||
|
Loading…
Reference in New Issue
Block a user