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

[micro-focus-performance-center-integration] Extract inline script blocks and event handler in com/microfocus/performancecenter/integration/pcgitsync/PcGitSyncBuilder/config.jelly

XMLWordPrintable

      Problems

      == Inline Script Block
      Line: 93
      ----
      <script>
      
      
              function assignhostPath(){
                  setTimeout(function(){
                      var href = window.location.href;
                      var splitter = href.split("/job");
                      var baseurl = splitter[0];
                      var p = document.getElementById('serverAndPort');
                      if(p){
                          p.value = baseurl;
                      }
                  },50)
      
              }
      
      
      
      		function isAddRunToTrendReportEnabled(sender) {
      			var x = sender.selectedIndex;
      			var y = sender.options;
      			var addRunToTrendReport = document.getElementById('trendReportTable');
      			//alert(y[x].value);
      			if (y[x].value === 'COLLATE_AND_ANALYZE'){
      				addRunToTrendReport.classList.remove("disabledLine");
      			}
      			else{
      				addRunToTrendReport.classList.add("disabledLine");
      			}
      
      		}
      
      		function onPostRunActionLoad(){
      			var postRunAction = document.getElementById('postRunAction');
      			if(postRunAction != null){
      			    isAddRunToTrendReportEnabled(postRunAction);
      			}
      
      		}
      
      		function verifyURLAvailable(){
      
                  var pcServer = document.getElementsByName("pcgit.pcServerName")[0].value;
                  var scheme = "http";
                  if(document.getElementsByName("pcgit.httpsProtocol")[0].checked){
                      scheme = "https"
                  }
                  if(pcServer){
                      var popup = window.open(scheme + "://" + pcServer + "/loadtest/");
                      popup.opener = null;
                  }else{
                      alert("LoadRunner Enterprise Server name is missing.");
                  }
                  return false;
      		}
      
      
      
      		</script>
      ----
      
      == Inline Script Block
      Line: 200
      ----
      <script>assignhostPath();</script>
      ----
      
      == Inline Event Handler
      Line: 197
      ----
      <f:textbox id="serverAndPort" name="pcgit.serverAndPort" value="" onchange="assignhostPath()" />
      ----
      

      Solutions

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

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

              Created:
              Updated: