This commit is contained in:
Garrett K 2021-01-26 05:02:25 +00:00
parent 59c03f25c3
commit 15bfee5ce1
4 changed files with 45 additions and 45 deletions

View File

@ -289,17 +289,23 @@ function drawPath(){
function crawlPathConnections(){ function crawlPathConnections(){
var pathConnections = {}; var pathConnections = [];
var workingPathConnections = {};
var connectorElementArray = $('#containerFullPath').find('.port'); var connectorElementArray = $('#containerFullPath').find('.port');
// Sort ports by connectionPairId // Group connection peers
$.each(connectorElementArray, function(index, element){ $.each(connectorElementArray, function(index, element){
if($(element).data('connectionPairId') !== '') {
var connectionPairID = $(element).data('connectionPairId'); var connectionPairID = $(element).data('connectionPairId');
if(pathConnections[connectionPairID] === undefined) { if(workingPathConnections[connectionPairID] === undefined) {
pathConnections[connectionPairID] = []; workingPathConnections[connectionPairID] = [];
} }
pathConnections[connectionPairID].push($(element)); workingPathConnections[connectionPairID].push($(element));
});
// Filter out singles
$.each(workingPathConnections, function(index, element){
if(element.length == 2) {
pathConnections.push(element);
} }
}); });
@ -309,21 +315,27 @@ function crawlPathConnections(){
function crawlPathTrunks(){ function crawlPathTrunks(){
var pathTrunks = {}; var pathTrunks = [];
var workingPathTrunks = {};
var connectorElementArray = $('#containerFullPath').find('.objectBox'); var connectorElementArray = $('#containerFullPath').find('.objectBox');
// Group trunk peers
$.each(connectorElementArray, function(index, element){ $.each(connectorElementArray, function(index, element){
if($(element).data('trunkPairId') !== 0) {
var trunkPairID = $(element).data('trunkPairId'); var trunkPairID = $(element).data('trunkPairId');
if(workingPathTrunks[trunkPairID] === undefined) {
if(pathTrunks[trunkPairID] === undefined) { workingPathTrunks[trunkPairID] = [];
pathTrunks[trunkPairID] = [];
} }
pathTrunks[trunkPairID].push($(element)); workingPathTrunks[trunkPairID].push($(element));
});
// Filter out singles
$.each(workingPathTrunks, function(index, element){
if(element.length == 2) {
pathTrunks.push(element);
} }
}); });
// Store path trunk data
$(document).data('pathTrunks', pathTrunks); $(document).data('pathTrunks', pathTrunks);
} }

View File

@ -321,7 +321,6 @@ if($_SERVER['REQUEST_METHOD'] == 'POST'){
findPaths2($qls, $maxResults, $maxDepth, $reachable, $endpointAObj, $endpointBObj, $finalPathArray, $previousPathType); findPaths2($qls, $maxResults, $maxDepth, $reachable, $endpointAObj, $endpointBObj, $finalPathArray, $previousPathType);
} }
error_log('Debug (finalPathArray): '.json_encode($finalPathArray));
foreach($finalPathArray as $mediaType => &$pathData) { foreach($finalPathArray as $mediaType => &$pathData) {
foreach($pathData as &$path) { foreach($pathData as &$path) {
$path['pathHTML'] = $qls->App->buildPathFull($path['pathArray'], null); $path['pathHTML'] = $qls->App->buildPathFull($path['pathArray'], null);

View File

@ -1959,6 +1959,9 @@ var $qls;
$pathOrientation = $this->qls->user_info['pathOrientation']; $pathOrientation = $this->qls->user_info['pathOrientation'];
$connectionPairID = 1;
$trunkPairID = 1;
// Cable Adjacent // Cable Adjacent
if($pathOrientation == 0) { if($pathOrientation == 0) {
foreach($path as $objectIndex => $object) { foreach($path as $objectIndex => $object) {
@ -1968,15 +1971,10 @@ var $qls;
case 'connector': case 'connector':
$addConnector = false; // Should connector be added?
if(isset($path[$objectIndex+1])) { if(isset($path[$objectIndex+1])) {
$addConnector = ($path[$objectIndex+1]['type'] != 'object') ? true : false;
if($path[$objectIndex+1]['type'] != 'object') {
$addConnector = true;
}
} else { } else {
$addConnector = true; $addConnector = true;
} }
@ -1986,8 +1984,8 @@ var $qls;
array_push($tableArray[count($tableArray)-1], '<td>'.$this->wrapObject(0, 'None').'</td>'); array_push($tableArray[count($tableArray)-1], '<td>'.$this->wrapObject(0, 'None').'</td>');
} }
// Generate and push connector HTML
$connectorTypeID = $object['data']['connectorType']; $connectorTypeID = $object['data']['connectorType'];
$connectionPairID = $object['data']['connectionPairID'];
$connectorTypeName = ($connectorTypeID != 0) ? $this->portTypeValueArray[$connectorTypeID]['name'] : 'Unk'; $connectorTypeName = ($connectorTypeID != 0) ? $this->portTypeValueArray[$connectorTypeID]['name'] : 'Unk';
$htmlString = '<td><div title="'.$connectorTypeName.'" class="port '.$connectorTypeName.'" data-connection-pair-id='.$connectionPairID.'></div></td>'; $htmlString = '<td><div title="'.$connectorTypeName.'" class="port '.$connectorTypeName.'" data-connection-pair-id='.$connectionPairID.'></div></td>';
array_push($tableArray[count($tableArray)-1], $htmlString); array_push($tableArray[count($tableArray)-1], $htmlString);
@ -2001,6 +1999,8 @@ var $qls;
case 'cable': case 'cable':
$trunkPairID++;
$cableTypeID = $object['data']['mediaTypeID']; $cableTypeID = $object['data']['mediaTypeID'];
if($cableTypeID != 0) { if($cableTypeID != 0) {
$cableTypeName = $mediaTypeClass = $this->mediaTypeValueArray[$cableTypeID]['name']; $cableTypeName = $mediaTypeClass = $this->mediaTypeValueArray[$cableTypeID]['name'];
@ -2025,7 +2025,6 @@ var $qls;
case 'object': case 'object':
$trunkPairID = $object['trunkPairID'];
$objName = ''; $objName = '';
foreach($object['data'] as $item) { foreach($object['data'] as $item) {
$objID = $item['id']; $objID = $item['id'];
@ -2045,7 +2044,6 @@ var $qls;
if($path[$objectIndex+1]['type'] == 'trunk' or !isset($path[$objectIndex+1])) { if($path[$objectIndex+1]['type'] == 'trunk' or !isset($path[$objectIndex+1])) {
if(isset($path[$objectIndex-1])) { if(isset($path[$objectIndex-1])) {
$connectorTypeID = $path[$objectIndex-1]['data']['connectorType']; $connectorTypeID = $path[$objectIndex-1]['data']['connectorType'];
$connectionPairID = $path[$objectIndex-1]['data']['connectionPairID'];
$connectorTypeName = ($connectorTypeID != 0) ? $this->portTypeValueArray[$connectorTypeID]['name'] : 'Unk'; $connectorTypeName = ($connectorTypeID != 0) ? $this->portTypeValueArray[$connectorTypeID]['name'] : 'Unk';
$htmlString = '<td><div title="'.$connectorTypeName.'" class="port '.$connectorTypeName.'" data-connection-pair-id='.$connectionPairID.'></div></td>'; $htmlString = '<td><div title="'.$connectorTypeName.'" class="port '.$connectorTypeName.'" data-connection-pair-id='.$connectionPairID.'></div></td>';
array_push($tableArray[count($tableArray)-1], $htmlString); array_push($tableArray[count($tableArray)-1], $htmlString);
@ -2064,6 +2062,8 @@ var $qls;
case 'trunk': case 'trunk':
$connectionPairID++;
$htmlString = '<div title="Trunk" class="trunk adjacent">'; $htmlString = '<div title="Trunk" class="trunk adjacent">';
// Wrap in <td> and add to row array // Wrap in <td> and add to row array
@ -2116,7 +2116,6 @@ var $qls;
case 'connector': case 'connector':
$htmlPathFull .= '<tr><td>'; $htmlPathFull .= '<tr><td>';
$connectorTypeID = $object['data']['connectorType']; $connectorTypeID = $object['data']['connectorType'];
$connectionPairID = $object['data']['connectionPairID'];
if($connectorTypeID != 0) { if($connectorTypeID != 0) {
$connectorTypeName = $this->connectorTypeValueArray[$connectorTypeID]['name']; $connectorTypeName = $this->connectorTypeValueArray[$connectorTypeID]['name'];
@ -2152,6 +2151,9 @@ var $qls;
break; break;
case 'trunk': case 'trunk':
$connectionPairID++;
$htmlPathFull .= '<td rowspan="2">'; $htmlPathFull .= '<td rowspan="2">';
$htmlPathFull .= '<div title="Trunk" class="trunk stacked">'; $htmlPathFull .= '<div title="Trunk" class="trunk stacked">';
$htmlPathFull .= '</td>'; $htmlPathFull .= '</td>';

View File

@ -44,9 +44,6 @@ if($isTrunked) {
$reversePortID = 0; $reversePortID = 0;
} }
$connectionPairID = 1;
$trunkPairID = 1;
// Discover path elements // Discover path elements
// First look outward from the far end of the cable, // First look outward from the far end of the cable,
// then look outward from the near end of the cable. // then look outward from the near end of the cable.
@ -56,10 +53,8 @@ for($x=0; $x<2; $x++){
// Object // Object
$selected = ($objID == $selectedObjID and $objFace == $selectedObjFace and $objDepth == $selectedObjDepth and $objPort == $selectedObjPort) ? true : false; $selected = ($objID == $selectedObjID and $objFace == $selectedObjFace and $objDepth == $selectedObjDepth and $objPort == $selectedObjPort) ? true : false;
$trunkPairID = (isset($qls->App->peerArray[$objID][$objFace][$objDepth])) ? $qls->App->peerArray[$objID][$objFace][$objDepth]['id'] : 0;
$workingArray = array( $workingArray = array(
'type' => 'object', 'type' => 'object',
'trunkPairID' => $trunkPairID,
'data' => array( 'data' => array(
array( array(
'id' => $objID, 'id' => $objID,
@ -93,8 +88,7 @@ for($x=0; $x<2; $x++){
'type' => 'connector', 'type' => 'connector',
'data' => array( 'data' => array(
'code39' => $connection[$localAttrPrefix.'_code39'], 'code39' => $connection[$localAttrPrefix.'_code39'],
'connectorType' => $connection[$localAttrPrefix.'_connector'], 'connectorType' => $connection[$localAttrPrefix.'_connector']
'connectionPairID' => $connectionPairID
) )
); );
@ -116,8 +110,7 @@ for($x=0; $x<2; $x++){
'type' => 'connector', 'type' => 'connector',
'data' => array( 'data' => array(
'code39' => $connection[$remoteAttrPrefix.'_code39'], 'code39' => $connection[$remoteAttrPrefix.'_code39'],
'connectorType' => $connection[$remoteAttrPrefix.'_connector'], 'connectorType' => $connection[$remoteAttrPrefix.'_connector']
'connectionPairID' => $connectionPairID
) )
); );
@ -129,9 +122,6 @@ for($x=0; $x<2; $x++){
$objDepth = $connection[$remoteAttrPrefix.'_object_depth']; $objDepth = $connection[$remoteAttrPrefix.'_object_depth'];
$objPort = $connection[$remoteAttrPrefix.'_port_id']; $objPort = $connection[$remoteAttrPrefix.'_port_id'];
$trunkPairID = (isset($qls->App->peerArray[$objID][$objFace][$objDepth])) ? $qls->App->peerArray[$objID][$objFace][$objDepth]['id'] : 0;
$objectWorkingArray['trunkPairID'] = $trunkPairID;
// Remote Object // Remote Object
$workingArray = array( $workingArray = array(
'id' => $objID, 'id' => $objID,
@ -214,9 +204,6 @@ for($x=0; $x<2; $x++){
// No connected object // No connected object
$objID = 0; $objID = 0;
} }
$connectionPairID++;
$trunkPairID++;
} }
// Now that we've discovered the far side of the scanned cable, // Now that we've discovered the far side of the scanned cable,