From dee69fd89af1d4340234a44c8cbfef4f0ce64e0a Mon Sep 17 00:00:00 2001 From: Alexander Shangin <5kr1p7@users.noreply.github.com> Date: Tue, 7 Nov 2023 13:25:34 +0300 Subject: [PATCH] Fix IP address sorting Fixed sorting of addresses by "IP" column in the "Active Leases" table. --- routes/dhcp_lease_search.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/routes/dhcp_lease_search.js b/routes/dhcp_lease_search.js index 662eeb5..18228dc 100644 --- a/routes/dhcp_lease_search.js +++ b/routes/dhcp_lease_search.js @@ -15,6 +15,16 @@ function human_time (time){ return year + "-" + month+"-"+date1+" "+hour+":"+minutes+":"+seconds; } +function ip_to_string (ip){ + var octets = ip.split('.'); + + for (let i = 0; i < octets.length; i++) { + while (octets[i].length < 3) octets[i] = "0" + octets[i]; + } + + return octets.join(''); +} + router.post('/', function(req, res, next) { var request = req.body; var search = request.search; @@ -41,7 +51,7 @@ router.post('/', function(req, res, next) { continue; table_row = ''; - table_row = table_row + '