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

[build-pipeline-plugin] Extract inline script blocks and event handlers in au/com/centrumsystems/hudson/plugin/buildpipeline/BuildPipelineView/bpp.jelly

XMLWordPrintable

      Problems

      == Inline Script Block
      Line: 21
      ----
      <script id="build-card-template" type="text/x-handlebars-template">
          <st:include page="buildCardTemplate.jelly"
                      from="${from.getBuildCard()}"
                      it="${from}"/>
      </script>
      ----
      
      == Inline Script Block
      Line: 27
      ----
      <script id="project-card-template" type="text/x-handlebars-template">
          <st:include page="projectCardTemplate.jelly"
                      from="${from.getColumnHeaders()}"
                      it="${from}" />
      </script>
      ----
      
      == Inline Script Block
      Line: 34
      ----
      <script type="text/javascript">
              var buildCardTemplateSource = jQuery("#build-card-template").html();
              var projectCardTemplateSource = jQuery("#project-card-template").html();
              var buildPipeline = new BuildPipeline(buildPipelineViewProxy, Handlebars.compile(buildCardTemplateSource), Handlebars.compile(projectCardTemplateSource), ${from.getRefreshFrequencyInMillis()});
          </script>
      ----
      
      == Inline Script Block
      Line: 134
      ----
      <script>
                                                  // generate build-card
                                                  var buildData = ${build.asJSON()};
                                                  jQuery("#build-${build.getId()}").append(buildPipeline.buildCardTemplate(buildData));
                                                  // add build proxy to proxies for future use
                                                  buildPipeline.buildProxies[${build.getId()}] = <st:bind value="${build}" />;
                                                  <j:if test="${build.getStatus() == 'BUILDING'}">
                                                      buildPipeline.showProgress(${build.getId()}, ${build.getDependencyIds()});
                                                  </j:if>
                                                  <j:if test="${build.getStatus() == 'PENDING'}">
                                                      jQuery("#pipelines").bind("show-status-${build.getId()}", function() {
                                                      <j:choose>
                                                          <j:when test="${build.isManualTrigger()}">
                                                              buildPipeline.updateBuildCard(${build.getId()});
                                                          </j:when>
                                                          <j:otherwise>
                                                              buildPipeline.updateNextBuildAndShowProgress(${build.getId()}, ${build.getNextBuildNumber()}, ${build.getDependencyIds()});
                                                          </j:otherwise>
                                                      </j:choose>
                                                      });
                                                  </j:if>
                                              </script>
      ----
      
      == Inline Event Handler
      Line: 64
      ----
      <span class="pointer" onclick="buildPipeline.fillDialog('${app.rootUrl}${from.gridBuilder.firstJobLink}/build?delay=0sec', 'Starts the pipeline with parameters')">
      ----
      
      == Inline Event Handler
      Line: 70
      ----
      <a id="trigger-pipeline-button" href='#' onclick="document.getElementById('triggerPipelineForm').submit()">
      ----
      
      == Inline Script Block
      Line: 21
      ----
      <script id="build-card-template" type="text/x-handlebars-template">
          <st:include page="buildCardTemplate.jelly"
                      from="${from.getBuildCard()}"
                      it="${from}"/>
      </script>
      ----
      
      == Inline Script Block
      Line: 27
      ----
      <script id="project-card-template" type="text/x-handlebars-template">
          <st:include page="projectCardTemplate.jelly"
                      from="${from.getColumnHeaders()}"
                      it="${from}" />
      </script>
      ----
      
      == Inline Script Block
      Line: 34
      ----
      <script type="text/javascript">
              var buildCardTemplateSource = jQuery("#build-card-template").html();
              var projectCardTemplateSource = jQuery("#project-card-template").html();
              var buildPipeline = new BuildPipeline(buildPipelineViewProxy, Handlebars.compile(buildCardTemplateSource), Handlebars.compile(projectCardTemplateSource), ${from.getRefreshFrequencyInMillis()});
          </script>
      ----
      
      == Inline Script Block
      Line: 134
      ----
      <script>
                                                  // generate build-card
                                                  var buildData = ${build.asJSON()};
                                                  jQuery("#build-${build.getId()}").append(buildPipeline.buildCardTemplate(buildData));
                                                  // add build proxy to proxies for future use
                                                  buildPipeline.buildProxies[${build.getId()}] = <st:bind value="${build}" />;
                                                  <j:if test="${build.getStatus() == 'BUILDING'}">
                                                      buildPipeline.showProgress(${build.getId()}, ${build.getDependencyIds()});
                                                  </j:if>
                                                  <j:if test="${build.getStatus() == 'PENDING'}">
                                                      jQuery("#pipelines").bind("show-status-${build.getId()}", function() {
                                                      <j:choose>
                                                          <j:when test="${build.isManualTrigger()}">
                                                              buildPipeline.updateBuildCard(${build.getId()});
                                                          </j:when>
                                                          <j:otherwise>
                                                              buildPipeline.updateNextBuildAndShowProgress(${build.getId()}, ${build.getNextBuildNumber()}, ${build.getDependencyIds()});
                                                          </j:otherwise>
                                                      </j:choose>
                                                      });
                                                  </j:if>
                                              </script>
      ----
      
      == Inline Event Handler
      Line: 64
      ----
      <span class="pointer" onclick="buildPipeline.fillDialog('${app.rootUrl}${from.gridBuilder.firstJobLink}/build?delay=0sec', 'Starts the pipeline with parameters')">
      ----
      
      == Inline Event Handler
      Line: 70
      ----
      <a id="trigger-pipeline-button" href='#' onclick="document.getElementById('triggerPipelineForm').submit()">
      ----
      

      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:
              Resolved: