statping/source/tmpl/index.html

269 lines
8.6 KiB
HTML
Raw Normal View History

2018-06-10 01:31:13 +00:00
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
2018-06-26 07:01:41 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1.0, user-scalable=0">
2018-06-30 05:08:08 +00:00
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
2018-06-24 06:44:15 +00:00
{{if .Core.OfflineAssets}}
2018-06-30 00:57:05 +00:00
<link rel="stylesheet" href="https://assets.statup.io/bootstrap.min.css">
2018-06-24 06:44:15 +00:00
{{ else }}
<link rel="stylesheet" href="/css/bootstrap.min.css">
{{end}}
2018-06-30 00:57:05 +00:00
<link rel="stylesheet" href="/css/base.css">
2018-06-19 04:48:25 +00:00
<title>{{.Core.Name}} Status</title>
2018-06-10 01:31:13 +00:00
</head>
<body>
2018-06-24 11:51:07 +00:00
<div class="container col-md-7 col-sm-12 mt-2 sm-container">
2018-06-19 04:48:25 +00:00
2018-06-26 07:01:41 +00:00
<h1 class="col-12 text-center mb-4 mt-sm-3">{{.Core.Name}}</h1>
2018-06-10 01:31:13 +00:00
2018-06-19 04:48:25 +00:00
{{ if .Core.Description }}
2018-06-26 07:01:41 +00:00
<h5 class="col-12 text-center mb-5 text-muted">{{ .Core.Description }}</h5>
2018-06-19 04:48:25 +00:00
{{ end }}
2018-06-27 06:45:00 +00:00
<div class="col-12 full-col-12 mb-5">
2018-06-22 04:02:57 +00:00
<div class="list-group online_list">
{{ range .Services }}
2018-06-27 06:45:00 +00:00
<a href="#" class="service_li list-group-item list-group-item-action {{if not .Online}}bg-danger text-white{{ end }}" data-id="{{.Id}}">
2018-06-22 04:02:57 +00:00
{{ .Name }}
{{if .Online}}
<span class="badge online_badge float-right">ONLINE</span>
{{ else }}
2018-06-22 06:56:44 +00:00
<span class="badge bg-white text-black-50 float-right">OFFLINE</span>
2018-06-22 04:02:57 +00:00
{{end}}
</a>
{{ end }}
2018-06-15 04:30:10 +00:00
</div>
2018-06-22 04:02:57 +00:00
</div>
2018-06-27 06:45:00 +00:00
<div class="col-12 full-col-12">
2018-06-10 01:31:13 +00:00
{{ range .Services }}
2018-06-27 02:59:59 +00:00
<div class="mt-4" id="service_id_{{.Id}}">
2018-06-10 01:31:13 +00:00
<div class="card">
2018-06-27 06:45:00 +00:00
<div class="card-body">
2018-06-10 01:31:13 +00:00
2018-06-26 07:01:41 +00:00
<div class="col-12">
2018-06-11 00:20:42 +00:00
2018-06-27 07:44:44 +00:00
<h4 class="mt-3"><a href="/service/{{.Id}}"{{if not .Online}} class="text-danger"{{end}}>{{ .Name }}</a>
{{if .Online}}
<span class="badge online_badge float-right">ONLINE</span>
{{ else }}
<span class="badge offline_badge float-right">OFFLINE</span>
{{end}}</h4>
2018-06-11 00:20:42 +00:00
2018-06-27 06:45:00 +00:00
<div class="row stats_area mt-5 mb-5">
2018-06-22 06:56:44 +00:00
<div class="col-4">
2018-06-15 04:30:10 +00:00
<span class="lg_number">{{.Online24}}%</span>
2018-06-10 01:31:13 +00:00
Online last 24 Hours
</div>
2018-06-22 06:56:44 +00:00
<div class="col-4">
2018-06-15 04:30:10 +00:00
<span class="lg_number">{{.AvgTime}}ms</span>
2018-06-10 01:31:13 +00:00
Average Response
</div>
2018-06-22 06:56:44 +00:00
<div class="col-4">
2018-06-15 04:30:10 +00:00
<span class="lg_number">{{.AvgUptime}}%</span>
2018-06-10 01:31:13 +00:00
Total Uptime
</div>
</div>
2018-06-22 04:02:57 +00:00
{{ if .LimitedFailures }}
2018-06-22 06:56:44 +00:00
2018-06-22 04:02:57 +00:00
{{ end }}
2018-06-26 07:01:41 +00:00
</div>
2018-06-10 01:31:13 +00:00
</div>
2018-06-27 06:45:00 +00:00
{{ if .AvgTime }}
<div class="chart-container">
<canvas id="service_{{ .Id }}"></canvas>
</div>
{{ end }}
<div class="lower_canvas full-col-12 text-white{{if not .Online}} bg-danger{{end}}">
<div class="col-12">
2018-06-30 03:40:00 +00:00
<span>{{.SmallText}}</span>
2018-06-27 06:45:00 +00:00
<a href="/service/{{ .Id }}" class="btn {{if .Online}}btn-success{{else}}btn-danger{{end}} btn-sm float-right">View Service</a>
</div>
</div>
2018-06-10 01:31:13 +00:00
</div>
</div>
{{ end }}
</div>
</div>
2018-06-22 04:02:57 +00:00
{{template "footer"}}
2018-06-10 04:16:04 +00:00
2018-06-30 00:57:05 +00:00
{{if .Core.OfflineAssets}}
<script src="https://assets.statup.io/jquery-3.3.1.slim.min.js"></script>
<script src="https://assets.statup.io/bootstrap.min.js"></script>
<script src="https://assets.statup.io/Chart.bundle.min.js"></script>
{{ else }}
<script src="/js/jquery-3.3.1.slim.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/Chart.bundle.min.js"></script>
{{end}}
2018-06-10 01:31:13 +00:00
<script>
{{ range .Services }}
2018-06-26 07:01:41 +00:00
{{ if .AvgTime }}
2018-06-10 01:31:13 +00:00
var ctx = document.getElementById("service_{{.Id}}").getContext('2d');
var chartdata = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
label: 'Response Time (Milliseconds)',
2018-06-15 04:30:10 +00:00
data: {{js .GraphData}},
2018-06-10 01:31:13 +00:00
backgroundColor: [
2018-06-22 06:56:44 +00:00
'rgba(47, 206, 30, 0.92)'
2018-06-10 01:31:13 +00:00
],
borderColor: [
2018-06-22 06:56:44 +00:00
'rgb(47, 171, 34)'
2018-06-10 01:31:13 +00:00
],
borderWidth: 1
}]
},
options: {
2018-06-24 11:51:07 +00:00
maintainAspectRatio: false,
2018-06-26 07:01:41 +00:00
scaleShowValues: true,
2018-06-27 02:59:59 +00:00
layout: {
padding: {
left: 0,
right: 0,
top: 0,
bottom: -10
}
},
2018-06-26 07:01:41 +00:00
hover: {
2018-06-27 02:59:59 +00:00
animationDuration: 0,
2018-06-26 07:01:41 +00:00
},
2018-06-27 02:59:59 +00:00
responsiveAnimationDuration: 0,
2018-06-26 07:01:41 +00:00
animation: {
2018-06-27 06:45:00 +00:00
duration: 3500,
onComplete: function() {
2018-06-26 07:01:41 +00:00
var chartInstance = this.chart,
ctx = chartInstance.ctx;
2018-06-27 02:59:59 +00:00
var controller = this.chart.controller;
var xAxis = controller.scales['x-axis-0'];
var yAxis = controller.scales['y-axis-0'];
2018-06-26 07:01:41 +00:00
ctx.font = Chart.helpers.fontString(Chart.defaults.global.defaultFontSize, Chart.defaults.global.defaultFontStyle, Chart.defaults.global.defaultFontFamily);
ctx.textAlign = 'center';
ctx.textBaseline = 'bottom';
var numTicks = xAxis.ticks.length;
var yOffsetStart = xAxis.width / numTicks;
var halfBarWidth = (xAxis.width / (numTicks * 2));
xAxis.ticks.forEach(function(value, index) {
var xOffset = 20;
var yOffset = (yOffsetStart * index) + halfBarWidth;
ctx.fillStyle = '#e2e2e2';
ctx.fillText(value, yOffset, xOffset);
});
this.data.datasets.forEach(function(dataset, i) {
var meta = chartInstance.controller.getDatasetMeta(i);
2018-06-27 02:59:59 +00:00
var hxH = 0;
var hyH = 0;
var hxL = 0;
var hyL = 0;
2018-06-26 07:01:41 +00:00
var highestNum = 0;
2018-06-27 02:59:59 +00:00
var lowestnum = 999999999999;
2018-06-26 07:01:41 +00:00
meta.data.forEach(function(bar, index) {
var data = dataset.data[index];
2018-06-27 02:59:59 +00:00
if (data.y < lowestnum) {
lowestnum = data.y;
hxL = bar._model.x;
hyL = bar._model.y;
}
2018-06-26 07:01:41 +00:00
if (data.y > highestNum) {
highestNum = data.y;
2018-06-27 02:59:59 +00:00
hxH = bar._model.x;
hyH = bar._model.y;
2018-06-26 07:01:41 +00:00
}
});
2018-06-27 02:59:59 +00:00
if (hxH >= 820) {
hxH = 820;
} else if (hxH <= 50) {
hxH = 50;
}
if (hxL >= 820) {
hxL = 820;
} else if (hxL <= 70) {
hxL = 70;
}
ctx.fillStyle = '#ffa7a2';
ctx.fillText(highestNum+"ms", hxH - 40, hyH + 15);
2018-06-27 06:45:00 +00:00
ctx.fillStyle = '#45d642';
ctx.fillText(lowestnum+"ms", hxL, hyL + 10);
console.log("done service_id_{{.Id}}")
2018-06-26 07:01:41 +00:00
});
}
},
2018-06-10 01:31:13 +00:00
legend: {
display: false
},
2018-06-26 07:01:41 +00:00
tooltips: {
"enabled": false
},
2018-06-10 01:31:13 +00:00
scales: {
yAxes: [{
2018-06-26 07:01:41 +00:00
display: false,
2018-06-10 01:31:13 +00:00
ticks: {
2018-06-26 07:01:41 +00:00
fontSize: 20,
2018-06-27 02:59:59 +00:00
display: false,
2018-06-27 06:45:00 +00:00
beginAtZero: false
2018-06-10 04:09:20 +00:00
},
gridLines: {
display:false
2018-06-10 01:31:13 +00:00
}
}],
xAxes: [{
type: 'time',
2018-06-10 04:09:20 +00:00
distribution: 'series',
2018-06-26 07:01:41 +00:00
autoSkip: false,
2018-06-10 04:09:20 +00:00
gridLines: {
display:false
2018-06-26 07:01:41 +00:00
},
ticks: {
2018-06-27 02:59:59 +00:00
stepSize: 1,
min: 0,
2018-06-26 07:01:41 +00:00
fontColor: "white",
fontSize: 20,
display: false,
2018-06-10 04:09:20 +00:00
}
2018-06-10 01:31:13 +00:00
}]
},
elements: {
point: {
radius: 0
}
}
}
});
{{ end }}
2018-06-22 04:02:57 +00:00
{{ end }}
2018-06-10 01:31:13 +00:00
</script>
2018-06-19 04:48:25 +00:00
2018-06-30 00:57:05 +00:00
<script src="/js/main.js"></script>
2018-06-19 04:48:25 +00:00
{{ if .Core.Style }}
<style>
{{ safe .Core.Style }}
</style>
{{ end }}
2018-06-24 06:44:15 +00:00
2018-06-10 01:31:13 +00:00
</body>
</html>