From 53f55dec58f2b6c4baa29130b70c34b16c6e1ea6 Mon Sep 17 00:00:00 2001 From: seud0nym Date: Mon, 6 Dec 2021 13:43:08 +1100 Subject: [PATCH] Sorted static leases and tags --- .../lan/www/docroot/modals/ethernet-modal.lp | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/build/lua/additional/common/lan/www/docroot/modals/ethernet-modal.lp b/build/lua/additional/common/lan/www/docroot/modals/ethernet-modal.lp index 1d925566..da7973ef 100644 --- a/build/lua/additional/common/lan/www/docroot/modals/ethernet-modal.lp +++ b/build/lua/additional/common/lan/www/docroot/modals/ethernet-modal.lp @@ -19,7 +19,7 @@ local uinetwork = require("web.uinetwork_helper") local hosts_ac = uinetwork.getAutocompleteHostsList() local tonumber,tostring = tonumber,tostring local content,helpmsg -local match,format = string.match,string.format +local match,format,toupper = string.match,string.format,string.upper ---@diagnostic disable-next-line: undefined-field local untaint = string.untaint local find = string.find @@ -318,6 +318,9 @@ local sleases_options = { createMsg = T"Add Static Lease", objectName = post_helper.getRandomKey(), addNamedObject = true, + sorted = function(a,b) + return toupper(a.name or "") < toupper(b.name or "") + end, } local used_tags = {} @@ -411,12 +414,12 @@ local tags_options = { createMsg = T"Add Tag", addNamedObject = true, canEdit = false, - onAdd = function(index,content) + onAdd = function(index,added) local value = "" - if content.tags_dns1 ~= "" then - value = "6,"..content.tags_dns1 - if content.tags_dns2 ~= "" then - value = value..","..content.tags_dns2 + if added.tags_dns1 ~= "" then + value = "6,"..added.tags_dns1 + if added.tags_dns2 ~= "" then + value = value..","..added.tags_dns2 end end if value ~= "" then @@ -435,6 +438,9 @@ local tags_options = { end end end, + sorted = function(a,b) + return toupper(a.paramindex or "") < toupper(b.paramindex or "") + end, } local tags_data,tags_helpmsg = post_helper.handleTableQuery(tags_columns,tags_options,tags_filter,nil,tags_valid) @@ -543,9 +549,9 @@ local function isNonPublicIPRange(ip) return nil end -local function split(x,sep) +local function split(x,separator) x = tostring(x) - local sep,fields = sep or ":",{} + local sep,fields = separator or ":",{} local pattern = string.format("([^%s]+)",sep) x:gsub(pattern,function(c) fields[#fields+1] = c end) return fields