aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMantas Vilčinskas <11616378+mistermantas@users.noreply.github.com>2020-02-29 19:13:41 +0200
committerGitHub <noreply@github.com>2020-02-29 19:13:41 +0200
commitbe7208f99ef75d1ca01c7c17481e6b7bb2955410 (patch)
tree6cade4ae8f564783a6d9bf264c7da78fce0b7047
parentf55cffc137c01ccf1543d0b956d64c428be78405 (diff)
parent1316c50e547f99f8ae6629342be3d1fc9302f4b7 (diff)
#93 - cState v4.1
-rw-r--r--README.md1
-rw-r--r--exampleSite/config.yml21
-rw-r--r--exampleSite/content/issues/2018-04-13-unavailable-guilds-connection-issues.md1
-rw-r--r--i18n/de.yaml18
-rw-r--r--i18n/en.yaml12
-rw-r--r--i18n/lt.yaml14
-rw-r--r--layouts/_default/list.html28
-rw-r--r--layouts/index.json2
-rw-r--r--layouts/index.svg44
-rw-r--r--layouts/partials/index/components.html8
-rw-r--r--layouts/partials/js.html2
-rw-r--r--layouts/partials/meta.html2
-rw-r--r--static/admin/config.yml9
13 files changed, 144 insertions, 18 deletions
diff --git a/README.md b/README.md
index 442732b..0b8517a 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,7 @@
Some more examples from the internet:
* [Chocolatey](https://status.chocolatey.org/)
+* [tmw.media](https://status.tmw.media)
* [Proventa](https://status.proventa.io/) (German)
* [sr.ht](https://status.sr.ht/)
* [Content Ignite](https://status.contentignite.com/)
diff --git a/exampleSite/config.yml b/exampleSite/config.yml
index b384501..afb644b 100644
--- a/exampleSite/config.yml
+++ b/exampleSite/config.yml
@@ -219,16 +219,17 @@ params:
# name: Name
# link: https://example.com
- # Auto refresh the page
- # every ~5 min
+ # Disable complex server-side
+ # calculations that may impact
+ # your build performance
#
- # This does nothing but
- # refresh the page; it
- # does not send alerts!
+ # Disables math calculations
+ # for average downtime on
+ # systems ("/affected/") pages
#
- # Default: true
+ # Default: false
# BOOLEAN; `true`, `false`
- autoRefresh: true
+ disableComplexCalculations: false
# Incident posts shown
# in one page
@@ -316,3 +317,9 @@ outputs:
- html
- json
- rss
+ - svg
+
+outputFormats:
+ svg:
+ isPlainText: true
+ mediaType: image/svg+xml \ No newline at end of file
diff --git a/exampleSite/content/issues/2018-04-13-unavailable-guilds-connection-issues.md b/exampleSite/content/issues/2018-04-13-unavailable-guilds-connection-issues.md
index a5213d1..170bd1f 100644
--- a/exampleSite/content/issues/2018-04-13-unavailable-guilds-connection-issues.md
+++ b/exampleSite/content/issues/2018-04-13-unavailable-guilds-connection-issues.md
@@ -7,6 +7,7 @@ resolvedWhen: 2018-04-13 17:30:00
severity: down
affected:
- API
+ - Media Proxy
section: issue
---
diff --git a/i18n/de.yaml b/i18n/de.yaml
index 15a6153..7ff9a57 100644
--- a/i18n/de.yaml
+++ b/i18n/de.yaml
@@ -1,5 +1,5 @@
# German language file for cState
-# Version 3.0
+# Version 4.1
- id: languageCode
translation: de
@@ -125,7 +125,23 @@
##
## v3
##
+
- id: entries
translation: Einträge
- id: newestToOldest
translation: von alt nach neu
+
+##
+## v4
+##
+- id: notFoundAffected
+ translation: Es sieht so aus als würde dieses Dokument nicht existieren, oder es hatte noch nie einen aufgezeichneten Ausfall.
+
+##
+## v4.1
+##
+
+- id: averageSystemsDowntime
+ translation: Zurzeit, basierend auf Durchschnittsdaten, sieht es so aus, als ob dieses System für ungefähr
+- id: averageSystemsDowntimeSecondPart
+ translation: Minuten ausfällt. \ No newline at end of file
diff --git a/i18n/en.yaml b/i18n/en.yaml
index e417040..2826eca 100644
--- a/i18n/en.yaml
+++ b/i18n/en.yaml
@@ -1,5 +1,6 @@
# English language file for cState
-# Version 3.0
+# Official
+# Version 4.1
- id: languageCode
translation: en
@@ -137,3 +138,12 @@
##
- id: notFoundAffected
translation: It looks like this system either does not exist or has never had any recorded downtime.
+
+##
+## v4.1
+##
+
+- id: averageSystemsDowntime
+ translation: Recently, based on averages data, it looks like this system has gone down for about
+- id: averageSystemsDowntimeSecondPart
+ translation: minutes at a time.
diff --git a/i18n/lt.yaml b/i18n/lt.yaml
index bee5e28..5c1368d 100644
--- a/i18n/lt.yaml
+++ b/i18n/lt.yaml
@@ -1,5 +1,6 @@
# Lithuanian language file for cState
-# Version 3.0
+# Official
+# Version 4.1
- id: languageCode
translation: en
@@ -136,4 +137,13 @@
## v4
##
- id: notFoundAffected
- translation: Ši sistema neturi nė vieno įrašo. Arba neegzistuoja, arba nė vieną kartą nebuvo sutrukdyta jos veikla. \ No newline at end of file
+ translation: Ši sistema neturi nė vieno įrašo. Arba neegzistuoja, arba nė vieną kartą nebuvo sutrukdyta jos veikla.
+
+##
+## v4.1
+##
+
+- id: averageSystemsDowntime
+ translation: Pastaruoju metu, regis, šis komponentas sutrikimų metu neveikia apie
+- id: averageSystemsDowntimeSecondPart
+ translation: min.
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index b8c14c6..8d80798 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -18,6 +18,34 @@
{{ end }}
{{ end }}
+
+ <!-- Average downtime -->
+ {{ if not .Params.disableComplexCalculations }}
+ <p class="bold">
+ <em>
+ {{ $resolved := first 5 (where .Pages "Params.resolved" "=" true) }}
+
+ {{ if gt $resolved 0 }}
+ {{ $.Scratch.Set "counter" 0 }}
+ {{ range $resolved }}
+
+ {{ $t := (time .Params.ResolvedWhen) }}
+ {{ $timeDiff := (sub $t.Unix .Date.Unix) }}
+ {{ $diffInMin := (div $timeDiff 60) }}
+
+ {{ $.Scratch.Set "counter" (add ($.Scratch.Get "counter") $diffInMin) }}
+ {{ end }}
+
+ {{ T "averageSystemsDowntime" }}
+
+ {{ div ($.Scratch.Get "counter") (len $resolved) }}
+ {{ T "averageSystemsDowntimeSecondPart" }}
+ {{ end }}
+ </em>
+ </p>
+ {{ end }}
+
+
<small class="faded">{{ len .Pages }} {{ T "entries" }}, {{ T "newestToOldest" }}</small>
<div class="padding"></div>
diff --git a/layouts/index.json b/layouts/index.json
index ce40383..922137a 100644
--- a/layouts/index.json
+++ b/layouts/index.json
@@ -5,7 +5,7 @@
{{ $isDown := where $active "Params.severity" "=" "down" }}
{
"is": "index",
- "cStateVersion": "4.0.1",
+ "cStateVersion": "4.1.0",
"apiVersion": "1.0.0",
"title": "{{ .Site.Title }}",
"languageCodeHTML": "{{ .Site.LanguageCode }}",
diff --git a/layouts/index.svg b/layouts/index.svg
new file mode 100644
index 0000000..dbd6483
--- /dev/null
+++ b/layouts/index.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) -}}
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="2em" width="{{ $total_width }}ex" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
+ <linearGradient id="b" x2="0" y2="100%">
+ <stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
+ <stop offset="1" stop-opacity=".1"/>
+ </linearGradient>
+ <clipPath id="a">
+ <rect width="100%" height="100%" rx="3" fill="#fff"/>
+ </clipPath>
+ <g clip-path="url(#a)" fill="#fff" >
+ <rect x="0" y="0" width="100%" height="100%" fill="#555" />
+ <rect x="{{ $right_box_padding }}ex" y="0" height="100%" width="100%" fill="{{ $status_color }}"/>
+ <rect x="0" y="0" width="100%" height="100%" fill="url(#b)"/>
+
+ <text x="{{ $left_text_padding }}ex" y="15" fill="#010101" fill-opacity=".3">{{ $shield_prefix }}</text>
+ <text x="{{ $left_text_padding }}ex" y="14">{{ $shield_prefix }}</text>
+ <text x="{{ $right_text_padding }}ex" y="15" fill="#010101" fill-opacity=".3">{{ $status_text }}</text>
+ <text x="{{ $right_text_padding }}ex" y="14">{{ $status_text }}</text>
+ </g>
+</svg>
diff --git a/layouts/partials/index/components.html b/layouts/partials/index/components.html
index 135349a..cfb1391 100644
--- a/layouts/partials/index/components.html
+++ b/layouts/partials/index/components.html
@@ -25,8 +25,8 @@
{{ if not .untitled }}
<div class="bold padding clicky category__head" onclick="toggleCategoryHead(this)">
<span class="hide-without-js">
- <span class="category__closed-marker">⯈</span>
- <span class="category__open-marker">⯆</span>
+ <span class="category__closed-marker">►</span>
+ <span class="category__open-marker">✕</span>
</span>
<b>
@@ -60,7 +60,7 @@
<div class="component" data-status="{{ if $thisIsDown }}down{{ else }}{{ if $thisIsDisrupted }}disrupted{{ else }}{{ if $thisIsNotice }}notice{{ else }}ok{{ end }}{{ end }}{{ end }}">
<a href="/affected/{{ .name | urlize }}" class="no-underline">
- {{ .name }}
+ {{ default .displayName .name }}
</a>
{{ with .description }}
@@ -98,4 +98,4 @@
</div>
{{ end }}
-</div> \ No newline at end of file
+</div>
diff --git a/layouts/partials/js.html b/layouts/partials/js.html
index 19e4a05..85f65f5 100644
--- a/layouts/partials/js.html
+++ b/layouts/partials/js.html
@@ -3,7 +3,7 @@
* Dev toolset
*/
- console.log('cState v4.0.1 - https://github.com/cstate/cstate');
+ console.log('cState v4.1.0 - https://github.com/cstate/cstate');
document.getElementsByTagName('html')[0].className = 'js';
/**
diff --git a/layouts/partials/meta.html b/layouts/partials/meta.html
index 6311441..9abb784 100644
--- a/layouts/partials/meta.html
+++ b/layouts/partials/meta.html
@@ -12,7 +12,7 @@
{{ range .AlternativeOutputFormats -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end -}}
- <meta name="generator" content="cState v4.0.1 - https://github.com/cstate/cstate">
+ <meta name="generator" content="cState v4.1.0 - https://github.com/cstate/cstate">
<meta name="theme-color" content="{{ .Site.Params.brand }}">
<script>
var themeBrandColor = '{{ .Site.Params.brand }}';
diff --git a/static/admin/config.yml b/static/admin/config.yml
index ffff761..98a6059 100644
--- a/static/admin/config.yml
+++ b/static/admin/config.yml
@@ -147,6 +147,15 @@ collections:
widget: 'string'
hint: 'Default: 15:04 — Jan 2. Hugo formatting docs: https://gohugo.io/functions/format/#hugo-date-and-time-templating-reference'
default: '15:04 — Jan 2'
+ # Design site title color toggle in v4.0.1
+ - label: 'Site title text color'
+ hint: 'This is irrelevant, if you use a logo in your header. Docs: https://github.com/cstate/cstate/wiki/Customization#site-title-text-color-v401'
+ name: 'headerTextColor'
+ widget: 'select'
+ default: 'white'
+ options:
+ - { label: "Black", value: "black" }
+ - { label: "White", value: "white" }
# Design toggles
- label: 'Use large header design'
name: 'useLargeHeaderDesign'