Testing out new UI stuff

main
riley 1 year ago
parent 8f440453d3
commit e21f27d562

@ -37,23 +37,39 @@ function detect_Node()
return data return data
end end
local function get_hw_modes(iface) function get_verbose_hw_info(iface)
local type = iwinfo.type(iface) local type = iwinfo.type(iface)
if not type then if not type then
return "unknown" return "Unknown interface"
end end
local hw_modes = iwinfo.hwmodelist(type) local driver = iwinfo[type]
if not hw_modes then if not driver then
return "unknown" return "Driver not supported"
end end
local modes = {} -- Get the hardware name (e.g., "Generic MAC80211")
for mode, _ in pairs(hw_modes) do local hw_name = driver.hardware_name and driver.hardware_name(iface)
table.insert(modes, mode) if not hw_name or hw_name == "" then
hw_name = "Unknown hardware"
end end
return table.concat(modes, "/") -- 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
-- Combine the hardware name with the supported modes
local verbose_info = hw_name .. hw_modes_str
return verbose_info
end end
local Nodes = luci.sys.exec("batctl n 2>/dev/null| tail +3 | wc -l") 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.placeholder = "easymesh"
--app.rmempty = true --app.rmempty = true
o = s:option(ListValue, "role", translate("Mesh Device Type")) s:tab("setup", translate("Basic Setup"))
o:value("off", translate("Mesh Node")) s:tab("advanced", translate("Advanced Settings"))
o:value("server", translate("Mesh Server"))
o:value("client", translate("Mesh Client")) -- 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 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", uci:foreach("wireless", "wifi-device",
function(s) function(s)
local iface = s['.name'] 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) local desc = string.format("%s (%s)", iface, hw_modes)
apRadio:value(iface, desc) -- Display radio interface with its hardware modes apRadio:value(iface, desc) -- Display radio interface with its hardware modes
end) end)
@ -111,22 +131,17 @@ apRadio:value("all", translate("ALL"))
apRadio.default = "radio0" apRadio.default = "radio0"
apRadio.rmempty = false apRadio.rmempty = false
---- mesh o = s:taboption("setup", Value, "mesh_id", translate("Mesh SSID"))
o = s:option(Value, "mesh_id", translate("Mesh ID"))
o.default = "easymesh_AC" 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.default = 0
enable.rmempty = false enable.rmempty = false
o = s:option(Value, "key", translate("Key")) o = s:taboption("setup", Value, "key", translate("Key"))
o.default = "easymesh" o.default = "easymesh"
o:depends("encryption", 1) 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 -- 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 = s:taboption("advanced", Flag, "kvr", translate("K/V/R"), translate("Enable Key Value Roaming"))
enable_kvr.default = 1 enable_kvr.default = 1
@ -147,6 +162,7 @@ low_rssi_val.default = "-88"
low_rssi_val.datatype = "range(-1,-120)" low_rssi_val.datatype = "range(-1,-120)"
low_rssi_val:depends("kvr", 1) low_rssi_val:depends("kvr", 1)
---- Apply MESH settings ---- Apply MESH settings
--ctrl = m:section(TypedSection, "easymesh", "Apply Mesh WiFi Settings to Server or Node") --ctrl = m:section(TypedSection, "easymesh", "Apply Mesh WiFi Settings to Server or Node")
--ctrl.anonymous = true --ctrl.anonymous = true

Loading…
Cancel
Save