// Copyright Epic Games, Inc. All Rights Reserved. function goHome() { location.href = '/' + location.hash } function unlockVerify() { let queryParams = processQueryParameters(['bot', 'branch', 'cl', 'target']) if (!queryParams) return; let requestedBotName = queryParams["bot"] let requestedBranchName = queryParams["branch"] let targetBranchName = queryParams["target"] let requestedBranchCl = parseInt(queryParams["cl"], 10) if (isNaN(requestedBranchCl)) { unlockFailure(`CL ${queryParams["cl"]} not a number.`) return } // Filled in if/when user clicks the verify button let unlockOperation = $.Deferred() // Get requested branch infomation and setup the page data getBranch(requestedBotName, requestedBranchName, function(data) { try { // Ensure we have data if (!data) { unlockFailure(`Couldn't retrieve data for ${requestedBotName}:${requestedBranchName}`) return } let requestedNode = data.branch // Verify we got a node if (!requestedNode) { let errText = `Could not find matching branch for ${requestedBotName}:${requestedBranchName}.` if (data.message) { errText += `\n${data.message}` } unlockFailure(errText) return } let requestedEdge = requestedNode.edges[targetBranchName.toUpperCase()] // Ensure this node actually has this requested edge if (!requestedEdge) { unlockFailure(`${requestedBotName}:${requestedNodeName} has no edge for "${targetBranchName}".`) $('#result').append(renderSingleBranchTable(requestedNode)) return } // Verify the request branch is paused if (!requestedEdge.blockage) { unlockFailure(`${requestedEdge.display_name} not currently blocked, no need to unlock.`) $('#result').append(renderSingleBranchTable(requestedNode)) return } // Ensure the current pause is applicable to the CL if (requestedEdge.blockage.change !== requestedBranchCl) { displayWarningMessage(`${requestedEdge.display_name} currently blocked, but not at requested CL ${requestedBranchCl}. Performing no action.`, false) $('#singleBranchDisplay').append(renderSingleBranchTable(requestedNode)).fadeIn("fast", "swing") return } // Passed all safety checks. Display branch info and unlock warning, and begin verifying the request $('#branchPreviewBeforeVerify').append(renderSingleBranchTable(requestedNode, requestedEdge)) $('.sourceName').each(function() { $(this).text(requestedBranchName) }) $('.targetName').each(function() { $(this).text(targetBranchName) }) $('.changelist').each(function() { $(this).text(requestedBranchCl) }) // Data all verified, time to perform the node operation. let unlockQueryData = { cl: requestedEdge.blockage.change, target: targetBranchName } let verifyOperation = nodeAPIOp(requestedNode.bot, requestedNode.def.name, "/verifyunlock?" + toQuery(unlockQueryData)) // If verification succeeded: verifyOperation.done(function(success) { // Unlock returns a JSON payload on success const unlockJson = JSON.parse(success) // Visualize the json visualizeUnlockVerification(requestedBranchCl, unlockJson) if (unlockJson.validRequest) { $('#afterVerificationResultText').html('Unlock Verification Complete') $('#afterVerificationResultText').append( $('

').text("Use the button below to proceed with the unlock operation") ) } else { $('#afterVerificationResultText').html(' Unlock Verification Returned Issues.') $('#afterVerificationResultText').css('color', 'red'); } transitionPostVerification() // If we're a valid request, add form buttons to formally request an unlock if (unlockJson.validRequest) { const formButtonDiv = $('#formButtons') // Return to Robomerge homepage let cancelButton = $('