2017-11-14 17:03:46 +01: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">
|
|
|
|
<!-- LeafLet -->
|
|
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/leaflet.css') }}">
|
|
|
|
<script src="{{ url_for('static', filename='js/leaflet.js') }}"></script>
|
|
|
|
|
|
|
|
<!-- 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>
|
2017-11-15 09:36:44 +01:00
|
|
|
<script src="{{ url_for('static', filename='js/jquery.flot.time.js') }}"></script>
|
2017-11-14 17:03:46 +01:00
|
|
|
<!-- Bootstrap Core JavaScript -->
|
|
|
|
<script src="{{ url_for('static', filename='js/bootstrap.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>
|
|
|
|
<link href="{{ url_for('static', filename='css/jquery-ui.min.css') }}" rel="stylesheet" type="text/css" />
|
|
|
|
<script src="{{ url_for('static', filename='js/jquery-ui.min.js') }}"></script>
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/punchcard.css') }}">
|
|
|
|
<script src="{{ url_for('static', filename='js/moment.js') }}"></script>
|
|
|
|
<script src="{{ url_for('static', filename='js/punchcard.js') }}"></script>
|
|
|
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
2017-11-15 13:45:01 +01:00
|
|
|
.highlightDay {
|
|
|
|
background-color: #edc240;
|
|
|
|
box-shadow: black 0px 0px 2px;
|
|
|
|
}
|
|
|
|
|
2017-11-14 17:03:46 +01:00
|
|
|
.panel {
|
|
|
|
margin-bottom: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.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;
|
|
|
|
padding-top: 9px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.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">
|
|
|
|
<img src="{{ url_for('static', filename='pics/MISP.png') }}" alt="MISP" style="float: left; height: 40px; margin-top: 5px;"><a class="navbar-brand dropdown-toggle" data-toggle="dropdown" href="#">MISP Users
|
|
|
|
<span class="caret"></span></a>
|
|
|
|
<ul class="dropdown-menu">
|
|
|
|
<li><a href="{{ url_for('index') }}">MISP Live Dashboard</a></li>
|
|
|
|
<li><a href="{{ url_for('geo') }}">MISP Geolocalisation</a></li>
|
|
|
|
<li><a href="{{ url_for('contrib') }}">MISP Contributors</a></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<!-- /.navbar-header -->
|
|
|
|
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
<!-- Page Content -->
|
|
|
|
<div id="page-wrapper" style="margin: 0px; padding: 0px;">
|
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="row">
|
|
|
|
<div style="height: 10px;"></div>
|
|
|
|
|
2017-11-15 09:36:44 +01:00
|
|
|
<div class="col-lg-12">
|
|
|
|
<div class="col-lg-8">
|
|
|
|
<div class="panel panel-default" style="">
|
|
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
|
|
|
<b>Punch card - login</b>
|
2017-11-15 13:45:01 +01:00
|
|
|
<strong class='leftSepa textTopHeader' style="float: none; padding: 11px;">Dates:
|
|
|
|
<input type="text" id="datepickerPunch" size="10" style="">
|
|
|
|
</strong>
|
2017-11-15 09:36:44 +01:00
|
|
|
</div>
|
|
|
|
<div id="panelbody" class="panel-body" style="">
|
|
|
|
<div id="punchcard" style="width:100%; height: 100%;"></div>
|
|
|
|
</div>
|
|
|
|
</div><!-- /.panel-body -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-lg-4">
|
|
|
|
<div class="panel panel-default" style="">
|
|
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
2017-11-15 13:45:01 +01:00
|
|
|
<b>Top organisation login</b>
|
|
|
|
<strong class='leftSepa textTopHeader' style="float: none; padding: 11px;">Dates:
|
|
|
|
<input type="text" id="datepickerOrgLogin" size="10" style="">
|
|
|
|
</strong>
|
2017-11-15 09:36:44 +01:00
|
|
|
</div>
|
|
|
|
<div id="panelbody" class="panel-body" style="">
|
2017-11-15 13:45:01 +01:00
|
|
|
<div id="pieOrg" style="width:100%; height: 20vh;"></div>
|
2017-11-15 09:36:44 +01:00
|
|
|
</div>
|
|
|
|
</div><!-- /.panel-body -->
|
|
|
|
|
|
|
|
<div class="panel panel-default" style="">
|
|
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
2017-11-15 14:43:28 +01:00
|
|
|
<b>Contribution after login</b>
|
2017-11-15 13:45:01 +01:00
|
|
|
<strong class='leftSepa textTopHeader' style="float: none; padding: 11px;">Dates:
|
|
|
|
<input type="text" id="datepickerApi" size="10" style="">
|
|
|
|
</strong>
|
2017-11-15 09:36:44 +01:00
|
|
|
</div>
|
|
|
|
<div id="panelbody" class="panel-body" style="">
|
2017-11-15 13:45:01 +01:00
|
|
|
<div id="pieApi" style="width:100%; height: 20vh;"></div>
|
2017-11-15 09:36:44 +01:00
|
|
|
</div>
|
|
|
|
</div><!-- /.panel-body -->
|
|
|
|
</div>
|
2017-11-14 17:03:46 +01:00
|
|
|
|
2017-11-15 09:36:44 +01:00
|
|
|
</div><!-- /.col-lg-12 -->
|
|
|
|
<div class="col-lg-12">
|
2017-11-14 17:03:46 +01:00
|
|
|
<div class="panel panel-default" style="">
|
|
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
2017-11-15 09:36:44 +01:00
|
|
|
<b>Login overtime</b>
|
2017-11-15 13:45:01 +01:00
|
|
|
<strong class='leftSepa textTopHeader' style="float: none; padding: 11px;">Dates:
|
|
|
|
<input type="text" id="datepickerOvertimeLogin" size="10" style="">
|
|
|
|
</strong>
|
2017-11-14 17:03:46 +01:00
|
|
|
</div>
|
|
|
|
<div id="panelbody" class="panel-body" style="">
|
2017-11-15 09:36:44 +01:00
|
|
|
<div id="lineChart" style="width:100%; height: 20vh;"></div>
|
2017-11-14 17:03:46 +01:00
|
|
|
</div>
|
|
|
|
</div><!-- /.panel-body -->
|
|
|
|
</div><!-- /.col-lg-12 -->
|
2017-11-15 09:36:44 +01:00
|
|
|
|
2017-11-14 17:03:46 +01:00
|
|
|
</div><!-- /.row -->
|
|
|
|
|
|
|
|
</div> <!-- /.container-fluid -->
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- /#page-wrapper -->
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!-- /#wrapper -->
|
|
|
|
|
|
|
|
<!-- Index -->
|
|
|
|
<script>
|
|
|
|
/* URL */
|
2017-11-15 13:45:01 +01:00
|
|
|
var urlIconCalendar = "{{ url_for('static', filename='pics/calendar.gif') }}";
|
2017-11-14 17:03:46 +01:00
|
|
|
|
|
|
|
/* DATA FROM CONF */
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script>
|
2017-11-15 13:45:01 +01:00
|
|
|
var punchcardWidget;
|
|
|
|
var pieOrgWidget;
|
|
|
|
var pieApiWidget;
|
|
|
|
var overtimeWidget;
|
|
|
|
|
|
|
|
var div_day;
|
|
|
|
function highlight_punchDay() {
|
|
|
|
if (!(div_day === undefined)) {
|
|
|
|
div_day.removeClass('highlightDay');
|
|
|
|
}
|
|
|
|
|
|
|
|
var curDay = datePickerWidgetPunch.datepicker( "getDate" ).getDay();
|
|
|
|
if (curDay == 7)
|
|
|
|
curDay = 0;
|
|
|
|
div_day = $('[data-daynum="'+curDay+'"]');
|
|
|
|
div_day.addClass('highlightDay')
|
|
|
|
}
|
|
|
|
|
|
|
|
function updateDatePunch() {
|
|
|
|
var date = datePickerWidgetPunch.datepicker( "getDate" );
|
|
|
|
$.getJSON( "{{ url_for('getUserLogins') }}"+"?date="+date.getTime()/1000, function( data ) {
|
|
|
|
if (!(punchcardWidget === undefined)) {
|
|
|
|
punchcardWidget.settings.data = data;
|
|
|
|
punchcardWidget.refresh();
|
|
|
|
highlight_punchDay();
|
|
|
|
} else {
|
|
|
|
punchcardWidget = $('#punchcard').punchcard({
|
|
|
|
data: data,
|
|
|
|
singular: 'login',
|
|
|
|
plural: 'logins',
|
|
|
|
timezones: ['local'],
|
|
|
|
timezoneIndex:0
|
|
|
|
});
|
|
|
|
punchcardWidget = punchcardWidget.data("plugin_" + "punchcard");
|
|
|
|
highlight_punchDay();
|
|
|
|
}
|
2017-11-14 17:03:46 +01:00
|
|
|
});
|
2017-11-15 13:45:01 +01:00
|
|
|
}
|
|
|
|
function updateDatePieOrg() {
|
|
|
|
var date = datePickerWidgetOrg.datepicker( "getDate" );
|
|
|
|
$.getJSON( "{{ url_for('getTopOrglogin') }}"+"?date="+date.getTime()/1000, function( data ) {
|
|
|
|
toPlot = [];
|
|
|
|
for (item of data) { toPlot.push({ label: item[0], data: item[1] }); }
|
|
|
|
if (toPlot.length == 0) {
|
|
|
|
toPlot = [{ label: 'No data', data: 100 }];
|
|
|
|
}
|
|
|
|
if (!pieOrgWidget === undefined) {
|
|
|
|
pieOrgWidget.setData(toPlot);
|
|
|
|
pieOrgWidget.draw();
|
|
|
|
} else {
|
|
|
|
pieOrgWidget = $.plot('#pieOrg', toPlot, {
|
|
|
|
series: {
|
|
|
|
pie: {
|
|
|
|
innerRadius: 0.5,
|
|
|
|
show: true
|
|
|
|
}
|
2017-11-14 17:03:46 +01:00
|
|
|
}
|
2017-11-15 13:45:01 +01:00
|
|
|
});
|
|
|
|
}
|
2017-11-14 17:03:46 +01:00
|
|
|
});
|
2017-11-15 13:45:01 +01:00
|
|
|
}
|
|
|
|
function updateDatePieApi() {
|
|
|
|
var date = datePickerWidgetApi.datepicker( "getDate" );
|
2017-11-15 14:34:37 +01:00
|
|
|
$.getJSON( "{{ url_for('getLoginVSCOntribution') }}"+"?date="+date.getTime()/1000, function( data ) {
|
2017-11-15 14:43:28 +01:00
|
|
|
toPlot = [
|
2017-11-15 14:34:37 +01:00
|
|
|
{label: 'Has contributed during the day', data: data[0], color: '#4da74d' },
|
|
|
|
{label: 'Has not contributed during the day', data:data[1], color: '#cb4b4b' }
|
2017-11-15 14:43:28 +01:00
|
|
|
];
|
|
|
|
if (data[0] == 0 && data[1] == 0) {
|
|
|
|
toPlot = [{ label: 'No data', data: 100 }];
|
|
|
|
}
|
2017-11-15 13:45:01 +01:00
|
|
|
|
|
|
|
if (!pieApiWidget === undefined) {
|
|
|
|
pieApiWidget.setData(toPlot);
|
|
|
|
pieApiWidget.draw();
|
|
|
|
} else {
|
2017-11-15 14:43:28 +01:00
|
|
|
pieApiWidget = $.plot('#pieApi', toPlot, {
|
2017-11-15 13:45:01 +01:00
|
|
|
series: {
|
|
|
|
pie: {
|
|
|
|
innerRadius: 0.5,
|
|
|
|
show: true
|
|
|
|
}
|
2017-11-15 09:36:44 +01:00
|
|
|
}
|
2017-11-15 13:45:01 +01:00
|
|
|
});
|
|
|
|
}
|
2017-11-15 09:36:44 +01:00
|
|
|
});
|
2017-11-15 13:45:01 +01:00
|
|
|
}
|
|
|
|
function updateDateOvertime() {
|
|
|
|
var date = datePickerWidgetOvertime.datepicker( "getDate" );
|
|
|
|
var now = new Date();
|
|
|
|
if (date.toDateString() == now.toDateString()) {
|
|
|
|
date = now;
|
|
|
|
} else {
|
|
|
|
date.setTime(date.getTime() + (24*60*60*1000-1)); // include data of selected date
|
|
|
|
}
|
|
|
|
$.getJSON( "{{ url_for('getUserLoginsOvertime') }}"+"?date="+parseInt(date.getTime()/1000), function( data ) {
|
2017-11-15 09:36:44 +01:00
|
|
|
temp = [];
|
|
|
|
var i=0;
|
|
|
|
for (item of data) {
|
|
|
|
temp.push([new Date(item[0]*1000), item[1]]);
|
|
|
|
}
|
|
|
|
data = {label: 'Login overtime', data: temp}
|
2017-11-15 13:45:01 +01:00
|
|
|
if (!overtimeWidget === undefined) {
|
|
|
|
overtimeWidget.setData(toPlot);
|
|
|
|
overtimeWidget.draw();
|
|
|
|
} else {
|
|
|
|
overtimeWidget = $.plot('#lineChart', [data], {
|
|
|
|
lines: {
|
|
|
|
show: true,
|
|
|
|
steps: true,
|
|
|
|
fill: true
|
|
|
|
},
|
|
|
|
xaxis: {
|
|
|
|
mode: "time",
|
|
|
|
minTickSize: [1, "day"],
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2017-11-15 09:36:44 +01:00
|
|
|
});
|
2017-11-14 17:03:46 +01:00
|
|
|
|
2017-11-15 13:45:01 +01:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
|
|
|
var datePickerOptions = {
|
|
|
|
showOn: "button",
|
|
|
|
// minDate: -31,
|
|
|
|
maxDate: 0,
|
|
|
|
buttonImage: urlIconCalendar,
|
|
|
|
buttonImageOnly: true,
|
|
|
|
buttonText: "Select date",
|
|
|
|
showAnim: "slideDown"
|
|
|
|
};
|
|
|
|
// punch
|
|
|
|
var datePickerOptionsPunch = jQuery.extend({}, datePickerOptions);
|
|
|
|
datePickerOptionsPunch['onSelect'] = updateDatePunch;
|
|
|
|
datePickerWidgetPunch = $( "#datepickerPunch" );
|
|
|
|
datePickerWidgetPunch.datepicker(datePickerOptionsPunch);
|
|
|
|
datePickerWidgetPunch.datepicker("setDate", new Date());
|
|
|
|
// org login
|
|
|
|
var datePickerOptionsOrg = jQuery.extend({}, datePickerOptions);
|
|
|
|
datePickerOptionsOrg['onSelect'] = updateDatePieOrg;
|
|
|
|
datePickerWidgetOrg = $( "#datepickerOrgLogin" );
|
|
|
|
datePickerWidgetOrg.datepicker(datePickerOptionsOrg);
|
|
|
|
datePickerWidgetOrg.datepicker("setDate", new Date());
|
|
|
|
// api
|
|
|
|
var datePickerOptionsApi = jQuery.extend({}, datePickerOptions);
|
|
|
|
datePickerOptionsApi['onSelect'] = updateDatePieApi;
|
|
|
|
datePickerWidgetApi = $( "#datepickerApi" );
|
|
|
|
datePickerWidgetApi.datepicker(datePickerOptionsApi);
|
|
|
|
datePickerWidgetApi.datepicker("setDate", new Date());
|
|
|
|
// overtime
|
|
|
|
var datePickerOptionsOvertime = jQuery.extend({}, datePickerOptions);
|
|
|
|
datePickerOptionsOvertime['onSelect'] = updateDateOvertime;
|
|
|
|
datePickerWidgetOvertime = $( "#datepickerOvertimeLogin" );
|
|
|
|
datePickerWidgetOvertime.datepicker(datePickerOptionsOvertime);
|
|
|
|
datePickerWidgetOvertime.datepicker("setDate", new Date());
|
|
|
|
|
|
|
|
updateDatePunch();
|
|
|
|
updateDatePieOrg();
|
|
|
|
updateDatePieApi();
|
|
|
|
updateDateOvertime();
|
|
|
|
|
2017-11-14 17:03:46 +01:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|