mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 16:09:32 +00:00
Add validation to live capture filters
This commit is contained in:
parent
520d2ecf8d
commit
c51f779bc9
4 changed files with 51 additions and 38 deletions
|
|
@ -48,18 +48,27 @@ function live_traffic_utils.printLiveTrafficForm(ifid, host_info)
|
|||
</form>
|
||||
|
||||
<script type='text/javascript'>
|
||||
var live_capture_download_show_modal = function() {
|
||||
|
||||
let input = $('#live-capture-bpf-filter');
|
||||
let valid = bpfValidator(input, true);
|
||||
if (!valid) {
|
||||
input.css('border-color', 'red');
|
||||
return false; /* Invalif filter */
|
||||
} else {
|
||||
input.css('border-color', '');
|
||||
}
|
||||
]]
|
||||
|
||||
if not has_vlan then
|
||||
print[[
|
||||
var live_capture_download_show_modal = function() {
|
||||
|
||||
/* resume submit */
|
||||
return true;
|
||||
}
|
||||
};
|
||||
]]
|
||||
else
|
||||
print[[
|
||||
var live_capture_download_show_modal = function(){
|
||||
if($('#live-capture-bpf-filter').val() == '' ||
|
||||
$('#live-capture-bpf-filter').val().includes('vlan')) {
|
||||
/* Resume submit, nothing to show (the user didn't specify any BPF or VLAN is specified) */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue