Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
bd5f92be
Commit
bd5f92be
authored
Jul 01, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(ids) UI load grid on tab open
parent
14d1ccf1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
68 deletions
+93
-68
index.volt
src/opnsense/mvc/app/views/OPNsense/IDS/index.volt
+93
-68
No files found.
src/opnsense/mvc/app/views/OPNsense/IDS/index.volt
View file @
bd5f92be
...
@@ -32,16 +32,14 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -32,16 +32,14 @@ POSSIBILITY OF SUCH DAMAGE.
//
//
var data_get_map = {'frm_GeneralSettings':"/api/ids/settings/get"};
var data_get_map = {'frm_GeneralSettings':"/api/ids/settings/get"};
// load initial data
mapDataToFormUI(data_get_map).done(function(){
formatTokenizersUI();
$('.selectpicker').selectpicker('refresh');
});
// list all known classtypes and add to selection box
/**
* list all known classtypes and add to selection box
*/
function updateRuleClassTypes() {
function updateRuleClassTypes() {
ajaxGet(url="/api/ids/settings/listRuleClasstypes",sendData={}, callback=function(data, status) {
ajaxGet(url="/api/ids/settings/listRuleClasstypes",sendData={}, callback=function(data, status) {
if (status == "success") {
if (status == "success") {
$('#ruleclass').html('<option value="">ALL</option>');
$.each(data['items'], function(key, value) {
$.each(data['items'], function(key, value) {
$('#ruleclass').append($("<option></option>").attr("value",value).text(value));
$('#ruleclass').append($("<option></option>").attr("value",value).text(value));
});
});
...
@@ -54,26 +52,28 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -54,26 +52,28 @@ POSSIBILITY OF SUCH DAMAGE.
});
});
}
}
// delay refresh for a bit
/**
setTimeout(updateRuleClassTypes, 500);
* update list of available alert logs
*/
// update list of alert logs
function updateAlertLogs() {
ajaxGet(url="/api/ids/service/getAlertLogs",sendData={}, callback=function(data, status) {
ajaxGet(url="/api/ids/service/getAlertLogs",sendData={}, callback=function(data, status) {
if (status == "success") {
if (status == "success") {
$.each(data, function(key, value) {
$('#alert-logfile').html("");
if (value['sequence'] == undefined) {
$.each(data, function(key, value) {
$('#alert-logfile').append($("<option></option>").attr("value",'none').text(value['modified']));
if (value['sequence'] == undefined) {
} else {
$('#alert-logfile').append($("<option></option>").attr("value",'none').text(value['modified']));
$('#alert-logfile').append($("<option></option>").attr("value",value['sequence']).text(value['modified']));
} else {
}
$('#alert-logfile').append($("<option></option>").attr("value",value['sequence']).text(value['modified']));
});
}
$('.selectpicker').selectpicker('refresh');
});
// link on change event
$('.selectpicker').selectpicker('refresh');
$('#alert-logfile').on('change', function(){
// link on change event
$('#grid-alerts').bootgrid('reload');
$('#alert-logfile').on('change', function(){
});
$('#grid-alerts').bootgrid('reload');
}
});
});
}
});
}
/**
/**
* Add classtype to rule filter
* Add classtype to rule filter
...
@@ -97,49 +97,74 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -97,49 +97,74 @@ POSSIBILITY OF SUCH DAMAGE.
return request;
return request;
}
}
// load initial data
mapDataToFormUI(data_get_map).done(function(){
formatTokenizersUI();
$('.selectpicker').selectpicker('refresh');
});
/**
/**
*
grid installed rul
es
*
load content on tab chang
es
*/
*/
$("#grid-installedrules").UIBootgrid(
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
{ search:'/api/ids/settings/searchinstalledrules',
if (e.target.id == 'rule_tab'){
get:'/api/ids/settings/getRuleInfo/',
//
options:{
// activate rule tab page
multiSelect:false,
//
selection:false,
requestHandler:addRuleFilters,
// delay refresh for a bit
formatters:{
setTimeout(updateRuleClassTypes, 500);
rowtoggle: function (column, row) {
if (parseInt(row[column.id], 2) == 1) {
/**
var toggle = "<span style=\"cursor: pointer;\" class=\"fa fa-check-square-o command-toggle\" data-value=\"1\" data-row-id=\"" + row.sid + "\"></span>";
* grid installed rules
} else {
*/
var toggle = "<span style=\"cursor: pointer;\" class=\"fa fa-square-o command-toggle\" data-value=\"0\" data-row-id=\"" + row.sid + "\"></span>";
$('#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/',
options:{
multiSelect:false,
selection:false,
requestHandler:addRuleFilters,
formatters:{
rowtoggle: function (column, row) {
if (parseInt(row[column.id], 2) == 1) {
var toggle = "<span style=\"cursor: pointer;\" class=\"fa fa-check-square-o command-toggle\" data-value=\"1\" data-row-id=\"" + row.sid + "\"></span>";
} else {
var toggle = "<span style=\"cursor: pointer;\" class=\"fa fa-square-o command-toggle\" data-value=\"0\" data-row-id=\"" + row.sid + "\"></span>";
}
toggle += " <button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.sid + "\"><span class=\"fa fa-info-circle\"></span></button> ";
return toggle;
}
}
}
toggle += " <button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.sid + "\"><span class=\"fa fa-info-circle\"></span></button> ";
},
return toggle;
toggle:'/api/ids/settings/toggleRule/'
}
}
}
},
);
toggle:'/api/ids/settings/toggleRule/'
} else if (e.target.id == 'alert_tab') {
}
updateAlertLogs();
);
/**
* grid query alerts
/**
*/
* grid query alerts
$('#grid-alerts').bootgrid('destroy'); // always destroy previous grid, so data is always fresh
*/
$("#grid-alerts").UIBootgrid(
$("#grid-alerts").UIBootgrid(
{ search:'/api/ids/service/queryAlerts',
{ search:'/api/ids/service/queryAlerts',
get:'/api/ids/service/getAlertInfo/',
get:'/api/ids/service/getAlertInfo/',
options:{
options:{
multiSelect:false,
multiSelect:false,
selection:false,
selection:false,
requestHandler:addAlertQryFilters,
requestHandler:addAlertQryFilters,
formatters:{
formatters:{
info: function (column, row) {
info: function (column, row) {
return "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.filepos + "\"><span class=\"fa fa-info-circle\"></span></button> ";
return "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.filepos + "\"><span class=\"fa fa-info-circle\"></span></button> ";
}
}
}
}
}
});
}
}
});
})
/**
/**
* grid for installable rule files
* grid for installable rule files
...
@@ -209,9 +234,9 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -209,9 +234,9 @@ POSSIBILITY OF SUCH DAMAGE.
</script>
</script>
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
<li class="active"><a data-toggle="tab" href="#settings">{{ lang._('Settings') }}</a></li>
<li class="active"><a data-toggle="tab" href="#settings"
id="settings_tab"
>{{ lang._('Settings') }}</a></li>
<li><a data-toggle="tab" href="#rules">{{ lang._('Rules') }}</a></li>
<li><a data-toggle="tab" href="#rules"
id="rule_tab"
>{{ lang._('Rules') }}</a></li>
<li><a data-toggle="tab" href="#alerts">{{ lang._('Alerts') }}</a></li>
<li><a data-toggle="tab" href="#alerts"
id="alert_tab"
>{{ lang._('Alerts') }}</a></li>
</ul>
</ul>
<div class="tab-content content-box tab-content">
<div class="tab-content content-box tab-content">
<div id="settings" class="tab-pane fade in active">
<div id="settings" class="tab-pane fade in active">
...
@@ -251,7 +276,7 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -251,7 +276,7 @@ POSSIBILITY OF SUCH DAMAGE.
<div class="row">
<div class="row">
<div class="col-sm-12 actionBar">
<div class="col-sm-12 actionBar">
<b>Classtype </b>
<b>Classtype </b>
<select id="ruleclass" class="selectpicker" data-width="200px"><
option value="">ALL</option><
/select>
<select id="ruleclass" class="selectpicker" data-width="200px"></select>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment