Fixes host filter not working in flows page

This commit is contained in:
Matteo Biscosi 2024-06-28 17:51:10 +02:00
parent ff7a96f89d
commit b1b7f582df
4 changed files with 7 additions and 30 deletions

View file

@ -31,8 +31,8 @@ if not isEmptyString(ip_version_or_host) then
_GET["version"] = version[2]
_GET["flowhosts_type"] = nil
else
local host = hostkey2hostinfo(p)
if host then
local host = hostkey2hostinfo(ip_version_or_host)
if isIPv4(host.host) or isIPv6(host.host) then
_GET["host"] = ip_version_or_host
_GET["flowhosts_type"] = nil
end

View file

@ -53,22 +53,6 @@ if interface.isView() then
}
end
if selected_ip then
local hosts_type_filters = {{
key = "flowhosts_type",
value = selected_ip,
label = selected_ip
}}
rsp[#rsp + 1] = {
action = "flowhosts_type",
label = i18n("db_explorer.host_data"),
name = "flowhosts_type",
value = hosts_type_filters
}
end
if not host then
local hosts_type_filters = {{
key = "flowhosts_type",
@ -76,16 +60,13 @@ if not host then
label = i18n("all")
}}
if not isEmptyString(selected_ip) then
local newFilter = {{
key = "flowhosts_type",
value = "",
label = i18n("all")
},{
local host = hostkey2hostinfo(selected_ip)
if not isEmptyString(host) and (isIPv4(host.host) or isIPv6(host.host)) then
local newFilter = {
key = "flowhosts_type",
value = selected_ip,
label = selected_ip
}}
}
table.insert(hosts_type_filters, newFilter)
end