View Issue Details

IDProjectCategoryView StatusLast Update
727RackTablesIPv4/IPv6/SLBpublic2014-06-17 05:44
Reporternrobst Assigned Toandriyanov  
PrioritynormalSeverityfeatureReproducibilityalways
Status assignedResolutionopen 
Product Version0.20.3 
Summary727: Feature request to only display allocated IPs in IPv4 listing
DescriptionI would like to request / suggest a feature whereby the user can tick a box on the subnet display IPv4/IPv6 space (of a specific subnet) to only display IP addresses that have been used - either have a Name or are related / allocated to an object.

Perhaps the converse would also be useful whereby an option could be provided to also only display IP addresses that are NOT allocated?
Steps To ReproduceClick on a subnet in IPv4 / IPv6 space.
Subnet is displayed entirely (e.g. /24 - .0 through .254) - may have some non-contigious IPs allocated throughout the range?
TagsNo tags attached.
Attached Files
727-ipv4.patch (2,378 bytes)   
--- interface.php	2014-03-03 05:43:45.000000000 -0700
+++ interface-mine.php	2014-06-16 21:30:02.000000000 -0600
@@ -2864,19 +2864,31 @@
 	}
 
 	echo $rendered_pager;
-	echo "<table class='widetable' border=0 cellspacing=0 cellpadding=5 align='center' width='100%'>\n";
-	echo "<tr><th>Address</th><th>Name</th><th>Comment</th><th>Allocation</th></tr>\n";
+	$tableDefn = "<table class='widetable' style='table-layout:fixed' border=0 cellspacing=0 cellpadding=5 align='center' width='100%'>\n";
+       echo $tableDefn;
+	echo "<tr class='tdleft $tr_class'><th style='width:120px'>Address</th><th>Name</th><th>Comment</th><th>Allocation</th></tr>\n";
 
 	markupIPAddrList ($range['addrlist']);
+	$inUnused = FALSE;
 	for ($ip = $startip; $ip <= $endip; $ip++)
 	{
 		$ip_bin = ip4_int2bin ($ip);
 		$dottedquad = ip4_format ($ip_bin);
 		$tr_class = (isset ($hl_ip) && $hl_ip == $ip ? 'highlight' : '');
-		if (isset ($range['addrlist'][$ip_bin]))
+		if (isset ($range['addrlist'][$ip_bin])) {
+			if ($inUnused) {
+				echo "</table></details>$tableDefn\n";
+				$inUnused = FALSE;
+			}
 			$addr = $range['addrlist'][$ip_bin];
+		}
 		else
 		{
+			if (!$inUnused) {
+				echo '</table><details><summary style="text-align:left">+</summary>';
+				echo "$tableDefn\n";
+				$inUnused = TRUE;
+			}
 			echo "<tr class='tdleft $tr_class'><td class=tdleft><a name='ip-$dottedquad' href='" . makeHref(array('page'=>'ipaddress', 'ip' => $dottedquad)) . "'>$dottedquad</a></td>";
 			$editable = permitted ('ipaddress', 'properties', 'editAddress')
 				? 'editable'
@@ -2895,7 +2907,7 @@
 		}
 		$tr_class .= ' ' . $addr['class'];
 		echo "<tr class='tdleft $tr_class'>";
-		echo "<td><a class='$history_class' $title name='ip-$dottedquad' href='".makeHref(array('page'=>'ipaddress', 'ip'=>$addr['ip']))."'>${addr['ip']}</a></td>";
+		echo "<td style='width:120px'><a class='$history_class' $title name='ip-$dottedquad' href='".makeHref(array('page'=>'ipaddress', 'ip'=>$addr['ip']))."'>${addr['ip']}</a></td>";
 		$editable =
 			(empty ($addr['allocs']) || !empty ($addr['name']) || !empty ($addr['comment']))
 			&& permitted ('ipaddress', 'properties', 'editAddress')
@@ -2938,6 +2950,9 @@
 		}
 		echo "</td></tr>\n";
 	}
+	if ($inUnsed) {
+		echo "</details>\n";
+	}
 	// end of iteration
 	if (permitted (NULL, NULL, 'set_reserve_comment'))
 		addJS ('js/inplace-edit.js');
727-ipv4.patch (2,378 bytes)   

Activities

dreid

dreid

2014-06-17 05:41

reporter   ~0002357

Just ran into this with our implementation, so I wrote a quick patch to deal with the IPv4 section. It uses the HTML5 Summary and Detail tags to collapse all contiguous unallocated addresses into a section which the user can expand by clicking the plus sign.
dreid

dreid

2014-06-17 05:43

reporter   ~0002359

BTW, the patch is against 0.20.7

Issue History

Date Modified Username Field Change
2013-01-17 12:37 nrobst New Issue
2013-01-17 12:37 nrobst Status new => assigned
2013-01-17 12:37 nrobst Assigned To => andriyanov
2014-06-17 05:39 dreid File Added: 727-ipv4.patch
2014-06-17 05:41 dreid Note Added: 0002357
2014-06-17 05:43 dreid Note Added: 0002359