gluon-config-mode-hostname: add option to use default hostname (#1529)

Before 7827f89, mandatory hostname field in config mode was
pre-filled with the default hostname.

This commit adds the config_mode.hostname.prefill option for
controlling the default value.
This commit is contained in:
David Bauer 2018-09-15 22:36:08 +02:00 committed by Andreas Ziegler
parent 71d1c00f89
commit 9de78e27b6
3 changed files with 6 additions and 1 deletions

View File

@ -403,6 +403,9 @@ config_mode \: optional
and the node's primary MAC address is assigned. Manually setting a hostname and the node's primary MAC address is assigned. Manually setting a hostname
can be enforced by setting *hostname.optional* to *false*. can be enforced by setting *hostname.optional* to *false*.
To not prefill the hostname-field in config-mode with the default hostname,
set *hostname.prefill* to *false*.
By default, no altitude field is shown by the *gluon-config-mode-geo-location* By default, no altitude field is shown by the *gluon-config-mode-geo-location*
package. Set *geo_location.show_altitude* to *true* if you want the altitude package. Set *geo_location.show_altitude* to *true* if you want the altitude
field to be visible. field to be visible.
@ -423,6 +426,7 @@ config_mode \: optional
config_mode = { config_mode = {
hostname = { hostname = {
optional = false, optional = false,
prefill = true,
}, },
geo_location = { geo_location = {
show_altitude = true, show_altitude = true,

View File

@ -1 +1,2 @@
need_boolean(in_site({'config_mode', 'hostname', 'optional'}), false) need_boolean(in_site({'config_mode', 'hostname', 'optional'}), false)
need_boolean(in_site({'config_mode', 'hostname', 'prefill'}), true)

View File

@ -23,7 +23,7 @@ return function(form, uci)
o.optional = true o.optional = true
o.placeholder = default_hostname o.placeholder = default_hostname
end end
if configured then if configured or site.config_mode.hostname.prefill(true) then
o.default = current_hostname o.default = current_hostname
end end