From 6d331c3ebdc21108a919c518043fea84b7061f37 Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 26 Nov 2020 17:16:54 +0000 Subject: [PATCH] Add static IP fields, fallback, toggle state --- app/js/custom.js | 11 +++++++ templates/dhcp/general.php | 63 +++++++++++++++++++++++++++++++++----- 2 files changed, 67 insertions(+), 7 deletions(-) diff --git a/app/js/custom.js b/app/js/custom.js index de05908d..b8876be5 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -245,6 +245,9 @@ function loadInterfaceDHCPSelect() { $.get('ajax/networking/get_netcfg.php?iface='+iface,function(data){ jsonData = JSON.parse(data); $('#dhcp-iface')[0].checked = jsonData.DHCPEnabled; + $('#txtipaddress').val(jsonData.StaticIP); + $('#txtgateway').val(jsonData.StaticRouters); + $('#chkfallback')[0].checked = jsonData.FallbackEnabled; $('#txtrangestart').val(jsonData.RangeStart); $('#txtrangeend').val(jsonData.RangeEnd); $('#txtrangeleasetime').val(jsonData.leaseTime); @@ -253,6 +256,14 @@ function loadInterfaceDHCPSelect() { $('#cbxrangeleasetimeunits').val(jsonData.leaseTimeInterval); $('#no-resolv')[0].checked = jsonData.upstreamServersEnabled; $('#cbxdhcpupstreamserver').val(jsonData.upstreamServers[0]); + $('#txtmetric').val(jsonData.Metric); + if (jsonData.StaticIP !== null && jsonData.StaticIP !== '') { + $('#chkstatic').closest('.btn').button('toggle'); + $('#chkstatic').closest('.btn').blur(); + } else { + $('#chkdhcp').closest('.btn').button('toggle'); + $('#chkdhcp').closest('.btn').blur(); + } }); } diff --git a/templates/dhcp/general.php b/templates/dhcp/general.php index 60f5b228..178a7a95 100644 --- a/templates/dhcp/general.php +++ b/templates/dhcp/general.php @@ -7,6 +7,48 @@ +
+
+
+
+ + +
+
+
+ +
+
+
+ + +
+

+ +

+
+
+ +
Static IP options
+
+
+ + +
+
+ +
+
+ + +
+
+ +
DHCP options
@@ -16,30 +58,30 @@

- +

- +
- +
- +
- +
@@ -55,14 +97,21 @@
- +
- + +
+
+ +
+
+ +