mirror of https://github.com/MISP/misp-dashboard
Updated test data + increased rank icon size
parent
0811823112
commit
50a1a349da
|
@ -188,7 +188,8 @@ class Contributor_helper:
|
||||||
dic['rank'] = random.randint(1,self.levelMax)
|
dic['rank'] = random.randint(1,self.levelMax)
|
||||||
dic['logo_path'] = 'logo'
|
dic['logo_path'] = 'logo'
|
||||||
dic['org'] = 'Org'+str(d)
|
dic['org'] = 'Org'+str(d)
|
||||||
for f in categories_in_datatable:
|
dic['pnts'] = random.randint(1,2**self.levelMax)
|
||||||
|
for f in self.categories_in_datatable:
|
||||||
dic[f] = random.randint(0,1600)
|
dic[f] = random.randint(0,1600)
|
||||||
data2.append(dic)
|
data2.append(dic)
|
||||||
return data2
|
return data2
|
||||||
|
@ -206,59 +207,75 @@ class Contributor_helper:
|
||||||
'rank': random.randint(1,self.levelMax),
|
'rank': random.randint(1,self.levelMax),
|
||||||
'logo_path': 'logo1',
|
'logo_path': 'logo1',
|
||||||
'org': 'CIRCL',
|
'org': 'CIRCL',
|
||||||
|
'pnts': random.randint(1,2**self.levelMax)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'rank': random.randint(1,self.levelMax),
|
'rank': random.randint(1,self.levelMax),
|
||||||
'logo_path': 'logo2',
|
'logo_path': 'logo2',
|
||||||
'org': 'CASES',
|
'org': 'CASES',
|
||||||
|
'pnts': random.randint(1,2**self.levelMax)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'rank': random.randint(1,self.levelMax),
|
'rank': random.randint(1,self.levelMax),
|
||||||
'logo_path': 'logo3',
|
'logo_path': 'logo3',
|
||||||
'org': 'SMILE',
|
'org': 'SMILE',
|
||||||
|
'pnts': random.randint(1,2**self.levelMax)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'rank': random.randint(1,self.levelMax),
|
'rank': random.randint(1,self.levelMax),
|
||||||
'logo_path': 'logo4',
|
'logo_path': 'logo4',
|
||||||
'org': 'ORG4',
|
'org': 'ORG4',
|
||||||
|
'pnts': random.randint(1,2**self.levelMax)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'rank': random.randint(1,self.levelMax),
|
'rank': random.randint(1,self.levelMax),
|
||||||
'logo_path': 'logo5',
|
'logo_path': 'logo5',
|
||||||
'org': 'ORG5',
|
'org': 'ORG5',
|
||||||
|
'pnts': random.randint(1,2**self.levelMax)
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
return data2
|
return data2*2
|
||||||
|
|
||||||
def TEST_getLastContributorsFromRedis(self):
|
def TEST_getLastContributorsFromRedis(self):
|
||||||
|
import time
|
||||||
data2 = [
|
data2 = [
|
||||||
{
|
{
|
||||||
'rank': random.randint(1,self.levelMax),
|
'rank': random.randint(1,self.levelMax),
|
||||||
'logo_path': 'logo1',
|
'logo_path': 'logo1',
|
||||||
'org': 'CIRCL',
|
'org': 'CIRCL',
|
||||||
|
'pnts': random.randint(1,2**self.levelMax),
|
||||||
|
'epoch': time.time() - random.randint(0, 10000)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'rank': random.randint(1,self.levelMax),
|
'rank': random.randint(1,self.levelMax),
|
||||||
'logo_path': 'logo2',
|
'logo_path': 'logo2',
|
||||||
'org': 'CASES',
|
'org': 'CASES',
|
||||||
|
'pnts': random.randint(1,2**self.levelMax),
|
||||||
|
'epoch': time.time() - random.randint(0, 10000)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'rank': random.randint(1,self.levelMax),
|
'rank': random.randint(1,self.levelMax),
|
||||||
'logo_path': 'logo3',
|
'logo_path': 'logo3',
|
||||||
'org': 'SMILE',
|
'org': 'SMILE',
|
||||||
|
'pnts': random.randint(1,2**self.levelMax),
|
||||||
|
'epoch': time.time() - random.randint(0, 10000)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'rank': random.randint(1,self.levelMax),
|
'rank': random.randint(1,self.levelMax),
|
||||||
'logo_path': 'logo4',
|
'logo_path': 'logo4',
|
||||||
'org': 'ORG4',
|
'org': 'ORG4',
|
||||||
|
'pnts': random.randint(1,2**self.levelMax),
|
||||||
|
'epoch': time.time() - random.randint(0, 10000)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'rank': random.randint(1,self.levelMax),
|
'rank': random.randint(1,self.levelMax),
|
||||||
'logo_path': 'logo5',
|
'logo_path': 'logo5',
|
||||||
'org': 'ORG5',
|
'org': 'ORG5',
|
||||||
|
'pnts': random.randint(1,2**self.levelMax),
|
||||||
|
'epoch': time.time() - random.randint(0, 10000)
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
return data2
|
return data2*2
|
||||||
|
|
||||||
def TEST_getAllOrgFromRedis(self):
|
def TEST_getAllOrgFromRedis(self):
|
||||||
data2 = ['CIRCL', 'CASES', 'SMILE' ,'ORG4' ,'ORG5', 'SUPER HYPER LONG ORGINZATION NAME', 'Org3']
|
data2 = ['CIRCL', 'CASES', 'SMILE' ,'ORG4' ,'ORG5', 'SUPER HYPER LONG ORGINZATION NAME', 'Org3']
|
||||||
|
|
10
server.py
10
server.py
|
@ -269,7 +269,7 @@ def getCoordsByRadius():
|
||||||
|
|
||||||
@app.route("/_getLastContributors")
|
@app.route("/_getLastContributors")
|
||||||
def getLastContributors():
|
def getLastContributors():
|
||||||
return jsonify(contributor_helper.getLastContributorsFromRedis())
|
return jsonify(contributor_helper.TEST_getLastContributorsFromRedis())
|
||||||
|
|
||||||
@app.route("/_eventStreamLastContributor")
|
@app.route("/_eventStreamLastContributor")
|
||||||
def getLastContributor():
|
def getLastContributor():
|
||||||
|
@ -296,7 +296,7 @@ def getTopContributor(suppliedDate=None):
|
||||||
else:
|
else:
|
||||||
date = suppliedDate
|
date = suppliedDate
|
||||||
|
|
||||||
data = contributor_helper.getTopContributorFromRedis(date)
|
data = contributor_helper.TEST_getTopContributorFromRedis(date)
|
||||||
return jsonify(data)
|
return jsonify(data)
|
||||||
|
|
||||||
@app.route("/_getFameContributor")
|
@app.route("/_getFameContributor")
|
||||||
|
@ -312,7 +312,7 @@ def getFameContributor():
|
||||||
|
|
||||||
@app.route("/_getTop5Overtime")
|
@app.route("/_getTop5Overtime")
|
||||||
def getTop5Overtime():
|
def getTop5Overtime():
|
||||||
return jsonify(contributor_helper.getTop5OvertimeFromRedis())
|
return jsonify(contributor_helper.TEST_getTop5OvertimeFromRedis())
|
||||||
|
|
||||||
@app.route("/_getCategPerContrib")
|
@app.route("/_getCategPerContrib")
|
||||||
def getCategPerContrib():
|
def getCategPerContrib():
|
||||||
|
@ -321,11 +321,11 @@ def getCategPerContrib():
|
||||||
except:
|
except:
|
||||||
date = datetime.datetime.now()
|
date = datetime.datetime.now()
|
||||||
|
|
||||||
return jsonify(contributor_helper.getCategPerContribFromRedis(date))
|
return jsonify(contributor_helper.TEST_getCategPerContribFromRedis(date))
|
||||||
|
|
||||||
@app.route("/_getAllOrg")
|
@app.route("/_getAllOrg")
|
||||||
def getAllOrg():
|
def getAllOrg():
|
||||||
return jsonify(contributor_helper.getAllOrgFromRedis())
|
return jsonify(contributor_helper.TEST_getAllOrgFromRedis())
|
||||||
|
|
||||||
@app.route("/_getOrgRank")
|
@app.route("/_getOrgRank")
|
||||||
def getOrgRank():
|
def getOrgRank():
|
||||||
|
|
|
@ -160,7 +160,7 @@ function generateRankingSheet(rank, rankDec, stepPnt, pnt, Rpnt) {
|
||||||
for (var i=1; i<=maxRank; i++) {
|
for (var i=1; i<=maxRank; i++) {
|
||||||
var tr = document.createElement('tr');
|
var tr = document.createElement('tr');
|
||||||
var td1 = document.createElement('td');
|
var td1 = document.createElement('td');
|
||||||
td1.innerHTML = getRankIcon(i, 20);
|
td1.innerHTML = getRankIcon(i, 40);
|
||||||
td1.style.padding = "2px";
|
td1.style.padding = "2px";
|
||||||
var td2 = document.createElement('td');
|
var td2 = document.createElement('td');
|
||||||
td2.innerHTML = Math.floor(Math.pow(rankMultiplier, i));
|
td2.innerHTML = Math.floor(Math.pow(rankMultiplier, i));
|
||||||
|
@ -182,7 +182,7 @@ function generateRankingSheet(rank, rankDec, stepPnt, pnt, Rpnt) {
|
||||||
gdiv.appendChild(table);
|
gdiv.appendChild(table);
|
||||||
OuterDiv.appendChild(gdiv);
|
OuterDiv.appendChild(gdiv);
|
||||||
// Tot nbr points
|
// Tot nbr points
|
||||||
var tableHeight = 440; //HARDCODED...
|
var tableHeight = 720; //HARDCODED...
|
||||||
var div = document.createElement('div');
|
var div = document.createElement('div');
|
||||||
div.classList.add('progress');
|
div.classList.add('progress');
|
||||||
div.style.width = '20px';
|
div.style.width = '20px';
|
||||||
|
@ -269,19 +269,19 @@ function updateProgressHeader(org) {
|
||||||
// update color in other dataTables
|
// update color in other dataTables
|
||||||
datatableTop.rows().every( function() {
|
datatableTop.rows().every( function() {
|
||||||
var row = this.node();
|
var row = this.node();
|
||||||
if(this.data()[3] == data.org) { row.classList.add('infoBlue'); } else { row.classList.remove('info'); }
|
if(this.data()[3] == data.org) { row.classList.add('infoBlue'); } else { row.classList.remove('infoBlue'); }
|
||||||
});
|
});
|
||||||
datatableFame.rows().every( function() {
|
datatableFame.rows().every( function() {
|
||||||
var row = this.node();
|
var row = this.node();
|
||||||
if(this.data()[3] == data.org) { row.classList.add('infoBlue'); } else { row.classList.remove('info'); }
|
if(this.data()[3] == data.org) { row.classList.add('infoBlue'); } else { row.classList.remove('infoBlue'); }
|
||||||
});
|
});
|
||||||
datatableCateg.rows().every( function() {
|
datatableCateg.rows().every( function() {
|
||||||
var row = this.node();
|
var row = this.node();
|
||||||
if(this.data()[3] == data.org) { row.classList.add('infoBlue'); } else { row.classList.remove('info'); }
|
if(this.data()[3] == data.org) { row.classList.add('infoBlue'); } else { row.classList.remove('infoBlue'); }
|
||||||
});
|
});
|
||||||
datatableLast.rows().every( function() {
|
datatableLast.rows().every( function() {
|
||||||
var row = this.node();
|
var row = this.node();
|
||||||
if(this.data()[3] == data.org) { row.classList.add('infoBlue'); } else { row.classList.remove('info'); }
|
if(this.data()[3] == data.org) { row.classList.add('infoBlue'); } else { row.classList.remove('infoBlue'); }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ $(document).ready(function() {
|
||||||
var row = data[i];
|
var row = data[i];
|
||||||
i = parseInt(i);
|
i = parseInt(i);
|
||||||
var to_add = [
|
var to_add = [
|
||||||
i+1,
|
row.pnts,
|
||||||
getRankIcon(row.rank),
|
getRankIcon(row.rank),
|
||||||
row.logo_path,
|
row.logo_path,
|
||||||
row.org,
|
row.org,
|
||||||
|
|
Loading…
Reference in New Issue