View Issue Details

IDProjectCategoryView StatusLast Update
923RackTablesVMs/containerspublic2013-07-21 01:07
ReporterMWilkinson Assigned Toadoom42  
PriorityhighSeveritytweakReproducibilityN/A
Status closedResolutionfixed 
Product Version0.20.5 
Target Version0.20.6Fixed in Version0.20.6 
Summary923: Enhancement to Blade layout in Chassis
DescriptionWith previous bug request (745), this enhancement allows for blades of different widths/heights to be displayed in the chassis.

The information for a blade will need to be added to the Hardware Description Dictionary to allow the patch to correctly display blades that are full height/double width

The slot number used for the blade must be the top left slot used in the chassis - chassis slots are numbered in the code from 1 in the top left, reading left to right, top to bottom (ie in a 2 row 16 slot chassis, slots are 1 - 8 on top row, then 9 - 16, with slot 9 being under slot 1, etc)

Where a blade requires a different width/height to the standard 1x1 configuration, append '%L<r>,<c>% to the dictionary description - where <r> is how many rows are needed (in the case of full height blades), and <c> is the number of columns needed (in the case of double width blades)
TagsNo tags attached.

Activities

MWilkinson

MWilkinson

2013-07-05 10:48

reporter  

bladelayout-0.20.5.patch (3,067 bytes)   
diff -uNr RackTables-0.20.5-base/wwwroot/inc/interface.php RackTables-0.20.5-dev/wwwroot/inc/interface.php
--- RackTables-0.20.5-base/wwwroot/inc/interface.php	2013-06-23 22:50:37.000000000 +0100
+++ RackTables-0.20.5-dev/wwwroot/inc/interface.php	2013-07-05 09:25:10.684775104 +0100
@@ -640,7 +640,7 @@
 		$body = ", visible label is \"${objectData['label']}\"";
 	// Display list of child objects, if any
 	$objectChildren = getEntityRelatives ('children', 'object', $objectData['id']);
-	$slotInfo = $slotData = $slotTitle = array ();
+	$slotRows = $slotCols = $slotInfo = $slotData = $slotTitle = array ();
 	if (count($objectChildren) > 0)
 	{
 		foreach ($objectChildren as $child)
@@ -648,9 +648,25 @@
 			$childNames[] = $child['name'];
 			$childData = spotEntity ('object', $child['entity_id']);
 			$attrData = getAttrValues ($child['entity_id']);
+			$numRows = 1;
+			$numCols = 1;
+			if (isset ($attrData[2]))
+			{
+				extractLayout ($attrData[2]);
+				if (isset ($attrData[2]['rows']))
+				{
+					$numRows = $attrData[2]['rows'];
+					$numCols = $attrData[2]['cols'];
+				}
+			}
 			if (isset ($attrData['28'])) // slot number
 			{
 				$slot = $attrData['28']['value'];
+				if ( preg_match("/\d+/", $slot, $matches) )
+					$slot = $matches[0];
+				$slotRows[$slot] = $numRows;
+				$slotCols[$slot] = $numCols;
+
 				$slotInfo[$slot] = $child['name'];
 				$slotData[$slot] = $child['entity_id'];
 				if (strlen ($childData['asset_no']))
@@ -688,19 +704,40 @@
 						$s = ($r * $cols) + $c + 1;
 						if (isset ($slotData[$s]))
 						{
-							echo "<td class='state_T";
-							if ($slotData[$s] == $hl_obj_id)
-								echo 'h';
-							echo "'>${slotTitle[$s]}";
-							if ($layout == 'V')
+							if ($slotData[$s] >= 0)
 							{
-								$tmp = substr ($slotInfo[$s], 0, 1);
-								foreach (str_split (substr ($slotInfo[$s],1)) as $letter)
-									$tmp .= '<br>' . $letter;
-								$slotInfo[$s] = $tmp;
+								for ($lr = 0; $lr < $slotRows[$s]; $lr++)
+								{
+									for ($lc = 0; $lc < $slotCols[$s]; $lc++)
+									{
+										$skip = ($lr * $cols) + $lc;
+										if ($skip > 0)
+											$slotData[$s + $skip] = -1;
+									}
+								}
+								echo '<td';
+								if ($slotRows[$s] > 1)
+								{
+									echo " rowspan=$slotRows[$s]";
+								}
+								if ($slotCols[$s] > 1)
+								{
+									echo " colspan=$slotCols[$s]";
+								}
+								echo " class='state_T";
+								if ($slotData[$s] == $hl_obj_id)
+									echo 'h';
+								echo "'>${slotTitle[$s]}";
+								if ($layout == 'V')
+								{
+									$tmp = substr ($slotInfo[$s], 0, 1);
+									foreach (str_split (substr ($slotInfo[$s],1)) as $letter)
+										$tmp .= '<br>' . $letter;
+									$slotInfo[$s] = $tmp;
+								}
+								echo mkA ($slotInfo[$s], 'object', $slotData[$s]);
+								echo '</div></td>';
 							}
-							echo mkA ($slotInfo[$s], 'object', $slotData[$s]);
-							echo '</div></td>';
 						}
 						else
 							echo "<td class='state_F'><div title=\"Free slot\">&nbsp;</div></td>";
bladelayout-0.20.5.patch (3,067 bytes)   

Issue History

Date Modified Username Field Change
2013-07-05 10:48 MWilkinson New Issue
2013-07-05 10:48 MWilkinson Status new => assigned
2013-07-05 10:48 MWilkinson Assigned To => adoom42
2013-07-05 10:48 MWilkinson File Added: bladelayout-0.20.5.patch
2013-07-21 01:07 adoom42 Status assigned => closed
2013-07-21 01:07 adoom42 Resolution open => fixed
2013-07-21 01:07 adoom42 Fixed in Version => 0.20.6
2013-07-21 01:07 adoom42 Target Version => 0.20.6