YARN-10233. Fix YARN UI2 Daemon Logs

Contributed by Akhil PB.
This commit is contained in:
Prabhu Joseph 2020-04-15 13:39:33 +05:30 committed by Prabhu Joseph
parent 55fcbcb5c2
commit 94f7470c71
5 changed files with 25 additions and 19 deletions

View File

@ -2,3 +2,4 @@ tmp/
node_modules/
bower_components/
dist/
node/

View File

@ -19,5 +19,6 @@
import DS from 'ember-data';
export default DS.Model.extend({
logfileName: DS.attr()
logFileName: DS.attr(),
logFileUrl: DS.attr()
});

View File

@ -19,8 +19,8 @@
import DS from 'ember-data';
export default DS.JSONAPISerializer.extend({
normalizeResponse(store, primaryModelClass, payload, id, requestType) {
const pattern = new RegExp('<A HREF="/logs/.+">', 'g');
normalizeResponse(store, primaryModelClass, payload) {
const pattern = new RegExp('<A HREF="/logs/.+">|<a href="/logs/.+">', 'g');
let fileNames = payload.match(pattern);
if (fileNames == null) {
@ -29,16 +29,20 @@ export default DS.JSONAPISerializer.extend({
let logfileNames = [];
for (var i = 0; i < fileNames.length; i++) {
var fileName = fileNames[i].match(/<A HREF="(\/logs\/.+)">/);
if (fileName.length != null) {
logfileNames.push({
id: i,
type: primaryModelClass.modelName,
attributes: {
logfileName: fileName[1]
}
});
}
var fileNameMatch = fileNames[i].match(/<A HREF="(\/logs\/.+)">.+<\/A>|<a href="(\/logs\/.+)">.+<\/a>/);
var logFileUrl = fileNameMatch[1] || fileNameMatch[2];
var logFileName = logFileUrl.replace('logs', '').replace(/\//g, '');
if (fileNameMatch.length != null) {
logfileNames.push({
id: i,
type: primaryModelClass.modelName,
attributes: {
logFileUrl: logFileUrl,
logFileName: logFileName
}
});
}
}
return { data : logfileNames };
},

View File

@ -52,7 +52,7 @@
{{/link-to}}
{{/link-to}}
{{#link-to 'yarn-tools.yarn-rm-log' tagName="li"}}
{{#link-to 'yarn-tools.yarn-rm-log'}}YARN Daemon logs
{{#link-to 'yarn-tools.yarn-rm-log'}}YARN Daemon Logs
{{/link-to}}
{{/link-to}}
</ul>

View File

@ -17,15 +17,15 @@
}}
<h1>YARN Daemon Logs</h1>
<div class="col-md-12 container-fluid">
<div class="col-md-10">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<ul class="list-group">
{{#if model.logs}}
{{#each model.logs as |log|}}
<li class=list-group-item>
{{#link-to 'yarn-tools.yarn-rm-log' (query-params filename=log.logfileName)}}
{{log.logfileName}}
<li class="list-group-item">
{{#link-to 'yarn-tools.yarn-rm-log' (query-params filename=log.logFileUrl)}}
{{log.logFileName}}
{{/link-to}}
</li>
{{/each}}