diff --git a/http_src/vue/ntop_vue.js b/http_src/vue/ntop_vue.js index f5c77a255d..fd3d2fb383 100644 --- a/http_src/vue/ntop_vue.js +++ b/http_src/vue/ntop_vue.js @@ -60,6 +60,7 @@ import { default as PageHistoricalFlow } from "./page-historical-flow-details.vu import { default as PageSNMPQoS } from "./page-snmp-qos.vue" import { default as PageGeoMap } from "./hosts-geomap.vue" import { default as PageCountryStats } from "./page-country-stats.vue" +import { default as PageAsStats } from "./page-as-stats.vue" /* Config pages */ import { default as PageSNMPConfig } from "./page-snmp-config.vue" @@ -142,7 +143,8 @@ let ntopVue = { PageOpenPorts: PageOpenPorts, PageVulnerabilityScanReport: PageVulnerabilityScanReport, PageFlowsList: PageFlowsList, - + PageAsStats: PageAsStats, + /* SNMP */ PageSNMPDevices: PageSNMPDevices, PageSNMPQoS: PageSNMPQoS, diff --git a/http_src/vue/page-aggregated-live-flows.vue b/http_src/vue/page-aggregated-live-flows.vue index 819214191a..50b793f657 100644 --- a/http_src/vue/page-aggregated-live-flows.vue +++ b/http_src/vue/page-aggregated-live-flows.vue @@ -398,6 +398,7 @@ const map_table_def_columns = async (columns) => { return columns; } +/* FUNCTIONS TO FORMAT */ const format_client_name = function (data, rowData) { let alert_label = '' if (data.is_alerted) { diff --git a/http_src/vue/page-country-stats.vue b/http_src/vue/page-country-stats.vue index 9861b14fb7..103873c5c6 100644 --- a/http_src/vue/page-country-stats.vue +++ b/http_src/vue/page-country-stats.vue @@ -43,7 +43,7 @@ const map_table_def_columns = (columns) => { }, "seen_since": (value, row) => { // `seen_since` might require formatting, e.g., date formatting. - const formattedDate = new Date(value*1000).toLocaleDateString(); // Example date formatting + const formattedDate = NtopUtils.secondsToTime(Math.round(new Date().getTime() / 1000) - value) return formattedDate; }, "score": (value, row) => { diff --git a/http_src/vue/page-flows-list.vue b/http_src/vue/page-flows-list.vue index a881d32a7c..ac4d2e1a15 100644 --- a/http_src/vue/page-flows-list.vue +++ b/http_src/vue/page-flows-list.vue @@ -323,10 +323,11 @@ function set_filter_array_label() { el.basic_label = el.label; } - /* Getting the currently selected filter */ - const url_entry = ntopng_url_manager.get_url_entry(el.id) + /* Getting currently selected filter */ + let url_entry = ntopng_url_manager.get_url_entry(el.id) + el.options.forEach((option) => { - if (option.value.toString() === url_entry) { + if ('value' in option && option.value.toString() === url_entry) { el.current_option = option; } }) @@ -453,6 +454,11 @@ function columns_sorting(col, r0, r1) { } const get_extra_params_obj = () => { let extra_params = ntopng_url_manager.get_url_object(); + + if (extra_params.flowhosts_type !== undefined) { + extra_params.flowhosts_type = extra_params.flowhosts_type.slice(0, -2); + } + return extra_params; }; diff --git a/http_src/vue/page-hosts-list.vue b/http_src/vue/page-hosts-list.vue index ea1f113fcc..0e0d8684cd 100644 --- a/http_src/vue/page-hosts-list.vue +++ b/http_src/vue/page-hosts-list.vue @@ -35,6 +35,7 @@ const props = defineProps({ /* ************************************** */ const host_filters_key = ref(0); +const as_filters_key = ref(0); const table_id = props.context?.has_vlans ? ref('hosts_list_with_vlans') : ref('hosts_list'); const table_hosts_list = ref(null); const csrf = props.context.csrf; @@ -262,6 +263,8 @@ async function load_table_filters_array() { const url = `${http_prefix}/lua/rest/v2/get/host/host_filters.lua?${url_params}`; let res = await ntopng_utility.http_request(url); host_filters_key.value = host_filters_key.value + 1 + as_filters_key.value = as_filters_key.value + 1 + return res.map((t) => { const key_in_url = ntopng_url_manager.get_url_entry(t.name); if(dataUtils.isEmptyOrNull(key_in_url)) { diff --git a/httpdocs/inc/as_stats_id.inc b/httpdocs/inc/as_stats_id.inc deleted file mode 100644 index 197a0499bb..0000000000 --- a/httpdocs/inc/as_stats_id.inc +++ /dev/null @@ -1,76 +0,0 @@ - - -// ---------------- Automatic AS table update code ------------------------ - -function as_table_setID (row) { - var index = 0; - var as_key = row.find("td").eq(0).text(); - - // Set the row index to the AS key - row.attr('id', as_key); - - row.find("td").eq(index++).attr('id', as_key+"_key"); - - row.find("td").eq(index++).attr('id', as_key+"_asn"); - row.find("td").eq(index++).attr('id', as_key+"_chart"); - - row.find("td").eq(index++).attr('id', as_key+"_hosts"); - row.find("td").eq(index++).attr('id', as_key+"_score"); - row.find("td").eq(index++).attr('id', as_key+"_host_score_ratio"); - - row.find("td").eq(index++).attr('id', as_key+"_asname"); - - row.find("td").eq(index++).attr('id', as_key+"_since"); - row.find("td").eq(index++).attr('id', as_key+"_alerted_flows"); - row.find("td").eq(index++).attr('id', as_key+"_breakdown"); - row.find("td").eq(index++).attr('id', as_key+"_throughput"); - row.find("td").eq(index++).attr('id', as_key+"_traffic"); - - return row; - -} - -function as_row_update(as_key) { - var url = "@HTTP_PREFIX@/lua/get_as_data.lua?asn="+as_key; - - $.ajax({ - type: 'GET', - url: url, - cache: false, - success: function(content) { - var data = jQuery.parseJSON(content); - $("#"+as_key+'_asn').html(data.column_asn); - $("#"+as_key+'_chart').html(data.column_chart); - - $("#"+as_key+'_hosts').html(data.column_hosts); - $("#"+as_key+'_score').html(data.column_score); - $("#"+as_key+'_host_score_ratio').html(data.column_host_score_ratio); - - $("#"+as_key+'_asname').html(data.column_asname); - - $("#"+as_key+'_since').html(data.column_since); - $("#"+as_key+'_alerted_flows').html(data.column_alerted_flows); - $("#"+as_key+'_breakdown').html(data.column_breakdown); - $("#"+as_key+'_throughput').html(data.column_thpt); - $("#"+as_key+'_traffic').html(data.column_traffic); - }, - error: function(content) { - console.log("error"); - } - }); -} - -// Updating function -function as_table_update () { - var $dt = $("#table-as").data("datatable"); - var rows = $dt.rows; - - for (var row in rows){ - var as_key = rows[row][0].id; - as_row_update(as_key); - } -} - -// Refresh Interval (10 sec) -var as_table_interval = window.setInterval(as_table_update, 10000); -// ---------------- End automatic table update code ------------------------ diff --git a/httpdocs/inc/country_stats_id.inc b/httpdocs/inc/country_stats_id.inc deleted file mode 100644 index b2195e0685..0000000000 --- a/httpdocs/inc/country_stats_id.inc +++ /dev/null @@ -1,69 +0,0 @@ - - -// ---------------- Automatic Country table update code ------------------------ - -function country_table_setID (row) { - var index = 0; - var country_key = row.find("td").eq(0).text(); - - // Set the row index to the AS key - row.attr('id', country_key); - - row.find("td").eq(index++).attr('id', country_key+"_key"); - row.find("td").eq(index++).attr('id', country_key+"_number"); - // skip chart column - index++; - // country_stats_top - row.find("td").eq(index++).attr('id', country_key+"_hosts"); - row.find("td").eq(index++).attr('id', country_key+"_alerts"); - - row.find("td").eq(index++).attr('id', country_key+"_since"); - - // country_stats_bottom - row.find("td").eq(index++).attr('id', country_key+"_score"); - row.find("td").eq(index++).attr('id', country_key+"_breakdown"); - row.find("td").eq(index++).attr('id', country_key+"_throughput"); - row.find("td").eq(index++).attr('id', country_key+"_traffic"); - - return row; - -} - -function country_row_update(country_key) { - var url = "@HTTP_PREFIX@/lua/get_country_data.lua?country="+country_key; - - $.ajax({ - type: 'GET', - url: url, - cache: false, - success: function(content) { - var data = jQuery.parseJSON(content); - $("#"+country_key+'_hosts').html(data.column_hosts); - $("#"+country_key+'_alerts').html(data.column_alerts); - $("#"+country_key+'_since').html(data.column_since); - $("#"+country_key+'_score').html(data.column_score); - $("#"+country_key+'_breakdown').html(data.column_breakdown); - $("#"+country_key+'_throughput').html(data.column_thpt); - $("#"+country_key+'_traffic').html(data.column_traffic); - }, - error: function(content) { - console.log("error"); - } - }); -} - -// Updating function -function country_table_update () { - - var $dt = $("#table-country").data("datatable"); - var rows = $dt.rows; - - for (var row in rows){ - var country_key = rows[row][0].id; - country_row_update(country_key); - } -} - -// Refresh Interval (10 sec) -var country_table_interval = window.setInterval(country_table_update, 10000); -// ---------------- End automatic table update code ------------------------ diff --git a/httpdocs/tables_config/as_stats.json b/httpdocs/tables_config/as_stats.json new file mode 100644 index 0000000000..f0e9dbe9a6 --- /dev/null +++ b/httpdocs/tables_config/as_stats.json @@ -0,0 +1,110 @@ +{ + "id": "as_stats", + "data_url": "lua/rest/v2/get/asn/get_as_data.lua", + "use_current_page": false, + "enable_search": false, + "paging": false, + "display_empty_rows": false, + "columns": [ + { + "id": "as_number", + "title_i18n": "as_number", + "data_field": "asn", + "sortable": false, + "sticky": true, + "class": [ + "text-nowrap" + ] + }, + { + "id": "num_hosts", + "title_i18n": "hosts", + "data_field": "num_hosts", + "sortable": true, + "class": [ + "text-center", + "text-nowrap" + ] + }, + { + "id": "score", + "title_i18n": "score", + "data_field": "score", + "sortable": true, + "class": [ + "text-center", + "text-nowrap" + ] + }, + { + "id": "avg_host_score", + "title_i18n": "avg_host_score", + "data_field": "avg_host_score", + "sortable": true, + "class": [ + "text-center", + "text-nowrap" + ] + }, + { + "id": "name", + "title_i18n": "name", + "data_field": "asname", + "sortable": false, + "class": [ + "text-left", + "text-nowrap" + ] + }, + { + "id": "seen_since", + "title_i18n": "seen_since", + "data_field": "seen_since", + "sortable": true, + "class": [ + "text-center", + "text-nowrap" + ] + }, + { + "id": "alerted_flows", + "title_i18n": "flow_details.alerted_flows", + "data_field": "alerted_flows", + "sortable": true, + "class": [ + "text-nowrap", + "text-center" + ] + }, + { + "id": "breakdown", + "title_i18n": "breakdown", + "data_field": "breakdown", + "sortable": false, + "class": [ + "text-nowrap", + "text-center" + ] + }, + { + "id": "throughput", + "title_i18n": "throughput", + "data_field": "throughput", + "sortable": true, + "class": [ + "text-nowrap", + "text-right" + ] + }, + { + "id": "traffic", + "title_i18n": "traffic", + "data_field": "traffic", + "sortable": true, + "class": [ + "text-nowrap", + "text-right" + ] + } + ] +} \ No newline at end of file diff --git a/scripts/locales/en.lua b/scripts/locales/en.lua index a572d35909..7b6bf0b59d 100644 --- a/scripts/locales/en.lua +++ b/scripts/locales/en.lua @@ -1,5 +1,6 @@ local lang = { ["abort"] = "Abort", + ["avg_host_score"] = "Average Host Score", ["num_alerts"] = "Alerts Count", ["city"] = "City", ["acknowledge"] = "Acknowledge", diff --git a/scripts/lua/admin/prefs.lua b/scripts/lua/admin/prefs.lua index c9b94c1250..ab79d833b1 100644 --- a/scripts/lua/admin/prefs.lua +++ b/scripts/lua/admin/prefs.lua @@ -2245,13 +2245,13 @@ if auth.has_capability(auth.capabilities.preferences) then return end - print('
') + print('') print('') - print('') + print('') local disabled = not info["version.enterprise_edition"] -- show or not show table entries for netbox configuration - local showNetboxConfiguration = true + local showNetboxConfiguration = false local elementToSwitch = {"netbox_activation_url", "netbox_default_site", "netbox_personal_access_token"} @@ -2261,6 +2261,8 @@ if auth.has_capability(auth.capabilities.preferences) then showNetboxConfiguration = false end + -- tprint(ntop.getPref("ntopng.prefs.toggle_netbox") .. " " .. tostring(showNetboxConfiguration)) + prefsToggleButton(subpage_active, { field = "toggle_netbox", default = "0", @@ -2271,34 +2273,39 @@ if auth.has_capability(auth.capabilities.preferences) then --(label, comment, prekey, key, default_value, _input_type, showEnabled, disableAutocomplete, allowURLs, extra) -- Netbox Activation URL + -- tprint(prefs) + -- Render the NetBox Activation URL input field prefsInputFieldPrefs(subpage_active.entries["netbox_activation_url"].title, - subpage_active.entries["netbox_activation_url"].description, "ntopng.prefs.", "netbox_activation_url", - "", false, showNetboxConfiguration, nil, nil, { - attributes = { - spellcheck = "false", - }, - required = true, - disabled = disabled + subpage_active.entries["netbox_activation_url"].description, "ntopng.prefs.", "netbox_activation_url", + ntop.getPref("ntopng.prefs.netbox_activation_url") or "", "text", showNetboxConfiguration, nil, nil, { + attributes = { + spellcheck = "false", + }, + required = true, + disabled = disabled, + pattern = "[^\\s]+" -- pattern to validate URL }) - - -- Netbox Asset default Site + + -- Render the NetBox Default Site input field prefsInputFieldPrefs(subpage_active.entries["netbox_default_site"].title, - subpage_active.entries["netbox_default_site"].description, "ntopng.prefs.", "netbox_default_site", - "", false, showNetboxConfiguration, nil, nil, { - attributes = { - spellcheck = "false", - }, - required = true, - disabled = disabled + subpage_active.entries["netbox_default_site"].description, "ntopng.prefs.", "netbox_default_site", + ntop.getPref("ntopng.prefs.netbox_default_site") or "", "text", showNetboxConfiguration, nil, nil, { + attributes = { + spellcheck = "false", + }, + required = true, + disabled = disabled, + pattern = "[^\\s]+" -- pattern to validate site name }) -- Netbox Personal Access token prefsInputFieldPrefs(subpage_active.entries["netbox_personal_access_token"].title, - subpage_active.entries["netbox_personal_access_token"].description, "ntopng.prefs.", "netbox_personal_access_token", "", - "", showNetboxConfiguration, nil, nil, { + subpage_active.entries["netbox_personal_access_token"].description, "ntopng.prefs.", "netbox_personal_access_token", + ntop.getPref("ntopng.prefs.netbox_personal_access_token") or "", "text", showNetboxConfiguration, nil, nil, { required = true, - inputBoxWidth = "40em" - }) + inputBoxWidth = "40em", + disabled = disabled + }) if (disabled) then prefsInformativeField(i18n("notes"), i18n("enterpriseOnly")) diff --git a/scripts/lua/as_stats.lua b/scripts/lua/as_stats.lua index 4e3f7dadcd..b30cd3f42a 100644 --- a/scripts/lua/as_stats.lua +++ b/scripts/lua/as_stats.lua @@ -5,164 +5,33 @@ dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path +local template_utils = require("template_utils") +local page_utils = require "page_utils" +local json = require "dkjson" require "lua_utils" -local asn = _GET["asn"] - -local page_utils = require("page_utils") - sendHTTPContentTypeHeader('text/html') - page_utils.print_header_and_set_active_menu_entry(page_utils.menu_entries.autonomous_systems) dofile(dirs.installdir .. "/scripts/lua/inc/menu.lua") -page_utils.print_page_title(i18n("as_stats.autonomous_systems")) +page_utils.print_navbar(i18n("as_stats.autonomous_systems"), ntop.getHttpPrefix() .. "lua/as_stats.lua", {{ + active = page == "overview" or not page, + page_name = "overview", + label = "" +}}) -local url = ntop.getHttpPrefix() .. "/lua/get_ases_data.lua?" -if not isEmptyString(asn) then - url = url .. "asn=" .. asn -end +local context = { + ifid = interface.getId() +} -print [[ -
- -]] +template_utils.render("pages/vue_page.template", { + vue_page_name = "PageAsStats", + page_context = json_context +}) dofile(dirs.installdir .. "/scripts/lua/inc/footer.lua") diff --git a/scripts/lua/get_as_data.lua b/scripts/lua/get_as_data.lua deleted file mode 100644 index fc9c071372..0000000000 --- a/scripts/lua/get_as_data.lua +++ /dev/null @@ -1,27 +0,0 @@ --- --- (C) 2013-24 - ntop.org --- - -dirs = ntop.getDirs() -package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path -require "lua_utils" -require "as_utils" -- needed for the function mac2record -local json = require("dkjson") - -sendHTTPContentTypeHeader('text/html') - --- sendHTTPHeader('application/json') -interface.select(ifname) - -local asn = tonumber(_GET["asn"]) - -interface.select(ifname) - -local as = interface.getASInfo(asn) - -local res = {} -if as ~= nil then - res = as2record(getInterfaceId(ifname), as) -end - -print(json.encode(res, nil)) diff --git a/scripts/lua/modules/as_utils.lua b/scripts/lua/modules/as_utils.lua deleted file mode 100644 index 50faae0789..0000000000 --- a/scripts/lua/modules/as_utils.lua +++ /dev/null @@ -1,52 +0,0 @@ --- --- (C) 2013-24 - ntop.org --- - -require "lua_utils" -local format_utils = require "format_utils" - --- Get from redis the throughput type bps or pps -local throughput_type = getThroughputType() - -local now = os.time() - -function as2record(ifId, as) - local record = {} - record["key"] = tostring(as["asn"]) - - local as_link = ""..as["asn"]..'' - as["host_score_ratio"] = math.floor(as["score"] / as["num_hosts"]) - - record["column_asn"] = as_link - record["column_asname"] = printASN(as["asn"], as["asname"]) - record["column_score"] = format_high_num_value_for_tables(as, "score") - record["column_hosts"] = format_high_num_value_for_tables(as, "num_hosts") - record["column_since"] = secondsToTime(now - as["seen.first"] + 1) - record["column_host_score_ratio"] = format_high_num_value_for_tables(as, "host_score_ratio") - - local sent2rcvd = round((as["bytes.sent"] * 100) / (as["bytes.sent"] + as["bytes.rcvd"]), 0) - record["column_breakdown"] = "
Sent
Rcvd
" - - if(throughput_type == "pps") then - record["column_thpt"] = pktsToSize(as["throughput_pps"]) - else - record["column_thpt"] = bitsToSize(8*as["throughput_bps"]) - end - - record["column_traffic"] = bytesToSize(as["bytes.sent"] + as["bytes.rcvd"]) - - record["column_chart"] = "" - - if areASTimeseriesEnabled(ifId) then - record["column_chart"] = '' - end - - record["column_alerted_flows"] = format_utils.formatValue(as["alerted_flows"]["total"] or 0) - if record["column_alerted_flows"] == '0' then - record["column_alerted_flows"] = '' - end - - return record -end - diff --git a/scripts/lua/modules/http_lint.lua b/scripts/lua/modules/http_lint.lua index 1942258d89..2ce401d476 100644 --- a/scripts/lua/modules/http_lint.lua +++ b/scripts/lua/modules/http_lint.lua @@ -2664,6 +2664,7 @@ local known_parameters = { ["sankey_version"] = validateNumber, ["blacklist_name"] = validateUnquoted, ["reset_url"] = validateBool, + ["as"] = validateNumber, -- nEdge policy ["default_policy"] = validatePolicy, -- users, nedge policies diff --git a/scripts/lua/rest/v2/get/flow/active_list.lua b/scripts/lua/rest/v2/get/flow/active_list.lua index 3189c73a28..b631f5e3ab 100644 --- a/scripts/lua/rest/v2/get/flow/active_list.lua +++ b/scripts/lua/rest/v2/get/flow/active_list.lua @@ -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 diff --git a/scripts/lua/rest/v2/get/flow/alert/list.lua b/scripts/lua/rest/v2/get/flow/alert/list.lua index b60e7a2b6e..d0d7e5a2db 100644 --- a/scripts/lua/rest/v2/get/flow/alert/list.lua +++ b/scripts/lua/rest/v2/get/flow/alert/list.lua @@ -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 diff --git a/scripts/lua/rest/v2/get/flow/flow_filters.lua b/scripts/lua/rest/v2/get/flow/flow_filters.lua index 8b1705f884..65aba59bd9 100644 --- a/scripts/lua/rest/v2/get/flow/flow_filters.lua +++ b/scripts/lua/rest/v2/get/flow/flow_filters.lua @@ -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", diff --git a/scripts/lua/rest/v2/get/host/host_filters.lua b/scripts/lua/rest/v2/get/host/host_filters.lua index aec2a81230..a04e0762c0 100644 --- a/scripts/lua/rest/v2/get/host/host_filters.lua +++ b/scripts/lua/rest/v2/get/host/host_filters.lua @@ -12,6 +12,7 @@ require "lua_utils_get" local rest_utils = require "rest_utils" local rsp = {} local country = _GET["country"] +local asn = _GET["asn"] local ip_version_filters = {{ key = "version", @@ -325,4 +326,23 @@ if (not isEmptyString(country)) then } end +local as_filter = {{ + key = "asn", + value = "", + label = i18n("all") +}, { + key = "asn", + value = asn, + label = asn +}} + +if (not isEmptyString(asn)) then + rsp[#rsp + 1] = { + action = "asn", + label = i18n("as"), + name = "asn", + value = as_filter + } +end + rest_utils.answer(rest_utils.consts.success.ok, rsp) diff --git a/scripts/lua/rest/v2/get/tables/user_columns_config.lua b/scripts/lua/rest/v2/get/tables/user_columns_config.lua index a0ee94f827..1dee3a3e4a 100644 --- a/scripts/lua/rest/v2/get/tables/user_columns_config.lua +++ b/scripts/lua/rest/v2/get/tables/user_columns_config.lua @@ -29,7 +29,6 @@ local function get_column_config() local redis_key = string.format(redis_base_key, table_id, user_id) local visible_columns = ntop.getCache(redis_key) or {} - if visible_columns == nil or visible_columns == "" then visible_columns = {} else
Assets Inventory
' .. i18n("prefs.assets_inventory") .. '