mirror of https://github.com/MISP/misp-dashboard
feature: Added a selector for the maximum number of showed items
parent
dab9a4e400
commit
127c1cef5e
|
@ -205,7 +205,14 @@ def users():
|
|||
|
||||
@app.route("/trendings")
|
||||
def trendings():
|
||||
maxNum = request.args.get('maxNum')
|
||||
try:
|
||||
maxNum = int(maxNum)
|
||||
except:
|
||||
maxNum = 15
|
||||
|
||||
return render_template('trendings.html',
|
||||
maxNum=maxNum
|
||||
)
|
||||
|
||||
''' INDEX '''
|
||||
|
|
|
@ -268,7 +268,8 @@ function updatePie(pie, line, data, url) {
|
|||
}
|
||||
}
|
||||
toPlot.sort(compareObj).reverse();
|
||||
toPlot = toPlot.slice(0,15); // take at max 12 elements
|
||||
var maxNum = $('#num_selector').val();
|
||||
toPlot = toPlot.slice(0,maxNum); // take at max 12 elements
|
||||
}
|
||||
if (!(pieWidget === undefined)) {
|
||||
pieWidget.setData(toPlot);
|
||||
|
@ -425,6 +426,12 @@ $(document).ready(function () {
|
|||
updateSignthingsChart();
|
||||
updateDisc();
|
||||
|
||||
$( "#num_selector" ).change(function() {
|
||||
var sel = parseInt($( this ).val());
|
||||
var maxNum = sel;
|
||||
window.location.href = url_currentPage+'?maxNum='+maxNum;
|
||||
});
|
||||
|
||||
$("<div id='tooltip'></div>").css({
|
||||
position: "absolute",
|
||||
display: "none",
|
||||
|
|
|
@ -116,6 +116,18 @@ small {
|
|||
<li><a href="{{ url_for('users') }}">MISP Users</a></li>
|
||||
<li><a href="{{ url_for('trendings') }}">MISP Trendings</a></li>
|
||||
</ul>
|
||||
<div class='leftSepa textTopHeader'>
|
||||
<strong>Max display:
|
||||
<select id="num_selector">
|
||||
<option value="1" {% if maxNum == 1 %}selected=""{% endif %}>1</option>
|
||||
<option value="3" {% if maxNum == 3 %}selected=""{% endif %}>3</option>
|
||||
<option value="5" {% if maxNum == 5 %}selected=""{% endif %}>5</option>
|
||||
<option value="10" {% if maxNum == 10 %}selected=""{% endif %}>10</option>
|
||||
<option value="15" {% if maxNum == 15 %}selected=""{% endif %}>15</option>
|
||||
<option value="20" {% if maxNum == 20 %}selected=""{% endif %}>20</option>
|
||||
</select>
|
||||
</strong>
|
||||
</div>
|
||||
<div class='leftSepa textTopHeader'>
|
||||
<strong>Date:
|
||||
<input type="text" id="datepickerStart" size="30" style="margin-bottom: 5px;">
|
||||
|
@ -212,6 +224,7 @@ small {
|
|||
<script>
|
||||
/* URL */
|
||||
var urlIconCalendar = "{{ url_for('static', filename='pics/calendar.gif') }}";
|
||||
var url_currentPage = "{{ url_for('trendings') }}";
|
||||
var url_getTrendingEvent = "{{ url_for('getTrendingEvents') }}";
|
||||
var url_getTrendingCateg = "{{ url_for('getTrendingCategs') }}";
|
||||
var url_getTrendingTag = "{{ url_for('getTrendingTags') }}";
|
||||
|
|
Loading…
Reference in New Issue