mirror of https://github.com/MISP/misp-dashboard
Added contribution page auto-reload
parent
58c187d0d5
commit
79cf989512
|
@ -21,6 +21,7 @@ clusteringDistance = 10
|
||||||
|
|
||||||
[CONTRIB]
|
[CONTRIB]
|
||||||
max_number_of_last_contributor = 10
|
max_number_of_last_contributor = 10
|
||||||
|
min_between_reload = 5
|
||||||
#How much harder it gets to rank up (exponential multiplier) [1.5 -> +inf]
|
#How much harder it gets to rank up (exponential multiplier) [1.5 -> +inf]
|
||||||
rankMultiplier = 2
|
rankMultiplier = 2
|
||||||
categories_in_datatable = ["internal_reference", "targeting_data", "antivirus_detection", "payload_delivery", "artifacts_dropped", "payload_installation", "persistence_mechanism", "network_activity", "payload_type", "attribution", "external_analysis", "financial_fraud", "support_Tool", "social_network", "person", "other" ]
|
categories_in_datatable = ["internal_reference", "targeting_data", "antivirus_detection", "payload_delivery", "artifacts_dropped", "payload_installation", "persistence_mechanism", "network_activity", "payload_type", "attribution", "external_analysis", "financial_fraud", "support_Tool", "social_network", "person", "other" ]
|
||||||
|
|
|
@ -157,7 +157,8 @@ def contrib():
|
||||||
currOrg=currOrg,
|
currOrg=currOrg,
|
||||||
rankMultiplier=contributor_helper.rankMultiplier,
|
rankMultiplier=contributor_helper.rankMultiplier,
|
||||||
categ_list=json.dumps(categ_list),
|
categ_list=json.dumps(categ_list),
|
||||||
categ_list_str=categ_list_str
|
categ_list_str=categ_list_str,
|
||||||
|
min_between_reload=cfg.getint('CONTRIB', 'min_between_reload')
|
||||||
)
|
)
|
||||||
|
|
||||||
''' INDEX '''
|
''' INDEX '''
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
var allOrg = [];
|
var allOrg = [];
|
||||||
var datatableTop;
|
var datatableTop;
|
||||||
var datatableFame;
|
var datatableFame;
|
||||||
|
var refresh_speed = min_between_reload*60;
|
||||||
|
var will_reload = $("#reloadCheckbox").is(':checked');
|
||||||
|
var sec_before_reload = refresh_speed;
|
||||||
|
|
||||||
/* CONFIG */
|
/* CONFIG */
|
||||||
var maxRank = 16;
|
var maxRank = 16;
|
||||||
|
@ -246,8 +249,6 @@ function addLastContributor(datatable, data, update) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function updateProgressHeader(org) {
|
function updateProgressHeader(org) {
|
||||||
// get Org rank
|
// get Org rank
|
||||||
$.getJSON( url_getOrgRank+'?org='+org, function( data ) {
|
$.getJSON( url_getOrgRank+'?org='+org, function( data ) {
|
||||||
|
@ -289,7 +290,36 @@ function showOnlyOrg() {
|
||||||
datatableCateg.search( $('#orgText').text() ).draw();
|
datatableCateg.search( $('#orgText').text() ).draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function timeToString(time) {
|
||||||
|
var min = Math.floor(time / 60);
|
||||||
|
min = (min < 10) ? ("0" + min) : min;
|
||||||
|
var sec = time - 60*min;
|
||||||
|
sec = (sec < 10) ? ("0" + sec) : sec;
|
||||||
|
return min + ":" + sec
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateTimer() {
|
||||||
|
if ($("#reloadCheckbox").is(':checked')) {
|
||||||
|
sec_before_reload--;
|
||||||
|
if (sec_before_reload < 1) {
|
||||||
|
source_lastContrib.close();
|
||||||
|
location.reload();
|
||||||
|
} else {
|
||||||
|
$('#labelRemainingTime').text(timeToString(sec_before_reload));
|
||||||
|
setTimeout(function(){ updateTimer(); }, 1000);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sec_before_reload = refresh_speed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(':checkbox').change(function() {
|
||||||
|
if ($("#reloadCheckbox").is(':checked')) { setTimeout(function(){ updateTimer(); }, 1000); }
|
||||||
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
$('#labelRemainingTime').text(timeToString(sec_before_reload));
|
||||||
|
updateTimer();
|
||||||
$('#orgName').typeahead(typeaheadOption);
|
$('#orgName').typeahead(typeaheadOption);
|
||||||
$('#btnCurrRank').popover(popOverOption);
|
$('#btnCurrRank').popover(popOverOption);
|
||||||
datatableTop = $('#topContribTable').DataTable(optionDatatable_top);
|
datatableTop = $('#topContribTable').DataTable(optionDatatable_top);
|
||||||
|
@ -335,5 +365,6 @@ $(document).ready(function() {
|
||||||
addLastContributor(datatableLast, json, true);
|
addLastContributor(datatableLast, json, true);
|
||||||
datatableLast.draw();
|
datatableLast.draw();
|
||||||
updateProgressHeader(json.org)
|
updateProgressHeader(json.org)
|
||||||
|
sec_before_reload = refresh_speed; //reset timer at each contribution
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -57,6 +57,14 @@
|
||||||
<li><a href="{{ url_for('geo') }}">MISP Geolocalisation</a></li>
|
<li><a href="{{ url_for('geo') }}">MISP Geolocalisation</a></li>
|
||||||
<li><a href="{{ url_for('contrib') }}">MISP Contributors</a></li>
|
<li><a href="{{ url_for('contrib') }}">MISP Contributors</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div id="ledsHolder" style="float: left; height: 50px;">
|
||||||
|
<div class='leftSepa textTopHeader'>
|
||||||
|
<label class="checkbox-inline" style="font-weight: bold; position: relative; top: -30%; left:10%">
|
||||||
|
<input id="reloadCheckbox" type="checkbox" style="top: -2px;" checked>Auto reload
|
||||||
|
</label>
|
||||||
|
<label id='labelRemainingTime' style="font-weight: bold; position: relative; left: -38%; bottom: -30%;"></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div id="ledsHolder" style="float: right; height: 50px;">
|
<div id="ledsHolder" style="float: right; height: 50px;">
|
||||||
<div class='leftSepa textTopHeader'>
|
<div class='leftSepa textTopHeader'>
|
||||||
<strong>Organisation name:</strong>
|
<strong>Organisation name:</strong>
|
||||||
|
@ -242,6 +250,7 @@
|
||||||
|
|
||||||
/* DATA FROM CONF */
|
/* DATA FROM CONF */
|
||||||
var currOrg = "{{ currOrg }}";
|
var currOrg = "{{ currOrg }}";
|
||||||
|
var min_between_reload = {{ min_between_reload }};
|
||||||
var rankMultiplier = {{ rankMultiplier }};
|
var rankMultiplier = {{ rankMultiplier }};
|
||||||
var categ_list = JSON.parse('{{ categ_list|safe }}');
|
var categ_list = JSON.parse('{{ categ_list|safe }}');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue