Skip to content

Commit

Permalink
fix scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
pgiertych committed Mar 7, 2024
1 parent 8a82bf6 commit 556a2c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h2 class="mb-5">{{ 'APP_INSTANCE.LOG_ACCESS.HEADER' | translate}}</h2>
</div>
<div *ngIf="!isLoading" class="ml-5">
<p class="font-bold pl-2">{{ 'APP_INSTANCE.LOG_ACCESS.CONTAINER' | translate}}</p>
<p-dropdown #dropdown [options]="selectedPodInfo.containers" [(ngModel)]="selectedContainer"
<p-dropdown [options]="selectedPodInfo.containers" [(ngModel)]="selectedContainer"
(onChange)="selectContainer()"
placeholder="{{ 'APP_INSTANCE.LOG_ACCESS.DROPDOWN_PLACEHOLDER' | translate}}"
class="col-2 bottom">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ export class AppLogAccessComponent implements OnInit, AfterViewChecked {
public selectedPodLogs: PodLogs = undefined;
public selectedContainer: string = undefined;
public isLoading = true;
private scrolledToBottom = false;

public blobUrl;

@ViewChild('terminal', {static: false}) private terminalElement: ElementRef;

@ViewChild('dropdown', {static: false}) private containerDropdown: ElementRef;

constructor(private logService: AppLogsService,
private route: ActivatedRoute) {
}
Expand Down Expand Up @@ -82,6 +81,7 @@ export class AppLogAccessComponent implements OnInit, AfterViewChecked {
}

retrieveLogs() {
this.scrolledToBottom = false
this.isLoading = true
this.logService.getLogsFromPod(this.appInstanceId, this.selectedPodInfo.name, this.selectedContainer).subscribe(
podLogs => {
Expand All @@ -93,7 +93,10 @@ export class AppLogAccessComponent implements OnInit, AfterViewChecked {

scrollToBottom(): void {
try {
this.terminalElement.nativeElement.scrollTop = this.terminalElement.nativeElement.scrollHeight;
if (!this.scrolledToBottom) {
this.terminalElement.nativeElement.scrollTop = this.terminalElement.nativeElement.scrollHeight;
this.scrolledToBottom = true;
}
} catch (_) {}
}
}

0 comments on commit 556a2c4

Please sign in to comment.