Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions core/src/main/resources/org/apache/spark/ui/static/log-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,22 @@ function noNewAlert() {
window.setTimeout(function () {alert.css("display", "none");}, 4000);
}

function getRESTEndPoint() {
var words = document.baseURI.split('/');
var ind = words.indexOf("proxy");
if (ind > 0) {
return words.slice(0, ind + 2).join('/') + "/log";
}
return "/log"
}

function loadMore() {
var offset = Math.max(startByte - byteLength, 0);
var moreByteLength = Math.min(byteLength, startByte);

$.ajax({
type: "GET",
url: "/log" + baseParams + "&offset=" + offset + "&byteLength=" + moreByteLength,
url: getRESTEndPoint() + baseParams + "&offset=" + offset + "&byteLength=" + moreByteLength,
success: function (data) {
var oldHeight = $(".log-content")[0].scrollHeight;
var newlineIndex = data.indexOf('\n');
Expand All @@ -83,14 +92,14 @@ function loadMore() {
function loadNew() {
$.ajax({
type: "GET",
url: "/log" + baseParams + "&byteLength=0",
url: getRESTEndPoint() + baseParams + "&byteLength=0",
success: function (data) {
var dataInfo = data.substring(0, data.indexOf('\n')).match(/\d+/g);
var newDataLen = dataInfo[2] - totalLogLength;
if (newDataLen != 0) {
$.ajax({
type: "GET",
url: "/log" + baseParams + "&byteLength=" + newDataLen,
url: getRESTEndPoint() + baseParams + "&byteLength=" + newDataLen,
success: function (data) {
var newlineIndex = data.indexOf('\n');
var dataInfo = data.substring(0, newlineIndex).match(/\d+/g);
Expand Down