Skip to content

Commit b687d55

Browse files
committed
Remove Ajax.Request from build-timeline-widget
1 parent 0aa7a21 commit b687d55

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

core/src/main/resources/hudson/model/BuildTimelineWidget/build-timeline-widget.js

+22-12
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,29 @@ function getData(eventSource1, current, min, max) {
1111
}
1212
if (!eventSource1.loaded[current]) {
1313
eventSource1.loaded[current] = true;
14-
new Ajax.Request("timeline/data/", {
15-
method: "POST",
16-
parameters: { min: current * interval, max: (current + 1) * interval },
17-
onSuccess: function (t) {
18-
if (t.status != 0) {
19-
try {
20-
eventSource1.loadJSON(JSON.parse(t.responseText), ".");
14+
fetch(
15+
"timeline/data/?" +
16+
new URLSearchParams({
17+
min: current * interval,
18+
max: (current + 1) * interval,
19+
}),
20+
{
21+
method: "POST",
22+
headers: {
23+
[document.head.dataset.crumbHeader]: document.head.dataset.crumbValue,
24+
},
25+
}
26+
).then((t) => {
27+
if (t.status !== 0) {
28+
t.json()
29+
.then((json) => {
30+
eventSource1.loadJSON(json, ".");
2131
getData(eventSource1, current - 1, min, max);
22-
} catch (e) {
23-
alert(e);
24-
}
25-
}
26-
},
32+
})
33+
.catch((err) => {
34+
alert(err);
35+
});
36+
}
2737
});
2838
}
2939
}

0 commit comments

Comments
 (0)