Skip to content

Commit dd5b264

Browse files
[JENKINS-73946] Remove inline event handlers in History/index.jelly (#658)
1 parent 693f7fd commit dd5b264

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/main/resources/hudson/tasks/junit/History/history.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,24 @@ var resultSeries
1010
var durationSeries
1111
var trendChartId = 'test-trend-chart'
1212

13-
function onBuildWindowChange(selectObj) {
13+
function onBuildWindowChange(changeEvent) {
14+
let selectObj = changeEvent.target;
1415
let idx = selectObj.selectedIndex;
1516
let c = selectObj.options[idx].value
1617
document.location = `${appRootUrl}${testObjectUrl}/history?start=${start}&count=${c}&interval=${interval}`
1718
}
1819

19-
function onBuildIntervalChange(selectObj) {
20+
function onBuildIntervalChange(changeEvent) {
21+
let selectObj = changeEvent.target;
2022
let idx = selectObj.selectedIndex;
2123
let i = selectObj.options[idx].value
2224
document.location = `${appRootUrl}${testObjectUrl}/history?start=${start}&count=${count}&interval=${i}`
2325
}
2426

2527
(function ($) {
2628
$(document).ready(function ($) {
29+
document.querySelector("#history-window").addEventListener("change", onBuildWindowChange);
30+
document.querySelector("#history-interval").addEventListener("change", onBuildIntervalChange);
2731
let dataEl = document.getElementById("history-data");
2832
start = dataEl.getAttribute("data-start")
2933
end = dataEl.getAttribute("data-end")

src/main/resources/hudson/tasks/junit/History/index.jelly

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ THE SOFTWARE.
7070
<div style="flex-grow: 1"/>
7171
<div style="display: flex; flex-basis: auto; justify-content: space-between; align-items: center" tooltip="The history window size. Out of N builds, every Mth build with test results is shown, where M is the interval.">
7272
<div id="history-info" class="jenkins-!-margin-right-1" style="text-wrap: nowrap"></div>
73-
<select name="history-window" id="history-window" onchange="onBuildWindowChange(this);" class="jenkins-!-margin-left-0 jenkins-!-margin-right-1 jenkins-select__input " style="min-width: fit-content;">
73+
<select name="history-window" id="history-window" class="jenkins-!-margin-left-0 jenkins-!-margin-right-1 jenkins-select__input " style="min-width: fit-content;">
7474
<option value="100">100</option>
7575
<option value="200">200</option>
7676
<option value="500">500</option>
@@ -82,7 +82,7 @@ THE SOFTWARE.
8282
</div>
8383
<div style="display: flex; flex-basis: auto; justify-content: space-between; align-items: center" tooltip="Every Mth build will be taken into account.">
8484
<div class="jenkins-!-margin-right-1" style="text-wrap: nowrap">Sample interval:</div>
85-
<select name="history-interval" id="history-interval" onchange="onBuildIntervalChange(this);" class="jenkins-!-margin-left-0 jenkins-!-margin-right-0 jenkins-select__input " style="min-width: fit-content;">
85+
<select name="history-interval" id="history-interval" class="jenkins-!-margin-left-0 jenkins-!-margin-right-0 jenkins-select__input " style="min-width: fit-content;">
8686
<option value="1">1</option>
8787
<option value="2">2</option>
8888
<option value="5">5</option>

0 commit comments

Comments
 (0)