diff --git a/core/src/main/resources/hudson/model/BuildTimelineWidget/build-timeline-widget.js b/core/src/main/resources/hudson/model/BuildTimelineWidget/build-timeline-widget.js index 6d4795ba65..4437c99d13 100644 --- a/core/src/main/resources/hudson/model/BuildTimelineWidget/build-timeline-widget.js +++ b/core/src/main/resources/hudson/model/BuildTimelineWidget/build-timeline-widget.js @@ -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); + }); + } }); } }