YARN-8115. [UI2] URL data like nodeHTTPAddress must be encoded in UI before 
using to access NM. Contributed by Sreenath Somarajapuram.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/42cd367c
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/42cd367c
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/42cd367c

Branch: refs/heads/YARN-1011
Commit: 42cd367c9308b944bc71de6c07b6c3f028a0d874
Parents: b779f4f
Author: Sunil G <sun...@apache.org>
Authored: Wed Apr 4 22:13:14 2018 +0530
Committer: Sunil G <sun...@apache.org>
Committed: Wed Apr 4 22:13:14 2018 +0530

----------------------------------------------------------------------
 .../webapp/app/components/node-menu-panel.js    | 25 ++++++++++++++++++++
 .../webapp/app/controllers/yarn-node-app.js     |  3 ++-
 .../webapp/app/controllers/yarn-node-apps.js    |  3 ++-
 .../app/controllers/yarn-node-container.js      |  3 ++-
 .../app/controllers/yarn-node-containers.js     |  3 ++-
 .../main/webapp/app/controllers/yarn-node.js    |  3 ++-
 .../webapp/app/controllers/yarn-nodes/table.js  |  2 +-
 .../src/main/webapp/app/helpers/node-link.js    |  2 +-
 .../src/main/webapp/app/initializers/loader.js  |  1 +
 .../main/webapp/app/routes/yarn-node-apps.js    |  8 ++++---
 .../webapp/app/routes/yarn-node-containers.js   |  8 ++++---
 .../src/main/webapp/app/routes/yarn-node.js     |  8 ++++---
 .../templates/components/node-menu-panel.hbs    |  8 +++----
 13 files changed, 57 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/42cd367c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/node-menu-panel.js
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/node-menu-panel.js
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/node-menu-panel.js
new file mode 100644
index 0000000..31457be
--- /dev/null
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/node-menu-panel.js
@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+  encodedAddr : Ember.computed("nodeAddr", function(){
+    return encodeURIComponent(this.get('nodeAddr'));
+  })
+});

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42cd367c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-app.js
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-app.js
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-app.js
index 3dc09fc..e0d58ec 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-app.js
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-app.js
@@ -22,6 +22,7 @@ export default Ember.Controller.extend({
 
   breadcrumbs: Ember.computed('model.nodeInfo', function () {
     var nodeInfo = this.get('model.nodeInfo');
+    var addr = encodeURIComponent(nodeInfo.addr);
     return [{
       text: "Home",
       routeName: 'application'
@@ -30,7 +31,7 @@ export default Ember.Controller.extend({
       routeName: 'yarn-nodes.table'
     }, {
       text: `Node [ ${nodeInfo.id} ]`,
-      href: `#/yarn-node/${nodeInfo.id}/${nodeInfo.addr}`,
+      href: `#/yarn-node/${nodeInfo.id}/${addr}/info`,
     }, {
       text: `Application [ ${nodeInfo.appId} ]`,
     }];

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42cd367c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-apps.js
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-apps.js
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-apps.js
index 6f53e74..ddc8256 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-apps.js
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-apps.js
@@ -22,6 +22,7 @@ export default Ember.Controller.extend({
 
   breadcrumbs: Ember.computed("model.attempt.appId", function () {
     var nodeInfo = this.get("model.nodeInfo");
+    var addr = encodeURIComponent(nodeInfo.addr);
     return [{
       text: "Home",
       routeName: 'application'
@@ -30,7 +31,7 @@ export default Ember.Controller.extend({
       routeName: 'yarn-nodes.table'
     }, {
       text: `Node [ ${nodeInfo.id} ]`,
-      href: `#/yarn-node/${nodeInfo.id}/${nodeInfo.addr}`
+      href: `#/yarn-node/${nodeInfo.id}/${addr}/info`
     }, {
       text: "Applications",
     }];

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42cd367c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-container.js
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-container.js
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-container.js
index afcd518..b8e7e36 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-container.js
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-container.js
@@ -22,6 +22,7 @@ export default Ember.Controller.extend({
 
   breadcrumbs: Ember.computed("model.nodeInfo", function () {
     var nodeInfo = this.get("model.nodeInfo");
+    var addr = encodeURIComponent(nodeInfo.addr);
     return [{
       text: "Home",
       routeName: 'application'
@@ -30,7 +31,7 @@ export default Ember.Controller.extend({
       routeName: 'yarn-nodes.table'
     }, {
       text: `Node [ ${nodeInfo.id} ]`,
-      href: `#/yarn-node/${nodeInfo.id}/${nodeInfo.addr}`
+      href: `#/yarn-node/${nodeInfo.id}/${addr}/info`
     }, {
       text: `Container [ ${nodeInfo.containerId} ]`
     }];

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42cd367c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-containers.js
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-containers.js
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-containers.js
index 21d50a3..9fb03c8 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-containers.js
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node-containers.js
@@ -22,6 +22,7 @@ export default Ember.Controller.extend({
 
   breadcrumbs: Ember.computed("model.nodeInfo", function () {
     var nodeInfo = this.get("model.nodeInfo");
+    var addr = encodeURIComponent(nodeInfo.addr);
     return [{
       text: "Home",
       routeName: 'application'
@@ -30,7 +31,7 @@ export default Ember.Controller.extend({
       routeName: 'yarn-nodes.table'
     }, {
       text: `Node [ ${nodeInfo.id} ]`,
-      href: `#/yarn-node/${nodeInfo.id}/${nodeInfo.addr}`
+      href: `#/yarn-node/${nodeInfo.id}/${addr}/info`
     }, {
       text: "Containers",
     }];

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42cd367c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node.js
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node.js
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node.js
index 335a33c..c6cf2e3 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node.js
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-node.js
@@ -22,6 +22,7 @@ export default Ember.Controller.extend({
 
   breadcrumbs: Ember.computed("model.nodeInfo", function () {
     var nodeInfo = this.get("model.nodeInfo");
+    var addr = encodeURIComponent(nodeInfo.addr);
 
     return [{
       text: "Home",
@@ -31,7 +32,7 @@ export default Ember.Controller.extend({
       routeName: 'yarn-nodes.table'
     }, {
       text: `Node [ ${nodeInfo.id} ]`,
-      href: `#/yarn-node/${nodeInfo.id}/${nodeInfo.addr}`,
+      href: `#/yarn-node/${nodeInfo.id}/${addr}/info`,
     }];
   })
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42cd367c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes/table.js
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes/table.js
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes/table.js
index f6a6ee6..0693d1b 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes/table.js
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-nodes/table.js
@@ -69,7 +69,7 @@ export default Ember.Controller.extend({
             facetType: null,
             getCellContent: function(row) {
               var node_id = row.get("id"),
-                  node_addr = row.get("nodeHTTPAddress"),
+                  node_addr = encodeURIComponent(row.get("nodeHTTPAddress")),
                   href = `#/yarn-node/${node_id}/${node_addr}/info`;
                 switch(row.get("nodeState")) {
                 case "SHUTDOWN":

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42cd367c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
index d71ac77..4f412da 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/node-link.js
@@ -29,7 +29,7 @@ export default Ember.Helper.helper(function(params,hash) {
   if (nodeState === "SHUTDOWN" || nodeState === "LOST") {
     html = html + nodeHTTPAddress;
   } else {
-    html = html + '<a href="#/yarn-node/' + nodeId + "/" + nodeHTTPAddress + 
'">' +
+    html = html + '<a href="#/yarn-node/' + nodeId + "/" + 
encodeURIComponent(nodeHTTPAddress) + '">' +
         nodeHTTPAddress + '</a>';
   }
   html = html + '</td>';

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42cd367c/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 51a318f..1f9c7c1 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
@@ -44,6 +44,7 @@ function updateConfigs(application) {
 
   if(!ENV.hosts.rmWebAddress) {
     ENV.hosts.rmWebAddress = rmhost;
+    ENV.hosts.protocolScheme = window.location.protocol;
   } else {
     rmhost = ENV.hosts.rmWebAddress;
   }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42cd367c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js
index 3a98558..a1d9f153 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-apps.js
@@ -23,10 +23,12 @@ import AbstractRoute from './abstract';
 export default AbstractRoute.extend({
   model(param) {
     // Get all apps running on a specific node. Node is contacted by using 
node_addr.
+    var address = decodeURIComponent(param.node_addr);
+    address = address.replace(/(^\w+:|^)\/\//, '');
     return Ember.RSVP.hash({
-      apps: this.store.query('yarn-node-app', { nodeAddr: param.node_addr }),
-      nmGpuInfo: this.store.findRecord('yarn-nm-gpu', param.node_addr, 
{reload:true}),
-      nodeInfo: { id: param.node_id, addr: param.node_addr }
+      apps: this.store.query('yarn-node-app', { nodeAddr: address }),
+      nmGpuInfo: this.store.findRecord('yarn-nm-gpu', address, {reload:true}),
+      nodeInfo: { id: param.node_id, addr: address }
     });
   },
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42cd367c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js
index 6968ce0..67c8fa6 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node-containers.js
@@ -22,10 +22,12 @@ import AbstractRoute from './abstract';
 export default AbstractRoute.extend({
   model(param) {
     // Get all containers running on specific node.
+    var address = decodeURIComponent(param.node_addr);
+    address = address.replace(/(^\w+:|^)\/\//, '');
     return Ember.RSVP.hash({
-      containers: this.store.query('yarn-node-container', { nodeHttpAddr: 
param.node_addr }),
-      nmGpuInfo: this.store.findRecord('yarn-nm-gpu', param.node_addr, 
{reload:true}),
-      nodeInfo: { id: param.node_id, addr: param.node_addr }
+      containers: this.store.query('yarn-node-container', { nodeHttpAddr: 
address }),
+      nmGpuInfo: this.store.findRecord('yarn-nm-gpu', address, {reload:true}),
+      nodeInfo: { id: param.node_id, addr: address }
     });
   },
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42cd367c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
index 7ce615c..0e0b701 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/yarn-node.js
@@ -23,10 +23,12 @@ import AbstractRoute from './abstract';
 export default AbstractRoute.extend({
   model(param) {
     // Fetches data from both NM and RM. RM is queried to get node usage info.
+    var address = decodeURIComponent(param.node_addr);
+    address = address.replace(/(^\w+:|^)\/\//, '');
     return Ember.RSVP.hash({
-      nodeInfo: { id: param.node_id, addr: param.node_addr },
-      nmGpuInfo: this.store.findRecord('yarn-nm-gpu', param.node_addr, 
{reload:true}),
-      node: this.store.findRecord('yarn-node', param.node_addr, {reload: 
true}),
+      nodeInfo: { id: param.node_id, addr: address },
+      nmGpuInfo: this.store.findRecord('yarn-nm-gpu', address, {reload:true}),
+      node: this.store.findRecord('yarn-node', address, {reload: true}),
       rmNode: this.store.findRecord('yarn-rm-node', param.node_id, {reload: 
true})
     });
   },

http://git-wip-us.apache.org/repos/asf/hadoop/blob/42cd367c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/node-menu-panel.hbs
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/node-menu-panel.hbs
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/node-menu-panel.hbs
index 966e408..acdff2f 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/node-menu-panel.hbs
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/node-menu-panel.hbs
@@ -25,20 +25,20 @@
         <ul class="nav nav-pills nav-stacked" id="stacked-menu">
           <ul class="nav nav-pills nav-stacked collapse in">
             {{#link-to 'yarn-node.info' tagName="li"}}
-              {{#link-to 'yarn-node.info' nodeId nodeAddr}}Node Information
+              {{#link-to 'yarn-node.info' nodeId encodedAddr}}Node Information
               {{/link-to}}
             {{/link-to}}
             {{#link-to 'yarn-node-apps' tagName="li"}}
-              {{#link-to 'yarn-node-apps' nodeId nodeAddr}}List of Applications
+              {{#link-to 'yarn-node-apps' nodeId encodedAddr}}List of 
Applications
               {{/link-to}}
             {{/link-to}}
             {{#link-to 'yarn-node-containers' tagName="li"}}
-              {{#link-to 'yarn-node-containers' nodeId nodeAddr}}List of 
Containers
+              {{#link-to 'yarn-node-containers' nodeId encodedAddr}}List of 
Containers
               {{/link-to}}
             {{/link-to}}
             {{#if (and nmGpuInfo nmGpuInfo.info.totalGpuDevices)}}
               {{#link-to 'yarn-node.yarn-nm-gpu' tagName="li"}}
-                {{#link-to 'yarn-node.yarn-nm-gpu' nodeId nodeAddr }}GPU 
Information
+                {{#link-to 'yarn-node.yarn-nm-gpu' nodeId encodedAddr }}GPU 
Information
                 {{/link-to}}
               {{/link-to}}
             {{/if}}


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to