mirror of https://github.com/MISP/misp-dashboard
Added help text in contribution board
parent
15170a152a
commit
0811823112
|
@ -28,6 +28,7 @@ categories_in_datatable = ["internal_reference", "targeting_data", "antivirus_de
|
|||
default_pnts_per_contribution = 1
|
||||
# array of the form [[category, pntsRcv], ...]
|
||||
pnts_per_contribution = [["payload_delivery", 5], ["artifact_dropped", 20], ["network_activity", 5]]
|
||||
additional_help_text = ["Sightings multiplies earned points by 2", "Editing an attribute earns you the same as creating one"]
|
||||
|
||||
[Log]
|
||||
field_to_plot = Attribute.category
|
||||
|
|
|
@ -11,6 +11,18 @@ class Contributor_helper:
|
|||
|
||||
self.MAX_NUMBER_OF_LAST_CONTRIBUTOR = cfg.getint('CONTRIB', 'max_number_of_last_contributor')
|
||||
self.categories_in_datatable = json.loads(cfg.get('CONTRIB', 'categories_in_datatable'))
|
||||
self.default_pnts_per_contribution = json.loads(cfg.get('CONTRIB', 'default_pnts_per_contribution'))
|
||||
temp = json.loads(cfg.get('CONTRIB', 'pnts_per_contribution'))
|
||||
self.DICO_PNTS_REWARD = {}
|
||||
for categ, pnts in temp:
|
||||
self.DICO_PNTS_REWARD[categ] = pnts
|
||||
# fill other categ with default points
|
||||
for categ in self.categories_in_datatable:
|
||||
if categ in self.DICO_PNTS_REWARD:
|
||||
continue
|
||||
else:
|
||||
self.DICO_PNTS_REWARD[categ] = self.default_pnts_per_contribution
|
||||
|
||||
self.rankMultiplier = cfg.getfloat('CONTRIB' ,'rankMultiplier')
|
||||
self.levelMax = 16
|
||||
|
||||
|
|
|
@ -150,14 +150,18 @@ def geo():
|
|||
def contrib():
|
||||
categ_list = contributor_helper.categories_in_datatable
|
||||
categ_list_str = [ s[0].upper() + s[1:].replace('_', ' ') for s in contributor_helper.categories_in_datatable]
|
||||
categ_list_points = [contributor_helper.DICO_PNTS_REWARD[categ] for categ in categ_list]
|
||||
currOrg = request.args.get('org')
|
||||
if currOrg is None:
|
||||
currOrg = ""
|
||||
return render_template('contrib.html',
|
||||
currOrg=currOrg,
|
||||
rankMultiplier=contributor_helper.rankMultiplier,
|
||||
default_pnts_per_contribution=contributor_helper.default_pnts_per_contribution,
|
||||
additional_help_text=json.loads(cfg.get('CONTRIB', 'additional_help_text')),
|
||||
categ_list=json.dumps(categ_list),
|
||||
categ_list_str=categ_list_str,
|
||||
categ_list_points=categ_list_points,
|
||||
min_between_reload=cfg.getint('CONTRIB', 'min_between_reload')
|
||||
)
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
}
|
||||
|
||||
.questionBadgeText {
|
||||
left: 15%;
|
||||
left: -15%;
|
||||
position: relative;
|
||||
bottom: 12%;
|
||||
bottom: 18%;
|
||||
}
|
||||
|
||||
.questionBadgeDiv {
|
||||
|
|
|
@ -44,6 +44,49 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Modal -->
|
||||
<div id="myModal" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Ranks and Point per contribution</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Ranks are generated by the formula: <pre>Rank = floor(Log(<it>points</it>, {{ rankMultiplier }}))</pre></p>
|
||||
<ul>
|
||||
{% for text in additional_help_text %}
|
||||
<li>{{ text }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Category</th>
|
||||
<th>Point(s) awarded</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for categ in categ_list_str %}
|
||||
<tr>
|
||||
<td>{{ categ }}</td>
|
||||
<td>{{ categ_list_points[loop.index0] }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="wrapper">
|
||||
|
||||
|
@ -83,7 +126,7 @@
|
|||
</div>
|
||||
<div id="orgNextRankDiv" class='textTopHeader' style="padding-top: 0px; position: relative; width: 40px; height: 40px;"></div>
|
||||
</button>
|
||||
<div class="questionBadgeDiv" style="float: right;"><i class="fa fa-question-circle questionBadgeText"></i></div>
|
||||
<button type="button" class="questionBadgeDiv" data-toggle="modal" data-target="#myModal"><i class="fa fa-question-circle questionBadgeText"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.navbar-header -->
|
||||
|
|
|
@ -168,7 +168,7 @@ def handler_sighting(zmq_name, jsonsight):
|
|||
org = jsonsight['org']
|
||||
categ = jsonsight['categ']
|
||||
action = jsonsight['action']
|
||||
handleContribution(zmq_name, org, categ, action)
|
||||
handleContribution(zmq_name, org, categ, action, pntMultiplier=2)
|
||||
return
|
||||
|
||||
def handler_event(zmq_name, jsonobj):
|
||||
|
|
Loading…
Reference in New Issue