aboutsummaryrefslogtreecommitdiff
path: root/layouts/_default/list.html
blob: 8d80798738d510533375a598e765c57d0baa6ab9 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{{ partial "meta" . }}
{{ $title := .Title }}

  <body class="default list">
    <header>
      <div class="contain">
        <a href="{{ .Site.BaseURL }}">← {{ T "goBack" }} <em>{{ .Site.Title }}</em></a>
        <div class="padding"></div>
        <div class="padding"></div>

        <h1 class="clean">{{ $title }}</h1>

        {{ range .Site.Params.systems }}
          {{ if eq .name $title }}
            {{ with .description }}
              <p class="bold">{{ . }}</p>
            {{ end }}
          {{ 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>
        <hr class="clean">
      </div>
      {{ $incidents := .Pages }}
    </header>

    <div class="contain contain--more" id="incidents">
      {{ if not $incidents }}
        <div class="padding"></div>
        <h3>{{ T "calmBeforeTheStorm" }}</h3>
        <p>{{ T "noIncidentsDesc" }}</p>
        <div class="padding"></div>
        <div class="padding"></div>
        <div class="padding"></div>
      {{ else }}
        {{ $paginator := .Paginate $incidents .Site.Params.incidentPostsPerPage }}
        {{ range $paginator.Pages }}
          {{ .Render "small" }}
        {{ end }}

        <!-- If there are more than 2 pages, show pagination -->
        {{ if gt $paginator.TotalPages 1 }}
          <hr>

          <div class="center">
            {{ if $paginator.HasPrev }}
              <a href="{{ $paginator.Prev.URL }}#incidents">
                ⭠ &nbsp;
                {{ T "prev" }}
              </a>
            {{ else }}
              <span class="faded">
                ⭠ &nbsp;
                {{ T "prev" }}
              </span>
            {{ end }}


            &nbsp; &nbsp;
            {{ $paginator.PageNumber }}
            /
            {{ $paginator.TotalPages }}
            &nbsp; &nbsp;


            {{ if $paginator.HasNext }}
              <a href="{{ $paginator.Next.URL }}#incidents">
                {{ T "next" }} &nbsp;
                ⭢
              </a>
            {{ else }}
              <span class="faded">
                {{ T "next" }} &nbsp;
                ⭢
              </span>
            {{ end }}
          </div>
        {{ end }}
      {{ end }}
      <div class="padding"></div>
    </div>

    {{ partial "js" . }}
    {{ partial "footer" . }}
  </body>
</html>