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
Show 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,12 +52,13 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -54,12 +52,13 @@ 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") {
$('#alert-logfile').html("");
$.each(data, function(key, value) {
$.each(data, function(key, value) {
if (value['sequence'] == undefined) {
if (value['sequence'] == undefined) {
$('#alert-logfile').append($("<option></option>").attr("value",'none').text(value['modified']));
$('#alert-logfile').append($("<option></option>").attr("value",'none').text(value['modified']));
...
@@ -74,6 +73,7 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -74,6 +73,7 @@ POSSIBILITY OF SUCH DAMAGE.
});
});
}
}
});
});
}
/**
/**
* Add classtype to rule filter
* Add classtype to rule filter
...
@@ -97,9 +97,28 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -97,9 +97,28 @@ POSSIBILITY OF SUCH DAMAGE.
return request;
return request;
}
}
// load initial data
mapDataToFormUI(data_get_map).done(function(){
formatTokenizersUI();
$('.selectpicker').selectpicker('refresh');
});
/**
* load content on tab changes
*/
$('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 installed rules
*/
*/
$('#grid-installedrules').bootgrid('destroy'); // always destroy previous grid, so data is always fresh
$("#grid-installedrules").UIBootgrid(
$("#grid-installedrules").UIBootgrid(
{ search:'/api/ids/settings/searchinstalledrules',
{ search:'/api/ids/settings/searchinstalledrules',
get:'/api/ids/settings/getRuleInfo/',
get:'/api/ids/settings/getRuleInfo/',
...
@@ -122,10 +141,12 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -122,10 +141,12 @@ POSSIBILITY OF SUCH DAMAGE.
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/',
...
@@ -140,6 +161,10 @@ POSSIBILITY OF SUCH DAMAGE.
...
@@ -140,6 +161,10 @@ POSSIBILITY OF SUCH DAMAGE.
}
}
}
}
});
});
}
})
/**
/**
* 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