YARN-5785. [YARN-3368] Accessing applications and containers list from Node page is throwing few exceptions in console. (Akhil P B and Sreenath Somarajapuram via Sunil G)

This commit is contained in:
sunilg 2016-10-28 19:56:18 +05:30 committed by Wangda Tan
parent fad392a22f
commit 013ff07bc6
6 changed files with 8 additions and 27 deletions

View File

@ -25,22 +25,14 @@ export default AbstractAdapter.extend({
serverName: "NM", serverName: "NM",
urlForQuery(query) { urlForQuery(query) {
var extension = this.get("host").split('/').pop();
if (extension != query.nodeAddr) {
this.host = this.get("host") + query.nodeAddr;
}
var url = this._buildURL(); var url = this._buildURL();
url = url + "/apps"; url = url.replace("{nodeAddress}", query.nodeAddr) + "/apps";
return url; return url;
}, },
urlForQueryRecord: function (query) { urlForQueryRecord: function (query) {
var extension = this.get("host").split('/').pop();
if (extension != query.nodeAddr) {
this.host = this.get("host") + query.nodeAddr;
}
var url = this._buildURL(); var url = this._buildURL();
url = url + "/apps/" + query.appId; url = url.replace("{nodeAddress}", query.nodeAddr) + "/apps/" + query.appId;
return url; return url;
}, },

View File

@ -25,22 +25,14 @@ export default AbstractAdapter.extend({
serverName: "NM", serverName: "NM",
urlForQuery(query) { urlForQuery(query) {
var extension = this.get("host").split('/').pop();
if (extension != query.nodeHttpAddr) {
this.host = this.get("host") + query.nodeHttpAddr;
}
var url = this._buildURL(); var url = this._buildURL();
url = url + "/containers"; url = url.replace("{nodeAddress}", query.nodeHttpAddr) + "/containers";
return url; return url;
}, },
urlForQueryRecord(query) { urlForQueryRecord(query) {
var extension = this.get("host").split('/').pop();
if (extension != query.nodeHttpAddr) {
this.host = this.get("host") + query.nodeHttpAddr;
}
var url = this._buildURL(); var url = this._buildURL();
url = url + "/containers/" + query.containerId; url = url.replace("{nodeAddress}", query.nodeHttpAddr) + "/containers/" + query.containerId;
return url; return url;
}, },

View File

@ -25,11 +25,8 @@ export default AbstractAdapter.extend({
serverName: "NM", serverName: "NM",
urlForFindRecord(id, modelName, snapshot) { urlForFindRecord(id, modelName, snapshot) {
var extension = this.get("host").split('/').pop();
if (extension != id) {
this.host = this.get("host") + id;
}
var url = this._buildURL(); var url = this._buildURL();
url = url.replace("{nodeAddress}", id);
return url; return url;
}, },

View File

@ -68,7 +68,7 @@ export default DS.JSONAPISerializer.extend({
// expected return response is of the form { data: [ {}, {} ] } // expected return response is of the form { data: [ {}, {} ] }
var normalizedArrayResponse = {}; var normalizedArrayResponse = {};
// payload is of the form { "apps" : { "app": [ {},{},{} ] } } // payload is of the form { "apps" : { "app": [ {},{},{} ] } }
if (payload.apps) { if (payload.apps && payload.apps.app) {
normalizedArrayResponse.data = payload.apps.app.map(singleApp => { normalizedArrayResponse.data = payload.apps.app.map(singleApp => {
return this.internalNormalizeSingleResponse(store, primaryModelClass, return this.internalNormalizeSingleResponse(store, primaryModelClass,
singleApp); singleApp);

View File

@ -54,7 +54,7 @@ export default DS.JSONAPISerializer.extend({
requestType) { requestType) {
// expected return response is of the form { data: [ {}, {} ] } // expected return response is of the form { data: [ {}, {} ] }
var normalizedArrayResponse = {}; var normalizedArrayResponse = {};
if (payload.containers) { if (payload.containers && payload.containers.container) {
// payload is of the form { "containers" : { "container": [ {},{},{} ] } } // payload is of the form { "containers" : { "container": [ {},{},{} ] } }
normalizedArrayResponse.data = normalizedArrayResponse.data =
payload.containers.container.map(singleContainer => { payload.containers.container.map(singleContainer => {

View File

@ -27,6 +27,6 @@ module.exports = { // Yarn UI App configurations
timeline: 'ws/v1/applicationhistory', timeline: 'ws/v1/applicationhistory',
cluster: 'ws/v1/cluster', cluster: 'ws/v1/cluster',
metrics: 'ws/v1/cluster/metrics', metrics: 'ws/v1/cluster/metrics',
node: 'ws/v1/node' node: '{nodeAddress}/ws/v1/node'
}, },
}; };