Skip to content

Commit

Permalink
v1.4.9 Added CreatePrefix button
Browse files Browse the repository at this point in the history
  • Loading branch information
Pieter Lambrecht committed Oct 9, 2024
1 parent 3a922f4 commit 2c96dcc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion netbox_ipcalculator/pluginvars.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<div class=\"d-flex justify-content-between\"><div>"+inet_ntoa(address)+'/'+mask+"</div><div class=\"btn-list justify-content-end ms-1\"><a href=\"/ipam/prefixes/add/?prefix="+inet_ntoa(address)+'/'+mask+"\" class=\"btn btn-outline-primary btn-sm\" title=\"Add\" target=\"_blank\" style=\"--tblr-btn-padding-y: 0;\"><i class=\"mdi mdi-plus\"></i></a></div></div>"
// newCell.appendChild(document.createTextNode(inet_ntoa(address)+'/'+mask));
newCell.setHTMLUnsafe(addPrefixBtn);
newRow.appendChild(newCell);

var addressFirst = address;
Expand All @@ -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);
}
}

Expand Down

0 comments on commit 2c96dcc

Please sign in to comment.