Skip to content

Commit

Permalink
feat: add ability to shift click log expand to expand all (#6629)
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime Caruchet <[email protected]>
  • Loading branch information
maximecaruchet authored Oct 10, 2023
1 parent 12af8fc commit 28f37f0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,20 +321,34 @@ export class WorkflowRunJobComponent implements OnInit, OnDestroy {
return DurationService.duration(fromM.toDate(), to ? to.toDate() : moment().toDate());
}

async clickExpandStepDown(index: number) {
async clickExpandStepDown(index: number, event: MouseEvent) {
let step = this.steps[index];

let limit = `${this.expandLoadLinesCount}`;
if (event.shiftKey) {
limit = '0';
}

let result = await this._workflowService.getLogLines(step.link,
{ offset: `${step.lines[step.lines.length - 1].number + 1}`, limit: `${this.expandLoadLinesCount}` }
{offset: `${step.lines[step.lines.length - 1].number + 1}`, limit: limit}
).toPromise();
this.steps[index].totalLinesCount = result.totalCount;
this.steps[index].lines = step.lines.concat(result.lines.filter(l => !step.endLines.find(line => line.number === l.number)));
this._cd.markForCheck();
}

async clickExpandStepUp(index: number) {
async clickExpandStepUp(index: number, event: MouseEvent) {
let step = this.steps[index];

let offset = `-${step.endLines.length + this.expandLoadLinesCount}`;
let limit = `${this.expandLoadLinesCount}`;
if (event.shiftKey) {
offset = `${step.lines[step.lines.length - 1].number + 1}`;
limit = '0';
}

let result = await this._workflowService.getLogLines(step.link,
{ offset: `-${step.endLines.length + this.expandLoadLinesCount}`, limit: `${this.expandLoadLinesCount}` }
{ offset: offset, limit: limit }
).toPromise();
this.steps[index].totalLinesCount = result.totalCount;
this.steps[index].endLines = result.lines.filter(l => !step.lines.find(line => line.number === l.number)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</div>
</div>
<div class="line expand" *ngIf="step.lines.length + step.endLines.length < step.totalLinesCount"
(click)="clickExpandStepDown(i)">
(click)="clickExpandStepDown(i, $event)">
<div class="number">
<i nz-icon nzType="caret-down" nzTheme="fill"></i>
{{step.firstDisplayedLineNumber +
Expand All @@ -65,7 +65,7 @@
</div>
<div class="line expand"
*ngIf="step.lines.length + step.endLines.length < (step.totalLinesCount - expandLoadLinesCount) - 1"
(click)="clickExpandStepUp(i)">
(click)="clickExpandStepUp(i, $event)">
<div class="number"><i nz-icon nzType="caret-up" nzTheme="fill"></i>{{(step.firstDisplayedLineNumber +
step.totalLinesCount) - step.endLines.length}}
</div>
Expand Down

0 comments on commit 28f37f0

Please sign in to comment.