diff --git a/src/www/firewall_rules.php b/src/www/firewall_rules.php
index 1dc7c90d7..500f1d348 100644
--- a/src/www/firewall_rules.php
+++ b/src/www/firewall_rules.php
@@ -198,6 +198,38 @@ $( document ).ready(function() {
$("#iform").submit();
});
+
+ // link category select/search
+ $("#fw_category").change(function(){
+ var stripe_color = 'transparent';
+ var selected_value = $(this).val();
+ $(".rule").each(function(){
+ // save zebra color
+ if ( $(this).children(0).css("background-color") != 'transparent') {
+ $("#fw_category").data('stripe_color', $(this).children(0).css("background-color"));
+ }
+ if ($(this).data('category') != selected_value && selected_value != "") {
+ $(this).hide();
+ } else {
+ $(this).show();
+ }
+ });
+
+ $("#rules").removeClass("table-striped");
+ // add stripes again
+ $(".rule:visible").each(function (index) {
+ $(this).css("background-color", "inherit");
+ if ( index % 2 == 0) {
+ $(this).css("background-color", $("#fw_category").data('stripe_color'));
+ }
+ });
+ });
+
+ // hide category search when not used
+ if ($("#fw_category > option").length == 1) {
+ $("#fw_category").addClass('hidden');
+ }
+
});
@@ -262,7 +294,7 @@ $( document ).ready(function() {
-
+
| |
@@ -427,7 +459,7 @@ $( document ).ready(function() {
?>
-
+
">
|
|
@@ -621,7 +653,23 @@ $( document ).ready(function() {
- |
+
+
+ |
|
" class="act_move btn btn-default btn-xs">
diff --git a/src/www/firewall_rules_edit.php b/src/www/firewall_rules_edit.php
index 86c5ac2b5..054569e30 100644
--- a/src/www/firewall_rules_edit.php
+++ b/src/www/firewall_rules_edit.php
@@ -152,7 +152,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
,'descr','tcpflags_any','tcpflags1','tcpflags2','tag','tagged','quick','allowopts'
,'disablereplyto','max','max-src-nodes','max-src-conn','max-src-states','statetype'
,'statetimeout','nopfsync','nosync','max-src-conn-rate','max-src-conn-rates','gateway','sched'
- ,'associated-rule-id','floating'
+ ,'associated-rule-id','floating', 'category'
);
$pconfig = array();
@@ -414,7 +414,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$copy_fields = array('type', 'interface', 'ipprotocol', 'tag', 'tagged', 'max', 'max-src-nodes'
, 'max-src-conn', 'max-src-states', 'statetimeout', 'statetype', 'os', 'descr', 'gateway'
, 'sched', 'associated-rule-id', 'direction', 'quick'
- , 'max-src-conn-rate', 'max-src-conn-rates') ;
+ , 'max-src-conn-rate', 'max-src-conn-rates', 'category') ;
foreach ($copy_fields as $fieldname) {
if (!empty($pconfig[$fieldname])) {
@@ -662,6 +662,14 @@ include("head.inc");
$("#toggleAdvanced").click();
+ // add typeahead for existing categories, all options are saves in the select option "existing_categories"
+ var categories = [];
+ $("#existing_categories > option").each(function(){
+ categories.push($(this).val());
+ });
+ $("#category").typeahead({
+ source: categories
+ });
});
@@ -1135,6 +1143,27 @@ include("head.inc");
|
+
+ | =gettext("Category"); ?> |
+
+
+
+ =gettext("You may enter or select a category here to group firewall rules (not parsed)."); ?>
+
+
+ |
| =gettext("Description"); ?> |
|