mirror of https://github.com/statping/statping
				
				
				
			
		
			
				
	
	
		
			268 lines
		
	
	
		
			9.0 KiB
		
	
	
	
		
			HTML
		
	
	
			
		
		
	
	
			268 lines
		
	
	
		
			9.0 KiB
		
	
	
	
		
			HTML
		
	
	
<!doctype html>
 | 
						|
<html lang="en">
 | 
						|
<head>
 | 
						|
    <meta charset="utf-8">
 | 
						|
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1.0, user-scalable=0">
 | 
						|
 | 
						|
    {{if .Core.OfflineAssets}}
 | 
						|
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
 | 
						|
        <link rel="stylesheet" href="https://statup.io/base.css">
 | 
						|
        <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.bundle.min.js"></script>
 | 
						|
    {{ else }}
 | 
						|
        <link rel="stylesheet" href="/css/bootstrap.min.css">
 | 
						|
        <link rel="stylesheet" href="/css/base.css">
 | 
						|
        <script src="/js/Chart.bundle.min.js"></script>
 | 
						|
    {{end}}
 | 
						|
    <title>{{.Core.Name}} Status</title>
 | 
						|
</head>
 | 
						|
<body>
 | 
						|
 | 
						|
 | 
						|
<div class="container col-md-7 col-sm-12 mt-2 sm-container">
 | 
						|
 | 
						|
<h1 class="col-12 text-center mb-4 mt-sm-3">{{.Core.Name}}</h1>
 | 
						|
 | 
						|
    {{ if .Core.Description }}
 | 
						|
        <h5 class="col-12 text-center mb-5 text-muted">{{ .Core.Description }}</h5>
 | 
						|
    {{ end }}
 | 
						|
 | 
						|
<div class="col-12 full-col-12 mb-5">
 | 
						|
    <div class="list-group online_list">
 | 
						|
    {{ range .Services }}
 | 
						|
        <a href="#" class="service_li list-group-item list-group-item-action {{if not .Online}}bg-danger text-white{{ end }}" data-id="{{.Id}}">
 | 
						|
        {{ .Name }}
 | 
						|
        {{if .Online}}
 | 
						|
            <span class="badge online_badge float-right">ONLINE</span>
 | 
						|
        {{ else }}
 | 
						|
            <span class="badge bg-white text-black-50 float-right">OFFLINE</span>
 | 
						|
        {{end}}
 | 
						|
        </a>
 | 
						|
    {{ end }}
 | 
						|
    </div>
 | 
						|
</div>
 | 
						|
 | 
						|
 | 
						|
    <div class="col-12 full-col-12">
 | 
						|
        {{ range .Services }}
 | 
						|
            <div class="mt-4" id="service_id_{{.Id}}">
 | 
						|
                <div class="card">
 | 
						|
                    <div class="card-body">
 | 
						|
 | 
						|
                        <div class="col-12">
 | 
						|
 | 
						|
                            <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>
 | 
						|
 | 
						|
                        <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">{{.AvgUptime}}%</span>
 | 
						|
                                Total Uptime
 | 
						|
                            </div>
 | 
						|
                        </div>
 | 
						|
 | 
						|
                    {{ if .LimitedFailures }}
 | 
						|
 | 
						|
                    {{ end }}
 | 
						|
                        </div>
 | 
						|
                    </div>
 | 
						|
                {{ 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">
 | 
						|
                            <span>No failures within the last 25 days</span>
 | 
						|
                            <a href="/service/{{ .Id }}" class="btn {{if .Online}}btn-success{{else}}btn-danger{{end}} btn-sm float-right">View Service</a>
 | 
						|
                        </div>
 | 
						|
                    </div>
 | 
						|
                </div>
 | 
						|
            </div>
 | 
						|
        {{ end }}
 | 
						|
    </div>
 | 
						|
</div>
 | 
						|
 | 
						|
{{template "footer"}}
 | 
						|
 | 
						|
<script>
 | 
						|
{{ range .Services }}
 | 
						|
{{ if .AvgTime }}
 | 
						|
var ctx = document.getElementById("service_{{.Id}}").getContext('2d');
 | 
						|
 | 
						|
var chartdata = new Chart(ctx, {
 | 
						|
    type: 'line',
 | 
						|
    data: {
 | 
						|
        datasets: [{
 | 
						|
            label: 'Response Time (Milliseconds)',
 | 
						|
            data: {{js .GraphData}},
 | 
						|
            backgroundColor: [
 | 
						|
                'rgba(47, 206, 30, 0.92)'
 | 
						|
            ],
 | 
						|
            borderColor: [
 | 
						|
                'rgb(47, 171, 34)'
 | 
						|
            ],
 | 
						|
            borderWidth: 1
 | 
						|
        }]
 | 
						|
    },
 | 
						|
    options: {
 | 
						|
        maintainAspectRatio: false,
 | 
						|
        scaleShowValues: true,
 | 
						|
        layout: {
 | 
						|
            padding: {
 | 
						|
                left: 0,
 | 
						|
                right: 0,
 | 
						|
                top: 0,
 | 
						|
                bottom: -10
 | 
						|
            }
 | 
						|
        },
 | 
						|
        hover: {
 | 
						|
            animationDuration: 0,
 | 
						|
        },
 | 
						|
        responsiveAnimationDuration: 0,
 | 
						|
        animation: {
 | 
						|
            duration: 3500,
 | 
						|
            onComplete: function() {
 | 
						|
                var chartInstance = this.chart,
 | 
						|
                        ctx = chartInstance.ctx;
 | 
						|
 | 
						|
                var controller = this.chart.controller;
 | 
						|
                var xAxis = controller.scales['x-axis-0'];
 | 
						|
                var yAxis = controller.scales['y-axis-0'];
 | 
						|
 | 
						|
                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);
 | 
						|
                    var hxH = 0;
 | 
						|
                    var hyH = 0;
 | 
						|
                    var hxL = 0;
 | 
						|
                    var hyL = 0;
 | 
						|
                    var highestNum = 0;
 | 
						|
                    var lowestnum = 999999999999;
 | 
						|
                    meta.data.forEach(function(bar, index) {
 | 
						|
                        var data = dataset.data[index];
 | 
						|
 | 
						|
                        if (data.y < lowestnum) {
 | 
						|
                            lowestnum = data.y;
 | 
						|
                            hxL = bar._model.x;
 | 
						|
                            hyL = bar._model.y;
 | 
						|
                        }
 | 
						|
 | 
						|
                        if (data.y > highestNum) {
 | 
						|
                            highestNum = data.y;
 | 
						|
                            hxH = bar._model.x;
 | 
						|
                            hyH = bar._model.y;
 | 
						|
                        }
 | 
						|
                    });
 | 
						|
 | 
						|
                    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);
 | 
						|
                    ctx.fillStyle = '#45d642';
 | 
						|
                    ctx.fillText(lowestnum+"ms", hxL, hyL + 10);
 | 
						|
 | 
						|
                    console.log("done service_id_{{.Id}}")
 | 
						|
 | 
						|
                });
 | 
						|
            }
 | 
						|
        },
 | 
						|
        legend: {
 | 
						|
            display: false
 | 
						|
        },
 | 
						|
        tooltips: {
 | 
						|
            "enabled": false
 | 
						|
        },
 | 
						|
        scales: {
 | 
						|
            yAxes: [{
 | 
						|
                display: false,
 | 
						|
                ticks: {
 | 
						|
                    fontSize: 20,
 | 
						|
                    display: false,
 | 
						|
                    beginAtZero: false
 | 
						|
                },
 | 
						|
                gridLines: {
 | 
						|
                    display:false
 | 
						|
                }
 | 
						|
            }],
 | 
						|
            xAxes: [{
 | 
						|
                type: 'time',
 | 
						|
                distribution: 'series',
 | 
						|
                autoSkip: false,
 | 
						|
                gridLines: {
 | 
						|
                    display:false
 | 
						|
                },
 | 
						|
                ticks: {
 | 
						|
                    stepSize: 1,
 | 
						|
                    min: 0,
 | 
						|
                    fontColor: "white",
 | 
						|
                    fontSize: 20,
 | 
						|
                    display: false,
 | 
						|
                }
 | 
						|
            }]
 | 
						|
        },
 | 
						|
        elements: {
 | 
						|
            point: {
 | 
						|
                radius: 0
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
});
 | 
						|
{{ end }}
 | 
						|
{{ end }}
 | 
						|
</script>
 | 
						|
 | 
						|
 | 
						|
    {{ if .Core.Style }}
 | 
						|
        <style>
 | 
						|
         {{ safe .Core.Style }}
 | 
						|
        </style>
 | 
						|
     {{ end }}
 | 
						|
 | 
						|
 | 
						|
{{if .Core.OfflineAssets}}
 | 
						|
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
 | 
						|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
 | 
						|
{{ else }}
 | 
						|
<script src="/js/jquery-3.3.1.slim.min.js"></script>
 | 
						|
<script src="/js/bootstrap.min.js"></script>
 | 
						|
<script src="/js/main.js"></script>
 | 
						|
{{end}}
 | 
						|
 | 
						|
</body>
 | 
						|
</html> |