2017-10-25 16:22:14 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
|
|
|
|
<head>
|
|
|
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<meta name="description" content="">
|
|
|
|
<meta name="author" content="">
|
|
|
|
|
|
|
|
<title>Misp live dashboard</title>
|
|
|
|
|
|
|
|
<!-- Bootstrap Core CSS -->
|
|
|
|
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
|
|
|
|
<!-- Custom CSS -->
|
|
|
|
<link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet">
|
|
|
|
<!-- Custom Fonts -->
|
|
|
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.2.0/dist/leaflet.css"
|
|
|
|
integrity="sha512-M2wvCLH6DSRazYeZRIm1JnYyh22purTM+FDB5CsyxtQJYeKq83arPe5wgbNmcFXGqiSH2XR8dT/fJISVA1r/zQ=="
|
|
|
|
crossorigin=""/>
|
|
|
|
<script src="https://unpkg.com/leaflet@1.2.0/dist/leaflet.js"
|
|
|
|
integrity="sha512-lInM/apFSqyy1o6s89K4iQUKg6ppXEgsVxT35HbzUupEVRh2Eu9Wdl4tHj7dZO0s1uvplcYGmt3498TtHq+log=="
|
|
|
|
crossorigin=""></script>
|
|
|
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.panel-body {
|
|
|
|
padding: 0px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.col-lg-6 {
|
|
|
|
padding-right: 5px;
|
|
|
|
padding-left: 5px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.leftSepa {
|
|
|
|
border-left-color: rgb(221, 221, 221);
|
|
|
|
border-left-style: solid;
|
|
|
|
border-left-width: 2px;
|
|
|
|
padding-left: 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.textTopHeader {
|
|
|
|
height: 50px;
|
|
|
|
text-align: center;
|
|
|
|
margin-left: 8px;
|
|
|
|
float: left;
|
|
|
|
}
|
|
|
|
|
|
|
|
.center {
|
|
|
|
display:block;
|
|
|
|
margin-left:auto;
|
|
|
|
margin-right:auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
small {
|
|
|
|
font-size: 100%;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div id="wrapper">
|
|
|
|
|
|
|
|
<!-- Navigation -->
|
|
|
|
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0; padding-left: 15px;">
|
|
|
|
<div class="navbar-header">
|
|
|
|
<a class="navbar-brand" href="{{ url_for('geo') }}">Misp Geolocalization</a>
|
|
|
|
<div id="ledsHolder" style="float: right; height: 50px;"><div class='leftSepa textTopHeader'><b>Date + zoom Level</b></div></div>
|
|
|
|
</div>
|
|
|
|
<!-- /.navbar-header -->
|
|
|
|
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
<!-- Page Content -->
|
|
|
|
<div id="page-wrapper" style="margin: 0px; padding: 0px;">
|
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-lg-12">
|
|
|
|
<div style="height: 10px;"></div>
|
|
|
|
<div class="col-lg-6">
|
|
|
|
|
|
|
|
<div class="col-lg-6">
|
|
|
|
<div class="panel panel-default" style="">
|
|
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
2017-10-25 17:32:06 +02:00
|
|
|
<b id="topMap1Header">1. Top location</b>
|
2017-10-25 16:22:14 +02:00
|
|
|
</div>
|
|
|
|
<div id="panelbody" class="panel-body" style="">
|
|
|
|
<div id="topMap1" style="width:100%; height: calc(75vh / 3);"></div>
|
|
|
|
</div>
|
|
|
|
</div><!-- /.panel-body -->
|
|
|
|
|
|
|
|
<div class="panel panel-default" style="">
|
|
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
2017-10-25 17:32:06 +02:00
|
|
|
<b id="topMap3Header">3. Top location</b>
|
2017-10-25 16:22:14 +02:00
|
|
|
</div>
|
|
|
|
<div id="panelbody" class="panel-body" style="">
|
|
|
|
<div id="topMap3" style="width:100%; height: calc(75vh / 3);"></div>
|
|
|
|
</div>
|
|
|
|
</div><!-- /.panel-body -->
|
|
|
|
|
|
|
|
<div class="panel panel-default" style="">
|
|
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
2017-10-25 17:32:06 +02:00
|
|
|
<b id="topMap5Header">5. Top location</b>
|
2017-10-25 16:22:14 +02:00
|
|
|
</div>
|
|
|
|
<div id="panelbody" class="panel-body" style="">
|
|
|
|
<div id="topMap5" style="width:100%; height: calc(75vh / 3);"></div>
|
|
|
|
</div>
|
|
|
|
</div><!-- /.panel-body -->
|
|
|
|
</div><!-- /.col-lg-6-6 -->
|
|
|
|
|
|
|
|
<div class="col-lg-6">
|
|
|
|
<div class="panel panel-default" style="">
|
|
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
2017-10-25 17:32:06 +02:00
|
|
|
<b id="topMap2Header">2. Top location</b>
|
2017-10-25 16:22:14 +02:00
|
|
|
</div>
|
|
|
|
<div id="panelbody" class="panel-body" style="">
|
|
|
|
<div id="topMap2" style="width:100%; height: calc(75vh / 3);"></div>
|
|
|
|
</div>
|
|
|
|
</div><!-- /.panel-body -->
|
|
|
|
|
|
|
|
<div class="panel panel-default" style="">
|
|
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
2017-10-25 17:32:06 +02:00
|
|
|
<b id="topMap4Header">4. Top location</b>
|
2017-10-25 16:22:14 +02:00
|
|
|
</div>
|
|
|
|
<div id="panelbody" class="panel-body" style="">
|
|
|
|
<div id="topMap4" style="width:100%; height: calc(75vh / 3);"></div>
|
|
|
|
</div>
|
|
|
|
</div><!-- /.panel-body -->
|
|
|
|
|
|
|
|
<div class="panel panel-default" style="">
|
|
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
2017-10-25 17:32:06 +02:00
|
|
|
<b id="topMap6Header">6. Top location</b>
|
2017-10-25 16:22:14 +02:00
|
|
|
</div>
|
|
|
|
<div id="panelbody" class="panel-body" style="">
|
|
|
|
<div id="topMap6" style="width:100%; height: calc(75vh / 3);"></div>
|
|
|
|
</div>
|
|
|
|
</div><!-- /.panel-body -->
|
|
|
|
</div><!-- /.col-lg-6-6 -->
|
|
|
|
|
|
|
|
</div><!-- /.col-lg-6 -->
|
|
|
|
|
|
|
|
<div class="col-lg-6">
|
|
|
|
|
|
|
|
<div class="panel panel-default" style="height: 100%;">
|
|
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
|
|
|
<b id="worldMapHeader">Hit map </b>
|
|
|
|
</div>
|
|
|
|
<div id="panelbody" class="panel-body" style="height: 100%;">
|
|
|
|
<div id="worldMap" style="width:100%; height: 88vh; position: relative;"></div>
|
|
|
|
</div>
|
|
|
|
<!-- /.panel-body -->
|
|
|
|
|
|
|
|
</div><!-- /.panel -->
|
|
|
|
|
|
|
|
</div><!-- /.col-lg-6 -->
|
|
|
|
|
|
|
|
</div><!-- /.col-lg-12 -->
|
|
|
|
</div><!-- /.row -->
|
|
|
|
|
|
|
|
</div> <!-- /.container-fluid -->
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- /#page-wrapper -->
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- /#wrapper -->
|
|
|
|
|
|
|
|
<!-- jQuery -->
|
|
|
|
<script src="{{ url_for('static', filename='js/jquery.min.js') }}"></script>
|
|
|
|
<!-- jQuery flot -->
|
|
|
|
<script src="{{ url_for('static', filename='js/jquery.flot.js') }}"></script>
|
|
|
|
<script src="{{ url_for('static', filename='js/jquery.flot.pie.min.js') }}"></script>
|
|
|
|
<script src="{{ url_for('static', filename='js/jquery.flot.resize.js') }}"></script>
|
|
|
|
<!-- Bootstrap Core JavaScript -->
|
|
|
|
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
|
|
|
|
|
|
|
|
<link href="{{ url_for('static', filename='css/font-awesome.min.css') }}" rel="text/css">
|
|
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/jquery-jvectormap-2.0.3.css') }}" type="text/css" media="screen"/>
|
|
|
|
<script src="{{ url_for('static', filename='js/jquery-jvectormap-2.0.3.min.js') }}"></script>
|
|
|
|
<script src="{{ url_for('static', filename='js/jquery-jvectormap-world-mill.js') }}"></script>
|
|
|
|
|
|
|
|
<!-- Index -->
|
|
|
|
<script>
|
2017-10-25 17:45:00 +02:00
|
|
|
var regionhitsMax = 10;
|
|
|
|
var regionhits = {};
|
2017-10-25 16:22:14 +02:00
|
|
|
|
|
|
|
const OSMURL='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
|
|
|
const OSMATTRIB='Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';
|
2017-10-25 17:32:06 +02:00
|
|
|
var ZOOMLEVEL = 17;
|
2017-10-25 16:22:14 +02:00
|
|
|
var allOpenStreetMap = {};
|
|
|
|
|
|
|
|
for(var i=1; i<7; i++) {
|
|
|
|
allOpenStreetMap[i] = L.map('topMap'+i).setView([0, 0], 0);
|
|
|
|
new L.TileLayer(OSMURL, {minZoom: 0, maxZoom: 18}).addTo(allOpenStreetMap[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
var vectorMapConfig = {
|
|
|
|
map: 'world_mill',
|
|
|
|
markers: [],
|
|
|
|
series: {
|
|
|
|
markers: [{
|
|
|
|
attribute: 'fill',
|
|
|
|
scale: ['#1A0DAB', '#e50000', '#62ff41'],
|
|
|
|
values: [],
|
|
|
|
min: 0,
|
|
|
|
max: 180
|
|
|
|
}],
|
|
|
|
regions: [{
|
|
|
|
values: [],
|
|
|
|
min: 0,
|
|
|
|
max: 10,
|
|
|
|
scale: ['#CD5C5C','#E34234','#D73B3E','#CE1620','#CC0000','#B22222','#B31B1B','#A40000','#800000','#701C1C','#3C1414','#321414'],
|
|
|
|
normalizeFunction: 'polynomial'
|
|
|
|
}]
|
|
|
|
},
|
2017-10-25 17:45:00 +02:00
|
|
|
onRegionTipShow: function(e, el, code){
|
|
|
|
el.html(el.html()+' ('+regionhits[code]+')');
|
|
|
|
}
|
2017-10-25 16:22:14 +02:00
|
|
|
}
|
|
|
|
|
2017-10-25 17:32:06 +02:00
|
|
|
|
|
|
|
function updateTopMaps(dayNum) {
|
|
|
|
$.getJSON("{{ url_for('getTopCoord') }}?dayNum="+dayNum, function(list){
|
|
|
|
for(var i=0; i<6 && i<list.length; i++) {
|
|
|
|
coordJson = JSON.parse(list[i][0]);
|
|
|
|
allOpenStreetMap[i+1].flyTo([coordJson.lat, coordJson.lon], ZOOMLEVEL);
|
|
|
|
var marker = L.marker([coordJson.lat, coordJson.lon]).addTo(allOpenStreetMap[i+1]);
|
|
|
|
marker.bindPopup('lat: '+coordJson.lat+', lon: '+coordJson.lon+' - '+list[i][1]).openPopup();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-10-25 17:45:00 +02:00
|
|
|
function updateWorldMap(dayNum) {
|
2017-10-25 17:32:06 +02:00
|
|
|
$.getJSON("{{ url_for('getHitMap') }}?dayNum="+dayNum, function(list){
|
|
|
|
for(var i=0; i<list.length; i++) {
|
2017-10-25 17:45:00 +02:00
|
|
|
rCode = list[i][0];
|
|
|
|
rNum = list[i][1];
|
|
|
|
update_region(rCode, rNum);
|
2017-10-25 17:32:06 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-10-25 17:45:00 +02:00
|
|
|
function update_region(regionCode, num) {
|
|
|
|
regionhits[regionCode] = num;
|
|
|
|
// Force recomputation of min and max for correct color scaling
|
|
|
|
regionhitsMax = regionhitsMax >= regionhits[regionCode] ? regionhitsMax : regionhits[regionCode];
|
|
|
|
worldMapObj.series.regions[0].params.max = regionhitsMax;
|
|
|
|
// Update data
|
|
|
|
worldMapObj.series.regions[0].setValues(regionhits);
|
|
|
|
}
|
|
|
|
|
2017-10-25 17:32:06 +02:00
|
|
|
$(document).ready(function () {
|
|
|
|
$('#worldMap').vectorMap(vectorMapConfig);
|
|
|
|
worldMapObj = $("#worldMap").vectorMap('get','mapObject');
|
|
|
|
updateTopMaps(1);
|
2017-10-25 17:45:00 +02:00
|
|
|
updateWorldMap(1);
|
2017-10-25 17:32:06 +02:00
|
|
|
});
|
2017-10-25 16:22:14 +02:00
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|