Check recording window when download a pcap from alerts

This commit is contained in:
Alfredo Cardigliano 2022-02-01 16:15:45 +01:00
parent b9287db3aa
commit 1fbb119b16
2 changed files with 27 additions and 2 deletions

View file

@ -151,7 +151,7 @@ function ui_utils.draw_pcap_download_dialog(ifid)
return true;
}
function pcapDownload(epoch_begin, epoch_end, bpf_filter) {
function pcapShowModal(epoch_begin, epoch_end, bpf_filter) {
var modalID = "]] print(modalID) print [[";
var date_begin = new Date(epoch_begin * 1000);
var date_end = new Date(epoch_end * 1000);
@ -176,6 +176,31 @@ function ui_utils.draw_pcap_download_dialog(ifid)
});
}
function pcapDownload(epoch_begin, epoch_end, bpf_filter) {
$.ajax({
type: "GET",
url: ']] print(ntop.getHttpPrefix().."/lua/check_recording_data.lua") print [[',
data: {
epoch_begin: epoch_begin,
epoch_end: epoch_end
}, error: function(err) {
console.error(err);
}, success: function(data) {
if(!data.available) {
if(data.extraction_checks_msg) {
$("#no-recording-data-message").html(data.extraction_checks_msg);
} else {
$("#no-recording-data-message").html(']] print(i18n("traffic_recording.no_recorded_data")) print[[');
}
$("#no-recording-data").modal("show");
return;
}
pcapShowModal(epoch_begin, epoch_end, bpf_filter);
}
});
}
function submitPcapDownload(form) {
var frm = $('#'+form.id);
window.open(']] print(ntop.getHttpPrefix()) print [[/lua/rest/v2/get/pcap/live_extraction.lua?' + frm.serialize(), '_self', false);