Ported AS table to new table (#8475)

* Fixes parsing error while pasing XML strings with comments

* Ported host countries table to new vue table

* Added country filter when redirected to hosts list page

* Ported network discovery table to TableWithConfig vue component

* FIxed indentation

* Added documentation for VueJS, Lua and cpp used in ntopng

* Fixed error

* Added Netbox pref entry for default site, customizable input box size. To implement cpp side for netbox default site

* Removed tprint

* Ported AS table to new table

* Started fixing live flow IP filter

* Fixed date formatter

* Removed debug code

* Removed tprint

* Removed unused import

---------

Co-authored-by: DGabri <gabriele.deri@gmail.com>
Co-authored-by: Luca Deri <lucaderi@users.noreply.github.com>
This commit is contained in:
GabrieleDeri 2024-06-26 15:22:55 +02:00 committed by GitHub
parent d6965f24b7
commit 43dcd76e2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 247 additions and 413 deletions

View file

@ -12,9 +12,11 @@ local rest_utils = require "rest_utils"
local alert_consts = require "alert_consts"
local format_utils = require "format_utils"
local l4_protocol_list = require "l4_protocol_list"
-- Trick to handle the application and the categories togheter
local application = _GET["application"]
local ip_version = _GET["flowhosts_type"]
local ip_version_or_host = _GET["flowhosts_type"]
if not isEmptyString(application) then
if string.starts(application, "cat_") then
local category = split(application, "cat_")
@ -22,11 +24,18 @@ if not isEmptyString(application) then
_GET["application"] = nil
end
end
if not isEmptyString(ip_version) then
if string.starts(ip_version, "ip_version_") then
local version = split(ip_version, "ip_version_")
if not isEmptyString(ip_version_or_host) then
if string.starts(ip_version_or_host, "ip_version_") then
local version = split(ip_version_or_host, "ip_version_")
_GET["version"] = version[2]
_GET["flowhosts_type"] = nil
else
local host = hostkey2hostinfo(p)
if host then
_GET["host"] = ip_version_or_host
_GET["flowhosts_type"] = nil
end
end
end

View file

@ -68,6 +68,7 @@ if not download then
local alerts, recordsFiltered, info = flow_alert_store:select_request(nil, "*")
for _, _value in ipairs(alerts or {}) do
-- tprint(_value)
res[#res + 1] = flow_alert_store:format_record(_value, no_html)
end

View file

@ -21,6 +21,7 @@ local client = _GET["client"]
local server = _GET["server"]
local flow_info = _GET["flow_info"]
local flowstats = interface.getActiveFlowsStats(host, nil, false, talking_with, client, server, flow_info)
local selected_ip = _GET["flowhosts_type"]
local rsp = {}
@ -34,15 +35,13 @@ if interface.isView() then
local interfaces = interface.getIfNames()
if table.len(interfaces) > 1 then
for id, _ in pairsByValues(interfaces, asc) do
if tonumber(id) == interface.getId() then
goto continue
if tonumber(id) ~= interface.getId() then
interfaces_filter[#interfaces_filter + 1] = {
key = "interface_filter",
value = id,
label = getInterfaceName(id)
}
end
interfaces_filter[#interfaces_filter + 1] = {
key = "interface_filter",
value = id,
label = getInterfaceName(id)
}
::continue::
end
end
@ -54,6 +53,22 @@ 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",
@ -61,6 +76,20 @@ if not host then
label = i18n("all")
}}
if not isEmptyString(selected_ip) then
local newFilter = {{
key = "flowhosts_type",
value = "",
label = i18n("all")
},{
key = "flowhosts_type",
value = selected_ip,
label = selected_ip
}}
table.insert(hosts_type_filters, newFilter)
end
local hosts_type_filters2 = {{
key = "flowhosts_type",
value = "ip_version_4",