hi there! i’m reaching out for help because one of my most requested features on the theme/project cState—an open source status page of mine
i’ll try to give as much context as possible with examples (and links) which I hope will suffice
what the project is
there are issues in content/issues
like gateway-latency.md
or whatnot. Each issue has a markup that looks like this:
---
title: Issues Sending DMs
date: 2018-01-17 16:24:00
resolved: true
resolvedWhen: 2018-01-17 16:58:00
# Possible severity levels: down, disrupted, notice
severity: disrupted
affected:
- API
section: issue
---
*Investigating* - We're aware of an issue affecting sending DMs and viewing online friends. We're online and working on a resolution.
every issue must have a section of “issue” and all the other outlined fields. what’s particularly going to be relevant is the “severity” & “affected” ones
how the current system works
this is for the homepage (see: https://cstate.mnts.lt) where we see what issues aren’t resolved and therefore changing the status from OK to disrupted or whatever
we first get the posts and filter out which, again, aren’t resolved
we also want to get each post’s severity (and this is kind of where the problem comes in)
{{ $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" }}
let’s say there are 2 issues. one is just maintenance, but the other is big major downtime. you’d want to show that there is major downtime instead of just maintenance (even though there’s both) because downtime is more relevant than maintenance, the severity is higher:
{{ $activeComponentIssues := where $active "Params.affected" "intersect" (slice .name) }}
{{ $thisIsNotice := where $activeComponentIssues "Params.severity" "=" "notice" }}
{{ $thisIsDisrupted := where $activeComponentIssues "Params.severity" "=" "disrupted" }}
{{ $thisIsDown := where $activeComponentIssues "Params.severity" "=" "down" }}
<span class="component-status">
{{ if $thisIsDown }}
<b>{{ T "thisIsDown" }}</b>
{{ else }}
{{ if $thisIsDisrupted }}
<b>{{ T "thisIsDisrupted" }}</b>
{{ else }}
{{ if $thisIsNotice }}
<b>{{ T "thisIsNotice" }}</b>
{{ else }}
{{ T "thisIsOk" }}
{{ end }}{{ end }}{{ end }}
</span>
that beautiful code shows either “Operational”, “Disrupted”, “Down” or “Maintenance” next to the name of a system/compoenent, like the Gateway, API< etc.
adding multiple severities
issue link: https://github.com/cstate/cstate/issues/47
let’s say the issues now look like this:
severity: disrupted # might be worth keeping?
affected:
- API: disrupted
- Web: down
then we want to show on the homepage for all systems, either:
- one of them is completely down => we’re having major issues
- one of them is disrupted, but neither is down => we have disruptions
- there’s maintenance, but no disruptions nor downtime => read announcement
- and finally if there’s no active issues then => we’re all doing ok everything is fine
so in each issue you have to check if ANY system is “down”, “disrupted” or on “notice”.
that means, like in my example, the summry would display: “We’re having major issues.”
But all of the affected systems should be shown correctly, as in:
- Gateway: operational (not shown here at all)
- API: disrupted
- Web: down
the way that this currently works would make it:
severity: down
affected:
- API
- Web
- gateway: operational
- API: down
- Web: down
closing notes
long post but I hope to find some insight or answers
for those who read everything - thank you! a solution would be awesome, of course, but any support/thoughts/opinions/hopes/dreams is/are welcome