mirror of
https://github.com/EDCD/EDDN.git
synced 2025-04-12 07:00:04 +03:00
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
288 lines
11 KiB
HTML
288 lines
11 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
<title>EDDN Status - Schemas</title>
|
||
|
||
<!-- Bootstrap -->
|
||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />
|
||
<link href="./css/eddn.css" rel="stylesheet" />
|
||
|
||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||
<!--[if lt IE 9]>
|
||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
|
||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||
<![endif]-->
|
||
|
||
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
|
||
<script src="./js/date.js"></script>
|
||
</head>
|
||
<body data-spy="scroll" data-target="#header-nav" data-offset="70">
|
||
<header>
|
||
<nav class="navbar navbar-default navbar-fixed-top">
|
||
<div class="container">
|
||
|
||
<div class="navbar-header">
|
||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#header-nav">
|
||
<span class="sr-only">Toggle navigation</span>
|
||
<span class="icon-bar"></span>
|
||
<span class="icon-bar"></span>
|
||
<span class="icon-bar"></span>
|
||
</button>
|
||
<a class="navbar-brand" href="">EDDN Status - Schemas</a>
|
||
</div>
|
||
|
||
<div class="collapse navbar-collapse" id="header-nav">
|
||
<ul class="nav navbar-nav">
|
||
<li><a href="./#schemas">Back to EDDN Status</a></li>
|
||
</ul>
|
||
|
||
<p class="navbar-right navbar-text">
|
||
<em>Provided by <a href="https://edcd.github.io/" target="_blank" class="navbar-link"><strong>EDCD</strong></a></em>
|
||
</p>
|
||
</div>
|
||
|
||
</div>
|
||
</nav>
|
||
</header>
|
||
|
||
<section id="schemas" class="container">
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<h2>Schemas (Last 60 days)</h2>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<div class="panel panel-default">
|
||
<div class="panel-body">
|
||
|
||
<div class="row">
|
||
<div class="col-md-12 charts" style="height: 500px;">
|
||
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<section id="schemasStacked" class="container">
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<h2>Schemas in percent (Last 60 days)</h2>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<div class="panel panel-default">
|
||
<div class="panel-body">
|
||
|
||
<div class="row">
|
||
<div class="col-md-12 charts" style="height: 500px;">
|
||
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<footer>
|
||
<nav class="navbar navbar-default">
|
||
<div class="container">
|
||
<p class="navbar-text">
|
||
The <em>Elite: Dangerous Data Network</em> is volunteer-run and not affiliated with <a href="https://frontier.co.uk/" target="_blank">Frontier Developments</a>.
|
||
|
|
||
Charts by <a href="http://www.highcharts.com/" target="_blank">HighCharts</a>
|
||
</p>
|
||
</div>
|
||
</nav>
|
||
</footer>
|
||
|
||
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
|
||
<!-- Include all compiled plugins (below), or include individual files as needed -->
|
||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
|
||
<script src="https://code.highcharts.com/5.0.12/highcharts.js"></script>
|
||
|
||
<script type="text/javascript">
|
||
var makeSlug = function(str) {
|
||
var slugcontent_hyphens = str.replace(/\s/g,'-');
|
||
var finishedslug = slugcontent_hyphens.replace(/[^a-zA-Z0-9\-]/g,'');
|
||
return finishedslug.toLowerCase();
|
||
}
|
||
var makeName = function(str) {
|
||
var match = /^https:\/\/eddn.edcd.io\/schemas\/(\w)(\w*)\/(\d+)$/.exec(str);
|
||
if(match)
|
||
{
|
||
return match[1].toUpperCase() + match[2] + " v" + match[3];
|
||
}
|
||
|
||
var match = /^https:\/\/eddn.edcd.io\/schemas\/(\w)(\w*)\/(\d+)\/test$/.exec(str);
|
||
if(match)
|
||
{
|
||
return match[1].toUpperCase() + match[2] + " v" + match[3] + " [TEST]";
|
||
}
|
||
|
||
return str;
|
||
}
|
||
|
||
$(document).ready(function(){
|
||
var monitorEndPoint = 'https://eddn.edcd.io:9091/';
|
||
|
||
var chartContainer = $('#schemas .charts');
|
||
|
||
chartContainer.highcharts({
|
||
chart: {
|
||
type: 'spline', animation: Highcharts.svg,
|
||
events: {
|
||
load: function(){ setTimeout(function(){$(window).trigger('resize');}, 250); }
|
||
},
|
||
marginRight: 10
|
||
},
|
||
title: { text: '', style: {display: 'none'} },
|
||
xAxis: {
|
||
type: 'datetime',
|
||
//tickPixelInterval: 24 * 3600 * 1000
|
||
},
|
||
yAxis: {
|
||
title: {text: ''},
|
||
plotLines: [{value: 0, width: 1, color: '#808080'}],
|
||
min: 0
|
||
},
|
||
//tooltip: { enabled: false },
|
||
credits: { enabled: false },
|
||
exporting: { enabled: false },
|
||
series: [
|
||
{id: 'duplicate-message', data: [], name: 'Messages duplicate', zIndex: 1}
|
||
]
|
||
});
|
||
|
||
var chartStackedContainer = $('#schemasStacked .charts');
|
||
|
||
chartStackedContainer.highcharts({
|
||
chart: {
|
||
type: 'area', animation: Highcharts.svg,
|
||
events: {
|
||
load: function(){ setTimeout(function(){$(window).trigger('resize');}, 250); }
|
||
},
|
||
marginRight: 10
|
||
},
|
||
colors: ['#000000', '#7cb5ec', '#2b908f', '#f7a35c', '#f15c80', '#e4d354', '#2b908f', '#f45b5b', '#91e8e1'],
|
||
title: { text: '', style: {display: 'none'} },
|
||
xAxis: {
|
||
type: 'datetime',
|
||
//tickPixelInterval: 24 * 3600 * 1000
|
||
},
|
||
yAxis: {
|
||
title: {text: ''},
|
||
plotLines: [{value: 0, width: 1, color: '#808080'}],
|
||
min: 0
|
||
},
|
||
plotOptions: {
|
||
area: {
|
||
stacking: 'percent',
|
||
lineColor: '#ffffff',
|
||
lineWidth: 1,
|
||
marker: {
|
||
lineWidth: 1,
|
||
lineColor: '#ffffff'
|
||
}
|
||
}
|
||
},
|
||
tooltip: {
|
||
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.percentage:.1f}%</b> ({point.y:,.0f})<br/>',
|
||
shared: true
|
||
},
|
||
credits: { enabled: false },
|
||
exporting: { enabled: false },
|
||
series: [
|
||
{id: 'duplicate-message', data: [], name: 'Messages duplicate', zIndex: 1}
|
||
]
|
||
});
|
||
|
||
var dYesterday = new (function(d){ d.setDate(d.getDate()-1); return d})(new Date),
|
||
d60 = new (function(d){ d.setDate(d.getDate()-60); return d})(new Date),
|
||
|
||
day60 = d60.getUTCFullYear() + '-' + ("0" + (d60.getUTCMonth() + 1)).slice(-2) + '-' + ("0" + (d60.getUTCDate())).slice(-2),
|
||
yesterday = dYesterday.getUTCFullYear() + '-' + ("0" + (dYesterday.getUTCMonth() + 1)).slice(-2) + '-' + ("0" + (dYesterday.getUTCDate())).slice(-2);
|
||
|
||
$.ajax({
|
||
dataType: "json",
|
||
url: monitorEndPoint + 'getSchemas/?dateStart=' + day60 + '&dateEnd = ' + yesterday,
|
||
success: function(schemas){
|
||
var chart = chartContainer.highcharts();
|
||
var chartStacked = chartStackedContainer.highcharts();
|
||
|
||
$.each(schemas, function(date, schemasCountTmp){
|
||
// Convert date for highcharts
|
||
date = date.split('-')
|
||
date = Date.UTC(date[0], date[1] - 1, date[2]);
|
||
|
||
// Convert old schemas and sum them to new schemas
|
||
schemasCount = {};
|
||
$.each(schemasCountTmp, function(schema, hits){
|
||
schema = schema.replace('http://schemas.elite-markets.net/eddn/', 'https://eddn.edcd.io/schemas/');
|
||
hits = parseInt(hits);
|
||
|
||
if(schemasCount[schema]){ schemasCount[schema] += hits; }
|
||
else{ schemasCount[schema] = hits; }
|
||
});
|
||
|
||
// Loop results
|
||
$.each(schemasCount, function(schema, hits){
|
||
// IF TEST CONTINUE
|
||
if(schema.slice(-4) == 'test')
|
||
return;
|
||
|
||
var slug = makeSlug(schema);
|
||
var name = makeName(schema);
|
||
|
||
// Check series exists
|
||
if(!chart.get(slug))
|
||
{
|
||
chart.addSeries({
|
||
id: slug,
|
||
name: name,
|
||
data: []
|
||
});
|
||
}
|
||
|
||
// Add data
|
||
serie = chart.get(slug);
|
||
serie.addPoint({x: date, y: parseInt(hits)}, false);
|
||
|
||
// Check series exists
|
||
if(!chartStacked.get(slug))
|
||
{
|
||
chartStacked.addSeries({
|
||
id: slug,
|
||
name: name,
|
||
data: []
|
||
});
|
||
}
|
||
|
||
// Add data
|
||
serie = chartStacked.get(slug);
|
||
serie.addPoint({x: date, y: parseInt(hits)}, false);
|
||
});
|
||
});
|
||
|
||
chart.redraw();
|
||
chartStacked.redraw();
|
||
}
|
||
});
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|