Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cState v4.1 #93

Merged
merged 10 commits into from
Feb 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down
21 changes: 14 additions & 7 deletions exampleSite/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -316,3 +317,9 @@ outputs:
- html
- json
- rss
- svg

outputFormats:
svg:
isPlainText: true
mediaType: image/svg+xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ resolvedWhen: 2018-04-13 17:30:00
severity: down
affected:
- API
- Media Proxy
section: issue
---

Expand Down
18 changes: 17 additions & 1 deletion i18n/de.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# German language file for cState
# Version 3.0
# Version 4.1

- id: languageCode
translation: de
Expand Down Expand Up @@ -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.
12 changes: 11 additions & 1 deletion i18n/en.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# English language file for cState
# Version 3.0
# Official
# Version 4.1

- id: languageCode
translation: en
Expand Down Expand Up @@ -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.
14 changes: 12 additions & 2 deletions i18n/lt.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Lithuanian language file for cState
# Version 3.0
# Official
# Version 4.1

- id: languageCode
translation: en
Expand Down Expand Up @@ -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.
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.
28 changes: 28 additions & 0 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,34 @@ <h1 class="clean">{{ $title }}</h1>
{{ 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>
Expand Down
2 changes: 1 addition & 1 deletion layouts/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}",
Expand Down
44 changes: 44 additions & 0 deletions layouts/index.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions layouts/partials/index/components.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -98,4 +98,4 @@
</div>
{{ end }}

</div>
</div>
2 changes: 1 addition & 1 deletion layouts/partials/js.html
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/**
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}';
Expand Down
9 changes: 9 additions & 0 deletions static/admin/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down