diff options
author | Florian Eckert <fe@dev.tdt.de> | 2024-04-08 10:54:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-08 10:54:51 +0200 |
commit | 0e71b881aea2c0f55250dc863d68f1974ac50401 (patch) | |
tree | 2b2654579e7f94311bab68ff34aca43554251065 /protocols | |
parent | 5dd6b148eea1fe4dd6d4b8cf705842980a2087db (diff) | |
parent | f48c8e59868bd995d8ea0f76e6cf26d2a1c6eb11 (diff) |
Merge pull request #7020 from findlayfeng/luci-proto-bonding
luci-proto-bonding: Modify ipaddr as optional
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/luci-proto-bonding/htdocs/luci-static/resources/protocol/bonding.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/protocols/luci-proto-bonding/htdocs/luci-static/resources/protocol/bonding.js b/protocols/luci-proto-bonding/htdocs/luci-static/resources/protocol/bonding.js index 4c774290f0..5309931a2a 100644 --- a/protocols/luci-proto-bonding/htdocs/luci-static/resources/protocol/bonding.js +++ b/protocols/luci-proto-bonding/htdocs/luci-static/resources/protocol/bonding.js @@ -42,8 +42,11 @@ function getSelectableSlaves(section_id) { }); } -function validateEmpty(section, value) { - if (value) { +function validate_netmask_empty(section, value) { + var opt = this.map.lookupOption('ipaddr', section); + var ipaddr = opt[0].formvalue(section); + + if (!ipaddr || value) { return true; } else { @@ -164,13 +167,15 @@ return network.registerProtocol('bonding', { _('IPv4 address'), _('The local IPv4 address')); o.datatype = 'ip4addr'; + o.optional = true; o.rmempty = false; o = s.taboption('general', form.Value, 'netmask', _('IPv4 netmask'), _('The local IPv4 netmask')); o.datatype = 'ip4addr'; - o.validate = validateEmpty; + o.optional = true; + o.validate = validate_netmask_empty; o.rmempty = false; o.value("255.255.255.0"); o.value("255.255.0.0"); @@ -196,7 +201,7 @@ return network.registerProtocol('bonding', { }; o.validate = updatePrimaries; o.rmempty = false; - + o = s.taboption('advanced', form.ListValue, 'bonding_policy', _('Bonding Policy'), _('Specifies the mode to be used for this bonding interface')); |