YARN-9089. Add Terminal Link to Service component instance page for UI2. Contributed by Eric Yang
This commit is contained in:
parent
1ea29b7385
commit
aab310978f
@ -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 {
|
||||
|
@ -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({
|
||||
|
@ -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;
|
||||
})
|
||||
});
|
||||
|
@ -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');
|
||||
}
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user