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

[arestocats] Extract inline script block in org/jenkinsci/plugins/arestocats/ArestocatsResultsAction/index.jelly

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Minor Minor
    • _unsorted

      Problem

      == Inline Script Block
      Line: 9
      ----
      <script type="text/javascript">
                     var results = ${it.results};
                     var charts = [];
                     google.charts.load('current', {'packages':['corechart']});
                     google.charts.setOnLoadCallback(drawCharts);
                     function drawCharts(){
                        results.forEach( ( result, index ) => {
                           var data = new google.visualization.DataTable();
                           data.addColumn( 'string', 'X' );
                           var testcase = Object.keys(result)[0];
                           var measurements = result[testcase];
                           var labeling = measurements["outcomes"];
                           labeling.forEach( label => {
                           data.addColumn( 'number', label );
                           });
                          data.addRows(measurements["data"]);
                           var options = {
                               'title': testcase,
                               isStacked: true,
                               chartArea: {
                                   left: 100,
                                   width: 600
                               },
                               width: 1000,
                               hAxis: {
                                   title: 'Build Nr.'
                               },
                               vAxis: {
                                   title: 'test-cases'
                               }
                           };
                           var div = document.createElement( "div" );
                           div.setAttribute( "id", testcase );
                           document.getElementById( "main-panel" ).appendChild( div );
                           var chart = new google.visualization.AreaChart( document.getElementById( testcase ) );
                           chart.draw( data, options );
                           charts.push( chart );
                        } );
                     }
                  </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: