Set default dhcp interface on page load

This commit is contained in:
billz 2020-11-21 13:52:20 +00:00
parent 73deab78cf
commit b63a53e182
3 changed files with 7 additions and 7 deletions

View file

@ -223,7 +223,7 @@ function contentLoaded() {
case "hostapd_conf":
loadChannel();
case "dhcpd_conf":
loadInterfaceDHCPSelect('wlan0');
loadInterfaceDHCPSelect();
break;
}
}
@ -240,9 +240,8 @@ function loadWifiStations(refresh) {
}
$(".js-reload-wifi-stations").on("click", loadWifiStations(true));
function loadInterfaceDHCPSelect(default_iface) {
var iface = (default_iface) ? default_iface : $('#cbxdhcpiface').val();
$('#cbxdhcpiface').val(iface);
function loadInterfaceDHCPSelect() {
var iface = $('#cbxdhcpiface').val();
$.get('ajax/networking/get_netcfg.php?iface='+iface,function(data){
jsonData = JSON.parse(data);
$('#dhcp-iface')[0].checked = jsonData.DHCPEnabled;

View file

@ -44,17 +44,18 @@ function DisplayDHCPConfig()
}
}
}
getWifiInterface();
$serviceStatus = $dnsmasq_state ? "up" : "down";
exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces);
exec('cat ' . RASPI_DNSMASQ_LEASES, $leases);
$ap_iface = $_SESSION['ap_interface'];
echo renderTemplate(
"dhcp", compact(
"status",
"serviceStatus",
"dnsmasq_state",
"conf",
"ap_iface",
"dhcpHost",
"interfaces",
"leases"

View file

@ -3,7 +3,7 @@
<div class="row">
<div class="form-group col-md-6">
<label for="code">Interface</label>
<?php SelectorOptions('interface', $interfaces, $conf['interface'], 'cbxdhcpiface', 'loadInterfaceDHCPSelect', $DHCPDisabled); ?>
<?php SelectorOptions('interface', $interfaces, $ap_iface, 'cbxdhcpiface', 'loadInterfaceDHCPSelect', $DHCPDisabled); ?>
</div>
</div>