Skip to content

Commit a127aee

Browse files
authored
fix(ui): logs not displayed when count of lines too long (#5130)
1 parent dd502d8 commit a127aee

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

ui/src/app/views/workflow/run/node/pipeline/spawninfo/spawninfo.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@import "../../../../../../../common";
22

3-
$squareSize: 32px;
3+
$squareSize: 30px;
44

55
.header {
66
display: flex;
@@ -41,12 +41,14 @@ $squareSize: 32px;
4141
background-color: #222;
4242
color: white;
4343
clear: both;
44-
padding: 10px $squareSize 10px $squareSize;
44+
padding: 10px 20px 10px 20px;
4545

4646
pre {
4747
font-size: 0.8em;
4848
line-height: 1.1em;
4949
max-height: 300px;
5050
overflow-y: auto;
51+
margin-top: 0px;
52+
margin-bottom: 0px;
5153
}
5254
}

ui/src/app/views/workflow/run/node/pipeline/step/step.log.component.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { DurationService } from 'app/shared/duration/duration.service';
2222
import { CDSWebWorker } from 'app/shared/worker/web.worker';
2323
import { ProjectState } from 'app/store/project.state';
2424
import { WorkflowState, WorkflowStateModel } from 'app/store/workflow.state';
25+
import cloneDeep from 'lodash-es/cloneDeep';
2526
import { Observable, Subscription } from 'rxjs';
2627

2728
@Component({
@@ -56,7 +57,7 @@ export class WorkflowStepLogComponent implements OnInit, OnDestroy {
5657
doneExec: Date;
5758
duration: string;
5859
selectedLine: number;
59-
splittedLogs: { lineNumber: number, value: string }[] = [];
60+
splittedLogs: { lineNumber: number, value: string }[];
6061
splittedLogsToDisplay: { lineNumber: number, value: string }[] = [];
6162
limitFrom: number;
6263
limitTo: number;
@@ -117,7 +118,7 @@ export class WorkflowStepLogComponent implements OnInit, OnDestroy {
117118
if (nrj.job.step_status && nrj.job.step_status.length >= this.stepOrder + 1) {
118119
let status = nrj.job.step_status[this.stepOrder].status;
119120
if (!this.stepStatus || status !== this.stepStatus.status) {
120-
if (!this.stepStatus ) {
121+
if (!this.stepStatus) {
121122
this.initWorker();
122123
this.showLogs = true;
123124
} else if (this.pipelineBuildStatusEnum.isActive(this.stepStatus.status) &&
@@ -231,7 +232,7 @@ export class WorkflowStepLogComponent implements OnInit, OnDestroy {
231232

232233
parseLogs() {
233234
let tmpLogs = this.getLogsSplitted();
234-
if ( (!this.splittedLogs && !tmpLogs) || (this.splittedLogs && tmpLogs && this.splittedLogs.length === tmpLogs.length)) {
235+
if ((!this.splittedLogs && !tmpLogs) || (this.splittedLogs && tmpLogs && this.splittedLogs.length === tmpLogs.length)) {
235236
return;
236237
}
237238
if (!this.splittedLogs || this.splittedLogs.length > tmpLogs.length) {
@@ -243,19 +244,20 @@ export class WorkflowStepLogComponent implements OnInit, OnDestroy {
243244
});
244245
} else {
245246
this.splittedLogs.push(...tmpLogs.slice(this.splittedLogs.length).map((log, i) => {
246-
if (this.ansiViewSelected) {
247-
return { lineNumber: this.splittedLogs.length + i, value: this.ansi_up.ansi_to_html(log) };
248-
}
249-
return { lineNumber: this.splittedLogs.length + i, value: log };
247+
if (this.ansiViewSelected) {
248+
return { lineNumber: this.splittedLogs.length + i + 1, value: this.ansi_up.ansi_to_html(log) };
249+
}
250+
return { lineNumber: this.splittedLogs.length + i + 1, value: log };
250251
}));
251252
}
252-
if (!this.allLogsView && this.splittedLogs.length > this.MAX_PRETTY_LOGS_LINES && !this._route.snapshot.fragment) {
253+
254+
this.splittedLogsToDisplay = cloneDeep(this.splittedLogs);
255+
if (!this.allLogsView && this.splittedLogsToDisplay.length > this.MAX_PRETTY_LOGS_LINES && !this._route.snapshot.fragment) {
253256
this.limitFrom = 30;
254257
this.limitTo = this.splittedLogs.length - 40;
255258
this.splittedLogsToDisplay.splice(this.limitFrom, this.limitTo - this.limitFrom);
256-
} else {
257-
this.splittedLogsToDisplay = this.splittedLogs;
258259
}
260+
259261
this._cd.markForCheck();
260262
}
261263

@@ -325,12 +327,13 @@ export class WorkflowStepLogComponent implements OnInit, OnDestroy {
325327
showAllLogs() {
326328
this.loadingMore = true;
327329
this.allLogsView = true;
330+
this._cd.markForCheck();
328331
setTimeout(() => {
329332
this.limitFrom = null;
330333
if (this.splittedLogs.length > this.MAX_PRETTY_LOGS_LINES) {
331334
this.basicView = true;
332335
}
333-
this.splittedLogsToDisplay = this.splittedLogs;
336+
this.splittedLogsToDisplay = cloneDeep(this.splittedLogs);
334337
this.loadingMore = false;
335338
this._cd.markForCheck();
336339
}, 0);

ui/src/app/views/workflow/run/node/pipeline/step/step.log.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
</ng-container>
6060
</tbody>
6161
</table></pre>
62-
<pre *ngIf="basicView && logs" class="ml50">{{logs.val}}</pre>
62+
<pre *ngIf="basicView && logs">{{logs.val}}</pre>
6363
<textarea class="fakeInput" name="fakeInput" #logsContent></textarea>
6464
<div class="ui active centered inline loader" *ngIf="loading"></div>
6565
</div>

ui/src/app/views/workflow/run/node/pipeline/step/step.log.scss

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ $yellowLogs: #FFFF91;
55
.mb25 {
66
margin-bottom: 25px;
77
}
8-
.ml50 {
9-
margin-left: 50px;
10-
}
118

129
.logHeader {
1310
display: flex;
@@ -49,8 +46,7 @@ $yellowLogs: #FFFF91;
4946
background-color: #222;
5047
color: white;
5148
clear: both;
52-
padding: 10px $squareSize 10px $squareSize;
53-
padding-left: 0px;
49+
padding: 10px;
5450
position: relative;
5551

5652
.toolbar {

0 commit comments

Comments
 (0)