mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Implements custom column in the hosts stats page
This commit is contained in:
parent
713415d232
commit
c40bfb1a8e
15 changed files with 227 additions and 400 deletions
|
|
@ -2822,52 +2822,6 @@ end
|
|||
|
||||
-- ###########################################
|
||||
|
||||
-- IMPORTANT: keep it in sync with sortField (ntop_typedefs.h)
|
||||
-- AND host_search_walker:NetworkInterface.cpp
|
||||
-- AND NetworkInterface::getFlows()
|
||||
looking_glass_criteria = {
|
||||
-- KEY LABEL Host::lua()-label formatting
|
||||
{ "uploaders", i18n("uploaders"), "upload", bytesToSize },
|
||||
{ "downloaders", i18n("downloaders"), "download", bytesToSize },
|
||||
{ "unknowers", i18n("unknowers"), "unknown", bytesToSize },
|
||||
{ "incomingflows", i18n("incomingflows"), "incomingflows", format_utils.formatValue },
|
||||
{ "outgoingflows", i18n("outgoingflows"), "outgoingflows", format_utils.formatValue },
|
||||
{ "total_outgoing_anomalous_flows", i18n("total_outgoing_anomalous_flows"), "total_outgoing_anomalous_flows", format_utils.formatValue },
|
||||
{ "total_incoming_anomalous_flows", i18n("total_incoming_anomalous_flows"), "total_incoming_anomalous_flows", format_utils.formatValue },
|
||||
}
|
||||
|
||||
function criteria2label(criteria)
|
||||
local id
|
||||
|
||||
for id, _ in ipairs(looking_glass_criteria) do
|
||||
local key = looking_glass_criteria[id][1]
|
||||
local label = looking_glass_criteria[id][2]
|
||||
local fnctn = looking_glass_criteria[id][4]
|
||||
|
||||
if(key == criteria) then
|
||||
return label, fnctn
|
||||
end
|
||||
end
|
||||
|
||||
return criteria, format_utils.formatValue
|
||||
end
|
||||
|
||||
function label2criteriakey(what)
|
||||
local id
|
||||
|
||||
for id, _ in ipairs(looking_glass_criteria) do
|
||||
local c = looking_glass_criteria[id][1]
|
||||
local key = looking_glass_criteria[id][3]
|
||||
local fnctn = looking_glass_criteria[id][4]
|
||||
|
||||
if(what == c) then
|
||||
return key, fnctn
|
||||
end
|
||||
end
|
||||
|
||||
return what, format_utils.formatValue
|
||||
end
|
||||
|
||||
-- Merges table a and table b into a new table. If some elements are presents in
|
||||
-- both a and b, b elements will have precedence.
|
||||
-- NOTE: this does *not* perform a deep merge. Only first level is merged.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue