Add advanced fields to JSON response

This commit is contained in:
billz 2020-11-17 11:18:10 +00:00
parent 209d741363
commit e4856484d9
3 changed files with 4 additions and 2 deletions

View file

@ -21,7 +21,7 @@ if (isset($interface)) {
$dhcpdata['dhcpHost'] = is_array($dhcpHost) ? $dhcpHost : [ $dhcpHost ];
$upstreamServers = is_array($conf['server']) ? $conf['server'] : [ $conf['server'] ];
$dhcpdata['upstreamServers'] = array_filter($upstreamServers);
$dhcpdata['upstreamServersEnabled'] = empty($conf['server']) ? false: true;
preg_match('/([0-9]*)([a-z])/i', $dhcpdata['leaseTime'], $arrRangeLeaseTime);
$dhcpdata['leaseTime'] = $arrRangeLeaseTime[1];
$dhcpdata['leaseTimeInterval'] = $arrRangeLeaseTime[2];

View file

@ -255,6 +255,8 @@ function loadInterfaceDHCPSelect() {
$('#txtdns1').val(jsonData.DNS1);
$('#txtdns2').val(jsonData.DNS2);
$('#cbxrangeleasetimeunits').val(jsonData.leaseTimeInterval);
$('#no-resolv')[0].checked = jsonData.upstreamServersEnabled;
$('#cbxdhcpupstreamserver').val(jsonData.upstreamServers[0]);
});
}

View file

@ -41,7 +41,7 @@
<code class="text-muted"><?php echo htmlspecialchars("[/[<domain>]/[domain/]][<ipaddr>[#<port>][@<source-ip>|<interface>[#<port>]]"); ?></code>
</small>
</p>
<select class="custom-select custom-select-sm js-field-preset" data-field-preset-target="#add-dhcp-upstream-server-field">
<select class="custom-select custom-select-sm js-field-preset" id="cbxdhcpupstreamserver" data-field-preset-target="#add-dhcp-upstream-server-field">
<option value=""><?php echo _("Choose a hosted server") ?></option>
<option disabled="disabled"></option>
<?php echo optionsForSelect(dnsServers()) ?>