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

[cavisson-ns-nd-integration] Extract inline script block and event handlers in com/cavisson/jenkins/BuildActionResultsDisplay/index.jelly

XMLWordPrintable

      Note

      While testing this plugin, evaluate whether the third-party libraries in src/main/webapp are compatible with CSP in restrictive mode. The plugin may need to be upgraded from jQuery 1.x to 3.x to fully function in CSP restrictive mode.

      Problems

      == Inline Script Block
      Line: 1844
      ----
      <script>setupTestRunsTableSort()
             function openTrend(value)
             {
               console.log("url to be open =="+value);
               window.open(value,'trendGraph');
             }
             function openEd(value)
             {
               console.log("url to be open =="+value);
               window.open(value,'transEd');
             }
             function openDashboard(value)
             {
               console.log("dashboard url  ==" + value);
               window.open(value);
             }
             function openMetric(value)
             {
               console.log("url to be open =="+value);
               window.open(value);
             }
             function openHtmlReport(value)
             {
              console.log("url to be open =="+value);
               window.open(value);
             }
      
             </script>
      ----
      
      == Inline Event Handler
      Line: 116
      ----
      <div class='panel panel-red panel-widget' title="Open WebDashboard" style="cursor:pointer;" onclick="openDashboard('${testReport.getDashboardURL()}')">
      ----
      
      == Inline Event Handler
      Line: 127
      ----
      <div class='panel panel-red panel-widget' title="Open HTML Report" style="cursor:pointer;" onclick="openHtmlReport('${testReport.getReportLink()}')">
      ----
      
      == Inline Event Handler
      Line: 209
      ----
      <div class='panel panel-red panel-widget' title="Open WebDashboard" style="cursor:pointer;" onclick="openDashboard('${testReport.getDashboardURL()}')">
      ----
      
      == Inline Event Handler
      Line: 220
      ----
      <div class='panel panel-red panel-widget' title="Open HTML Report" style="cursor:pointer;" onclick="openHtmlReport('${testReport.getReportLink()}')">
      ----
      
      == Inline Event Handler
      Line: 384
      ----
      <td align='right' style='background:${suit_metric.currValue.substring( suit_metric.currValue.indexOf("-") + 1, suit_metric.currValue.indexOf(")"))};color:blue;cursor:pointer;' onclick="openEd('${suit_metric.edLink}')">
      ----
      
      == Inline Event Handler
      Line: 706
      ----
      <i title="Trend Link" onclick="openTrend('${values.trendLink}')" class='fa fa-line-chart' aria-hidden='true'>
      ----
      
      == Inline Event Handler
      Line: 731
      ----
      <i title="Metric Graph" onclick="openMetric('${metrLink}')" class='fa fa-bar-chart' aria-hidden='true'>
      ----
      
      == Inline Event Handler
      Line: 869
      ----
      <i title="Trend Link" onclick="openTrend('${values.trendLink}')" class='fa fa-line-chart' aria-hidden='true'>
      ----
      
      == Inline Event Handler
      Line: 893
      ----
      <i title="Metric Graph" onclick="openMetric('${metrLink}')" class='fa fa-bar-chart' aria-hidden='true'>
      ----
      
      == Inline Event Handler
      Line: 1011
      ----
      <i title="Trend Link" onclick="openTrend('${scalarGr.trendLink}')" class='fa fa-line-chart' aria-hidden='true'>
      ----
      
      == Inline Event Handler
      Line: 1015
      ----
      <i title="Metric Graph" onclick="openMetric('${scalarGr.link}')" class='fa fa-bar-chart' aria-hidden='true'>
      ----
      
      == Inline Event Handler
      Line: 1090
      ----
      <div class='panel panel-red panel-widget' title="Open WebDashboard" style="cursor:pointer;" onclick="openDashboard('${testReportND.getDashboardURL()}')">
      ----
      
      == Inline Event Handler
      Line: 1100
      ----
      <div class='panel panel-red panel-widget' title="Open HTML Report" style="cursor:pointer;" onclick="openHtmlReport('${testReportND.getReportLink()}')">
      ----
      
      == Inline Event Handler
      Line: 1163
      ----
      <div class='panel panel-red panel-widget' title="Open WebDashboard" style="cursor:pointer;" onclick="openDashboard('${testReportND.getDashboardURL()}')">
      ----
      
      == Inline Event Handler
      Line: 1173
      ----
      <div class='panel panel-red panel-widget' title="Open HTML Report" style="cursor:pointer;" onclick="openHtmlReport('${testReportND.getReportLink()}')">
      ----
      
      == Inline Event Handler
      Line: 1331
      ----
      <td align='right' style='background:${suit_metric.currValue.substring( suit_metric.currValue.indexOf("-") + 1, suit_metric.currValue.indexOf(")"))};color:blue;cursor:pointer;' onclick="openEd('${suit_metric.edLink}')">
      ----
      
      == Inline Event Handler
      Line: 1395
      ----
      <i title="Trend Graph" onclick="openTrend('${suit_metric.linkForTrend}')" class='fa fa-line-chart' aria-hidden='true'>
      ----
      
      == Inline Event Handler
      Line: 1396
      ----
      <i title="Metric Graph" onclick="openMetric('${suit_metric.metricLink}')" class='fa fa-bar-chart' aria-hidden='true'>
      ----
      
      == Inline Event Handler
      Line: 1524
      ----
      <i title="Trend Link" onclick="openTrend('${values.trendLink}')" class='fa fa-line-chart' aria-hidden='true'>
      ----
      
      == Inline Event Handler
      Line: 1548
      ----
      <i title="Metric Graph" onclick="openMetric('${metrLink}')" class='fa fa-bar-chart' aria-hidden='true'>
      ----
      
      == Inline Event Handler
      Line: 1686
      ----
      <i title="Trend Link" onclick="openTrend('${values.trendLink}')" class='fa fa-line-chart' aria-hidden='true'>
      ----
      
      == Inline Event Handler
      Line: 1710
      ----
      <i title="Metric Graph" onclick="openMetric('${metrLink}')" class='fa fa-bar-chart' aria-hidden='true'>
      ----
      
      == Inline Event Handler
      Line: 1828
      ----
      <i title="Trend Link" onclick="openTrend('${scalarGr.trendLink}')" class='fa fa-line-chart' aria-hidden='true'>
      ----
      
      == Inline Event Handler
      Line: 1832
      ----
      <i title="Metric Graph" onclick="openMetric('${scalarGr.link}')" class='fa fa-bar-chart' aria-hidden='true'>
      ----
      
      == Inline Event Handler
      Line: 1879
      ----
      <img src ="${rootURL}/plugin/cavisson-ns-nd-integration/images/arrow_r.png" title="Show or Hide Transaction Report" style="margin-right:8px" onClick='showOrHideReport()' id = "showOrHideReportImgId"/>
      ----
      

      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: