Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-74499

[mentor-questa-vrm] Extract inline script block in com/mentor/questa/vrm/jenkins/QuestaVrmRegressionResult/body.jelly

XMLWordPrintable

      Problem

      == Inline Script Block
      Line: 68
      ----
      <script type="text/javascript">
            	var linktitle= ["Show Actions", "Show Tests"]
            	var displayStyle= ["none", ""]
        	var linkIndex =1;
      	var failed = parseInt("${it.failedActionCount}")
      
      	var total = parseInt("${it.totalActionCount}")
      	document.addEventListener("DOMContentLoaded",function(){
      		onload();
      		flipTable();
      	});
                                              
           	function flipTable(){
           		//"use strict";
      		if(total == 0){
      			return;
      		}
           		var x = document.getElementById("vrmregr").rows
      		linkIndex = 1 - linkIndex;
      		document.getElementById("flipLink").innerHTML = linktitle[linkIndex];
      		document.getElementById("action-col").style.display=displayStyle[linkIndex]
      		for(var i=1; i&lt; x.length; i++){
      			var className= x[i].className
      			if(className =="action-row"){
      				x[i].style.display= displayStyle[linkIndex]
      			}
      
      			x[i].firstElementChild.style.display= displayStyle[linkIndex]
      		}
      		if(failed &gt; 0){
           			var x = document.getElementById("failed-table").rows
      			for(var i=1; i&lt; x.length; i++){
      				var className= x[i].className
      				if(className =="action-row"){
      					x[i].style.display= displayStyle[linkIndex]
      				}
      
      			}
      		}
      	}
      	function flipView(){
      
      		if(total == 0){
      			return;
      		}
      
      		if(failed &gt; 0){
      			var tempStyle=document.getElementById("failed-tests").style.display
      			document.getElementById("failed-tests").style.display = document.getElementById("failed-actions").style.display
      			document.getElementById("failed-actions").style.display = tempStyle
      		}
      		tempStyle=document.getElementById("all-tests").style.display
      		document.getElementById("all-tests").style.display = document.getElementById("all-actions").style.display
      		document.getElementById("all-actions").style.display = tempStyle
      		flipTable();
      	}
           </script>
      ----
      

      Solution

      https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks

            Unassigned Unassigned
            basil Basil Crow
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: