From 820e597d72e73bb431184f222f38c178fb2e55ee Mon Sep 17 00:00:00 2001 From: Tine Date: Thu, 29 Feb 2024 23:57:23 +0100 Subject: [PATCH] fix(index): bucket calculation --- internal/handlers/index.go | 4 ++-- web/static/css/tailwind.css | 8 ++++---- web/templates/pages/index.tmpl | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/handlers/index.go b/internal/handlers/index.go index 8d1f697..a3d9758 100644 --- a/internal/handlers/index.go +++ b/internal/handlers/index.go @@ -31,7 +31,7 @@ type History struct { } func getHour(date time.Time) string { - return date.UTC().Format("2006-01-02T15:04") + return date.UTC().Format("2006-01-02T15:04:05") } func getHistory(history []*models.MonitorHistory, period time.Duration, buckets int) *History { @@ -45,7 +45,7 @@ func getHistory(history []*models.MonitorHistory, period time.Duration, buckets } for _, _history := range history { - hour := getHour(_history.CreatedAt.Time.Truncate(time.Hour)) + hour := getHour(_history.CreatedAt.Time.Truncate(period)) // Skip if not part of the "buckets" if _, ok := historyMap[hour]; !ok { diff --git a/web/static/css/tailwind.css b/web/static/css/tailwind.css index 1a792d9..d318d87 100644 --- a/web/static/css/tailwind.css +++ b/web/static/css/tailwind.css @@ -900,9 +900,9 @@ video { background-color: rgb(243 244 246 / var(--tw-bg-opacity)); } -.bg-gray-400 { +.bg-gray-200 { --tw-bg-opacity: 1; - background-color: rgb(156 163 175 / var(--tw-bg-opacity)); + background-color: rgb(229 231 235 / var(--tw-bg-opacity)); } .bg-gray-50 { @@ -1612,9 +1612,9 @@ code { background-color: rgb(243 244 246 / var(--tw-bg-opacity)); } -.hover\:bg-gray-500:hover { +.hover\:bg-gray-300:hover { --tw-bg-opacity: 1; - background-color: rgb(107 114 128 / var(--tw-bg-opacity)); + background-color: rgb(209 213 219 / var(--tw-bg-opacity)); } .hover\:bg-green-500:hover { diff --git a/web/templates/pages/index.tmpl b/web/templates/pages/index.tmpl index 2fa2540..3c83fb9 100644 --- a/web/templates/pages/index.tmpl +++ b/web/templates/pages/index.tmpl @@ -96,7 +96,7 @@ {{ else if eq .Status "FAILURE" }} {{ else }} - + {{ end }}

{{ .Name }}

@@ -112,7 +112,7 @@ {{ else if eq . "FAILURE" }}
{{ else }} -
+
{{ end }} {{ end }}