more UI refactoring

main
riley 1 year ago
parent f01cc79f0c
commit ef03e3b06f

@ -48,27 +48,28 @@ end
return "Driver not supported" return "Driver not supported"
end end
-- Get the hardware name (e.g., "Generic MAC80211")
local hw_name = driver.hardware_name and driver.hardware_name(iface) local hw_name = driver.hardware_name and driver.hardware_name(iface)
if not hw_name or hw_name == "" then if not hw_name or hw_name == "" then
hw_name = "Unknown hardware" hw_name = "Unknown hardware"
end end
-- Get the list of supported modes (e.g., "802.11bgnac") local hw_modes = driver.hwmodelist and driver.hwmodelist(iface)
local hw_modes_tbl = driver.hwmodelist and driver.hwmodelist(iface) local supported_modes = {}
local hw_modes_str = "" if hw_modes then
if hw_modes_tbl then for mode, supported in pairs(hw_modes) do
local hw_modes = {} if supported then
for mode, _ in pairs(hw_modes_tbl) do table.insert(supported_modes, mode)
table.insert(hw_modes, mode)
end end
hw_modes_str = table.concat(hw_modes, "/") end
end
if #supported_modes == 0 then
supported_modes_str = "No mode information"
else else
hw_modes_str = "No mode information" supported_modes_str = table.concat(supported_modes, "/")
end end
-- Combine the hardware name with the supported modes local verbose_info = hw_name .. " (" .. supported_modes_str .. ")"
local verbose_info = hw_name .. hw_modes_str
return verbose_info return verbose_info
end end
@ -83,11 +84,6 @@ v:option(DummyValue, "lastseen", translate("lastseen"))
s = m:section(TypedSection, "easymesh", translate("Mesh Gateway & Node WiFi Settings"), translate("Choose Mesh Gateway or Mesh Node WiFi Settings: Begin by completing this section on your mesh server and nodes. Ensure each radio's WiFi network name is consistent. For example: easymesh_AC, easymesh_N.")) s = m:section(TypedSection, "easymesh", translate("Mesh Gateway & Node WiFi Settings"), translate("Choose Mesh Gateway or Mesh Node WiFi Settings: Begin by completing this section on your mesh server and nodes. Ensure each radio's WiFi network name is consistent. For example: easymesh_AC, easymesh_N."))
s.anonymous = true s.anonymous = true
---- Eanble
o = s:option(Flag, "enabled", translate("Enable"), translate("Enable or disable Easy Mesh"))
o.default = 0
o.rmempty = false
-- Connection Type Dropdown -- Connection Type Dropdown
--o = s:option(ListValue, "backbone", translate("Connection Type"), translate("Choose if Node or Gateway is connected to internet by LAN or WiFi")) --o = s:option(ListValue, "backbone", translate("Connection Type"), translate("Choose if Node or Gateway is connected to internet by LAN or WiFi"))
--o:value("lan", translate("LAN")) --o:value("lan", translate("LAN"))
@ -111,11 +107,17 @@ o.rmempty = false
s:tab("setup", translate("Basic Setup")) s:tab("setup", translate("Basic Setup"))
s:tab("advanced", translate("Advanced Settings")) s:tab("advanced", translate("Advanced Settings"))
---- Eanble
o = s:taboption("setup", Flag, "enabled", translate("Enable"), translate("Enable or disable Easy Mesh"))
o.default = 0
o.rmempty = false
-- Move basic settings under the "Setup" tab -- Move basic settings under the "Setup" tab
o = s:taboption("setup", ListValue, "role", translate("Mesh Mode")) o = s:taboption("setup", ListValue, "role", translate("Mesh Mode"))
o:value("off", translate("Node")) o:value("off", translate("Node"))
o:value("server", translate("Server")) o:value("server", translate("Server"))
o:value("client", translate("Client (advanced)")) o:value("client", translate("Client (advanced)"))
o:depends("enabled", 1)
o.rmempty = false o.rmempty = false
apRadio = s:taboption("setup", ListValue, "apRadio", translate("Mesh Radio")) apRadio = s:taboption("setup", ListValue, "apRadio", translate("Mesh Radio"))
@ -129,18 +131,22 @@ uci:foreach("wireless", "wifi-device",
end) end)
apRadio:value("all", translate("ALL")) apRadio:value("all", translate("ALL"))
apRadio.default = "radio0" apRadio.default = "radio0"
apRadio:depends("enabled", 1)
apRadio.rmempty = false apRadio.rmempty = false
o = s:taboption("setup", Value, "mesh_id", translate("Mesh SSID")) o = s:taboption("setup", Value, "mesh_id", translate("Mesh SSID"))
o.default = "easymesh_AC" o.default = "easymesh_AC"
o:depends("enabled", 1)
enable = s:taboption("setup", Flag, "encryption", translate("Encryption WIP DROPDOWN"), translate("")) encryption = s:taboption("setup", Flag, "encryption", translate("Encryption WIP DROPDOWN"), translate(""))
enable.default = 0 encryption.default = 0
enable.rmempty = false encryption.rmempty = false
encryption:depends("enabled", 1)
o = s:taboption("setup", Value, "key", translate("Mesh Password")) o = s:taboption("setup", Value, "key", translate("Mesh Password"))
o.default = "easymesh" o.default = "easymesh"
o:depends("encryption", 1) o:depends({enabled = "1", encryption = "1"})
o.password = true
-- 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"))

Loading…
Cancel
Save