YARN-7761. [UI2] Clicking 'master container log' or 'Link' next to 'log' under application's appAttempt goes to Old UI's Log link. Contributed by Akhil PB.

This commit is contained in:
Sunil G 2019-02-14 20:55:43 +05:30
parent f4b9ba230b
commit d321d0e747
13 changed files with 60 additions and 23 deletions

View File

@ -395,9 +395,9 @@ export default Ember.Component.extend({
contentPath: 'logsLink',
cellComponentName: 'em-table-html-cell',
getCellContent: function(row) {
var logUrl = self.checkHttpProtocol(row.get('logsLink'));
if (logUrl) {
return `<a href="${logUrl}" target="_blank">Link</a>`;
var containerLogUrl = row.get('appAttemptContainerLogsURL');
if (containerLogUrl) {
return `<a href="${containerLogUrl}">Link</a>`;
} else {
return 'N/A';
}
@ -470,9 +470,9 @@ export default Ember.Component.extend({
contentPath: 'logUrl',
cellComponentName: 'em-table-html-cell',
getCellContent: function(row) {
var url = self.checkHttpProtocol(row.get('logUrl'));
if (url) {
return `<a href="${url}" target="_blank">${url}</a>`;
var containerLogUrl = row.get('appAttemptContainerLogsURL');
if (containerLogUrl) {
return `<a href="${containerLogUrl}">Link</a>`;
} else {
return 'N/A';
}

View File

@ -20,8 +20,10 @@ import Ember from 'ember';
import Constants from 'yarn-ui/constants';
export default Ember.Controller.extend({
queryParams: ["service"],
queryParams: ["service", "attempt", "containerid"],
service: undefined,
attempt: undefined,
containerid: undefined,
selectedAttemptId: "",
attemptContainerList: null,
@ -40,7 +42,7 @@ export default Ember.Controller.extend({
},
actions: {
showContainersForAttemptId(attemptId) {
showContainersForAttemptId(attemptId, containerId = "") {
this.set("selectedAttemptId", "");
if (attemptId) {
this.set("_isLoadingTopPanel", true);
@ -75,6 +77,9 @@ export default Ember.Controller.extend({
}
this.set("attemptContainerList", containers);
this.initializeSelect(".js-fetch-logs-containers");
if (containerId) {
this.send("showLogFilesForContainerId", containerId);
}
})
.finally(() => {
this.set("_isLoadingTopPanel", false);

View File

@ -47,7 +47,7 @@ export default Ember.Helper.helper(function(params,hash) {
nodeAddr + '/' + containerId + '/' + logFileName + '">' + logFileName +
'</a>';
if (i !== logFilesLen - 1) {
html = html + ",";
html = html + ", ";
}
}
html = html + '</td>';

View File

@ -146,4 +146,10 @@ export default DS.Model.extend({
return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`;
}.property("nodeId", "nodeHttpAddress"),
appAttemptContainerLogsURL: function() {
const attemptId = this.get("id");
const containerId = this.get("appMasterContainerId");
const appId = Converter.attemptIdToAppId(attemptId);
return `#/yarn-app/${appId}/logs?attempt=${attemptId}&containerid=${containerId}`;
}.property("id", "appMasterContainerId")
});

View File

@ -66,4 +66,11 @@ export default DS.Model.extend({
var addr = encodeURIComponent(this.get("nodeHttpAddress"));
return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`;
}.property("nodeId", "nodeHttpAddress"),
appAttemptContainerLogsURL: function() {
const containerId = this.get("id");
const attemptId = Converter.containerIdToAttemptId(containerId);
const appId = Converter.attemptIdToAppId(attemptId);
return `#/yarn-app/${appId}/logs?attempt=${attemptId}&containerid=${containerId}`;
}.property("id")
});

View File

@ -67,4 +67,11 @@ export default DS.Model.extend({
var addr = encodeURIComponent(this.get("nodeHttpAddress"));
return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`;
}.property("nodeId", "nodeHttpAddress"),
appAttemptContainerLogsURL: function() {
const containerId = this.get("id");
const attemptId = Converter.containerIdToAttemptId(containerId);
const appId = Converter.attemptIdToAppId(attemptId);
return `#/yarn-app/${appId}/logs?attempt=${attemptId}&containerid=${containerId}`;
}.property("id")
});

View File

@ -37,8 +37,14 @@ export default AbstractRoute.extend(AppAttemptMixin, {
activate() {
const controller = this.controllerFor("yarn-app.logs");
const { attempt, containerid } = this.paramsFor('yarn-app.logs');
controller.resetAfterRefresh();
controller.initializeSelect();
if (attempt) {
controller.send("showContainersForAttemptId", attempt, containerid);
} else {
controller.set("selectedAttemptId", "");
}
},
unloadAll() {

View File

@ -22,12 +22,14 @@ import AbstractRoute from './abstract';
export default AbstractRoute.extend({
model(param) {
let nodeAddress = decodeURIComponent(param.node_addr);
nodeAddress = nodeAddress.replace(/(^\w+:|^)\/\//, '');
// Get a specific container running on a specific node.
return Ember.RSVP.hash({
nodeContainer: this.store.queryRecord('yarn-node-container',
{ nodeHttpAddr: param.node_addr, containerId: param.container_id }),
nmGpuInfo: this.store.findRecord('yarn-nm-gpu', param.node_addr, {reload:true}),
nodeInfo: { id: param.node_id, addr: param.node_addr, containerId: param.container_id }
{ nodeHttpAddr: nodeAddress, containerId: param.container_id }),
nmGpuInfo: this.store.findRecord('yarn-nm-gpu', nodeAddress, {reload:true}),
nodeInfo: { id: param.node_id, addr: nodeAddress, containerId: param.container_id }
});
},

View File

@ -56,10 +56,12 @@
<td title="{{attempt.nodeHttpAddress}}"><a href="{{attempt.masterNodeURL}}">{{attempt.nodeHttpAddress}}</a></td>
</tr>
{{/if}}
{{#if attempt.logsLink}}
{{#if attempt.appAttemptContainerLogsURL}}
<tr>
<td>Log</td>
<td><a href="{{prepend-protocol attempt.logsLink}}" target="_blank">Link</a></td>
<td>Logs</td>
<td>
<a href="{{attempt.appAttemptContainerLogsURL}}">Link</a>
</td>
</tr>
{{/if}}
{{#if attempt.diagnosticsInfo}}

View File

@ -54,10 +54,12 @@
<td title="{{container.nodeHttpAddress}}"><a href="{{container.masterNodeURL}}">{{container.nodeHttpAddress}}</a></td>
</tr>
{{/if}}
{{#if container.logUrl}}
{{#if container.appAttemptContainerLogsURL}}
<tr>
<td>Log</td>
<td><a href="{{prepend-protocol container.logUrl}}" target="_blank">Link</a></td>
<td>Logs</td>
<td>
<a href="{{container.appAttemptContainerLogsURL}}">Link</a>
</td>
</tr>
{{/if}}
</tbody>

View File

@ -19,7 +19,7 @@
{{breadcrumb-bar breadcrumbs=breadcrumbs}}
{{#if actionResponse}}
<div class="row">
<div class="alert-wrapper">
<div class="col-md-12">
<div class="alert alert-dismissible {{if (eq actionResponse.type 'error') 'alert-danger' 'alert-success'}}" role="alert">
<button class="close" data-dismiss="alert" aria-label="Close" {{action "resetActionResponse"}}><span aria-hidden="true">&times;</span></button>
@ -29,7 +29,7 @@
</div>
{{/if}}
<div class="panel-group">
<div class="panel-group col-md-12">
<div class="panel panel-default">
<div class="yarn-app-header">
<div class="flex">

View File

@ -20,7 +20,9 @@
<h4 align="center">Loading...</h4>
{{else}}
{{#if model.apps}}
<div class="col-md-12">
{{em-table columns=columns rows=model.apps definition=tableDefinition}}
</div>
{{else}}
<h4 align="center">Could not find any applications from this cluster</h4>
{{/if}}

View File

@ -129,9 +129,7 @@
<div class="col-lg-6 container-fluid">
<div class="panel panel-default">
<div class="panel-heading">
<li>
Resources - yarn.io/gpu
</li>
Resources - yarn.io/gpu
</div>
<div class="container-fluid" id="gpu-donut-chart">
{{donut-chart data=model.rmNode.getGpuDataForDonutChart