YARN-6631. Refactor loader.js in new Yarn UI. Contributed by Akhil P B.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/16357413 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/16357413 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/16357413 Branch: refs/heads/YARN-3368_branch2 Commit: 16357413908c8f04a9ebe384fadc502800bc514b Parents: 6232c3a Author: Sunil G <sun...@apache.org> Authored: Thu Aug 10 11:53:26 2017 +0530 Committer: Varun Saxena <varunsax...@apache.org> Committed: Wed Oct 18 02:06:49 2017 +0530 ---------------------------------------------------------------------- .../src/main/webapp/app/initializers/loader.js | 42 +++++++++----------- 1 file changed, 19 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/16357413/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js index aa8fb07..55f6e1b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/loader.js @@ -20,25 +20,27 @@ import Ember from 'ember'; -function getTimeLineURL() { - return '/conf?name=yarn.timeline-service.webapp.address'; +function getTimeLineURL(rmhost) { + var url = window.location.protocol + '//' + + (ENV.hosts.localBaseAddress? ENV.hosts.localBaseAddress + '/' : '') + rmhost; + + url += '/conf?name=yarn.timeline-service.webapp.address'; + Ember.Logger.log("Get Timeline Address URL: " + url); + return url; } function updateConfigs(application) { var hostname = window.location.hostname; - var rmhost = hostname + - (window.location.port ? ':' + window.location.port: ''); - - Ember.Logger.log("RM Address:" + rmhost); + var rmhost = hostname + (window.location.port ? ':' + window.location.port: ''); if(!ENV.hosts.rmWebAddress) { - ENV = { - hosts: { - rmWebAddress: rmhost, - }, - }; + ENV.hosts.rmWebAddress = rmhost; + } else { + rmhost = ENV.hosts.rmWebAddress; } + Ember.Logger.log("RM Address: " + rmhost); + if(!ENV.hosts.timelineWebAddress) { var timelinehost = ""; $.ajax({ @@ -46,7 +48,7 @@ function updateConfigs(application) { dataType: 'json', async: true, context: this, - url: getTimeLineURL(), + url: getTimeLineURL(rmhost), success: function(data) { timelinehost = data.property.value; ENV.hosts.timelineWebAddress = timelinehost; @@ -54,24 +56,18 @@ function updateConfigs(application) { var address = timelinehost.split(":")[0]; var port = timelinehost.split(":")[1]; - Ember.Logger.log("Timeline Address from RM:" + address + ":" + port); + Ember.Logger.log("Timeline Address from RM: " + timelinehost); if(address === "0.0.0.0" || address === "localhost") { var updatedAddress = hostname + ":" + port; - - /* Timeline v2 is not supporting CORS, so make as default*/ - ENV = { - hosts: { - rmWebAddress: rmhost, - timelineWebAddress: updatedAddress, - }, - }; - Ember.Logger.log("Timeline Updated Address:" + updatedAddress); + ENV.hosts.timelineWebAddress = updatedAddress; + Ember.Logger.log("Timeline Updated Address: " + updatedAddress); } application.advanceReadiness(); - }, + } }); } else { + Ember.Logger.log("Timeline Address: " + ENV.hosts.timelineWebAddress); application.advanceReadiness(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org