From e21f27d5625ea37d9bb111a6d78fe3ffbd23cc91 Mon Sep 17 00:00:00 2001 From: riley Date: Fri, 10 Nov 2023 18:41:06 -0500 Subject: [PATCH] Testing out new UI stuff --- luasrc/model/cbi/easymesh.lua | 66 ++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/luasrc/model/cbi/easymesh.lua b/luasrc/model/cbi/easymesh.lua index 49ebd30..a9a271d 100755 --- a/luasrc/model/cbi/easymesh.lua +++ b/luasrc/model/cbi/easymesh.lua @@ -37,23 +37,39 @@ function detect_Node() return data end -local function get_hw_modes(iface) + function get_verbose_hw_info(iface) local type = iwinfo.type(iface) if not type then - return "unknown" + return "Unknown interface" end - local hw_modes = iwinfo.hwmodelist(type) - if not hw_modes then - return "unknown" + local driver = iwinfo[type] + if not driver then + return "Driver not supported" end - - local modes = {} - for mode, _ in pairs(hw_modes) do - table.insert(modes, mode) + + -- Get the hardware name (e.g., "Generic MAC80211") + local hw_name = driver.hardware_name and driver.hardware_name(iface) + if not hw_name or hw_name == "" then + hw_name = "Unknown hardware" + end + + -- Get the list of supported modes (e.g., "802.11bgnac") + local hw_modes_tbl = driver.hwmodelist and driver.hwmodelist(iface) + local hw_modes_str = "" + if hw_modes_tbl then + local hw_modes = {} + for mode, _ in pairs(hw_modes_tbl) do + table.insert(hw_modes, mode) + end + hw_modes_str = table.concat(hw_modes, "/") + else + hw_modes_str = "No mode information" end - - return table.concat(modes, "/") + + -- Combine the hardware name with the supported modes + local verbose_info = hw_name .. hw_modes_str + return verbose_info end local Nodes = luci.sys.exec("batctl n 2>/dev/null| tail +3 | wc -l") @@ -92,18 +108,22 @@ o.rmempty = false --app.placeholder = "easymesh" --app.rmempty = true -o = s:option(ListValue, "role", translate("Mesh Device Type")) -o:value("off", translate("Mesh Node")) -o:value("server", translate("Mesh Server")) -o:value("client", translate("Mesh Client")) +s:tab("setup", translate("Basic Setup")) +s:tab("advanced", translate("Advanced Settings")) + +-- Move basic settings under the "Setup" tab +o = s:taboption("setup", ListValue, "role", translate("Mesh Mode")) +o:value("off", translate("Node")) +o:value("server", translate("Server")) +o:value("client", translate("Client (advanced)")) o.rmempty = false -apRadio = s:option(ListValue, "apRadio", translate("Mesh Radio device"), translate("The WiFi radio device Mesh will use")) +apRadio = s:taboption("setup", ListValue, "apRadio", translate("Mesh Radio")) uci:foreach("wireless", "wifi-device", function(s) local iface = s['.name'] - local hw_modes = get_hw_modes(iface) + local hw_modes = get_verbose_hw_info(iface) local desc = string.format("%s (%s)", iface, hw_modes) apRadio:value(iface, desc) -- Display radio interface with its hardware modes end) @@ -111,22 +131,17 @@ apRadio:value("all", translate("ALL")) apRadio.default = "radio0" apRadio.rmempty = false ----- mesh -o = s:option(Value, "mesh_id", translate("Mesh ID")) +o = s:taboption("setup", Value, "mesh_id", translate("Mesh SSID")) o.default = "easymesh_AC" -o.description = translate("Mesh ID") -enable = s:option(Flag, "encryption", translate("Encryption"), translate("")) +enable = s:taboption("setup", Flag, "encryption", translate("Encryption MAKE THIS A DROPDOWN"), translate("")) enable.default = 0 enable.rmempty = false -o = s:option(Value, "key", translate("Key")) +o = s:taboption("setup", Value, "key", translate("Key")) o.default = "easymesh" o:depends("encryption", 1) --- Add a new tab called "Advanced" to the existing "Setup" section -s:tab("advanced", translate("Advanced Settings")) - -- Move K/V/R settings to the "Advanced" tab enable_kvr = s:taboption("advanced", Flag, "kvr", translate("K/V/R"), translate("Enable Key Value Roaming")) enable_kvr.default = 1 @@ -147,6 +162,7 @@ low_rssi_val.default = "-88" low_rssi_val.datatype = "range(-1,-120)" low_rssi_val:depends("kvr", 1) + ---- Apply MESH settings --ctrl = m:section(TypedSection, "easymesh", "Apply Mesh WiFi Settings to Server or Node") --ctrl.anonymous = true