From 2c96dcc12e7d4520ec76742762f47e243e7b96bb Mon Sep 17 00:00:00 2001 From: Pieter Lambrecht Date: Wed, 9 Oct 2024 08:58:04 +0200 Subject: [PATCH] v1.4.9 Added CreatePrefix button --- netbox_ipcalculator/pluginvars.json | 2 +- .../templates/netbox_ipcalculator/core/subnets.html | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/netbox_ipcalculator/pluginvars.json b/netbox_ipcalculator/pluginvars.json index 577c11c..69e8642 100644 --- a/netbox_ipcalculator/pluginvars.json +++ b/netbox_ipcalculator/pluginvars.json @@ -1,7 +1,7 @@ { "__name__": "netbox_ipcalculator", "__verbose_name__": "IP Calculator", - "__version__": "1.4.8", + "__version__": "1.4.9", "__base_url__": "netbox_ipcalculator", "__description__": "Netbox IP Calculator and Subnet Splitter", "__author__": "Pieter Lambrecht", diff --git a/netbox_ipcalculator/templates/netbox_ipcalculator/core/subnets.html b/netbox_ipcalculator/templates/netbox_ipcalculator/core/subnets.html index e0ef2ba..f150263 100644 --- a/netbox_ipcalculator/templates/netbox_ipcalculator/core/subnets.html +++ b/netbox_ipcalculator/templates/netbox_ipcalculator/core/subnets.html @@ -182,7 +182,9 @@ /* subnet address */ var newCell = document.createElement('TD'); newCell.classList.add("col_subnet"); - newCell.appendChild(document.createTextNode(inet_ntoa(address)+'/'+mask)); + var addPrefixBtn = "
"+inet_ntoa(address)+'/'+mask+"
" + // newCell.appendChild(document.createTextNode(inet_ntoa(address)+'/'+mask)); + newCell.setHTMLUnsafe(addPrefixBtn); newRow.appendChild(newCell); var addressFirst = address; @@ -202,12 +204,12 @@ else { addressRange = inet_ntoa(addressFirst)+' - '+inet_ntoa(addressLast); if (mask == 31) { - useableRange = addressRange; - numHosts = 2; + useableRange = addressRange; + numHosts = 2; } else { - useableRange = inet_ntoa(useableFirst)+' - '+inet_ntoa(useableLast); - numHosts = (1 + useableLast - useableFirst); + useableRange = inet_ntoa(useableFirst)+' - '+inet_ntoa(useableLast); + numHosts = (1 + useableLast - useableFirst); } }