From 86958c1d3620019e14f1362029789d010cb67596 Mon Sep 17 00:00:00 2001 From: Hunter Long Date: Wed, 12 Dec 2018 18:35:09 -0800 Subject: [PATCH] added 7 day uptime on index - JS updates --- core/services.go | 6 ++++++ source/js/main.js | 9 +++++++++ source/tmpl/index.gohtml | 10 +++++----- source/tmpl/settings.gohtml | 24 +++++++++++++----------- version.txt | 2 +- 5 files changed, 34 insertions(+), 17 deletions(-) diff --git a/core/services.go b/core/services.go index 9c2f42e6..d43f2683 100644 --- a/core/services.go +++ b/core/services.go @@ -131,6 +131,12 @@ func (s *Service) Online24() float32 { return s.OnlineSince(ago) } +// Online7Days returns the service's uptime percent within last 7 days +func (s *Service) Online7Days() float32 { + ago := time.Now().Add((-24 * 7) * time.Hour) + return s.OnlineSince(ago) +} + // OnlineSince accepts a time since parameter to return the percent of a service's uptime. func (s *Service) OnlineSince(ago time.Time) float32 { failed, _ := s.TotalFailuresSince(ago) diff --git a/source/js/main.js b/source/js/main.js index b6400637..07505c49 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -143,6 +143,15 @@ function PingAjaxChart(chart, service, start=0, end=9999999999, group="hour") { }); } +$('.confirm_btn').on('click', function() { + let msg = $(this).attr('data-msg'); + var r = confirm(msg); + if (r !== true) { + return false; + } + return true; +}); + $('.ajax_delete').on('click', function() { var r = confirm('Are you sure you want to delete?'); if (r !== true) { diff --git a/source/tmpl/index.gohtml b/source/tmpl/index.gohtml index c6aeb9b2..b587887b 100644 --- a/source/tmpl/index.gohtml +++ b/source/tmpl/index.gohtml @@ -62,18 +62,18 @@ {{end}}
-
- {{.Online24}}% - Online last 24 Hours -
{{.AvgTime}}ms Average Response
- {{.AvgUptime24}}% + {{.Online24}}% Uptime last 24 Hours
+
+ {{.Online7Days}}% + Uptime last 7 Days +
diff --git a/source/tmpl/settings.gohtml b/source/tmpl/settings.gohtml index 6325faa1..e1b3a23a 100644 --- a/source/tmpl/settings.gohtml +++ b/source/tmpl/settings.gohtml @@ -113,25 +113,27 @@
- You can Regenerate API Keys if you need to. + You can Regenerate API Keys if you need to.
-
- Export Settings - {{if .Domain}} - Authentication QR Code - {{end}} -
+ +

Additional Settings

+ +
+ Export Settings {{if .Domain}} + Authentication QR Code + {{end}} +
+ + {{if .Domain}}
Open in Statping App - {{end}} - - + {{end}} @@ -141,7 +143,7 @@

Enable Local Assets

- Customize your status page design by enabling local assets. This will create a 'assets' directory containing all CSS.

Enable Local Assets

+ Customize your status page design by enabling local assets. This will create a 'assets' directory containing all CSS.

Enable Local Assets

{{ else }} diff --git a/version.txt b/version.txt index e0d6b5ea..8c273553 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.80.0 \ No newline at end of file +0.80.1 \ No newline at end of file