added 7 day uptime on index - JS updates

pull/116/head
Hunter Long 2018-12-12 18:35:09 -08:00
parent 8f9d55f675
commit 86958c1d36
5 changed files with 34 additions and 17 deletions

View File

@ -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)

View File

@ -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) {

View File

@ -62,18 +62,18 @@
{{end}}</h4>
<div class="row stats_area mt-5 mb-5">
<div class="col-4">
<span class="lg_number">{{.Online24}}%</span>
Online last 24 Hours
</div>
<div class="col-4">
<span class="lg_number">{{.AvgTime}}ms</span>
Average Response
</div>
<div class="col-4">
<span class="lg_number">{{.AvgUptime24}}%</span>
<span class="lg_number">{{.Online24}}%</span>
Uptime last 24 Hours
</div>
<div class="col-4">
<span class="lg_number">{{.Online7Days}}%</span>
Uptime last 7 Days
</div>
</div>
</div>

View File

@ -113,10 +113,14 @@
<label for="api_secret" class="col-sm-3 col-form-label">API Secret</label>
<div class="col-sm-9">
<input type="text" class="form-control select-input" value="{{ .ApiSecret }}" id="api_secret" readonly>
<small class="form-text text-muted">You can <a href="/api/renew">Regenerate API Keys</a> if you need to.</small>
<small class="form-text text-muted">You can <a class="confirm_btn" data-msg="Are you sure you want to reset the API keys?" href="/api/renew">Regenerate API Keys</a> if you need to.</small>
</div>
</div>
</form>
<h3>Additional Settings</h3>
<div class="row">
<a href="/settings/export" class="btn btn-sm btn-secondary float-right">Export Settings</a>
{{if .Domain}}
@ -131,8 +135,6 @@
<a class="btn btn-sm btn-primary" href={{safeURL QrAuth}}>Open in Statping App</a>
{{end}}
</form>
</div>
<div class="tab-pane" id="v-pills-style" role="tabpanel" aria-labelledby="v-pills-style-tab">
@ -141,7 +143,7 @@
<div class="jumbotron jumbotron-fluid">
<div class="text-center col-12">
<h1 class="display-5">Enable Local Assets</h1>
<a class="lead">Customize your status page design by enabling local assets. This will create a 'assets' directory containing all CSS.<p><a href="/settings/build" class="btn btn-primary mt-3"{{if USE_CDN}} disabled{{end}}>Enable Local Assets</a></p></p>
<span class="lead">Customize your status page design by enabling local assets. This will create a 'assets' directory containing all CSS.<p><a href="/settings/build" class="btn btn-primary mt-3"{{if USE_CDN}} disabled{{end}}>Enable Local Assets</a></p></span>
</div>
</div>
{{ else }}

View File

@ -1 +1 @@
0.80.0
0.80.1