mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-30 07:59:35 +00:00
Fixes flow devices not working with view interface
This commit is contained in:
parent
21129f81e4
commit
f6c29ea09f
11 changed files with 187 additions and 153 deletions
|
|
@ -1743,14 +1743,15 @@ end
|
|||
|
||||
local function printFlowDevicesFilterDropdown(base_url, page_params)
|
||||
local snmp_cached_dev = require "snmp_cached_dev"
|
||||
local flowdevs = interface.getFlowDevices()
|
||||
|
||||
local flowdevs = interface.getFlowDevices()
|
||||
local observationPointId = ntop.getUserObservationPointId() or 0
|
||||
|
||||
|
||||
--[[
|
||||
if observationPointId ~= 0 then
|
||||
local obs_info = interface.getObsPointsInfo()["ObsPoints"]
|
||||
local exporter_list = {}
|
||||
|
||||
tprint(obs_info)
|
||||
for k, v in ipairs(obs_info) do
|
||||
if (v.obs_point == observationPointId) then
|
||||
exporter_list = v.exporter_list
|
||||
|
|
@ -1759,29 +1760,10 @@ local function printFlowDevicesFilterDropdown(base_url, page_params)
|
|||
end
|
||||
|
||||
flowdevs = exporter_list
|
||||
else
|
||||
if interface.isView() then -- If it's view
|
||||
local ifid = tostring(interface.getId())
|
||||
for id, name in pairs(interface.getIfNames()) do
|
||||
interface.select(id) -- Change the interface
|
||||
if interface.isViewed() then -- Viewed, add the exporters
|
||||
flowdevs = interface.getFlowDevices()
|
||||
end
|
||||
end
|
||||
interface.select(ifid)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
local ordering_fun = pairsByKeys
|
||||
|
||||
if flowdevs == nil then
|
||||
flowdevs = {}
|
||||
end
|
||||
|
||||
]]
|
||||
local devips = getProbesName(flowdevs, false, false)
|
||||
local ordering_fun = pairsByKeys
|
||||
local devips_order = ntop.getPref("ntopng.prefs.flow_table_probe_order") == "1" -- Order by Probe Name
|
||||
|
||||
if devips_order then
|
||||
|
|
@ -1816,26 +1798,28 @@ local function printFlowDevicesFilterDropdown(base_url, page_params)
|
|||
print [[">]]
|
||||
print(i18n("flows_page.all_devices"))
|
||||
print [[</a></li>\]]
|
||||
for dev_ip, dev_resolved_name in pairsByValues(devips, asc) do
|
||||
local dev_name = dev_ip
|
||||
local dev_name_full = dev_ip
|
||||
for interface, device_list in pairs(devips) do
|
||||
for dev_ip, dev_resolved_name in pairsByValues(device_list, asc) do
|
||||
local dev_name = dev_ip
|
||||
local dev_name_full = dev_ip
|
||||
|
||||
dev_params["deviceIP"] = dev_name
|
||||
dev_params["deviceIP"] = dev_name
|
||||
|
||||
dev_name = format_name_value(dev_resolved_name, dev_ip, true)
|
||||
dev_name_full = format_name_value(dev_resolved_name, dev_ip, false)
|
||||
dev_name = format_name_value(dev_resolved_name, dev_ip, true)
|
||||
dev_name_full = format_name_value(dev_resolved_name, dev_ip, false)
|
||||
|
||||
print [[
|
||||
<li>\
|
||||
<a class="dropdown-item ]]
|
||||
print(dev_ip == cur_dev and 'active' or '')
|
||||
print [[" href="]]
|
||||
print(getPageUrl(base_url, dev_params))
|
||||
print [[" title="]]
|
||||
print(dev_name_full)
|
||||
print [[">]]
|
||||
print(dev_name)
|
||||
print [[</a></li>\]]
|
||||
print [[
|
||||
<li>\
|
||||
<a class="dropdown-item ]]
|
||||
print(dev_ip == cur_dev and 'active' or '')
|
||||
print [[" href="]]
|
||||
print(getPageUrl(base_url, dev_params))
|
||||
print [[" title="]]
|
||||
print(dev_name_full)
|
||||
print [[">]]
|
||||
print(dev_name)
|
||||
print [[</a></li>\]]
|
||||
end
|
||||
end
|
||||
print [[
|
||||
</ul>\
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue