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

View File

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

View File

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

View File

@ -146,4 +146,10 @@ export default DS.Model.extend({
return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`; return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`;
}.property("nodeId", "nodeHttpAddress"), }.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")); var addr = encodeURIComponent(this.get("nodeHttpAddress"));
return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`; return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`;
}.property("nodeId", "nodeHttpAddress"), }.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")); var addr = encodeURIComponent(this.get("nodeHttpAddress"));
return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`; return `#/yarn-node/${this.get("nodeId")}/${addr}/info/`;
}.property("nodeId", "nodeHttpAddress"), }.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() { activate() {
const controller = this.controllerFor("yarn-app.logs"); const controller = this.controllerFor("yarn-app.logs");
const { attempt, containerid } = this.paramsFor('yarn-app.logs');
controller.resetAfterRefresh(); controller.resetAfterRefresh();
controller.initializeSelect(); controller.initializeSelect();
if (attempt) {
controller.send("showContainersForAttemptId", attempt, containerid);
} else {
controller.set("selectedAttemptId", "");
}
}, },
unloadAll() { unloadAll() {

View File

@ -22,12 +22,14 @@ import AbstractRoute from './abstract';
export default AbstractRoute.extend({ export default AbstractRoute.extend({
model(param) { model(param) {
let nodeAddress = decodeURIComponent(param.node_addr);
nodeAddress = nodeAddress.replace(/(^\w+:|^)\/\//, '');
// Get a specific container running on a specific node. // Get a specific container running on a specific node.
return Ember.RSVP.hash({ return Ember.RSVP.hash({
nodeContainer: this.store.queryRecord('yarn-node-container', nodeContainer: this.store.queryRecord('yarn-node-container',
{ nodeHttpAddr: param.node_addr, containerId: param.container_id }), { nodeHttpAddr: nodeAddress, containerId: param.container_id }),
nmGpuInfo: this.store.findRecord('yarn-nm-gpu', param.node_addr, {reload:true}), nmGpuInfo: this.store.findRecord('yarn-nm-gpu', nodeAddress, {reload:true}),
nodeInfo: { id: param.node_id, addr: param.node_addr, containerId: param.container_id } 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> <td title="{{attempt.nodeHttpAddress}}"><a href="{{attempt.masterNodeURL}}">{{attempt.nodeHttpAddress}}</a></td>
</tr> </tr>
{{/if}} {{/if}}
{{#if attempt.logsLink}} {{#if attempt.appAttemptContainerLogsURL}}
<tr> <tr>
<td>Log</td> <td>Logs</td>
<td><a href="{{prepend-protocol attempt.logsLink}}" target="_blank">Link</a></td> <td>
<a href="{{attempt.appAttemptContainerLogsURL}}">Link</a>
</td>
</tr> </tr>
{{/if}} {{/if}}
{{#if attempt.diagnosticsInfo}} {{#if attempt.diagnosticsInfo}}

View File

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

View File

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

View File

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

View File

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