From 469c6fc298d89421e0c113ed9885cc610bc38211 Mon Sep 17 00:00:00 2001 From: Mantas VilĨinskas Date: Fri, 1 Oct 2021 23:30:43 +0300 Subject: need to test #208 I think the code for index.svg can be the same (or mostly the same) and be reapplied for other categories just because of how hugo parses things will get this done soon for v5.1 --- layouts/_default/list.svg | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 layouts/_default/list.svg (limited to 'layouts/_default') diff --git a/layouts/_default/list.svg b/layouts/_default/list.svg new file mode 100644 index 0000000..dbd6483 --- /dev/null +++ b/layouts/_default/list.svg @@ -0,0 +1,44 @@ +{{ $incidents := where .Site.RegularPages "Params.section" "issue" -}} +{{ $active := where $incidents "Params.resolved" "=" false -}} +{{ $isNotice := where $active "Params.severity" "=" "notice" -}} +{{ $isDisrupted := where $active "Params.severity" "=" "disrupted" -}} +{{ $isDown := where $active "Params.severity" "=" "down" -}} +{{ $shield_prefix := .Site.Title -}} +{{ $status_text := T "thisIsOk" -}} +{{ $status_color := .Site.Params.ok -}} +{{ if $isDown -}} + {{ $status_text = T "thisIsDown" -}} + {{ $status_color = .Site.Params.down -}} +{{ else if $isDisrupted -}} + {{ $status_text = T "thisIsDisrupted" -}} + {{ $status_color = .Site.Params.disrupted -}} +{{ else if $isNotice -}} + {{ $status_text = T "thisIsNotice" -}} + {{ $status_color = .Site.Params.notice -}} +{{ end -}} +{{ $text_padding := 1 -}} +{{ $left_text_lenght := $shield_prefix | strings.RuneCount -}} +{{ $right_text_length := $status_text | strings.RuneCount -}} +{{ $left_text_padding := $text_padding -}} +{{ $right_box_padding := add (mul $text_padding 2) $left_text_lenght -}} +{{ $right_text_padding := add $right_box_padding $text_padding -}} +{{ $total_width := add (mul $text_padding 4) (add $left_text_lenght $right_text_length) -}} + + + + + + + + + + + + + + {{ $shield_prefix }} + {{ $shield_prefix }} + {{ $status_text }} + {{ $status_text }} + + -- cgit v1.2.3-70-g09d2 From 9c96914679f1ff1df0f14f2ba629a93ae2013843 Mon Sep 17 00:00:00 2001 From: Mantas VilĨinskas Date: Sat, 2 Oct 2021 17:23:45 +0300 Subject: fix #208 - /affected/gateway/index.svg shows component status --- exampleSite/config.yml | 2 +- layouts/_default/list.svg | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'layouts/_default') diff --git a/exampleSite/config.yml b/exampleSite/config.yml index 85de8ab..b270320 100644 --- a/exampleSite/config.yml +++ b/exampleSite/config.yml @@ -393,7 +393,6 @@ outputs: - html - json - rss - - svg home: - html - json @@ -403,6 +402,7 @@ outputs: - html - json - rss + - svg outputFormats: svg: diff --git a/layouts/_default/list.svg b/layouts/_default/list.svg index dbd6483..73b480f 100644 --- a/layouts/_default/list.svg +++ b/layouts/_default/list.svg @@ -1,9 +1,9 @@ -{{ $incidents := where .Site.RegularPages "Params.section" "issue" -}} +{{ $incidents := where .RegularPages "Params.section" "issue" -}} {{ $active := where $incidents "Params.resolved" "=" false -}} {{ $isNotice := where $active "Params.severity" "=" "notice" -}} {{ $isDisrupted := where $active "Params.severity" "=" "disrupted" -}} {{ $isDown := where $active "Params.severity" "=" "down" -}} -{{ $shield_prefix := .Site.Title -}} +{{ $shield_prefix := .Title -}} {{ $status_text := T "thisIsOk" -}} {{ $status_color := .Site.Params.ok -}} {{ if $isDown -}} -- cgit v1.2.3-70-g09d2