Fix block flow button in host flows page

This commit is contained in:
emanuele-f 2018-10-08 12:22:03 +02:00
parent c78fe49697
commit 3802913084
5 changed files with 48 additions and 31 deletions

View file

@ -1887,3 +1887,39 @@ function printFlowSNMPInfo(snmpdevice, input_idx, output_idx)
end
-- #######################
function printBlockFlowJs()
print[[
var block_flow_csrf = "]] print(ntop.getRandomCSRFValue()) print[[";
function block_flow(flow_key) {
var url = "]] print(ntop.getHttpPrefix()) print[[/lua/pro/nedge/block_flow.lua";
$.ajax({
type: 'GET',
url: url,
cache: false,
data: {
csrf: block_flow_csrf,
flow_key: flow_key
},
success: function(content) {
var data = jQuery.parseJSON(content);
block_flow_csrf = data.csrf;
if (data.status == "BLOCKED") {
$('#'+flow_key+'_info').find('.block-badge')
.removeClass('label-default')
.addClass('label-danger')
.attr('title', ']] print(i18n("flow_details.flow_traffic_is_dropped")) print[[');
$('#'+flow_key+'_application, #'+flow_key+'_l4, #'+flow_key+'_client, #'+flow_key+'_server')
.css("text-decoration", "line-through");
}
},
error: function(content) {
console.log("error");
}
});
}
]]
end
-- #######################