This commit is contained in:
Garrett K 2021-02-01 06:36:49 +00:00
parent e71860e9f4
commit 1ffad1a8fe
8 changed files with 109 additions and 29 deletions

View File

@ -34,7 +34,9 @@ Contents
**Changes introduced in 0.3.12
[Fix] Corrected nested insert size as displayed in "Available Templates" box
[Fix] Template port ID add/remove field not refreshing when shown for different connectable partitions
[Fix] Fresh install inserted data in a way that would cause a "duplicate cabinet order" error on backup restore
[Enhance] When configuring template port ID, show last port ID in long abreviated list
[Enhance] Cable path connections generated programatically instead of static images
**Changes introduced in 0.3.11
[Enhance] Added ability to create inserts with enclosure partitions

View File

@ -60,11 +60,13 @@ function crawlCabinet(){
if(connectedPortIDArray.length) {
var peerPortFound = false;
var sourceSelectedPort = selectedPort;
var tempTrunkArray = [];
$.each(connectedPortIDArray, function(index, connectedPortID){
var connectedPort = $('#'+connectedPortID);
if($(connectedPort).length) {
connectionArray.push([selectedPort, connectedPort]);
connectionArray.push([sourceSelectedPort, connectedPort]);
var connectedPartition = $(connectedPort).closest('.partition');
var connectedPartitionPeerID = $(connectedPartition).data('peerGlobalId');
@ -72,7 +74,8 @@ function crawlCabinet(){
if($('#'+connectedPartitionPeerID).length) {
var connectedPartitionPeer = $('#'+connectedPartitionPeerID);
trunkArray.push([connectedPartition, connectedPartitionPeer]);
tempTrunkArray = [connectedPartition, connectedPartitionPeer];
//trunkArray.push([connectedPartition, connectedPartitionPeer]);
var connectedPartitionPeerIDArray = connectedPartitionPeerID.split('-');
var peerID = connectedPartitionPeerIDArray[2];
@ -85,7 +88,8 @@ function crawlCabinet(){
peerPortFound = true;
} else {
if(connectedPartitionPeerID != 'none') {
trunkArray.push([connectedPartition, connectedPartitionPeerID]);
tempTrunkArray = [connectedPartition, connectedPartitionPeerID];
//trunkArray.push([connectedPartition, connectedPartitionPeerID]);
}
}
@ -93,6 +97,9 @@ function crawlCabinet(){
connectionArray.push([selectedPort, connectedPortID]);
}
});
if(tempTrunkArray.length) {
trunkArray.push(tempTrunkArray);
}
if(peerPortFound == false) {
selectedPort = false;
}

View File

@ -706,14 +706,6 @@ function postProcessCable(){
$( document ).ready(function() {
$('#checkboxBreakoutCable').on('change', function(){
if($(this).is(':checked')) {
$('#objTree').jstree(true).settings.core.multiple = true;
} else {
$('#objTree').jstree(true).settings.core.multiple = false;
}
});
$('#printFullPath').on('click', function(event){
event.preventDefault();
$('#containerFullPath').parent().printThis({
@ -1173,7 +1165,7 @@ $( document ).ready(function() {
})
.jstree({
'core' : {
'multiple': false,
'multiple': true,
'check_callback': function(operation, node, node_parent, node_position, more){
if(operation == 'move_node'){
return node_parent.type === 'location';

View File

@ -172,10 +172,27 @@ if($_SERVER['REQUEST_METHOD'] == 'POST'){
$objDepth = $data['objDepth'];
$objPort = $data['objPort'];
if(isset($qls->App->inventoryArray[$objID][$objFace][$objDepth][$objPort])) {
$deleteRowArray = array();
$port = $qls->App->inventoryArray[$objID][$objFace][$objDepth][$objPort];
foreach($port as $connection) {
// Clear inventory table entry
$rowID = $connection['rowID'];
$peerID = $connection['id'];
$peerFace = $connection['face'];
$peerDepth = $connection['depth'];
$peerPort = $connection['port'];
// Account for remote port being breakout cable
if(isset($qls->App->inventoryArray[$peerID][$peerFace][$peerDepth][$peerPort])) {
$peerPort = $qls->App->inventoryArray[$peerID][$peerFace][$peerDepth][$peerPort];
foreach($peerPort as $peerConnection) {
array_push($deleteRowArray, $peerConnection['rowID']);
}
} else {
array_push($deleteRowArray, $peerConnection['rowID']);
}
}
// Delete inventory entries
foreach($deleteRowArray as $rowID) {
if($connection['localEndID'] or $connection['remoteEndID']) {
clearTableInventory($qls, $connection['localAttrPrefix'], $rowID);
} else {
@ -201,6 +218,7 @@ if($_SERVER['REQUEST_METHOD'] == 'POST'){
}
$remotePortString = implode('<br>', $remotePortArray);
$actionString = 'Deleted connection: <strong>'.$localPort.'</strong> to <strong>'.$remotePortString.'</strong>';
error_log('Debug (actionString): '.$actionString);
$qls->App->logAction(3, 3, $actionString);
break;
@ -443,6 +461,34 @@ function validate($data, &$validate, &$qls){
array_push($validate->returnData['error'], $errMsg);
}
}
if(count($remotePortArray) > 1) {
$breakoutCableValid = true;
$localObj = $qls->App->objectArray[$localID];
$localTemplateID = $localObj['template_id'];
$localTemplate = $qls->App->templateArray[$localTemplateID];
$localTemplateFunction = $localTemplate['templateFunction'];
if($remoteTemplateFunction != 'Endpoint') {
$localTemplateFunction = false;
}
foreach($remotePortArray as $remotePortData) {
$remoteID = $remotePortData['remoteID'];
$remoteObj = $qls->App->objectArray[$remoteID];
$remoteTemplateID = $remoteObj['template_id'];
$remoteTemplate = $qls->App->templateArray[$remoteTemplateID];
$remoteTemplateFunction = $remoteTemplate['templateFunction'];
if($remoteTemplateFunction != 'Endpoint') {
$breakoutCableValid = false;
}
}
if(!$breakoutCableValid) {
$errMsg = 'One-to-many connections must be between two endpoints.';
array_push($validate->returnData['error'], $errMsg);
}
}
}
}
return;

View File

@ -1638,6 +1638,7 @@ function validateImportedConnections(&$qls, &$importedConnectionArray, $portArra
// Check to see if object port exists
$portNameHash = $connection['portNameHash'];
$peerPortNameHash = $connection['peerPortNameHash'];
if(isset($portArray[$portNameHash]) or isset($importedTrunkArray[$portNameHash])) {
if(!in_array($portNameHash, $portNameHashArray)) {
array_push($portNameHashArray, $portNameHash);
@ -1725,9 +1726,48 @@ function validateImportedConnections(&$qls, &$importedConnectionArray, $portArra
}
}
} else {
$validOneToManyConnection = false;
$port = $portArray[$portNameHash];
$objID = $port['objID'];
$face = $port['face'];
$depth = $port['depth'];
$portID = $port['portID'];
$obj = $qls->App->objectArray[$objID];
$templateID = $obj['template_id'];
$template = $qls->App->templateArray[$templateID];
$templateFunction = $template['templateFunction'];
if(isset($portArray[$peerPortNameHash])) {
$peerPort = $portArray[$peerPortNameHash];
$peerObjID = $peerPort['objID'];
$peerFace = $peerPort['face'];
$peerDepth = $peerPort['depth'];
$peerPortID = $peerPort['portID'];
$peerObj = $qls->App->objectArray[$peerObjID];
$peerTemplateID = $peerObj['template_id'];
$peerTemplate = $qls->App->templateArray[$peerTemplateID];
$peerTemplateFunction = $peerTemplate['templateFunction'];
if($templateFunction == 'Endpoint' and $peerTemplateFunction == 'Endpoint') {
$connection['objID'] = $objID;
$connection['face'] = $face;
$connection['depth'] = $depth;
$connection['portID'] = $portID;
$connection['peerObjID'] = $peerObjID;
$connection['peerFace'] = $peerFace;
$connection['peerDepth'] = $peerDepth;
$connection['peerPortID'] = $peerPortID;
$validOneToManyConnection = true;
}
}
if(!$validOneToManyConnection) {
$errMsg = 'PortA on line '.$connection['line'].' of file "'.$connection['fileName'].'" is a duplicate.';
array_push($validate->returnData['error'], $errMsg);
}
}
} else {
if($connection['code39']) {
// Managed cable is not connected to anything.

1
debug-portArray.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -26,14 +26,6 @@
<div class="modal-body">
<div class="row">
<div class="col-sm-12">
<?php if($page == 'explore.php') { ?>
<div class="checkbox">
<input id="checkboxBreakoutCable" type="checkbox">
<label for="checkboxBreakoutCable">
Breakout Cable
</label>
</div>
<?php } ?>
<div class="card-box">
<div id="objTree" class="navTree"></div>
</div>

View File

@ -498,11 +498,11 @@ var $install_error = array();
$env_tree = array(
"'Location', '#', 'location', 42, NULL, 0, 1",
"'Sub-Location', '1', 'location', 42, NULL, 0, 1",
"'Pod', '2', 'pod', 42, NULL, 0, 1",
"'Cab1', '3', 'cabinet', 42, NULL, 0, 1",
"'Cab2', '3', 'cabinet', 42, NULL, 0, 1",
"'Cab3', '3', 'cabinet', 42, NULL, 0, 1"
"'Sub-Location', '1', 'location', 42, NULL, 0, 2",
"'Pod', '2', 'pod', 42, NULL, 0, 3",
"'Cab1', '3', 'cabinet', 42, NULL, 0, 4",
"'Cab2', '3', 'cabinet', 42, NULL, 0, 5",
"'Cab3', '3', 'cabinet', 42, NULL, 0, 6"
);
// Add environment tree data