message: |
    {{if eq .serviceType "slack"}}:exclamation:{{end}} Application {{.app.metadata.name}} has degraded.
    Application details: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}.
email:
    subject: Application {{.app.metadata.name}} has degraded.
slack:
    attachments: |
        [{
          "title": "{{ .app.metadata.name}}",
          "title_link": "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}",
          "color": "#f4c030",
          "fields": [
          {
            "title": "Health Status",
            "value": "{{.app.status.health.status}}",
            "short": true
          },
          {
            "title": "Repository",
            "value": "{{.app.spec.source.repoURL}}",
            "short": true
          }
          {{range $index, $c := .app.status.conditions}}
          {{if not $index}},{{end}}
          {{if $index}},{{end}}
          {
            "title": "{{$c.type}}",
            "value": "{{$c.message}}",
            "short": true
          }
          {{end}}
          ]
        }]
teams:
    themeColor: "#FF0000"
    title: Application {{.app.metadata.name}} has degraded.
    facts: |
        [{
          "name": "Health Status",
          "value": "{{.app.status.health.status}}"
        },
        {
          "name": "Repository",
          "value": "{{.app.spec.source.repoURL}}"
        }
        {{range $index, $c := .app.status.conditions}}
          {{if not $index}},{{end}}
          {{if $index}},{{end}}
          {
            "name": "{{$c.type}}",
            "value": "{{$c.message}}"
          }
        {{end}}
        ]
    potentialAction: |
        [{
          "@type":"OpenUri",
          "name":"Open Application",
          "targets":[{
            "os":"default",
            "uri":"{{.context.argocdUrl}}/applications/{{.app.metadata.name}}"
          }]
        },
        {
          "@type":"OpenUri",
          "name":"Open Repository",
          "targets":[{
            "os":"default",
            "uri":"{{.app.spec.source.repoURL | call .repo.RepoURLToHTTPS}}"
          }]
        }]
