2018-10-02 06:21:14 +00:00
{{define "title"}}{{.Service.Name}} Status{{end}}
2018-11-06 07:15:55 +00:00
{{define "description"}}{{$s := .Service}}{{if $s.Online }}{{.Service.Name}} is currently online and responding within {{$s.AvgTime}} milliseconds with {{$s.TotalUptime}}% total uptime on {{$s.Domain}}.{{else}}{{.Service.Name}} is currently offline on {{$s.Domain}}. Notify the admin to let them know their service is offline.{{end}}{{end}}
2018-10-02 06:21:14 +00:00
{{ define "content" }}
2018-09-18 22:02:27 +00:00
{{$s := .Service}}
2018-06-24 11:51:07 +00:00
< div class = "container col-md-7 col-sm-12 mt-md-5 bg-light" >
2018-06-11 03:41:02 +00:00
2018-06-19 04:48:25 +00:00
{{if Auth}}
2018-06-11 03:41:02 +00:00
{{template "nav"}}
{{end}}
2018-10-02 06:21:14 +00:00
< div class = "col-12 mb-4" >
2018-06-11 03:41:02 +00:00
2018-11-07 05:06:44 +00:00
{{if $s.Online }}
< span class = "mt-3 mb-3 text-white d-md-none btn bg-success d-block d-md-none" > ONLINE< / span >
{{ else }}
< span class = "mt-3 mb-3 text-white d-md-none btn bg-danger d-block d-md-none" > OFFLINE< / span >
{{end}}
2018-10-02 06:21:14 +00:00
< h4 class = "mt-2" > {{ $s.Name }}
{{if $s.Online }}
< span class = "badge bg-success float-right d-none d-md-block" > ONLINE< / span >
{{ else }}
< span class = "badge bg-danger float-right d-none d-md-block" > OFFLINE< / span >
{{end}}< / h4 >
2018-06-11 03:41:02 +00:00
2018-10-02 06:21:14 +00:00
< div class = "row stats_area mt-5 mb-5" >
< div class = "col-4" >
< span class = "lg_number" > {{$s.Online24}}%< / span >
Online last 24 Hours
< / div >
< div class = "col-4" >
< span class = "lg_number" > {{$s.AvgTime}}ms< / span >
Average Response
2018-06-22 04:02:57 +00:00
< / div >
2018-06-11 03:41:02 +00:00
2018-10-02 06:21:14 +00:00
< div class = "col-4" >
< span class = "lg_number" > {{$s.TotalUptime}}%< / span >
Total Uptime
< / div >
< / div >
2018-11-07 08:53:37 +00:00
{{if $s.ActiveMessages}}
2018-11-16 16:42:49 +00:00
< div class = "col-12 mb-5" >
2018-11-07 08:53:37 +00:00
{{range $s.ActiveMessages}}
< div class = "alert alert-warning" role = "alert" >
< h3 > {{.Title}}< / h3 >
2018-11-16 16:42:49 +00:00
< span class = "mb-3" > {{safe .Description}}< / span >
< div class = "d-block mt-2 mb-4" >
< span class = "float-left small" > Starts at {{.StartOn}}< / span >
< span class = "float-right small" > Ends on {{.EndOn}}< / span >
< / div >
2018-11-07 08:53:37 +00:00
< / div >
{{end}}
< / div >
{{end}}
2018-10-02 06:21:14 +00:00
< div class = "service-chart-container" >
< canvas id = "service" > < / canvas >
< / div >
< form id = "service_date_form" class = "col-12 mt-2 mb-3" >
2018-11-07 05:06:44 +00:00
< input type = "text" class = "d-none" name = "start" id = "service_start" data-input >
< span data-toggle title = "toggle" id = "start_date" class = "text-muted small float-left pointer mt-2" > {{.Start}} to {{.End}}< / span >
< button type = "submit" class = "btn btn-light btn-sm mt-2" > Set Timeframe< / button >
< input type = "text" class = "d-none" name = "end" id = "service_end" data-input >
2018-10-02 06:21:14 +00:00
< div id = "start_container" > < / div >
< div id = "end_container" > < / div >
< / form >
{{if not $s.Online}}
< div class = "col-12 small text-center mt-3 text-muted" > {{$s.DowntimeText}}< / div >
{{end}}
2018-11-08 10:50:06 +00:00
{{$failures := $s.LimitedFailures 16}}
{{ if $failures }}
2018-10-02 06:21:14 +00:00
< div class = "list-group mt-3 mb-4" >
2018-11-08 10:50:06 +00:00
{{ range $failures }}
2018-10-02 06:21:14 +00:00
< a href = "#" class = "list-group-item list-group-item-action flex-column align-items-start" >
< div class = "d-flex w-100 justify-content-between" >
< h5 class = "mb-1" > {{.ParseError}}< / h5 >
< small > {{.Ago}}< / small >
< / div >
< p class = "mb-1" > {{.Issue}}< / p >
< / a >
{{ end }}
< / div >
{{ end }}
< / div >
2018-06-11 03:41:02 +00:00
2018-06-26 07:01:41 +00:00
{{if Auth}}
2018-06-22 06:56:44 +00:00
2018-10-05 04:28:38 +00:00
< div class = "col-12 mt-4{{if ne $s.Type " http " } } d-none { { end } } " >
2018-10-02 06:21:14 +00:00
< h3 > Last Response< / h3 >
< textarea rows = "8" class = "form-control" readonly > {{ $s.LastResponse }}< / textarea >
< div class = "form-group row mt-2" >
< label for = "last_status_code" class = "col-sm-3 col-form-label" > HTTP Status Code< / label >
< div class = "col-sm-2" >
< input type = "text" id = "last_status_code" class = "form-control" value = "{{ $s.LastStatusCode }}" readonly >
< / div >
2018-06-23 08:42:50 +00:00
< / div >
< / div >
2018-06-11 03:41:02 +00:00
2018-10-05 04:28:38 +00:00
< div class = "col-12 mt-4" >
< h3 > Edit Service< / h3 >
{{template "form_service" $s}}
< / div >
2018-10-04 08:18:55 +00:00
< div class = "col-12 mt-4" >
< h3 > Service Checkin< / h3 >
2018-10-07 22:38:56 +00:00
{{if $s.LimitedCheckins}}
2018-10-04 08:18:55 +00:00
< table class = "table" >
< thead >
2018-10-05 04:28:38 +00:00
< tr >
< th scope = "col" > Checkin< / th >
< th scope = "col" > Report Period< br > Grace Period< / th >
< th scope = "col" > Last Seen< / th >
< th scope = "col" > Expected< / th >
2018-10-07 22:38:56 +00:00
< th scope = "col" > < / th >
2018-10-05 04:28:38 +00:00
< / tr >
2018-10-04 08:18:55 +00:00
< / thead >
< tbody >
2018-10-07 22:38:56 +00:00
{{range $s.LimitedCheckins}}
2018-10-06 03:35:53 +00:00
{{ $ch := . }}
2018-10-07 22:38:56 +00:00
< tr class = "{{ if lt $ch.Expected 0}}bg-warning text-black{{else}}bg-light{{end}}" >
< td > {{$ch.Name}}< br > < a href = "{{$ch.Link}}" target = "_blank" > {{$ch.Link}}< / a > < / td >
2018-10-05 04:28:38 +00:00
< td > every {{Duration $ch.Period}}< br > after {{Duration $ch.Grace}}< / td >
2018-10-07 22:38:56 +00:00
< td > {{ if $ch.Last.CreatedAt.IsZero}}
Never
{{else}}
{{Ago $ch.Last.CreatedAt}}
{{end}}
< / td >
< td >
{{ if $ch.Last.CreatedAt.IsZero}}
-
{{else}}
{{ if lt $ch.Expected 0}}{{Duration $ch.Expected}} ago{{else}}in {{Duration $ch.Expected}}{{end}}
{{end}}
< / td >
< td > < a href = "/checkin/{{$ch.Id}}/delete" class = "btn btn-sm btn-danger" > Delete< / a > < / td >
2018-10-04 08:18:55 +00:00
< / tr >
2018-10-06 03:35:53 +00:00
{{end}}
2018-10-04 08:18:55 +00:00
< / tbody >
< / table >
2018-10-07 22:38:56 +00:00
{{end}}
{{template "form_checkin" $s}}
2018-10-02 06:21:14 +00:00
< / div >
2018-06-30 03:40:00 +00:00
2018-06-30 19:30:58 +00:00
{{end}}
2018-06-30 03:40:00 +00:00
< / div >
2018-10-02 06:21:14 +00:00
{{end}}
2018-11-07 05:06:44 +00:00
{{define "extra_css"}}
< link rel = "stylesheet" href = "/css/flatpickr.min.css" >
2018-07-07 05:02:47 +00:00
{{end}}
2018-11-07 05:06:44 +00:00
{{define "extra_scripts"}}
2018-10-02 06:21:14 +00:00
{{$s := .Service}}
2018-11-07 05:06:44 +00:00
< script src = "/js/flatpickr.js" > < / script >
< script src = "/js/rangePlugin.js" > < / script >
2018-09-18 22:02:27 +00:00
< script >
2018-11-07 05:06:44 +00:00
$(document).ready(function() {
2018-09-21 04:17:24 +00:00
var ctx = document.getElementById("service").getContext('2d');
var chartdata = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
label: 'Response Time (Milliseconds)',
2018-09-30 13:39:52 +00:00
data: [],
2018-09-21 04:17:24 +00:00
backgroundColor: [
'rgba(47, 206, 30, 0.92)'
],
borderColor: [
'rgb(47, 171, 34)'
],
borderWidth: 1
}]
},
options: {
legend: {
display: false
},
scales: {
yAxes: [{
ticks: {
beginAtZero: true
},
gridLines: {
2018-09-25 04:19:59 +00:00
display: true
2018-09-21 04:17:24 +00:00
}
}],
xAxes: [{
type: 'time',
2018-09-30 13:39:52 +00:00
distribution: 'series',
time: {
displayFormats: {
'millisecond': 'MMM DD',
'second': 'MMM DD',
'minute': 'MMM DD',
'hour': 'MMM DD hA',
'day': 'MMM DD',
'week': 'MMM DD',
'month': 'MMM DD',
'quarter': 'MMM DD',
'year': 'MMM DD',
}
},
2018-09-21 04:17:24 +00:00
gridLines: {
2018-09-27 03:20:02 +00:00
display: true
2018-09-30 13:39:52 +00:00
},
ticks: {
source: 'auto'
2018-09-21 04:17:24 +00:00
}
2018-09-30 13:39:52 +00:00
}],
2018-09-21 04:17:24 +00:00
},
elements: {
point: {
radius: 0
}
}
}
});
2018-11-07 05:06:44 +00:00
AjaxChart(chartdata,{{$s.Id}},{{.Start}},{{.End}},"hour");
2018-09-21 04:17:24 +00:00
2018-11-07 05:06:44 +00:00
let startDate = $("#service_start").flatpickr({
enableTime: false,
static: true,
altInput: true,
altFormat: "U",
maxDate: "today",
dateFormat: "F j, Y",
onChange: function(selectedDates, dateStr, instance) {
var one = Math.round((new Date(selectedDates[0])).getTime() / 1000);
var two = Math.round((new Date(selectedDates[1])).getTime() / 1000);
$("#service_start").val(one);
$("#service_end").val(two);
$("#start_date").html(dateStr);
},
"plugins": [new rangePlugin({ input: "#service_end"})]
2018-09-18 22:02:27 +00:00
});
$("#start_date").click(function(e) {
2018-11-07 05:06:44 +00:00
startDate.open()
2018-10-07 22:38:56 +00:00
});
2018-09-18 22:02:27 +00:00
2018-11-07 05:06:44 +00:00
});
2018-09-18 22:02:27 +00:00
< / script >
2018-10-02 06:21:14 +00:00
{{end}}