[SPARK-35822][UI] Spark UI-Executor tab is empty in IE11

### What changes were proposed in this pull request?
Refactor some functions in utils.js to fix the empty UI-Executor tab in yarn mode in IE11.

### Why are the changes needed?
Spark UI-Executor tab is empty in IE11: So this PR to fix this.
![Executortab_IE](https://user-images.githubusercontent.com/84778052/132786964-b17b6d12-457f-4ba3-894f-3f2e1c285b1e.PNG)

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Existed UT Testcase

Closes #33937 from dgd-contributor/SPARK-35822-v2.

Authored-by: dgd_contributor <dgd_contributor@viettel.com.vn>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit ebca01f03e)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
This commit is contained in:
dgd_contributor 2021-09-11 15:58:31 -07:00 committed by Dongjoon Hyun
parent b8a23e9ccc
commit 6b62459c09
3 changed files with 14 additions and 10 deletions

View file

@ -15,7 +15,7 @@
* limitations under the License.
*/
/* global $ */
/* global $, getBaseURI */
var baseParams;
@ -58,7 +58,7 @@ function getRESTEndPoint() {
// If the worker is served from the master through a proxy (see doc on spark.ui.reverseProxy),
// we need to retain the leading ../proxy/<workerid>/ part of the URL when making REST requests.
// Similar logic is contained in executorspage.js function createRESTEndPoint.
var words = document.baseURI.split('/');
var words = getBaseURI().split('/');
var ind = words.indexOf("proxy");
if (ind > 0) {
return words.slice(0, ind + 2).join('/') + "/log";

View file

@ -17,7 +17,7 @@
/* global $, ConvertDurationString, Mustache, createRESTEndPointForExecutorsPage */
/* global createTemplateURI, formatBytes, formatDate, formatDuration, formatLogsCells */
/* global getStandAloneAppId, setDataTableDefaults, uiRoot */
/* global getStandAloneAppId, setDataTableDefaults, getBaseURI, uiRoot */
var shouldBlockUI = true;
@ -71,8 +71,8 @@ $.extend( $.fn.dataTable.ext.type.order, {
// e.g. (history) https://domain:50509/history/application_1536254569791_3806251/1/stages/stage/?id=4&attempt=1
// e.g. (proxy) https://domain:50505/proxy/application_1502220952225_59143/stages/stage?id=4&attempt=1
function stageEndPoint(appId) {
var queryString = document.baseURI.split('?');
var words = document.baseURI.split('/');
var queryString = getBaseURI().split('?');
var words = getBaseURI().split('/');
var indexOfProxy = words.indexOf("proxy");
var stageId = queryString[1].split("&").filter(word => word.includes("id="))[0].split("=")[1];
var newBaseURI;
@ -303,7 +303,7 @@ function reselectCheckboxesBasedOnTaskTableState() {
}
function getStageAttemptId() {
var words = document.baseURI.split('?');
var words = getBaseURI().split('?');
var digitsRegex = /[0-9]+/;
// We are using regex here to extract the stage attempt id as there might be certain url's with format
// like /proxy/application_1539986433979_27115/stages/stage/?id=0&attempt=0#tasksTitle

View file

@ -96,7 +96,7 @@ function formatLogsCells(execLogs, type) {
}
function getStandAloneAppId(cb) {
var words = document.baseURI.split('/');
var words = getBaseURI().split('/');
var ind = words.indexOf("proxy");
var appId;
if (ind > 0) {
@ -148,7 +148,7 @@ function ConvertDurationString(data) {
}
function createTemplateURI(appId, templateName) {
var words = document.baseURI.split('/');
var words = getBaseURI().split('/');
var ind = words.indexOf("proxy");
var baseURI;
if (ind > 0) {
@ -183,7 +183,7 @@ function formatDate(date) {
}
function createRESTEndPointForExecutorsPage(appId) {
var words = document.baseURI.split('/');
var words = getBaseURI().split('/');
var ind = words.indexOf("proxy");
var newBaseURI;
if (ind > 0) {
@ -206,7 +206,7 @@ function createRESTEndPointForExecutorsPage(appId) {
}
function createRESTEndPointForMiscellaneousProcess(appId) {
var words = document.baseURI.split('/');
var words = getBaseURI().split('/');
var ind = words.indexOf("proxy");
var newBaseURI;
if (ind > 0) {
@ -227,4 +227,8 @@ function createRESTEndPointForMiscellaneousProcess(appId) {
}
return uiRoot + "/api/v1/applications/" + appId + "/allmiscellaneousprocess";
}
function getBaseURI() {
return document.baseURI || document.URL;
}
/* eslint-enable no-unused-vars */