-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Minor
-
Component/s: radargun-reporting-plugin
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.
Problem
== Inline Script Block
Line: 18
----
<script type="text/javascript">
function getDemoPlotSize() {
return [window.innerWidth-100, Math.round(0.45*(window.innerWidth-100))];
}
$(document).ready(function() {
var data1 = [[-1,5], [0.5,6], [5,-2.5], [6,1], [10,9], [20,-55]];
var plot1 = new CanvasDataPlot(d3.select("#maincontainer"), [1000, 900], {
xAxisLabel: "IQ",
yAxisLabel: "Test Score",
markerLineWidth: 3,
markerRadius: 5
});
plot1.addDataSet("ds1", "Test 1", data1, "orange", true, false);
plot1.addDataPoint("ds1", [15,0]); // Will not be added! (x values have to be in ascending order)
plot1.addDataPoint("ds1", [20,10]); // Will be added.
plot1.addDataPoint("ds1", [21,0]);
plot1.updateDomains([-2,22], [-60,15], true);
// Since we told addDataSet() not to copy our data, data1 is mutated by addDataPoint().
console.log(data1);
var ts1 = [];
var ts2 = [];
var now = new Date();
for(var i=0; i<100; ++i) {
var time = new Date(now);
time.setHours(i);
ts1.push([time, Math.random()]);
ts2.push([time, Math.random()]);
}
var plot2 = new CanvasTimeSeriesPlot(d3.select("#maincontainer"), getDemoPlotSize(), {
yAxisLabel: "Voltage [V]"
});
plot2.addDataSet("ds1", "Signal 1", ts1, "orange", true, true);
plot2.addDataSet("ds2", "Signal 2", ts2, "steelblue", true, true);
plot2.setZoomYAxis(false);
$(window).resize(function() {
plot2.resize(getDemoPlotSize());
});
var time = new Date(now);
time.setHours(101);
// Since we told addDataSet() to copy our data, ts1 is not mutated by addDataPoint().
// Cf. the plot of ts1 in the plot group below.
var newDataPoint = [time, 1.5];
plot2.addDataPoint("ds1", newDataPoint, true, true);
newDataPoint[1] = 3.0; // Has no effect since we told addDataPoint() to copy the new value.
var tsPlotGroup = new CanvasDataPlotGroup(d3.select("#maincontainer"), [550, 350], true, true, {});
tsPlotGroup.addDataSet("CanvasTimeSeriesPlot", "ds1", "Signal 1", ts1, "orange", {
yAxisLabel: "Voltage [V]"
});
tsPlotGroup.addDataSet("CanvasTimeSeriesPlot", "ds2", "Signal 2", ts2, "steelblue", {
yAxisLabel: "Voltage [V]",
plotLineWidth: 1.5
});
tsPlotGroup.addDataSet("CanvasDataPlot", "ds3", "Signal 3", ts2, "blue", {
yAxisLabel: "Voltage [V]"
});
tsPlotGroup.removeDataSet("ds3");
tsPlotGroup.setSyncViews(true, true, false);
var plot3 = new CanvasVectorSeriesPlot(d3.select("#maincontainer"), [750, 500], {
yAxisLabel: "Depth [m]",
maxInformationDensity: 0.3,
plotLineWidth: 1.5,
vectorScale: 7.0e5,
scaleUnits: "mm/s"
});
var tsVector1 = [];
for(var i=0; i<1000; ++i) {
var time = new Date(now);
time.setHours(i);
tsVector1.push([time, 50, 0.01*i*Math.PI, 100]);
}
plot3.addDataSet("ts1", "Velocity", tsVector1, "steelblue", true);
plot3.setZoomYAxis(false);
});
</script>
----
Solution
https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks