From 78b3b15525d756c5b522b07e98049dcb9c024a6a Mon Sep 17 00:00:00 2001 From: Kevin Hamer Date: Sun, 11 Oct 2020 17:12:45 -0400 Subject: Add .relative-time class and JS logic --- layouts/issues/small.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'layouts/issues') diff --git a/layouts/issues/small.html b/layouts/issues/small.html index 6ed2cce..6112e46 100644 --- a/layouts/issues/small.html +++ b/layouts/issues/small.html @@ -7,8 +7,8 @@ {{ if .Params.informational }} - - + + {{ if .Site.Params.dateFormat }} {{ .Date.Format .Site.Params.dateFormat }} {{ else }} @@ -21,9 +21,9 @@ {{ .Summary | truncate 200 }} - + {{ else if .Params.Resolved }} - + {{ if .Site.Params.dateFormat }} {{ .Date.Format .Site.Params.dateFormat }} {{ else }} @@ -67,7 +67,7 @@ {{ end }} {{ else }} - + {{ if .Site.Params.dateFormat }} {{ .Date.Format .Site.Params.dateFormat }} {{ else }} @@ -82,17 +82,17 @@ {{ if eq .Params.severity "notice" }} - ◆ + ◆ {{ T "downtimeOngoing" }} {{ else }} {{ if eq .Params.severity "down" }} - ■ + ■ {{ else if eq .Params.severity "disrupted" }} - ▲ + ▲ {{ else }} - ◆ + ◆ {{ end }} {{ T "downtimeOngoing" }} -- cgit v1.2.3-70-g09d2 From f5e7f886e79241f002cf28a1c8018d81fbd2ee57 Mon Sep 17 00:00:00 2001 From: Kevin Hamer Date: Sun, 11 Oct 2020 17:28:37 -0400 Subject: add .Site.Params.useRelativeTime --- exampleSite/config.yml | 9 +++++++-- layouts/issues/small.html | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'layouts/issues') diff --git a/exampleSite/config.yml b/exampleSite/config.yml index 85665f6..967505f 100644 --- a/exampleSite/config.yml +++ b/exampleSite/config.yml @@ -124,7 +124,7 @@ params: - name: North Coast description: The main servers are located here. closed: true - - name: East Coast + - name: East Coast - name: Uncategorized untitled: true @@ -157,6 +157,11 @@ params: dateFormat: January 2, 2006 at 3:04 PM shortDateFormat: 15:04 — Jan 2 + # If enabled, will display relative times for incident history and summaries instead of using dateFormat. + # + # Default: true + useRelativeTime: true + # What header design should we use? # # Default: true @@ -277,7 +282,7 @@ params: # Default: `true` # BOOLEAN; `true`, `false` alwaysKeepBrandColor: true - + # Introduced in v4.0.1 for consistent # site title text color. # diff --git a/layouts/issues/small.html b/layouts/issues/small.html index 6112e46..79db524 100644 --- a/layouts/issues/small.html +++ b/layouts/issues/small.html @@ -8,7 +8,7 @@ {{ if .Params.informational }} - + {{ if .Site.Params.dateFormat }} {{ .Date.Format .Site.Params.dateFormat }} {{ else }} @@ -23,7 +23,7 @@ {{ else if .Params.Resolved }} - + {{ if .Site.Params.dateFormat }} {{ .Date.Format .Site.Params.dateFormat }} {{ else }} @@ -67,7 +67,7 @@ {{ end }} {{ else }} - + {{ if .Site.Params.dateFormat }} {{ .Date.Format .Site.Params.dateFormat }} {{ else }} -- cgit v1.2.3-70-g09d2 From 925027e85b74a77e06448be5baa6053f1222fb78 Mon Sep 17 00:00:00 2001 From: Mantas Vilčinskas Date: Wed, 24 Feb 2021 13:48:14 +0200 Subject: Doc updates, bugfixes, add rel time to NCMS --- exampleSite/config.yml | 35 ++++- .../issues/2019-10-08-testing-new-pipeline.md | 2 +- .../issues/2020-06-13-maintenance-window.md | 13 -- .../issues/2021-02-13-maintenance-window.md | 14 ++ i18n/tl.yaml | 159 +++++++++++++++++++++ i18n/tl.yml | 159 --------------------- layouts/index.json | 4 +- layouts/issues/small.html | 9 +- layouts/partials/js.html | 18 ++- layouts/partials/meta.html | 2 +- static/admin/config.yml | 22 ++- static/admin/index.html | 2 +- 12 files changed, 239 insertions(+), 200 deletions(-) delete mode 100644 exampleSite/content/issues/2020-06-13-maintenance-window.md create mode 100644 exampleSite/content/issues/2021-02-13-maintenance-window.md create mode 100644 i18n/tl.yaml delete mode 100644 i18n/tl.yml (limited to 'layouts/issues') diff --git a/exampleSite/config.yml b/exampleSite/config.yml index 49faaee..7dc5972 100644 --- a/exampleSite/config.yml +++ b/exampleSite/config.yml @@ -161,17 +161,44 @@ params: # # dateFormat Default: "January 2, 2006 at 3:04 PM" # shortDateFormat Default: "15:04 — Jan 2" - dateFormat: January 2, 2006 at 3:04 PM - shortDateFormat: 15:04 — Jan 2 + dateFormat: January 2, 2006 at 3:04 PM UTC + shortDateFormat: 15:04 UTC — Jan 2 - # If enabled, will display relative times for incident history and summaries instead of using dateFormat. + # Should relative time (x min ago) be used? + # + # IMPORTANT: In the frontmatter, the dates MUST be in + # the UTC time zone for this to work preperly. If you + # use Netlify CMS, all good — the CMS picks UTC time + # by default. Otherwise, there may be very inaccurate + # times if multiple time zones are in your issue files. + # + # FOR YOUR CONSIDERATION: This feature was introduced in + # v5. It may be a breaking change in the case when you + # wish to use relative time but old issues do not have + # UTC time (and therefore are out of sync by ±24 hours) + # + # Read the wiki for more: + # https://github.com/cstate/cstate/wiki/Customization#time + # + # If enabled, will display relative times in places like + # the incident history and summaries instead of using + # dateFormat and shortDateFormat (except for if you use + # the old shortcode). # # Default: `true` + # BOOLEAN; `true`, `false` useRelativeTime: true - + # If enabled, doesn't show seconds on relative times. # + # With option ON (true): + # "Last checked <1 min ago" + # + # With option OFF (false; default): + # "Last checked 20s ago" + # # Default: `false` + # BOOLEAN; `true`, `false` skipSeconds: false # What header design should we use? diff --git a/exampleSite/content/issues/2019-10-08-testing-new-pipeline.md b/exampleSite/content/issues/2019-10-08-testing-new-pipeline.md index 4f139de..4e9da4f 100644 --- a/exampleSite/content/issues/2019-10-08-testing-new-pipeline.md +++ b/exampleSite/content/issues/2019-10-08-testing-new-pipeline.md @@ -1,7 +1,7 @@ --- title: New Pipeline Rollout date: 2019-10-05 16:24:00 -resolved: false +resolved: true resolvedWhen: 2019-10-05 16:58:00 # Possible severity levels: down, disrupted, notice severity: disrupted diff --git a/exampleSite/content/issues/2020-06-13-maintenance-window.md b/exampleSite/content/issues/2020-06-13-maintenance-window.md deleted file mode 100644 index 404ccc4..0000000 --- a/exampleSite/content/issues/2020-06-13-maintenance-window.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Maintenance Window -date: 2020-06-13 15:54:00 -resolved: true -resolvedWhen: 2020-06-13 16:54:00 -# Possible severity levels: down, disrupted, notice -severity: disrupted -affected: - - API -section: issue ---- - -*Just began* - We're currently shutting down the network. {{< track "2018-06-13 15:54:00" >}} diff --git a/exampleSite/content/issues/2021-02-13-maintenance-window.md b/exampleSite/content/issues/2021-02-13-maintenance-window.md new file mode 100644 index 0000000..00b4765 --- /dev/null +++ b/exampleSite/content/issues/2021-02-13-maintenance-window.md @@ -0,0 +1,14 @@ +--- +title: Maintenance Window +#date: 24 Feb 21 12:35 +0200 +date: 2021-02-24 10:35:00 +resolved: false +resolvedWhen: 2021-02-24 12:10:00 +# Possible severity levels: down, disrupted, notice +severity: disrupted +affected: + - API +section: issue +--- + +*Just began* - We're currently shutting down the network. {{< track "2018-06-13 12:54:00" >}} diff --git a/i18n/tl.yaml b/i18n/tl.yaml new file mode 100644 index 0000000..1600abc --- /dev/null +++ b/i18n/tl.yaml @@ -0,0 +1,159 @@ +# Tagalog language file for cState +# Version 4.4 + +- id: languageCode + translation: tl +- id: languageName + translation: Tagalog +- id: languageNameShort + translation: TGL + +## +## INDEX.HTML +## + +# Summary status message +- id: isDown + translation: Nakakaranas ng malaking isyu +- id: isDisrupted + translation: Nakakaranas ng pagkagambala +- id: isNotice + translation: Pakiusap paki-basa ang anunsyo +- id: isOk + translation: Lahat ng sistema ay gumagana + +# No JS warning +- id: noScriptingIntro + translation: Ay! Mukhang naka-diseybol ang Javascript mo. Pakiusap +- id: noScriptingLink + translation: i-eneybol ang skripting +- id: noScriptingOutro + translation: para mas maganda ang iyong eksperyensha sa websayt na ito. +- id: thisIsDown + translation: Hindi gumagana +- id: thisIsDisrupted + translation: May pagkagambala +- id: thisIsNotice + translation: Pagpapanatili +- id: thisIsOk + translation: Gumagana + +# "Last checked" + "just now" +- id: lastChecked + translation: Huling na-chek +- id: justNow + translation: ngayon lamang +- id: someTimeAgo + translation: nakaraan + +# Example usage: `5` + `years` +# Final result: 'Last checked 5 years ago' +# Number goes before string +# Use short variants until months +- id: yearsAgo + translation: mga taon +- id: monthsAgo + translation: mga buwan +- id: daysAgo + translation: a +- id: hoursAgo + translation: o +- id: minsAgo + translation: min +- id: secondsAgo + translation: s + +- id: autoRefreshNotice + translation: Susubukan naming mag-refresh bawat 5 min + +# Incidents +- id: incidents + translation: Mga insidente +- id: incidentHistory + translation: Kasaysayan ng mga insidente + +- id: resolved + translation: Na-resolba # if it's less than a min +- id: inUnderAMinute + translation: sa ilalim ng isang minuto # continuing the last string +- id: resolvedAfter + translation: Na-resolba pagkatapos ng # + 19 min +- id: ofDowntime + translation: ng dawntaym + +- id: downtimeOngoing + translation: Ang isyung ito ay hindi pa na-reresolba + + +- id: calmBeforeTheStorm + translation: Ito ba ang katahimikan bago ang bagyo? +- id: noIncidentsDesc + translation: Ang status peyg na ito ay walang na-itala na insidente. This status page has no logged incidents. This may be because the status page owner (or owners) have recently set up their status page, have had no downtime, or have not logged any downtime. + + +- id: continueReading + translation: Ipagpatuloy ang pagbabasa +- id: prev + translation: Dati +- id: next + translation: Susunod + +## +## OTHER +## + +- id: goBack + translation: Bumalik sa +- id: backToTop + translation: Bumalik sa ibabaw +- id: poweredBy + translation: Pinapatakbo ng + +- id: notFound + translation: Walang dito. +- id: notFoundText + translation: Ito'y maaaring problema sa amin. Maaring may nilipat kami na resors at ngayon ay nawala na ito. Posible din na ang resors na nais mong makita ay walang laman. Pero, ayos lang ba sa iyo ang dobol-check sa link? + +- id: rss + translation: Mag-subskrayb sa pamamagitan ng RSS +- id: toAllUpdates + translation: sa lahat ng mga updeyt +- id: or + translation: o +- id: onlyThisFeed + translation: sa feed lamang na ito + +## +## v3 +## +- id: entries + translation: mga entri +- id: newestToOldest + translation: mula sa pinaka-bago hanggang sa pinaka-luma + +## +## v4 +## +- id: notFoundAffected + translation: Mukang ang sistemang ito ay hindi na nag-eesist o di kailan mang nagkaroon ng na-rekord na dawntaym. + +## +## v4.1 +## + +- id: averageSystemsDowntime + translation: Kamakailan, base sa iyong average na data, mukang ang sistemang ito ay nag-dawn ng mga +- id: averageSystemsDowntimeSecondPart + translation: minuto nang paisa-isa. + + +## +## v4.4 +## + +- id: in + translation: sa +- id: weeksAgo + translation: " l" +- id: yearAgo + translation: " taon" diff --git a/i18n/tl.yml b/i18n/tl.yml deleted file mode 100644 index 1600abc..0000000 --- a/i18n/tl.yml +++ /dev/null @@ -1,159 +0,0 @@ -# Tagalog language file for cState -# Version 4.4 - -- id: languageCode - translation: tl -- id: languageName - translation: Tagalog -- id: languageNameShort - translation: TGL - -## -## INDEX.HTML -## - -# Summary status message -- id: isDown - translation: Nakakaranas ng malaking isyu -- id: isDisrupted - translation: Nakakaranas ng pagkagambala -- id: isNotice - translation: Pakiusap paki-basa ang anunsyo -- id: isOk - translation: Lahat ng sistema ay gumagana - -# No JS warning -- id: noScriptingIntro - translation: Ay! Mukhang naka-diseybol ang Javascript mo. Pakiusap -- id: noScriptingLink - translation: i-eneybol ang skripting -- id: noScriptingOutro - translation: para mas maganda ang iyong eksperyensha sa websayt na ito. -- id: thisIsDown - translation: Hindi gumagana -- id: thisIsDisrupted - translation: May pagkagambala -- id: thisIsNotice - translation: Pagpapanatili -- id: thisIsOk - translation: Gumagana - -# "Last checked" + "just now" -- id: lastChecked - translation: Huling na-chek -- id: justNow - translation: ngayon lamang -- id: someTimeAgo - translation: nakaraan - -# Example usage: `5` + `years` -# Final result: 'Last checked 5 years ago' -# Number goes before string -# Use short variants until months -- id: yearsAgo - translation: mga taon -- id: monthsAgo - translation: mga buwan -- id: daysAgo - translation: a -- id: hoursAgo - translation: o -- id: minsAgo - translation: min -- id: secondsAgo - translation: s - -- id: autoRefreshNotice - translation: Susubukan naming mag-refresh bawat 5 min - -# Incidents -- id: incidents - translation: Mga insidente -- id: incidentHistory - translation: Kasaysayan ng mga insidente - -- id: resolved - translation: Na-resolba # if it's less than a min -- id: inUnderAMinute - translation: sa ilalim ng isang minuto # continuing the last string -- id: resolvedAfter - translation: Na-resolba pagkatapos ng # + 19 min -- id: ofDowntime - translation: ng dawntaym - -- id: downtimeOngoing - translation: Ang isyung ito ay hindi pa na-reresolba - - -- id: calmBeforeTheStorm - translation: Ito ba ang katahimikan bago ang bagyo? -- id: noIncidentsDesc - translation: Ang status peyg na ito ay walang na-itala na insidente. This status page has no logged incidents. This may be because the status page owner (or owners) have recently set up their status page, have had no downtime, or have not logged any downtime. - - -- id: continueReading - translation: Ipagpatuloy ang pagbabasa -- id: prev - translation: Dati -- id: next - translation: Susunod - -## -## OTHER -## - -- id: goBack - translation: Bumalik sa -- id: backToTop - translation: Bumalik sa ibabaw -- id: poweredBy - translation: Pinapatakbo ng - -- id: notFound - translation: Walang dito. -- id: notFoundText - translation: Ito'y maaaring problema sa amin. Maaring may nilipat kami na resors at ngayon ay nawala na ito. Posible din na ang resors na nais mong makita ay walang laman. Pero, ayos lang ba sa iyo ang dobol-check sa link? - -- id: rss - translation: Mag-subskrayb sa pamamagitan ng RSS -- id: toAllUpdates - translation: sa lahat ng mga updeyt -- id: or - translation: o -- id: onlyThisFeed - translation: sa feed lamang na ito - -## -## v3 -## -- id: entries - translation: mga entri -- id: newestToOldest - translation: mula sa pinaka-bago hanggang sa pinaka-luma - -## -## v4 -## -- id: notFoundAffected - translation: Mukang ang sistemang ito ay hindi na nag-eesist o di kailan mang nagkaroon ng na-rekord na dawntaym. - -## -## v4.1 -## - -- id: averageSystemsDowntime - translation: Kamakailan, base sa iyong average na data, mukang ang sistemang ito ay nag-dawn ng mga -- id: averageSystemsDowntimeSecondPart - translation: minuto nang paisa-isa. - - -## -## v4.4 -## - -- id: in - translation: sa -- id: weeksAgo - translation: " l" -- id: yearAgo - translation: " taon" diff --git a/layouts/index.json b/layouts/index.json index 5c47558..b37af7a 100644 --- a/layouts/index.json +++ b/layouts/index.json @@ -5,8 +5,8 @@ {{ $isDown := where $active "Params.severity" "=" "down" }} { "is": "index", - "cStateVersion": "4.4", - "apiVersion": "1.0.0", + "cStateVersion": "5.0", + "apiVersion": "2.0", "title": "{{ .Site.Title }}", "languageCodeHTML": "{{ .Site.LanguageCode }}", "languageCode": "{{ T "languageCode" }}", diff --git a/layouts/issues/small.html b/layouts/issues/small.html index 79db524..531b47b 100644 --- a/layouts/issues/small.html +++ b/layouts/issues/small.html @@ -8,7 +8,7 @@ {{ if .Params.informational }} - + {{ if .Site.Params.dateFormat }} {{ .Date.Format .Site.Params.dateFormat }} {{ else }} @@ -23,7 +23,7 @@ {{ else if .Params.Resolved }} - + {{ if .Site.Params.dateFormat }} {{ .Date.Format .Site.Params.dateFormat }} {{ else }} @@ -65,9 +65,10 @@ {{ end }} {{ end }} - {{ else }} - + {{ else }} + + {{ if .Site.Params.dateFormat }} {{ .Date.Format .Site.Params.dateFormat }} {{ else }} diff --git a/layouts/partials/js.html b/layouts/partials/js.html index 8465483..d966643 100644 --- a/layouts/partials/js.html +++ b/layouts/partials/js.html @@ -3,11 +3,11 @@ * Dev toolset */ - console.log('cState v4.4 - https://github.com/cstate/cstate'); + console.log('cState v5 Dev - https://github.com/cstate/cstate'); document.getElementsByTagName('html')[0].className = 'js'; /** - * Make theme color pretty + * Change header color based on status */ if (document.body.className === 'change-header-color') { @@ -43,6 +43,7 @@ /** * Returns a relative date string for the given date. */ + function timeSince(date) { var seconds = Math.floor((new Date() - date) / 1000); @@ -78,6 +79,7 @@ * Changes elements with the class 'relative-time' into relative times and * moves the timestamp to a title attribute tooltip. */ + function updateRelativeTimes() { var elements = document.querySelectorAll('.relative-time'); for (var i = 0; i < elements.length; i++) { @@ -95,21 +97,17 @@ element.innerHTML = html.trim(); } } + updateRelativeTimes(); - setInterval(updateRelativeTimes, 5000); - /** - * Reload homepage after 290 seconds. - */ - if (document.querySelector('body.status-homepage')) { - setTimeout(location.reload, 290000) - } + // Update "time since" feature every 5s + setInterval(updateRelativeTimes, 5000); {{ if ne .Site.Params.googleAnalytics "UA-00000000-1" }} - + +