Commit e15c7428 authored by Franco Fichtner's avatar Franco Fichtner

intrusion detection: finish up after #1129

This reverts commit 25d8428c and adds
normal enabled/disable indicators.  POST is all weird today, but so
far this looks good.

(cherry picked from commit bbe9e070)
(cherry picked from commit 177010dd)
parent 4ce0026e
...@@ -221,14 +221,15 @@ POSSIBILITY OF SUCH DAMAGE. ...@@ -221,14 +221,15 @@ POSSIBILITY OF SUCH DAMAGE.
options:{ options:{
navigation:0, navigation:0,
formatters:{ formatters:{
rowtoggle: function (column, row) { editor: function (column, row) {
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> "; return "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.filename + "\"><span class=\"fa fa-pencil\"></span></button>";
},
boolean: function (column, row) {
if (parseInt(row[column.id], 2) == 1) { if (parseInt(row[column.id], 2) == 1) {
toggle += "<span style=\"cursor: pointer;\" class=\"fa fa-check-square-o command-toggle\" data-value=\"1\" data-row-id=\"" + row.filename + "\"></span>"; return "<span class=\"fa fa-check command-boolean\" data-value=\"1\" data-row-id=\"" + row.filename + "\"></span>";
} else { } else {
toggle += "<span style=\"cursor: pointer;\" class=\"fa fa-square-o command-toggle\" data-value=\"0\" data-row-id=\"" + row.filename + "\"></span>"; return "<span class=\"fa fa-times command-boolean\" data-value=\"0\" data-row-id=\"" + row.filename + "\"></span>";
} }
return toggle;
} }
}, },
converters: { converters: {
...@@ -538,10 +539,6 @@ POSSIBILITY OF SUCH DAMAGE. ...@@ -538,10 +539,6 @@ POSSIBILITY OF SUCH DAMAGE.
}); });
// When ajax commands complete, hide some controls from our grid(s)
$( document ).ajaxComplete(function(){
$("#grid-rule-files .command-toggle").hide();
});
}); });
...@@ -598,8 +595,9 @@ POSSIBILITY OF SUCH DAMAGE. ...@@ -598,8 +595,9 @@ POSSIBILITY OF SUCH DAMAGE.
<th data-column-id="filename" data-type="string" data-visible="false" data-identifier="true">{{ lang._('Filename') }}</th> <th data-column-id="filename" data-type="string" data-visible="false" data-identifier="true">{{ lang._('Filename') }}</th>
<th data-column-id="description" data-type="string" data-sortable="false" data-visible="true">{{ lang._('Description') }}</th> <th data-column-id="description" data-type="string" data-sortable="false" data-visible="true">{{ lang._('Description') }}</th>
<th data-column-id="modified_local" data-type="rulets" data-sortable="false" data-visible="true">{{ lang._('Last updated') }}</th> <th data-column-id="modified_local" data-type="rulets" data-sortable="false" data-visible="true">{{ lang._('Last updated') }}</th>
<th data-column-id="enabled" data-formatter="boolean" data-sortable="false" data-width="10em">{{ lang._('Enabled') }}</th>
<th data-column-id="filter_str" data-type="string" data-identifier="true">{{ lang._('Filter') }}</th> <th data-column-id="filter_str" data-type="string" data-identifier="true">{{ lang._('Filter') }}</th>
<th data-column-id="enabled" data-formatter="rowtoggle" data-sortable="false" data-width="10em">{{ lang._('Commands') }}</th> <th data-column-id="edit" data-formatter="editor" data-sortable="false" data-width="10em">{{ lang._('Edit') }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
......
...@@ -56,9 +56,9 @@ function stdBootgridUI(obj, sourceUrl, options) { ...@@ -56,9 +56,9 @@ function stdBootgridUI(obj, sourceUrl, options) {
}, },
"boolean": function (column, row) { "boolean": function (column, row) {
if (parseInt(row[column.id], 2) == 1) { if (parseInt(row[column.id], 2) == 1) {
return "<span class=\"fa fa-check\"></span>"; return "<span class=\"fa fa-check\" data-value=\"1\" data-row-id=\"" + row.uuid + "\"></span>";
} else { } else {
return "<span class=\"fa fa-times\"></span>"; return "<span class=\"fa fa-times\" data-value=\"0\" data-row-id=\"" + row.uuid + "\"></span>";
} }
}, },
} }
...@@ -80,6 +80,9 @@ function stdBootgridUI(obj, sourceUrl, options) { ...@@ -80,6 +80,9 @@ function stdBootgridUI(obj, sourceUrl, options) {
if ($(this).find('[class*="command-toggle"]').first().data("value") == "0") { if ($(this).find('[class*="command-toggle"]').first().data("value") == "0") {
$(this).addClass("text-muted"); $(this).addClass("text-muted");
} }
if ($(this).find('[class*="command-boolean"]').first().data("value") == "0") {
$(this).addClass("text-muted");
}
}); });
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment