mirror of https://github.com/statping/statping
added 7 day uptime on index - JS updates
parent
8f9d55f675
commit
86958c1d36
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -113,25 +113,27 @@
|
|||
<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>
|
||||
|
||||
<div class="row">
|
||||
<a href="/settings/export" class="btn btn-sm btn-secondary float-right">Export Settings</a>
|
||||
{{if .Domain}}
|
||||
<a href="#" class="btn btn-sm btn-secondary float-right ml-1">Authentication QR Code</a>
|
||||
{{end}}
|
||||
</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}}
|
||||
<a href="#" class="btn btn-sm btn-secondary float-right ml-1">Authentication QR Code</a>
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
{{if .Domain}}
|
||||
<div class="row align-content-center">
|
||||
<img class="rounded text-center" width="300" height="300" src="https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl={{ QrAuth }}">
|
||||
</div>
|
||||
<a class="btn btn-sm btn-primary" href={{safeURL QrAuth}}>Open in Statping App</a>
|
||||
{{end}}
|
||||
|
||||
</form>
|
||||
{{end}}
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -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 }}
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.80.0
|
||||
0.80.1
|
Loading…
Reference in New Issue