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

[docker-swarm] Extract inline script block in org/jenkinsci/plugins/docker/swarm/dashboard/UIPage/swarm-node.jelly

XMLWordPrintable

      Problem

      == Inline Script Block
      Line: 29
      ----
      <script defer="true">
                          (function() {
                              google.charts.load('current', {'packages':['corechart']});
                              google.charts.setOnLoadCallback(drawCharts);
      
                              function drawCharts() {
                                  drawMemoryChart();
                                  drawCpuChart();
                              }
      
                              function buildChartOptions(title) {
                                  return {
                                      title: title,
                                      titlePosition: 'none',
                                      legend: { position: 'none' },
                                      enableInteractivity: false,
                                      width: 30,
                                      height: 30,
                                      theme: 'maximized',
                                      colors:['grey', 'red'],
                                      backgroundColor: { fill:'transparent' }
                                  };
                              }
      
                              function drawMemoryChart() {
                                  var memoryData = google.visualization.arrayToDataTable(${node.memoryUsageJson});
                                  var memoryChart = new google.visualization.PieChart(document.getElementById('memory${node.name}'));
                                  var options = buildChartOptions('memory');
                                  memoryChart.draw(memoryData, options);
                              }
                              
                              function drawCpuChart() {
                                  var cpuData = google.visualization.arrayToDataTable(${node.cpuUsageJson});
                                  var cpuChart = new google.visualization.PieChart(document.getElementById('cpu${node.name}'));
                                  var options = buildChartOptions('cpu');
                                  cpuChart.draw(cpuData, options);
                              }
                          })()
                      </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: