luci-app-olsr: handle empty result for non-status tables
[oweals/luci.git] / protocols / luci-proto-qmi / luasrc / model / cbi / admin_network / proto_qmi.lua
1 -- Copyright 2016 David Thornley <david.thornley@touchstargroup.com>
2 -- Licensed to the public under the Apache License 2.0.
3
4 local map, section, net = ...
5
6 local device, apn, pincode, username, password
7 local auth, ipv6, delay, mtu
8
9
10 device = section:taboption("general", Value, "device", translate("Modem device"))
11 device.rmempty = false
12
13 local device_suggestions = nixio.fs.glob("/dev/cdc-wdm*")
14
15 if device_suggestions then
16         local node
17         for node in device_suggestions do
18                 device:value(node)
19         end
20 end
21
22
23 apn = section:taboption("general", Value, "apn", translate("APN"))
24
25
26 pincode = section:taboption("general", Value, "pincode", translate("PIN"))
27
28
29 auth = section:taboption("general", Value, "auth", translate("Authentication Type"))
30 auth:value("both", "PAP/CHAP (both)")
31 auth:value("pap", "PAP")
32 auth:value("chap", "CHAP")
33 auth:value("none", "NONE")
34 auth.default = "none"
35
36
37 username = section:taboption("general", Value, "username", translate("PAP/CHAP username"))
38 username:depends("auth", "pap")
39 username:depends("auth", "chap")
40 username:depends("auth", "both")
41
42
43 password = section:taboption("general", Value, "password", translate("PAP/CHAP password"))
44 password:depends("auth", "pap")
45 password:depends("auth", "chap")
46 password:depends("auth", "both")
47 password.password = true
48
49
50 if luci.model.network:has_ipv6() then
51     ipv6 = section:taboption("advanced", Flag, "ipv6", translate("Enable IPv6 negotiation"))
52     ipv6.default = ipv6.disabled
53 end
54
55 delay = section:taboption("advanced", Value, "delay",
56         translate("Modem init timeout"),
57         translate("Maximum amount of seconds to wait for the modem to become ready"))
58 delay.placeholder = "10"
59 delay.datatype    = "min(1)"
60
61 mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU"))
62 mtu.placeholder = "1500"
63 mtu.datatype    = "max(9200)"