@@ -34,7 +34,7 @@ <h2 class="panel-title">Events list</h2>
34
34
</ ul >
35
35
</ div >
36
36
37
- {% endif %}
37
+ {% endif %} {# kibana or evebox #}
38
38
{% if request.user.is_staff %}
39
39
< div class ="panel-heading ">
40
40
< h2 class ="panel-title "> Action</ h2 >
@@ -61,7 +61,7 @@ <h2 class="panel-title">Action</h2>
61
61
< span class ="text-muted "> Transform rule</ span >
62
62
{% endif %}
63
63
</ li >
64
- {% endif %}
64
+ {% endif %} {# rule.state #}
65
65
{% if not rule.state_in_source %}
66
66
< li >
67
67
< a href ="{% url 'toggle_availability' rule.sid %} "> Toggle availability</ a >
@@ -74,7 +74,7 @@ <h2 class="panel-title">Action</h2>
74
74
{% endif %}
75
75
</ ul >
76
76
</ div >
77
- {% endif %}
77
+ {% endif %} {# user.is_staff #}
78
78
{% endblock %}
79
79
80
80
{% block content %}
@@ -121,12 +121,11 @@ <h2 class="panel-title">Information</h2>
121
121
</ div >
122
122
{% endif %}
123
123
</ div > <!-- panel -->
124
- {% endif %}
125
124
</ div > <!-- col -->
125
+ {% endif %}
126
126
</ div > <!-- row -->
127
127
128
128
129
- {% if elasticsearch %}
130
129
131
130
< script >
132
131
$ ( document ) . ready ( function ( ) {
@@ -142,15 +141,16 @@ <h2 class="panel-title">Information</h2>
142
141
143
142
<!-- Nav tabs -->
144
143
< ul class ="nav nav-tabs " role ="tablist " id ="ruleinfo ">
145
- {% if suricata_stats %}
144
+ {% if suricata_stats and elasticsearch %}
146
145
< li role ="presentation " class ="active "> < a href ="#stats " aria-controls ="stats " role ="tab " data-toggle ="tab "> Statistics</ a > </ li >
147
146
{% endif %}
148
147
< li role ="presentation "> < a href ="#rule_status " aria-controls ="rule_status " role ="tab " data-toggle ="tab "> Information</ a > </ li >
149
148
< li role ="presentation "> < a href ="#rule_comments " aria-controls ="rule_comments " role ="tab " data-toggle ="tab "> History</ a > </ li >
150
149
</ ul >
151
150
152
151
< div class ="tab-content ">
153
-
152
+
153
+ {% if suricata_stats and elasticsearch %}
154
154
< div role ="tabpanel " class ="tab-pane fade in active " id ="stats ">
155
155
< div class ="container-fluid " >
156
156
< div class ="col-md-4 ">
@@ -251,7 +251,7 @@ <h2 class="title">Destination IP (last {{ date }})
251
251
</ div > <!-- container -->
252
252
</ div >
253
253
254
- </ div > <!-- row -->
254
+ </ div > <!-- container-fluid -->
255
255
{% if probes %}
256
256
< div class ="row ">
257
257
< div class ="col-md-12 ">
@@ -281,10 +281,11 @@ <h2 class="title">Activity (last {{ date }})
281
281
</ div > <!-- col -->
282
282
</ div > <!-- row -->
283
283
284
- {% endif %}
285
- </ div > <!-- container -->
284
+ {% endif %} {# if probes #}
285
+ </ div > <!-- tabpanel -->
286
+ {% endif %} {# suricata_stats and elasticsearch #}
286
287
287
- < div role ="tabpanel " class ="tab-pane fade in " id ="rule_status ">
288
+ < div role ="tabpanel " class ="tab-pane fade in{% if not suricata_stats and not elasticsearch %} active{% endif %} " id ="rule_status ">
288
289
< div class ="container-fluid ">
289
290
290
291
< h2 class ="title "> Definition</ h2 >
@@ -302,9 +303,8 @@ <h3 class="title">{{ ruleset.name }}</h3>
302
303
</ div >
303
304
{% endif %}
304
305
{% endfor %}
305
- {% endif %}
306
+ {% endif %} {# rule_transformation #}
306
307
307
- {% endif %}
308
308
< div class ="row ">
309
309
< div id ="validity_error " class ="col-md-12 " style ="display:none; ">
310
310
< h2 class ="title "> Rulesets error</ h2 >
@@ -342,7 +342,7 @@ <h2 class="panel-title"><a href="{% url 'ruleset' ruleset.pk %}">{{ ruleset.name
342
342
</ div >
343
343
{% endfor %}
344
344
</ div >
345
- </ div >
345
+ </ div > <!-- container-fluid -->
346
346
347
347
</ div > <!-- col -->
348
348
@@ -365,8 +365,6 @@ <h2 class="title">Suppressions</h2>
365
365
</ div > <!-- col -->
366
366
{% endif %}
367
367
368
-
369
- {% if elasticsearch %}
370
368
</ div >
371
369
</ div >
372
370
@@ -422,11 +420,12 @@ <h3 class="title">Add comment</h3>
422
420
</ div > <!-- tabpanel -->
423
421
424
422
< script >
425
-
423
+ { % if suricata_stats and elasticsearch % }
426
424
{ % if probes % }
427
425
$ ( 'document' ) . ready ( function ( ) { draw_timeline ( { { from_date } } , [ { % autoescape off % } { { probes | join :',' } } { % endautoescape % } ] , "alert.signature_id:{{ rule.sid }}" ) ; } ) ;
428
426
{ % endif % }
429
427
428
+
430
429
function load_stats ( ) {
431
430
$ . ajax ( {
432
431
url : '{% url ' elasticsearch ' %}?query=rule&sid={{ rule.pk }}&from_date={{ from_date }}' ,
@@ -497,12 +496,12 @@ <h3 class="title">Add comment</h3>
497
496
}
498
497
499
498
$ ( 'document' ) . ready ( load_ip_stats ( ) ) ;
500
-
499
+ { % endif % } { # suricata_stats and elasticsearch # }
501
500
</ script >
502
- {% endif %}
503
501
504
- </ div >
505
502
503
+ </ div >
504
+ </ div > <!-- container-fluid -->
506
505
< script >
507
506
function rule_validity_check ( ) {
508
507
$ ( "div.ruleset-status" ) . each (
0 commit comments