From 35316299c107c3e4b4b4c123edcc9d825a1417ef Mon Sep 17 00:00:00 2001 From: Paul K3PGM Date: Mon, 22 Jan 2024 21:27:12 -0500 Subject: [PATCH] Deduplicate and sort tag names in Advanced DHCP Options selector. (#1078) * Deduplicate and sort tag names in Advanced DHCP Options selector. * Only build the deduplicated list of tag names once. * Build DHCP option tag table more efficiently. --- files/www/cgi-bin/ports | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/files/www/cgi-bin/ports b/files/www/cgi-bin/ports index 70c17166..a299680e 100755 --- a/files/www/cgi-bin/ports +++ b/files/www/cgi-bin/ports @@ -1666,18 +1666,30 @@ function print_dhcp_tags() html.print("") end -function print_dhcp_tag_selector(row, tag_name) - local field_name = "dhcpopt" .. row .. "_tag" - html.print("") + html.print("") + for _, name in ipairs(all_tags) + do + local sel = name == tag_name and "selected " or "" html.print("") end html.print("") @@ -1737,6 +1749,7 @@ function print_dhcp_options() html.print("For TagAlwaysSend DHCP OptionWith Value") local known_options = load_known_options() + local all_tags = get_dhcp_tag_names() local list = make_addable_list(parms.dhcpoptions_num) for _, val in ipairs(list) @@ -1749,7 +1762,7 @@ function print_dhcp_options() print_new_entry_vsep(val, list, 5) html.print("") - print_dhcp_tag_selector(val, tag) + print_dhcp_tag_selector(val, tag, all_tags) html.print("")