From 250389126d7badca1d879dd8f07e44efc5c3a6f9 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 31 Jan 2017 22:50:43 +0100 Subject: [PATCH 1/3] Copy row from currently active DHCP leases to input fields for static releases --- scripts/pi-hole/js/settings.js | 14 +++++++++++--- settings.php | 7 ++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index c1542362..c8b7e3f4 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -1,8 +1,15 @@ $(function () { - $("[data-mask]").inputmask(); -}); + $("[data-mask]").inputmask(); + + $("[data-static]").on("click", function(){ + var mac = $(this).closest("tr").find('#MAC').text(); + var ip = $(this).closest("tr").find('#IP').text(); + var host = $(this).closest("tr").find('#HOST').text(); + $('input[name="AddHostname"]').val(host); + $('input[name="AddIP"]').val(ip); + $('input[name="AddMAC"]').val(mac); + }); -$(function(){ $("#custom1val").ipAddress({s:4}); $("#custom2val").ipAddress({s:4}); $("#custom3val").ipAddress({v:6}); @@ -75,6 +82,7 @@ $(document).ready(function() { { leasetable = $("#DHCPLeasesTable").DataTable({ dom: "<'row'<'col-sm-12'tr>><'row'<'col-sm-6'i><'col-sm-6'f>>", + "columnDefs": [ { "bSortable": false, "orderable": false, targets: -1} ], "paging": false, "scrollCollapse": true, "scrollY": "200px", diff --git a/settings.php b/settings.php index 7da7eb25..8b5f3eed 100644 --- a/settings.php +++ b/settings.php @@ -346,10 +346,11 @@ MAC address IP address Hostname + -
Remaining lease time:
DHCP UID: "> +
Remaining lease time:
DHCP UID: ">
@@ -365,10 +366,10 @@ - 0){ ?> + 0){ ?> - +

Specifying the MAC address is mandatory and only one entry per MAC address is allowed. If the IP address is omitted and a host name is given, the IP address will still be generated dynamically and the specified host name will be used. If the host name is omitted, only a static release will be added.

From a21b5e1cd9845c0acbfad94ee4e1acde6c6adf91 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 31 Jan 2017 22:53:19 +0100 Subject: [PATCH 2/3] Remove ineffective alt="..." --- settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.php b/settings.php index 8b5f3eed..60ae1452 100644 --- a/settings.php +++ b/settings.php @@ -366,7 +366,7 @@ - 0){ ?> + 0){ ?> From f428d98fec73a22f32df27bc954f9818cd95cefa Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 1 Feb 2017 15:59:01 +0100 Subject: [PATCH 3/3] Pleasing codacy --- scripts/pi-hole/js/settings.js | 13 +++++++------ settings.php | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index c8b7e3f4..2bd41f9f 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -2,12 +2,13 @@ $(function () { $("[data-mask]").inputmask(); $("[data-static]").on("click", function(){ - var mac = $(this).closest("tr").find('#MAC').text(); - var ip = $(this).closest("tr").find('#IP').text(); - var host = $(this).closest("tr").find('#HOST').text(); - $('input[name="AddHostname"]').val(host); - $('input[name="AddIP"]').val(ip); - $('input[name="AddMAC"]').val(mac); + var row = $(this).closest("tr"); + var mac = row.find("#MAC").text(); + var ip = row.find("#IP").text(); + var host = row.find("#HOST").text(); + $("input[name=\"AddHostname\"]").val(host); + $("input[name=\"AddIP\"]").val(ip); + $("input[name=\"AddMAC\"]").val(mac); }); $("#custom1val").ipAddress({s:4}); diff --git a/settings.php b/settings.php index 60ae1452..e40aeb42 100644 --- a/settings.php +++ b/settings.php @@ -369,7 +369,7 @@ 0){ ?> - +

Specifying the MAC address is mandatory and only one entry per MAC address is allowed. If the IP address is omitted and a host name is given, the IP address will still be generated dynamically and the specified host name will be used. If the host name is omitted, only a static release will be added.