-- -- (C) 2020 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path 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, title, is_ordered) 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, is_ordered = is_ordered, title = title }) 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 "".. title .. " / "..subpage.."" end return ui_utils