Repository: hadoop Updated Branches: refs/heads/trunk 1ea29b738 -> aab310978
YARN-9089. Add Terminal Link to Service component instance page for UI2. Contributed by Eric Yang Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/aab31097 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/aab31097 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/aab31097 Branch: refs/heads/trunk Commit: aab310978f64d57cf414de095e6195cbc4d0ed55 Parents: 1ea29b7 Author: Billie Rinaldi <bil...@apache.org> Authored: Fri Dec 14 18:38:03 2018 -0800 Committer: Billie Rinaldi <bil...@apache.org> Committed: Fri Dec 14 18:38:03 2018 -0800 ---------------------------------------------------------------------- .../src/main/webapp/app/initializers/env.js | 1 + .../src/main/webapp/app/initializers/loader.js | 26 ++++++++++++++++++++ .../app/models/yarn-component-instance.js | 10 ++++++++ .../app/routes/yarn-component-instance/info.js | 5 ++++ .../templates/yarn-component-instance/info.hbs | 4 +++ 5 files changed, 46 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/aab31097/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/env.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/env.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/env.js index c613593..bb9329e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/env.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/initializers/env.js @@ -21,6 +21,7 @@ export function initialize( application ) { application.inject('controller', 'env', 'service:env'); application.inject('route', 'env', 'service:env'); application.inject('adapter', 'env', 'service:env'); + application.inject('model', 'env', 'service:env'); } export default { http://git-wip-us.apache.org/repos/asf/hadoop/blob/aab31097/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 befff8f..e695ea6 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 @@ -110,6 +110,29 @@ function getClusterIdFromYARN(rmhost, application) { return clusterId; } +function getNodeManagerPort(rmhost, application) { + var httpUrl = window.location.protocol + "//" + + (ENV.hosts.localBaseAddress ? ENV.hosts.localBaseAddress + '/' : '') + rmhost + + ":" + window.location.port + "/conf?name=yarn.nodemanager.webapp.address"; + var port = "8042"; + $.ajax({ + type: 'GET', + dataType: 'json', + async: false, + context: this, + url: httpUrl, + success: function(data) { + port = data.property.value.split(":")[1]; + application.advanceReadiness(); + }, + error: function() { + port = "8042"; + application.advanceReadiness(); + } + }); + return port; +} + function updateConfigs(application) { var hostname = window.location.hostname; var rmhost = hostname + (window.location.port ? ':' + window.location.port: '') + @@ -134,6 +157,9 @@ function updateConfigs(application) { var clusterIdFromYARN = getClusterIdFromYARN(rmhost, application); ENV.clusterId = clusterIdFromYARN; + var nodeManagerPort = getNodeManagerPort(rmhost, application); + ENV.nodeManagerPort = nodeManagerPort; + if(!ENV.hosts.timelineWebAddress) { var timelinehost = ""; $.ajax({ http://git-wip-us.apache.org/repos/asf/hadoop/blob/aab31097/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-component-instance.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-component-instance.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-component-instance.js index 532fc55..e4b6a9b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-component-instance.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-component-instance.js @@ -47,5 +47,15 @@ export default DS.Model.extend({ return Converter.timeStampToDate(timestamp); } return 'N/A'; + }), + + termLink: Ember.computed('node', 'containerId', function() { + var protocol = window.location.protocol; + var node = this.get('node'); + var port = this.get('env.app.nodeManagerPort'); + var containerId = this.get('containerId'); + var url = protocol + "//" + node + ":" + port + + "/terminal/terminal.template?container=" + containerId; + return url; }) }); http://git-wip-us.apache.org/repos/asf/hadoop/blob/aab31097/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-component-instance/info.js ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-component-instance/info.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-component-instance/info.js index a67324a..71c2893 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-component-instance/info.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-component-instance/info.js @@ -39,6 +39,11 @@ export default AbstractRoute.extend({ }); }, + afterModel(model) { + const appContrl = this.controllerFor('application'); + model.userInfo = appContrl.get('userInfo'); + }, + unloadAll() { this.store.unloadAll('yarn-component-instance'); } http://git-wip-us.apache.org/repos/asf/hadoop/blob/aab31097/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-component-instance/info.hbs ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-component-instance/info.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-component-instance/info.hbs index 1b9d04a..c9157b8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-component-instance/info.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-component-instance/info.hbs @@ -61,6 +61,10 @@ <td>Exit Status Code</td> <td>{{check-availability model.container.exitStatusCode}}</td> </tr> + <tr> + <td>Terminal</td> + <td><a href="{{model.container.termLink}}&user.name={{model.userInfo.requestedUser}}" target="_blank">Link</a></td> + </tr> </tbody> </table> </div> --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org