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/partials/index/summary.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'layouts/partials/index') diff --git a/layouts/partials/index/summary.html b/layouts/partials/index/summary.html index de6bceb..dcf753c 100644 --- a/layouts/partials/index/summary.html +++ b/layouts/partials/index/summary.html @@ -20,5 +20,5 @@ {{ end }}{{ end }}{{ end }} -
- \ No newline at end of file +
+ -- cgit v1.2.3-70-g09d2 From 656f716ecb87ac563e1566592472a65db7019409 Mon Sep 17 00:00:00 2001 From: Kevin Hamer Date: Sun, 11 Oct 2020 17:18:40 -0400 Subject: fix IE bug; rename 'data-prefix' to 'data-time-prefix' and add unused 'data-time-suffix' --- layouts/partials/index/summary.html | 2 +- layouts/partials/js.html | 34 +++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 16 deletions(-) (limited to 'layouts/partials/index') diff --git a/layouts/partials/index/summary.html b/layouts/partials/index/summary.html index dcf753c..41f285b 100644 --- a/layouts/partials/index/summary.html +++ b/layouts/partials/index/summary.html @@ -20,5 +20,5 @@ {{ end }}{{ end }}{{ end }} -
+
diff --git a/layouts/partials/js.html b/layouts/partials/js.html index 7971bc5..c4c5a85 100644 --- a/layouts/partials/js.html +++ b/layouts/partials/js.html @@ -75,26 +75,30 @@ * moves the timestamp to a title attribute tooltip. */ function updateRelativeTimes() { - document.querySelectorAll('.relative-time') - .forEach(function(element) { - var time = Date.parse(element.getAttribute('title')); - var html = element.getAttribute('data-prefix') || ''; - if (!time) { - time = element.innerText; - element.setAttribute('title', time || new Date); - html += '{{ T "justNow" }}'; - } else { - html += timeSince(time) + ' {{ T "someTimeAgo" }}'; - } - element.innerHTML = html.trim(); - }) + var elements = document.querySelectorAll('.relative-time'); + for (var i = 0; i < elements.length; i++) { + var element = elements[i]; + var time = Date.parse(element.getAttribute('title')); + var html = element.getAttribute('data-time-prefix') || ''; + if (!time) { + time = element.innerText; + element.setAttribute('title', time || new Date); + html += '{{ T "justNow" }}'; + } else { + html += timeSince(time) + ' {{ T "someTimeAgo" }}'; + } + html += element.getAttribute('data-time-suffix') || ''; + element.innerHTML = html.trim(); + } } updateRelativeTimes(); setInterval(updateRelativeTimes, 5000); - // Reload homepage eevery 290 seconds + /** + * Reload homepage after 290 seconds. + */ if (document.querySelector('body.status-homepage')) { - setInterval(location.reload, 290000) + setTimeout(location.reload, 290000) } -- cgit v1.2.3-70-g09d2 From d64bfe770d5ccb46c6ca7fb07c90a1ce03b40f13 Mon Sep 17 00:00:00 2001 From: Mantas VilĨinskas Date: Sat, 6 Mar 2021 16:01:11 +0200 Subject: fix #101 - add category status, #161 ref in config.yml --- exampleSite/config.yml | 8 ++- .../issues/2018-05-25-us-east-conn-issues.md | 2 +- .../issues/2021-02-13-maintenance-window.md | 4 +- layouts/partials/index/components.html | 64 +++++++++++++++++----- layouts/partials/js.html | 12 ++++ layouts/partials/meta.html | 43 ++++++++++----- 6 files changed, 100 insertions(+), 33 deletions(-) (limited to 'layouts/partials/index') diff --git a/exampleSite/config.yml b/exampleSite/config.yml index ee52734..1d3149d 100644 --- a/exampleSite/config.yml +++ b/exampleSite/config.yml @@ -138,26 +138,30 @@ params: # because you need to set an 'Uncategorized' category. # Or it can be used alongside other categories. # + # These are case sensitive. + # # For help, see the wiki: # https://github.com/cstate/cstate/wiki/Customization categories: - name: North Coast description: The main servers are located here. closed: true - - name: East Coast + - name: Empty Category - name: Uncategorized untitled: true # These are your systems. Change them to # change the amount of components. # + # These are case sensitive. + # # For help, see the wiki: # https://github.com/cstate/cstate/wiki/Customization systems: - name: Gateway category: North Coast - name: Backup Gateway - category: East Coast + category: North Coast - name: API description: The guts of the application. category: Uncategorized diff --git a/exampleSite/content/issues/2018-05-25-us-east-conn-issues.md b/exampleSite/content/issues/2018-05-25-us-east-conn-issues.md index 1b87285..8d56cf2 100644 --- a/exampleSite/content/issues/2018-05-25-us-east-conn-issues.md +++ b/exampleSite/content/issues/2018-05-25-us-east-conn-issues.md @@ -1,7 +1,7 @@ --- title: US East Connection Issues date: 2018-04-25 04:13:00 -resolved: false +resolved: true resolvedWhen: 2018-04-25 04:13:59 # Possible severity levels: down, disrupted, notice severity: down diff --git a/exampleSite/content/issues/2021-02-13-maintenance-window.md b/exampleSite/content/issues/2021-02-13-maintenance-window.md index 00b4765..d6c8b14 100644 --- a/exampleSite/content/issues/2021-02-13-maintenance-window.md +++ b/exampleSite/content/issues/2021-02-13-maintenance-window.md @@ -5,9 +5,9 @@ date: 2021-02-24 10:35:00 resolved: false resolvedWhen: 2021-02-24 12:10:00 # Possible severity levels: down, disrupted, notice -severity: disrupted +severity: notice affected: - - API + - Gateway section: issue --- diff --git a/layouts/partials/index/components.html b/layouts/partials/index/components.html index 82964fe..acb1aa7 100644 --- a/layouts/partials/index/components.html +++ b/layouts/partials/index/components.html @@ -10,18 +10,8 @@ {{ $systems := .Site.Params.systems }} {{ $categories := .Site.Params.categories }} - - {{ range $categories }} -
+
{{ if not .untitled }}
@@ -42,6 +32,8 @@ {{ end }} + +
{{ else }} @@ -94,8 +86,54 @@ {{ end }}
{{ end }} -
+ + + + {{ end }} - + \ No newline at end of file diff --git a/layouts/partials/js.html b/layouts/partials/js.html index d966643..765e787 100644 --- a/layouts/partials/js.html +++ b/layouts/partials/js.html @@ -40,6 +40,18 @@ document.location.pathname = '/admin'; } + /** + * Category logic + */ + + function toggleCategoryHead(el) { + if (el.parentNode.className == 'category category--open category--titled') { + el.parentNode.className = 'category category--closed category--titled'; + } else { + el.parentNode.className = 'category category--open category--titled'; + } + } + /** * Returns a relative date string for the given date. */ diff --git a/layouts/partials/meta.html b/layouts/partials/meta.html index 283e840..dfb5a98 100644 --- a/layouts/partials/meta.html +++ b/layouts/partials/meta.html @@ -319,14 +319,23 @@ .status-notice .announcement-box { border-top: 0; } /** - * Dynamically show individual component statuses + * Dynamically show component statuses */ - .component-status { float: right; } - .component[data-status="ok"] .component-status { color: {{ .Site.Params.ok }}; } - .component[data-status="disrupted"] .component-status { color: {{ .Site.Params.disrupted }}; } - .component[data-status="down"] .component-status { color: {{ .Site.Params.down }}; } - .component[data-status="notice"] .component-status { color: {{ .Site.Params.notice }}; } + .category--open .category-status { display: none; } + .component-status, .category-status { float: right; } + .component[data-status="ok"] .component-status, + .category__head[data-status="ok"] .category-status + { color: {{ .Site.Params.ok }}; } + .component[data-status="disrupted"] .component-status, + .category__head[data-status="disrupted"] .category-status + { color: {{ .Site.Params.disrupted }}; } + .component[data-status="notice"] .component-status, + .category__head[data-status="notice"] .category-status + { color: {{ .Site.Params.notice }}; } + .component[data-status="down"] .component-status, + .category__head[data-status="down"] .category-status + { color: {{ .Site.Params.down }}; } /** * Responsiveness @@ -386,15 +395,19 @@ .error { color: #ff4242; } .warning {color: #ffde7f; } .ok { color: #7fff7f; } - - .component[data-status="ok"] - .component-status { color: #7fff7f; } - .component[data-status="disrupted"] - .component-status { color: #ffde7f; } - .component[data-status="notice"] - .component-status { color: #83a4e8; } - .component[data-status="down"] - .component-status { color: #ff8181; } + + .component[data-status="ok"] .component-status, + .category__head[data-status="ok"] .category-status + { color: #7fff7f; } + .component[data-status="disrupted"] .component-status, + .category__head[data-status="disrupted"] .category-status + { color: #ffde7f; } + .component[data-status="notice"] .component-status, + .category__head[data-status="notice"] .category-status + { color: #83a4e8; } + .component[data-status="down"] .component-status, + .category__head[data-status="down"] .category-status + { color: #ff8181; } } {{ end }} -- cgit v1.2.3-70-g09d2