[JENKINS-70912] Remove Ajax.Request from build-timeline-widget (#7731)

This commit is contained in:
Tim Jacomb authored and GitHub committed 2023-04-04 08:23:21 -07:00
1 parent b0b2fd194e
commit 4e9cc522bb
1 file changed
+20 -12
@@ -11,19 +11,27 @@ function getData(eventSource1, current, min, max) {
}
if (!eventSource1.loaded[current]) {
eventSource1.loaded[current] = true;
new Ajax.Request("timeline/data/", {
method: "POST",
parameters: { min: current * interval, max: (current + 1) * interval },
onSuccess: function (t) {
if (t.status != 0) {
try {
eventSource1.loadJSON(JSON.parse(t.responseText), ".");
fetch(
"timeline/data/?" +
new URLSearchParams({
min: current * interval,
max: (current + 1) * interval,
}),
{
method: "POST",
headers: crumb.wrap({}),
}
).then((t) => {
if (t.ok) {
t.json()
.then((json) => {
eventSource1.loadJSON(json, ".");
getData(eventSource1, current - 1, min, max);
} catch (e) {
alert(e);
}
}
},
})
.catch((err) => {
alert(err);
});
}
});
}
}