mirror of https://github.com/MISP/misp-dashboard
fix: [contrib] improvement on the handling of lots of contributions at the same time
parent
cf70fef0ac
commit
f22a9db067
|
@ -66,6 +66,11 @@
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.higlightRowInTable {
|
||||||
|
background-color: #dff0d8 !important;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
.centerInBtn {
|
.centerInBtn {
|
||||||
float: left;
|
float: left;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
@ -9,6 +9,8 @@ var sec_before_reload = refresh_speed;
|
||||||
var plotLineChart;
|
var plotLineChart;
|
||||||
var source_awards;
|
var source_awards;
|
||||||
var source_lastContrib;
|
var source_lastContrib;
|
||||||
|
var last_added_contrib;
|
||||||
|
var timeout_last_added_contrib;
|
||||||
|
|
||||||
/* CONFIG */
|
/* CONFIG */
|
||||||
var maxRank = 16;
|
var maxRank = 16;
|
||||||
|
@ -336,39 +338,39 @@ function addLastFromJson(datatable, url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function addLastContributor(datatable, data, update) {
|
function addLastContributor(datatable, data, update) {
|
||||||
var date = new Date(data.epoch*1000);
|
var org = data.org;
|
||||||
date.toString = function() {return this.toTimeString().slice(0,-15) +' '+ this.toLocaleDateString(); };
|
if (org == last_added_contrib) {
|
||||||
var to_add = [
|
let node = $('#lastTable > tbody tr:eq(0)');
|
||||||
date,
|
node.addClass('higlightRowInTable');
|
||||||
data.pnts,
|
update_timeout_last_added_contrib();
|
||||||
getMonthlyRankIcon(data.rank),
|
} else {
|
||||||
getOrgRankIcon(data.orgRank, 60),
|
last_added_contrib = org;
|
||||||
createHonorImg(data.honorBadge, 20),
|
var date = new Date(data.epoch*1000);
|
||||||
createImg(data.logo_path, 32),
|
date.toString = function() {return this.toTimeString().slice(0,-15) +' '+ this.toLocaleDateString(); };
|
||||||
createOrgLink(data.org),
|
var to_add = [
|
||||||
];
|
date,
|
||||||
if (update == undefined || update == false) {
|
data.pnts,
|
||||||
datatable.row.add(to_add);
|
getMonthlyRankIcon(data.rank),
|
||||||
datatable.draw();
|
getOrgRankIcon(data.orgRank, 60),
|
||||||
} else if(update == true) {
|
createHonorImg(data.honorBadge, 20),
|
||||||
var row_added = false;
|
createImg(data.logo_path, 32),
|
||||||
datatable.rows().every( function() {
|
createOrgLink(data.org),
|
||||||
if($(this.data()[6])[0].text == data.org) {
|
];
|
||||||
var node = $(datatable.row( this ).node());
|
if (update === undefined || update === false) {
|
||||||
datatable.row( this ).data( to_add );
|
datatable.row.add(to_add);
|
||||||
if(next_effect <= new Date()) {
|
|
||||||
node.effect("slide", 500);
|
|
||||||
next_effect.setSeconds((new Date()).getSeconds() + 5);
|
|
||||||
}
|
|
||||||
row_added = true;
|
|
||||||
}
|
|
||||||
datatable.draw();
|
datatable.draw();
|
||||||
});
|
} else if(update == true) {
|
||||||
if (!row_added) {
|
datatable.rows().every( function() {
|
||||||
var node = $(datatable.row.add(to_add).draw().node());
|
if($(this.data()[6])[0].text == data.org) {
|
||||||
node.effect("slide", 700);
|
var node = $(datatable.row( this ).node());
|
||||||
|
datatable.row( this ).data( to_add );
|
||||||
|
node.effect("slide", 500);
|
||||||
|
}
|
||||||
|
datatable.draw();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addAwards(datatableAwards, json, playAnim) {
|
function addAwards(datatableAwards, json, playAnim) {
|
||||||
|
@ -549,6 +551,15 @@ function updateProgressHeader(org) {
|
||||||
updateOvertakePnts();
|
updateOvertakePnts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_timeout_last_added_contrib() {
|
||||||
|
clearTimeout(timeout_last_added_contrib);
|
||||||
|
timeout_last_added_contrib = setTimeout(function() {
|
||||||
|
let node = $('#lastTable > tbody tr:eq(0)');
|
||||||
|
node.removeClass('higlightRowInTable');
|
||||||
|
last_added_contrib = null;
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
function showOnlyOrg() {
|
function showOnlyOrg() {
|
||||||
datatableCateg.search( $('#orgText').text() ).draw();
|
datatableCateg.search( $('#orgText').text() ).draw();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue