From 556a2c4bc754751eabed699c7709e4a5a001fe64 Mon Sep 17 00:00:00 2001 From: pgiertych Date: Thu, 7 Mar 2024 23:00:28 +0100 Subject: [PATCH] fix scroll --- .../app-log-access/app-log-access.component.html | 2 +- .../app-log-access/app-log-access.component.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/appmarket/appinstance/app-log-access/app-log-access.component.html b/src/app/appmarket/appinstance/app-log-access/app-log-access.component.html index 097e150..d798ba3 100644 --- a/src/app/appmarket/appinstance/app-log-access/app-log-access.component.html +++ b/src/app/appmarket/appinstance/app-log-access/app-log-access.component.html @@ -19,7 +19,7 @@

{{ 'APP_INSTANCE.LOG_ACCESS.HEADER' | translate}}

{{ 'APP_INSTANCE.LOG_ACCESS.CONTAINER' | translate}}

- diff --git a/src/app/appmarket/appinstance/app-log-access/app-log-access.component.ts b/src/app/appmarket/appinstance/app-log-access/app-log-access.component.ts index c317ca0..a1e0287 100644 --- a/src/app/appmarket/appinstance/app-log-access/app-log-access.component.ts +++ b/src/app/appmarket/appinstance/app-log-access/app-log-access.component.ts @@ -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) { } @@ -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 => { @@ -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 (_) {} } }