// Copyright Epic Games, Inc. All Rights Reserved. function goHome() { location.href = '/' + location.hash } function stompVerify() { 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)) { stompFailure(`CL ${queryParams["cl"]} not a number.`) return } // Filled in if/when user clicks the stomp button let stompOperation = $.Deferred() // Get requested branch infomation and setup the page data getBranch(requestedBotName, requestedBranchName, function(data) { try { // Ensure we have data if (!data) { stompFailure(`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}` } stompFailure(errText) return } let requestedEdge = requestedNode.edges[targetBranchName.toUpperCase()] // Ensure this node actually has this requested edge if (!requestedEdge) { stompFailure(`${requestedBotName}:${requestedNodeName} has no edge for "${targetBranchName}".`) $('#result').append(renderSingleBranchTable(requestedNode)) return } // Verify the request branch is paused if (!requestedEdge.blockage) { stompFailure(`${requestedEdge.display_name} not currently blocked, no need to stomp.`) $('#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 stomp 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 stompQueryData = { cl: requestedEdge.blockage.change, target: targetBranchName } let verifyOperation = nodeAPIOp(requestedNode.bot, requestedNode.def.name, "/verifystomp?" + toQuery(stompQueryData)) // If verification succeeded: verifyOperation.done(function(success) { // Stomp returns a JSON payload on success const stompJson = JSON.parse(success) console.log(`Stomp Verification message: ${stompJson.message}`) // Visualize the json visualizeStompVerification(requestedBranchCl, stompJson) if (stompJson.validRequest) { $('#afterVerificationResultText').html('Stomp Verification Complete') $('#afterVerificationResultText').append( $('

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