index.volt 32.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
{#

OPNsense® is Copyright © 2014 – 2015 by Deciso B.V.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1.  Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2.  Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

#}

<script type="text/javascript">

    $( document ).ready(function() {
32 33 34
        //
        var data_get_map = {'frm_GeneralSettings':"/api/ids/settings/get"};

35 36 37 38 39 40 41 42
        /**
         * update service status
         */
        function updateStatus() {
            ajaxCall(url="/api/ids/service/status", sendData={}, callback=function(data,status) {
                updateServiceStatusUI(data['status']);
            });
        }
43

44 45 46
        /**
         * list all known classtypes and add to selection box
         */
47 48 49
        function updateRuleClassTypes() {
            ajaxGet(url="/api/ids/settings/listRuleClasstypes",sendData={}, callback=function(data, status) {
                if (status == "success") {
50
                    $('#ruleclass').html('<option value="">ALL</option>');
51 52 53 54 55 56 57 58 59 60 61
                    $.each(data['items'], function(key, value) {
                        $('#ruleclass').append($("<option></option>").attr("value",value).text(value));
                    });
                    $('.selectpicker').selectpicker('refresh');
                    // link on change event
                    $('#ruleclass').on('change', function(){
                        $('#grid-installedrules').bootgrid('reload');
                    });
                }
            });
        }
62 63 64 65 66 67
        /**
         * link on change event for alert "action" selectionbox
         */
        $('#ruleaction').on('change', function(){
            $('#grid-installedrules').bootgrid('reload');
        });
68

69 70 71 72 73 74 75 76 77
        /**
         * update list of available alert logs
         */
        function updateAlertLogs() {
            ajaxGet(url="/api/ids/service/getAlertLogs",sendData={}, callback=function(data, status) {
                if (status == "success") {
                    $('#alert-logfile').html("");
                    $.each(data, function(key, value) {
                        if (value['sequence'] == undefined) {
78
                            $('#alert-logfile').append($("<option/>").data('filename', value['filename']).attr("value",'none').text(value['modified']));
79
                        } else {
80
                            $('#alert-logfile').append($("<option/>").data('filename', value['filename']).attr("value",value['sequence']).text(value['modified']));
81 82 83 84 85 86 87 88 89 90
                        }
                    });
                    $('.selectpicker').selectpicker('refresh');
                    // link on change event
                    $('#alert-logfile').on('change', function(){
                        $('#grid-alerts').bootgrid('reload');
                    });
                }
            });
        }
91 92

        /**
93
         * Add classtype / action to rule filter
94 95
         */
        function addRuleFilters(request) {
96 97 98 99
            var selected =$('#ruleclass').find("option:selected").val();
            if ( selected != "") {
                request['classtype'] = selected;
            }
100 101 102 103
            var selected =$('#ruleaction').find("option:selected").val();
            if ( selected != "") {
                request['action'] = selected;
            }
104 105 106
            return request;
        }

107
        /**
108
         *  add filter criteria to log query
109 110
         */
        function addAlertQryFilters(request) {
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
            var selected_logfile =$('#alert-logfile').find("option:selected").val();
            var selected_max_entries =$('#alert-logfile-max').find("option:selected").val();
            var search_phrase = $("#inputSearchAlerts").val();

            // add loading overlay
            $('#processing-dialog').modal('show');
            $("#grid-alerts").bootgrid().on("loaded.rs.jquery.bootgrid", function (e){
                $('#processing-dialog').modal('hide');
            });


            if ( selected_logfile != "") {
                request['fileid'] = selected_logfile;
                request['rowCount'] = selected_max_entries;
                request['searchPhrase'] = search_phrase;
126 127 128 129
            }
            return request;
        }

130
        // load initial data
131 132 133 134 135 136 137 138 139 140 141
        function loadGeneralSettings() {
            mapDataToFormUI(data_get_map).done(function(data){
                // set schedule updates link to cron
                $.each(data.frm_GeneralSettings.ids.general.UpdateCron, function(key, value) {
                    if (value.selected == 1) {
                        $("#scheduled_updates").attr("href","/ui/cron/item/open/"+key);
                        $("#scheduled_updates").show();
                    }
                });
                formatTokenizersUI();
                $('.selectpicker').selectpicker('refresh');
142
            });
143
        }
144

145 146
        /**
         * save (general) settings and reconfigure
147
         * @param callback_funct: callback function, receives result status true/false
148
         */
149 150
        function actionReconfigure(callback_funct) {
            var result_status = false;
151 152
            saveFormToEndpoint(url="/api/ids/settings/set",formid='frm_GeneralSettings',callback_ok=function(){
                ajaxCall(url="/api/ids/service/reconfigure", sendData={}, callback=function(data,status) {
153 154
                    if (status == "success" || data['status'].toLowerCase().trim() == "ok") {
                        result_status = true;
155
                    }
156
                    callback_funct(result_status);
157 158 159 160
                });
            });
        }

161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
        /**
         * toggle selected items
         * @param gridId: grid id to to use
         * @param url: ajax action to call
         * @param state: 0/1/undefined
         * @param combine: number of keys to combine (seperate with ,)
         *                 try to avoid too much items per call (results in too long url's)
         */
        function actionToggleSelected(gridId, url, state, combine) {
            var rows =$("#"+gridId).bootgrid('getSelectedRows');
            if (rows != undefined){
                var deferreds = [];
                if (state != undefined) {
                    var url_suffix = state;
                } else {
                    var url_suffix = "";
                }

                var keyset = [];
                $.each(rows, function(key,uuid){
                    keyset.push(uuid);
                    if ( combine == undefined || keyset.length > combine) {
                        deferreds.push(ajaxCall(url + keyset.join(',') +'/'+url_suffix, sendData={},null));
                        keyset = [];
                    }
                });

                // flush remaining items
                if (keyset.length > 0) {
                    deferreds.push(ajaxCall(url + keyset.join(',') +'/'+url_suffix, sendData={},null));
                }

                // refresh when all toggles are executed
                $.when.apply(null, deferreds).done(function(){
195
                    $("#"+gridId).bootgrid("reload");
196 197 198 199
                });
            }
        }

200 201 202
        /*************************************************************************************************************
         * UI load grids (on tab change)
         *************************************************************************************************************/
203

204
        /**
205
         * load content on tab changes
206
         */
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
        $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
            if (e.target.id == 'rule_tab'){
                //
                // activate rule tab page
                //

                // delay refresh for a bit
                setTimeout(updateRuleClassTypes, 500);

                /**
                 * grid installed rules
                 */
                $('#grid-installedrules').bootgrid('destroy'); // always destroy previous grid, so data is always fresh
                $("#grid-installedrules").UIBootgrid(
                        {   search:'/api/ids/settings/searchinstalledrules',
                            get:'/api/ids/settings/getRuleInfo/',
223
                            set:'/api/ids/settings/setRule/',
224 225
                            options:{
                                requestHandler:addRuleFilters,
226
                                rowCount:[10, 25, 50,100,500,1000] ,
227 228
                                formatters:{
                                    rowtoggle: function (column, row) {
229
                                        var toggle = " <button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.sid + "\"><span class=\"fa fa-pencil\"></span></button> ";
230
                                        if (parseInt(row[column.id], 2) == 1) {
231
                                            toggle += "&nbsp; <span style=\"cursor: pointer;\" class=\"fa fa-check-square-o command-toggle\" data-value=\"1\" data-row-id=\"" + row.sid + "\"></span>";
232
                                        } else {
233
                                            toggle += "&nbsp; <span style=\"cursor: pointer;\" class=\"fa fa-square-o command-toggle\" data-value=\"0\" data-row-id=\"" + row.sid + "\"></span>";
234 235 236
                                        }
                                        return toggle;
                                    }
237
                                }
238 239
                            },
                            toggle:'/api/ids/settings/toggleRule/'
240
                        }
241 242 243 244 245 246 247 248 249 250 251 252 253
                );
            } else if (e.target.id == 'alert_tab') {
                updateAlertLogs();
                /**
                 * grid query alerts
                 */
                $('#grid-alerts').bootgrid('destroy'); // always destroy previous grid, so data is always fresh
                $("#grid-alerts").UIBootgrid(
                        {   search:'/api/ids/service/queryAlerts',
                            get:'/api/ids/service/getAlertInfo/',
                            options:{
                                multiSelect:false,
                                selection:false,
254 255 256
                                templates : {
                                    header: ""
                                },
257 258 259
                                requestHandler:addAlertQryFilters,
                                formatters:{
                                    info: function (column, row) {
260
                                        return "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.filepos + "/" + row.fileid + "\"><span class=\"fa fa-pencil\"></span></button> ";
261
                                    }
262
                                },
263
                            }
264
                        });
265 266 267 268 269 270 271 272 273
            } else if (e.target.id == 'userrules_tab') {
                $('#grid-userrules').bootgrid('destroy'); // always destroy previous grid, so data is always fresh
                $("#grid-userrules").UIBootgrid({
                        search:'/api/ids/settings/searchUserRule',
                        get:'/api/ids/settings/getUserRule/',
                        set:'/api/ids/settings/setUserRule/',
                        add:'/api/ids/settings/addUserRule/',
                        del:'/api/ids/settings/delUserRule/',
                        toggle:'/api/ids/settings/toggleUserRule/'
274 275 276
                    }
                );

277 278 279
            }
        })

280 281 282 283
        /**
         * grid for installable rule files
         */
        $("#grid-rule-files").UIBootgrid(
284 285 286 287
                {   search:'/api/ids/settings/listRulesets',
                    get:'/api/ids/settings/getRuleset/',
                    set:'/api/ids/settings/setRuleset/',
                    toggle:'/api/ids/settings/toggleRuleset/',
288 289 290 291
                    options:{
                        navigation:0,
                        formatters:{
                            rowtoggle: function (column, row) {
292
                                var toggle = " <button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.filename + "\"><span class=\"fa fa-pencil\"></span></button> ";
293
                                if (parseInt(row[column.id], 2) == 1) {
294
                                    toggle += "<span style=\"cursor: pointer;\" class=\"fa fa-check-square-o command-toggle\" data-value=\"1\" data-row-id=\"" + row.filename + "\"></span>";
295
                                } else {
296
                                    toggle += "<span style=\"cursor: pointer;\" class=\"fa fa-square-o command-toggle\" data-value=\"0\" data-row-id=\"" + row.filename + "\"></span>";
297 298 299
                                }
                                return toggle;
                            }
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314
                        },
                        converters: {
                            // show "not installed" for rules without timestamp (not on disc)
                            rulets: {
                                from: function (value) {
                                    return value;
                                },
                                to: function (value) {
                                    if ( value == null ) {
                                        return "{{ lang._('not installed') }}";
                                    } else {
                                        return value;
                                    }
                                }
                            }
315 316 317 318
                        }
                    }
                });

319
        /*************************************************************************************************************
320
         * UI button Commands
321 322 323 324 325 326
         *************************************************************************************************************/

        /**
         * save settings and reconfigure ids
         */
        $("#reconfigureAct").click(function(){
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
            $("#reconfigureAct_progress").addClass("fa fa-spinner fa-pulse");
            actionReconfigure(function(status){
                // when done, disable progress animation.
                $("#reconfigureAct_progress").removeClass("fa fa-spinner fa-pulse");
                updateStatus();

                if (!status) {
                    BootstrapDialog.show({
                        type: BootstrapDialog.TYPE_WARNING,
                        title: "Error reconfiguring IDS",
                        message: data['status'],
                        draggable: true
                    });
                }
            });
342
        });
343

344 345 346 347 348 349 350 351 352 353 354
        /**
         * update (userdefined) rules
         */
        $(".act_update").click(function(){
            $(".act_update_progress").addClass("fa fa-spinner fa-pulse");
            ajaxCall(url="/api/ids/service/reloadRules", sendData={}, callback=function(data,status) {
                // when done, disable progress animation.
                $(".act_update_progress").removeClass("fa fa-spinner fa-pulse");
            });
        });

355 356 357 358 359 360 361 362
        /**
         * update rule definitions
         */
        $("#updateRulesAct").click(function(){
            $("#updateRulesAct_progress").addClass("fa fa-spinner fa-pulse");
            ajaxCall(url="/api/ids/service/updateRules", sendData={}, callback=function(data,status) {
                // when done, disable progress animation and reload grid.
                $('#grid-rule-files').bootgrid('reload');
363
                updateStatus();
364 365
                if ($('#scheduled_updates').is(':hidden') ){
                    // save and reconfigure on initial download (tries to create a cron job)
366 367 368 369 370 371
                    actionReconfigure(function(status){
                        loadGeneralSettings();
                        $("#updateRulesAct_progress").removeClass("fa fa-spinner fa-pulse");
                    });
                } else {
                    $("#updateRulesAct_progress").removeClass("fa fa-spinner fa-pulse");
372
                }
373 374 375
            });
        });

376 377 378 379 380
        /**
         * disable selected rulesets
         */
        $("#disableSelectedRuleSets").click(function(){
            var gridId = 'grid-rule-files';
381
            var url = '/api/ids/settings/toggleRuleset/';
382 383 384 385 386 387 388 389
            actionToggleSelected(gridId, url, 0, 20);
        });

        /**
         * enable selected rulesets
         */
        $("#enableSelectedRuleSets").click(function(){
            var gridId = 'grid-rule-files';
390
            var url = '/api/ids/settings/toggleRuleset/';
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
            actionToggleSelected(gridId, url, 1, 20);
        });

        /**
         * disable selected rules
         */
        $("#disableSelectedRules").click(function(){
            var gridId = 'grid-installedrules';
            var url = '/api/ids/settings/toggleRule/';
            actionToggleSelected(gridId, url, 0, 100);
        });

        /**
         * enable selected rules
         */
        $("#enableSelectedRules").click(function(){
            var gridId = 'grid-installedrules';
            var url = '/api/ids/settings/toggleRule/';
            actionToggleSelected(gridId, url, 1, 100);
        });

412 413 414 415 416 417
        /**
         * link query alerts button.
         */
        $("#actQueryAlerts").click(function(){
            $('#grid-alerts').bootgrid('reload');
        });
418 419 420 421 422
        $("#inputSearchAlerts").keypress(function (e) {
            if (e.which == 13) {
                $("#actQueryAlerts").click();
            }
        });
423

424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
        /**
         * Change sid to action selector after DialogAlert show
         */
        $( "#DialogAlert" ).on('shown.bs.modal', function (e) {
            // replace "sid" for sid + action
            $("#alert_sid").show();
            $("#alert_sid_action").remove();
            var sid = $("#alert_sid").html();
            ajaxGet(url="/api/ids/settings/getRuleInfo/"+sid,sendData={}, callback=function(data, status) {
                if (status == "success") {
                    $("#alert_sid").hide();
                    var alert_select = $('<select class="selectpicker"/>');
                    $.each(data['action'], function(key, value){
                        var opt = $('<option/>').attr("value", key).text(value.value)
                        if (value.selected == 1) {
                            opt.attr('selected', 'selected');
                        }
                        alert_select.append(opt);
                    });
                    $("#alert_sid").parent().append($('<div id="alert_sid_action"/>'));
                    $("#alert_sid_action").append($('<table style="width:200px;"/>')
                        .append($('<tr/>')
                            .append($('<td/>').html(sid))
                            .append($('<td/>').append(alert_select))
                    ));
                    alert_select.change(function(){
                        ajaxCall(url="/api/ids/settings/setRule/"+sid, sendData={action:$(this).val()}, callback=function(data,status) {
                            $("#alert_sid_action > small").remove();
                            $("#alert_sid_action").append($('<small/>').html("{{ lang._('Changes will be active after apply (rules tab)') }}"));
                        });
                    });
                }
            });
        });

459 460 461 462 463
        /**
         * Initialize
         */
        loadGeneralSettings();
        updateStatus();
464

465 466 467 468 469 470 471 472
        // update history on tab state and implement navigation
        if(window.location.hash != "") {
            $('a[href="' + window.location.hash + '"]').click()
        }
        $('.nav-tabs a').on('shown.bs.tab', function (e) {
            history.pushState(null, null, e.target.hash);
        });

473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500
        // delete selected alert log
        $("#actDeleteLog").click(function(){
            var selected_log = $("#alert-logfile > option:selected");
            BootstrapDialog.show({
                type:BootstrapDialog.TYPE_DANGER,
                title: '{{ lang._('Remove log file ') }} ' + selected_log.html(),
                message: '{{ lang._('Removing this file will cleanup disk space, but cannot be undone.') }}',
                buttons: [{
                    icon: 'fa fa-trash-o',
                    label: '{{ lang._('Yes') }}',
                    cssClass: 'btn-primary',
                    action: function(dlg){
                        ajaxCall(url="/api/ids/service/dropAlertLog/",sendData={filename: selected_log.data('filename')},
                                callback=function(data,status){
                                    updateAlertLogs();
                                });
                        dlg.close();
                    }
                }, {
                    label: 'Close',
                    action: function(dlg){
                        dlg.close();
                    }
                }]
            });

        });

501 502 503 504
        // When ajax commands complete, hide some controls from our grid(s)
        $( document ).ajaxComplete(function(){
            $("#grid-rule-files  .command-toggle").hide();
        });
505 506 507 508 509 510
    });


</script>

<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
511 512
    <li class="active"><a data-toggle="tab" href="#settings" id="settings_tab">{{ lang._('Settings') }}</a></li>
    <li><a data-toggle="tab" href="#rules" id="rule_tab">{{ lang._('Rules') }}</a></li>
513
    <li><a data-toggle="tab" href="#userrules" id="userrules_tab">{{ lang._('User defined') }}</a></li>
514
    <li><a data-toggle="tab" href="#alerts" id="alert_tab">{{ lang._('Alerts') }}</a></li>
515
    <li><a href="" id="scheduled_updates" style="display:none">{{ lang._('Schedule') }}</a></li>
516 517
</ul>
<div class="tab-content content-box tab-content">
518 519
    <div id="settings" class="tab-pane fade in active">
        {{ partial("layout_partials/base_form",['fields':formGeneralSettings,'id':'frm_GeneralSettings'])}}
520 521 522 523 524 525 526 527 528 529
        <!-- add installable rule files -->
        <table class="table table-striped table-condensed table-responsive">
            <colgroup>
                <col class="col-md-3"/>
                <col class="col-md-9"/>
            </colgroup>
            <tbody>
            <tr>
                <td><div class="control-label">
                    <i class="fa fa-info-circle text-muted"></i>
530
                    <b>{{ lang._('Rulesets') }}</b>
531 532 533
                    </div>
                </td>
                <td>
534 535 536
                  <table class="table table-condensed table-responsive">
                    <tr>
                      <td>
537 538
                        <button data-toggle="tooltip" id="enableSelectedRuleSets" type="button" class="btn btn-xs btn-default btn-primary">{{ lang._('Enable selected') }}</span></button>
                        <button data-toggle="tooltip" id="disableSelectedRuleSets" type="button" class="btn btn-xs btn-default btn-primary">{{ lang._('Disable selected') }}</span></button>
539 540 541
                      </td>
                    </tr>
                  </table>
542
                <table id="grid-rule-files" class="table table-condensed table-hover table-striped table-responsive" data-editDialog="DialogRuleset">
543 544
                    <thead>
                    <tr>
545
                        <th data-column-id="filename" data-type="string" data-visible="false" data-identifier="true">{{ lang._('Filename') }}</th>
546
                        <th data-column-id="description" data-type="string" data-sortable="false" data-visible="true">{{ lang._('Description') }}</th>
547
                        <th data-column-id="modified_local" data-type="rulets" data-sortable="false" data-visible="true">{{ lang._('Last updated') }}</th>
548
                        <th data-column-id="filter_str" data-type="string" data-identifier="true">{{ lang._('Filter') }}</th>
549
                        <th data-column-id="enabled" data-formatter="rowtoggle" data-sortable="false" data-width="10em">{{ lang._('Commands') }}</th>
550 551 552 553 554 555 556 557 558
                    </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
                </td>
            </tr>
            </tbody>
        </table>
559 560
        <div class="col-md-12">
            <hr/>
561 562
            <button class="btn btn-primary" id="reconfigureAct" type="button"><b>{{ lang._('Apply') }}</b><i id="reconfigureAct_progress" class=""></i></button>
            <button class="btn btn-primary" id="updateRulesAct" type="button"><b>{{ lang._('Download & Update Rules') }}</b><i id="updateRulesAct_progress" class=""></i></button>
563
            <br/>
564
            <i>{{ lang._('Please use "Download & Update Rules" to fetch your initial ruleset, automatic updating can be scheduled after the first download.') }} </i>
565
        </div>
566 567
    </div>
    <div id="rules" class="tab-pane fade in">
568 569 570
        <div class="bootgrid-header container-fluid">
            <div class="row">
                <div class="col-sm-12 actionBar">
571
                    <b>{{ lang._('Classtype') }} &nbsp;</b>
572
                    <select id="ruleclass" class="selectpicker" data-width="200px"></select>
573 574 575 576 577 578 579
                    &nbsp;
                    <b>{{ lang._('Action') }} &nbsp;</b>
                    <select id="ruleaction" class="selectpicker" data-width="100px">
                        <option value="">{{ lang._('All') }}</option>
                        <option value="drop">{{ lang._('Drop') }}</option>
                        <option value="alert">{{ lang._('Alert') }}</option>
                    </select>
580 581 582 583 584
                </div>
            </div>
        </div>

        <!-- tab page "installed rules" -->
585
        <table id="grid-installedrules" class="table table-condensed table-hover table-striped table-responsive" data-editDialog="DialogRule">
586 587
            <thead>
            <tr>
588
                <th data-column-id="sid" data-type="numeric" data-visible="true" data-identifier="true" data-width="6em">{{ lang._('sid') }}</th>
589
                <th data-column-id="action" data-type="string">{{ lang._('Action') }}</th>
590 591 592
                <th data-column-id="source" data-type="string">{{ lang._('Source') }}</th>
                <th data-column-id="classtype" data-type="string">{{ lang._('ClassType') }}</th>
                <th data-column-id="msg" data-type="string">{{ lang._('Message') }}</th>
593
                <th data-column-id="enabled" data-formatter="rowtoggle" data-sortable="false" data-width="10em">{{ lang._('Info / Enabled') }}</th>
594 595 596 597
            </tr>
            </thead>
            <tbody>
            </tbody>
598 599 600
            <tfoot>
            <tr>
                <td>
601 602
                    <button title="{{ lang._('Disable selected') }}" id="disableSelectedRules" type="button" class="btn btn-xs btn-default"><span class="fa fa-square-o command-toggle"></span></button>
                    <button title="{{ lang._('Enable selected') }}" id="enableSelectedRules" type="button" class="btn btn-xs btn-default"><span class="fa fa-check-square-o command-toggle"></span></button>
603
                </td>
604
                <td></td>
605 606
            </tr>
            </tfoot>
607
        </table>
608 609
        <div class="col-md-12">
            <hr/>
610
            <button class="btn btn-primary act_update" type="button"><b>{{ lang._('Apply') }}</b><i class="act_update_progress"></i></button>
611 612 613
            <br/>
            <br/>
        </div>
614
    </div>
615 616 617
    <div id="userrules" class="tab-pane fade in">
        <!-- tab page "userrules" -->
        <table id="grid-userrules" class="table table-condensed table-hover table-striped table-responsive" data-editDialog="DialogUserDefined">
618 619
            <thead>
                <tr>
620
                    <th data-column-id="enabled" data-formatter="rowtoggle" data-sortable="false" data-width="10em">{{ lang._('Enabled') }}</th>
621
                    <th data-column-id="action" data-type="string" data-sortable="true">{{ lang._('Action') }}</th>
622
                    <th data-column-id="description" data-type="string" data-sortable="true">{{ lang._('Description') }}</th>
623
                    <th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638
                    <th data-column-id="commands" data-width="7em" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
                </tr>
            </thead>
            <tbody>
            </tbody>
            <tfoot>
                <tr >
                    <td></td>
                    <td>
                        <button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
                        <button data-action="deleteSelected" type="button" class="btn btn-xs btn-default"><span class="fa fa-trash-o"></span></button>
                    </td>
                </tr>
            </tfoot>
        </table>
639 640
        <div class="col-md-12">
            <hr/>
641
            <button class="btn btn-primary act_update" type="button"><b>{{ lang._('Apply') }}</b><i class="act_update_progress"></i></button>
642 643 644
            <br/>
            <br/>
        </div>
645
    </div>
646
    <div id="alerts" class="tab-pane fade in">
647
        <!-- tab page "alerts" -->
648 649 650 651
        <div class="bootgrid-header container-fluid">
            <div class="row">
                <div class="col-sm-12 actionBar">
                    <select id="alert-logfile" class="selectpicker" data-width="200px"></select>
652
                    <span id="actDeleteLog" class="btn btn-lg fa fa-trash" style="cursor: pointer;"></span>
653 654 655 656 657 658 659 660 661 662 663 664
                    <select id="alert-logfile-max" class="selectpicker" data-width="80px">
                        <option value="7">7</option>
                        <option value="50">50</option>
                        <option value="100">100</option>
                        <option value="250">250</option>
                        <option value="500">500</option>
                        <option value="1000">1000</option>
                        <option value="-1">All</option>
                    </select>
                    <div class="search form-group">
                        <div class="input-group">
                            <input class="search-field form-control" placeholder="{{ lang._('Search') }}" type="text" id="inputSearchAlerts">
665
                            <span id="actQueryAlerts" class="icon input-group-addon fa fa-refresh" title="{{ lang._('Query') }}" style="cursor: pointer;"></span>
666 667
                        </div>
                    </div>
668 669 670
                </div>
            </div>
        </div>
671 672 673
        <table id="grid-alerts" class="table table-condensed table-hover table-striped table-responsive" data-editDialog="DialogAlert">
            <thead>
            <tr>
674
                <th data-column-id="timestamp" data-type="string" data-sortable="false">{{ lang._('Timestamp') }}</th>
675
                <th data-column-id="alert_action" data-type="string" data-sortable="false">{{ lang._('Action') }}</th>
676 677
                <th data-column-id="src_ip" data-type="string" data-sortable="false" data-width="10em">{{ lang._('Source') }}</th>
                <th data-column-id="dest_ip" data-type="string" data-sortable="false" data-width="10em">{{ lang._('Destination') }}</th>
678 679
                <th data-column-id="alert" data-type="string" data-sortable="false" >{{ lang._('Alert') }}</th>
                <th data-column-id="info" data-formatter="info" data-sortable="false" data-width="4em">{{ lang._('Info') }}</th>
680 681 682 683 684 685
            </tr>
            </thead>
            <tbody>
            </tbody>
        </table>
    </div>
686
</div>
687

688
{{ partial("layout_partials/base_dialog_processing") }}
689

690
{{ partial("layout_partials/base_dialog",['fields':formDialogRule,'id':'DialogRule','label':'Rule details','hasSaveBtn':'true','msgzone_width':1])}}
691
{{ partial("layout_partials/base_dialog",['fields':formDialogAlert,'id':'DialogAlert','label':'Alert details','hasSaveBtn':'false','msgzone_width':1])}}
692
{{ partial("layout_partials/base_dialog",['fields':formDialogRuleset,'id':'DialogRuleset','label':'Ruleset details','hasSaveBtn':'true','msgzone_width':1])}}
693
{{ partial("layout_partials/base_dialog",['fields':formDialogUserDefined,'id':'DialogUserDefined','label':'Rule details','hasSaveBtn':'true'])}}