Bladeren bron

YARN-8040. [UI2] New YARN UI webapp does not respect current pathname for REST api. Contributed by Sunil G.

Sunil G 7 jaren geleden
bovenliggende
commit
4d4f6c94a6

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

@@ -40,7 +40,7 @@ function getTimeLineV1URL(rmhost) {
 
 function updateConfigs(application) {
   var hostname = window.location.hostname;
-  var rmhost = hostname + (window.location.port ? ':' + window.location.port: '');
+  var rmhost = hostname + (window.location.port ? ':' + window.location.port: '') + skipTrailingSlash(window.location.pathname);
 
   if(!ENV.hosts.rmWebAddress) {
     ENV.hosts.rmWebAddress = rmhost;
@@ -127,3 +127,8 @@ export default {
   before: 'env',
   initialize
 };
+
+const skipTrailingSlash = function(path) {
+  path = path.replace('ui2/', '');
+  return path.replace(/\/$/, '');
+};