mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
59 lines
No EOL
1.6 KiB
Lua
59 lines
No EOL
1.6 KiB
Lua
--
|
|
-- (C) 2020 - ntop.org
|
|
--
|
|
|
|
local dirs = ntop.getDirs()
|
|
|
|
require "lua_utils"
|
|
local template_utils = require("template_utils")
|
|
|
|
local ui_utils = {}
|
|
|
|
function ui_utils.render_configuration_footer(item)
|
|
return template_utils.gen('pages/components/manage-configuration-link.template', {item = item})
|
|
end
|
|
|
|
--- Single note element: { content = 'note description', hidden = true|false }
|
|
function ui_utils.render_notes(notes_items)
|
|
|
|
if notes_items == nil then
|
|
traceError(TRACE_DEBUG, TRACE_CONSOLE, "The notes table is nil!")
|
|
return ""
|
|
end
|
|
|
|
return template_utils.gen("pages/components/notes.template", {
|
|
notes = notes_items
|
|
})
|
|
end
|
|
|
|
function ui_utils.render_pools_dropdown(pools_instance, member, key)
|
|
|
|
if (pools_instance == nil) then
|
|
traceError(TRACE_DEBUG, TRACE_CONSOLE, "The pools instance is nil!")
|
|
return ""
|
|
end
|
|
|
|
if (member == nil) then
|
|
traceError(TRACE_DEBUG, TRACE_CONSOLE, "The member is nil!")
|
|
return ""
|
|
end
|
|
|
|
local selected_pool = pools_instance:get_pool_by_member(member)
|
|
local selected_pool_id = selected_pool and selected_pool.pool_id or pools_instance.DEFAULT_POOL_ID
|
|
|
|
local all_pools = pools_instance:get_all_pools()
|
|
|
|
return template_utils.gen("pages/components/pool-select.template", {
|
|
pools = all_pools,
|
|
selected_pool_id = selected_pool_id,
|
|
key = key,
|
|
})
|
|
end
|
|
|
|
function ui_utils.create_navbar_title(title, subpage, title_link)
|
|
|
|
if isEmptyString(subpage) then return title end
|
|
return "<a href='".. title_link .."'>".. title .. "</a> / <span>"..subpage.."</span>"
|
|
end
|
|
|
|
return ui_utils |