YARN-9715. [UI2] yarn-container-log URI need to be encoded to avoid potential misuses. Contributed by Akhil PB.
(cherry picked from commit acffec7a92
)
This commit is contained in:
parent
3e9071207a
commit
9fb6c6e2a1
|
@ -23,6 +23,7 @@ export default Ember.Controller.extend({
|
||||||
breadcrumbs: Ember.computed('model.nodeInfo', 'model.containerInfo', function () {
|
breadcrumbs: Ember.computed('model.nodeInfo', 'model.containerInfo', function () {
|
||||||
var nodeInfo = this.get('model.nodeInfo'),
|
var nodeInfo = this.get('model.nodeInfo'),
|
||||||
containerInfo = this.get('model.containerInfo');
|
containerInfo = this.get('model.containerInfo');
|
||||||
|
var nodeAddr = encodeURIComponent(nodeInfo.addr);
|
||||||
return [{
|
return [{
|
||||||
text: "Home",
|
text: "Home",
|
||||||
routeName: 'application'
|
routeName: 'application'
|
||||||
|
@ -31,10 +32,10 @@ export default Ember.Controller.extend({
|
||||||
routeName: 'yarn-nodes.table'
|
routeName: 'yarn-nodes.table'
|
||||||
}, {
|
}, {
|
||||||
text: `Node [ ${nodeInfo.id} ]`,
|
text: `Node [ ${nodeInfo.id} ]`,
|
||||||
href: `#/yarn-node/${nodeInfo.id}/${nodeInfo.addr}`,
|
href: `#/yarn-node/${nodeInfo.id}/${nodeAddr}/info`,
|
||||||
}, {
|
}, {
|
||||||
text: `Container [ ${containerInfo.id} ]`,
|
text: `Container [ ${containerInfo.id} ]`,
|
||||||
href: `#/yarn-node-container/${nodeInfo.id}/${nodeInfo.addr}/${containerInfo.id}`,
|
href: `#/yarn-node-container/${nodeInfo.id}/${nodeAddr}/${containerInfo.id}`,
|
||||||
}, {
|
}, {
|
||||||
text: "Log",
|
text: "Log",
|
||||||
}];
|
}];
|
||||||
|
|
|
@ -35,6 +35,11 @@ export default Ember.Controller.extend({
|
||||||
}, {
|
}, {
|
||||||
text: `Application [ ${nodeInfo.appId} ]`,
|
text: `Application [ ${nodeInfo.appId} ]`,
|
||||||
}];
|
}];
|
||||||
|
}),
|
||||||
|
|
||||||
|
encodedNodeAddr: Ember.computed("model.nodeInfo", function() {
|
||||||
|
var nodeInfo = this.get("model.nodeInfo");
|
||||||
|
return encodeURIComponent(nodeInfo.addr);
|
||||||
})
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,6 +35,11 @@ export default Ember.Controller.extend({
|
||||||
}, {
|
}, {
|
||||||
text: "Applications",
|
text: "Applications",
|
||||||
}];
|
}];
|
||||||
|
}),
|
||||||
|
|
||||||
|
encodedNodeAddr: Ember.computed("model.nodeInfo", function() {
|
||||||
|
var nodeInfo = this.get("model.nodeInfo");
|
||||||
|
return encodeURIComponent(nodeInfo.addr);
|
||||||
})
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,6 +35,11 @@ export default Ember.Controller.extend({
|
||||||
}, {
|
}, {
|
||||||
text: `Container [ ${nodeInfo.containerId} ]`
|
text: `Container [ ${nodeInfo.containerId} ]`
|
||||||
}];
|
}];
|
||||||
|
}),
|
||||||
|
|
||||||
|
encodedNodeAddr: Ember.computed("model.nodeInfo", function() {
|
||||||
|
var nodeInfo = this.get("model.nodeInfo");
|
||||||
|
return encodeURIComponent(nodeInfo.addr);
|
||||||
})
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,6 +35,11 @@ export default Ember.Controller.extend({
|
||||||
}, {
|
}, {
|
||||||
text: "Containers",
|
text: "Containers",
|
||||||
}];
|
}];
|
||||||
|
}),
|
||||||
|
|
||||||
|
encodedNodeAddr: Ember.computed("model.nodeInfo", function() {
|
||||||
|
var nodeInfo = this.get("model.nodeInfo");
|
||||||
|
return encodeURIComponent(nodeInfo.addr);
|
||||||
})
|
})
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,12 +23,14 @@ import AbstractRoute from './abstract';
|
||||||
|
|
||||||
export default AbstractRoute.extend({
|
export default AbstractRoute.extend({
|
||||||
model(param) {
|
model(param) {
|
||||||
var id = param.node_addr + Constants.PARAM_SEPARATOR + param.container_id +
|
var nodeAddress = decodeURIComponent(param.node_addr);
|
||||||
|
nodeAddress = nodeAddress.replace(/(^\w+:|^)\/\//, '');
|
||||||
|
var id = nodeAddress + Constants.PARAM_SEPARATOR + param.container_id +
|
||||||
Constants.PARAM_SEPARATOR + param.filename;
|
Constants.PARAM_SEPARATOR + param.filename;
|
||||||
return Ember.RSVP.hash({
|
return Ember.RSVP.hash({
|
||||||
containerLog: this.store.findRecord('yarn-container-log', id),
|
containerLog: this.store.findRecord('yarn-container-log', id),
|
||||||
containerInfo: { id: param.container_id },
|
containerInfo: { id: param.container_id },
|
||||||
nodeInfo: { id: param.node_id, addr: param.node_addr }
|
nodeInfo: { id: param.node_id, addr: nodeAddress }
|
||||||
}).then(function(hash) {
|
}).then(function(hash) {
|
||||||
// Just return as its success.
|
// Just return as its success.
|
||||||
return hash;
|
return hash;
|
||||||
|
@ -38,7 +40,7 @@ export default AbstractRoute.extend({
|
||||||
return reason;
|
return reason;
|
||||||
} else {
|
} else {
|
||||||
// Assume empty response received from server.
|
// Assume empty response received from server.
|
||||||
return { nodeInfo: { id: param.node_id, addr: param.node_addr },
|
return { nodeInfo: { id: param.node_id, addr: nodeAddress },
|
||||||
containerInfo: { id: param.container_id },
|
containerInfo: { id: param.container_id },
|
||||||
containerLog: { logs: "", containerID: param.container_id,
|
containerLog: { logs: "", containerID: param.container_id,
|
||||||
logFileName: param.filename}};
|
logFileName: param.filename}};
|
||||||
|
|
|
@ -22,11 +22,13 @@ import AbstractRoute from './abstract';
|
||||||
|
|
||||||
export default AbstractRoute.extend({
|
export default AbstractRoute.extend({
|
||||||
model(param) {
|
model(param) {
|
||||||
|
var address = decodeURIComponent(param.node_addr);
|
||||||
|
address = address.replace(/(^\w+:|^)\/\//, '');
|
||||||
return Ember.RSVP.hash({
|
return Ember.RSVP.hash({
|
||||||
nodeApp: this.store.queryRecord('yarn-node-app',
|
nodeApp: this.store.queryRecord('yarn-node-app',
|
||||||
{ nodeAddr : param.node_addr, appId: param.app_id }),
|
{ nodeAddr : address, appId: param.app_id }),
|
||||||
nmGpuInfo: this.store.findRecord('yarn-nm-gpu', param.node_addr, {reload:true}),
|
nmGpuInfo: this.store.findRecord('yarn-nm-gpu', address, {reload:true}),
|
||||||
nodeInfo: { id: param.node_id, addr: param.node_addr, appId: param.app_id }
|
nodeInfo: { id: param.node_id, addr: address, appId: param.app_id }
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{{#each model.nodeApp.containers as |container|}}
|
{{#each model.nodeApp.containers as |container|}}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="#/yarn-node-container/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{container}}">{{container}}</a></td>
|
<td><a href="#/yarn-node-container/{{model.nodeInfo.id}}/{{encodedNodeAddr}}/{{container}}">{{container}}</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
{{#if model.apps}}
|
{{#if model.apps}}
|
||||||
{{#each model.apps as |app|}}
|
{{#each model.apps as |app|}}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="#/yarn-node-app/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{app.appId}}">{{app.appId}}</a></td>
|
<td><a href="#/yarn-node-app/{{model.nodeInfo.id}}/{{encodedNodeAddr}}/{{app.appId}}">{{app.appId}}</a></td>
|
||||||
<td><span class={{app.appStateStyle}}>{{app.state}}</span></td>
|
<td><span class={{app.appStateStyle}}>{{app.state}}</span></td>
|
||||||
<td>{{app.user}}</td>
|
<td>{{app.user}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
<td>Link to Logs</td>
|
<td>Link to Logs</td>
|
||||||
<td>
|
<td>
|
||||||
{{log-files-comma nodeId=model.nodeInfo.id
|
{{log-files-comma nodeId=model.nodeInfo.id
|
||||||
nodeAddr=model.nodeInfo.addr
|
nodeAddr=encodedNodeAddr
|
||||||
containerId=model.nodeContainer.containerId
|
containerId=model.nodeContainer.containerId
|
||||||
logFiles=model.nodeContainer.containerLogFiles}}
|
logFiles=model.nodeContainer.containerLogFiles}}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -36,12 +36,12 @@
|
||||||
{{#if model.containers}}
|
{{#if model.containers}}
|
||||||
{{#each model.containers as |container|}}
|
{{#each model.containers as |container|}}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="#/yarn-node-container/{{model.nodeInfo.id}}/{{model.nodeInfo.addr}}/{{container.containerId}}">{{container.containerId}}</a></td>
|
<td><a href="#/yarn-node-container/{{model.nodeInfo.id}}/{{encodedNodeAddr}}/{{container.containerId}}">{{container.containerId}}</a></td>
|
||||||
<td><span class={{container.containerStateStyle}}>{{container.state}}</span></td>
|
<td><span class={{container.containerStateStyle}}>{{container.state}}</span></td>
|
||||||
<td>{{container.user}}</td>
|
<td>{{container.user}}</td>
|
||||||
<td>
|
<td>
|
||||||
{{log-files-comma nodeId=model.nodeInfo.id
|
{{log-files-comma nodeId=model.nodeInfo.id
|
||||||
nodeAddr=model.nodeInfo.addr
|
nodeAddr=encodedNodeAddr
|
||||||
containerId=container.containerId
|
containerId=container.containerId
|
||||||
logFiles=container.containerLogFiles}}
|
logFiles=container.containerLogFiles}}
|
||||||
</td>
|
</td>
|
||||||
|
|
Loading…
Reference in New Issue