Skip to content

Commit

Permalink
Merge pull request #189 from linuxserver/badges
Browse files Browse the repository at this point in the history
  • Loading branch information
Roxedus authored Nov 23, 2023
2 parents a858674 + 343f9b5 commit efc975f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
11 changes: 11 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ params:
disrupted: "#cc4400"
down: "#e60000"
notice: "#24478f"
badge_ok: "#4c1"
badge_down: "#e05d44"

# If the status page shows that
# there are disruptions or outages
Expand Down Expand Up @@ -339,8 +341,17 @@ outputs:
- html
- json
- rss
- badge

mediaTypes:
application/badge:
suffixes:
- badge

outputFormats:
svg:
isPlainText: true
mediaType: image/svg+xml
badge:
isPlainText: true
mediaType: application/badge
25 changes: 25 additions & 0 deletions layouts/affected/list.badge
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{ $incidents := .Pages }}{{ $active := where $incidents "Params.resolved" "=" false }}{{ $isNotice := where $active "Params.severity" "=" "notice" }}{{ $isDisrupted := where $active "Params.severity" "=" "disrupted" }}{{ $isDown := where $active "Params.severity" "=" "down" -}}
{{ $status_color := .Site.Params.badge_ok -}}
{{ $status_text := "OK" -}}
{{ $status_error := false -}}
{{ if $isDown -}}
{{ $status_text := "Important message" -}}
{{ $status_error := true -}}
{{ $status_color = .Site.Params.badge_down -}}
{{ else if $isDisrupted -}}
{{ $status_text := "Notice" -}}
{{ $status_error := true -}}
{{ $status_color = .Site.Params.disrupted -}}
{{ else if $isNotice -}}
{{ $status_text := "Notice" -}}
{{ $status_error := true -}}
{{ $status_color = .Site.Params.notice -}}
{{ end -}}
{
"schemaVersion": 1,
"label": "Info",
"message": "{{ $status_text }}",
"color": "{{ $status_color }}",
"labelColor": "#555555",
"isError": {{ $status_error }}
}

0 comments on commit efc975f

Please sign in to comment.