blob: 957ca8fab895f82233c84c50c5b0e66d45225648 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
{{ partial "meta" . }}
{{ $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" }}
<body class="uptime status-{{ if $isDown }}down{{ else }}{{ if $isDisrupted}}disrupted{{ else }}{{ if $isNotice }}notice{{ else }}ok{{ end }}{{ end }}{{ end }} {{ if not .Site.Params.alwaysKeepBrandColor }}change-header-color{{ end }}">
{{ partial "header" . }}
<div class="padding"></div>
<div class="tabs">
<div class="contain tabs--inner">
<a href="/" class="tab tab--other">
Incidents
</a>
<a href="/stats" class="tab tab--current">
Uptime
</a>
</div>
</div>
{{ if not $active }}
<div class="contain">
<!-- still counting ALL the things -->
{{ $inactive := where $incidents "Params.resolved" "=" true }}
{{ range $inactive }}
{{ $t := (time .Params.ResolvedWhen) }}
{{ $timeDiff := (sub $t.Unix .Date.Unix) }}
{{ $diffInMin := (div $timeDiff 60) }}
{{ $.Scratch.Add "rackedUpDowntime" $timeDiff }}
{{ end }}
{{ $scratchValue := $.Scratch.Get "rackedUpDowntime" }}
<div class="stat">
{{ if gt $scratchValue 3600 }}
{{ $minutesForCalc := (mod (div $scratchValue 60) 60) }}
{{ div (sub (div $scratchValue 60) $minutesForCalc) 60 }}h
{{ $minutesForCalc }}m
{{ else }}
{{ $secsForCalc := (mod $scratchValue 60) }}
{{ div (sub $scratchValue $secsForCalc) 60 }}m
{{ $secsForCalc }}s
{{ end }} of downtime so far
<hr>
</div>
<p>
There have been {{ len $incidents }} incidents in total so far.
In total, this added up to {{ $scratchValue }}s (or {{ div $scratchValue 60 }} min) of downtime. Please note that the uptime statistics only counts resolved incidents, ongoing incidents are not included in these calculations.
</p>
</div>
{{ else }}
<div class="contain">
<p>Uptime stats are not available during an outage. Sorry!</p>
</div>
{{ end }}
{{ partial "js" . }}
{{ partial "footer" . }}
|