소스 검색

YARN-8469. [UI2] URL needs to be trimmed to handle index.html redirection while accessing via knox. Contributed by Sunil Govindan.

(cherry picked from commit a820738e347854aed7cdaa7758d9c0830df624e3)
Rohith Sharma K S 6 년 전
부모
커밋
00406f583b
1개의 변경된 파일9개의 추가작업 그리고 1개의 파일을 삭제
  1. 9 1
      hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js

+ 9 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js

@@ -205,5 +205,13 @@ export default {
 
 const skipTrailingSlash = function(path) {
   path = path.replace('ui2/', '');
-  return path.replace(/\/$/, '');
+  path = path.replace(/\/$/, '');
+  console.log('base url:' + path)
+  if(path.includes("redirect")) {
+    var to = path.lastIndexOf('/');
+    to = to == -1 ? path.length : to + 1;
+    path = path.substring(0, to);
+    console.log('base url after redirect:' + path)
+  }
+  return path;
 };