From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 17 Jan 2024 07:00:18 +0000 (-0800) Subject: Fix: tweak how auto-scrolling of logs works X-Git-Tag: v2.4.0~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=648dc709fda24cb6d6030a2504921b1650be7782;p=thirdparty%2Fpaperless-ngx.git Fix: tweak how auto-scrolling of logs works --- diff --git a/src-ui/src/app/components/admin/logs/logs.component.html b/src-ui/src/app/components/admin/logs/logs.component.html index b75f85ae50..9a0a71cd85 100644 --- a/src-ui/src/app/components/admin/logs/logs.component.html +++ b/src-ui/src/app/components/admin/logs/logs.component.html @@ -3,8 +3,8 @@ i18n-title info="Review the log files for the application and for email checking." i18n-info> -
- +
+
diff --git a/src-ui/src/app/components/admin/logs/logs.component.ts b/src-ui/src/app/components/admin/logs/logs.component.ts index 0c1231a48a..1b2dbef3e8 100644 --- a/src-ui/src/app/components/admin/logs/logs.component.ts +++ b/src-ui/src/app/components/admin/logs/logs.component.ts @@ -2,9 +2,9 @@ import { Component, ElementRef, OnInit, - AfterViewChecked, ViewChild, OnDestroy, + ChangeDetectorRef, } from '@angular/core' import { Subject, takeUntil } from 'rxjs' import { LogService } from 'src/app/services/rest/log.service' @@ -14,8 +14,11 @@ import { LogService } from 'src/app/services/rest/log.service' templateUrl: './logs.component.html', styleUrls: ['./logs.component.scss'], }) -export class LogsComponent implements OnInit, AfterViewChecked, OnDestroy { - constructor(private logService: LogService) {} +export class LogsComponent implements OnInit, OnDestroy { + constructor( + private logService: LogService, + private changedetectorRef: ChangeDetectorRef + ) {} public logs: string[] = [] @@ -47,10 +50,6 @@ export class LogsComponent implements OnInit, AfterViewChecked, OnDestroy { }) } - ngAfterViewChecked() { - this.scrollToBottom() - } - ngOnDestroy(): void { this.unsubscribeNotifier.next(true) this.unsubscribeNotifier.complete() @@ -66,6 +65,7 @@ export class LogsComponent implements OnInit, AfterViewChecked, OnDestroy { next: (result) => { this.logs = result this.isLoading = false + this.scrollToBottom() }, error: () => { this.logs = [] @@ -89,6 +89,7 @@ export class LogsComponent implements OnInit, AfterViewChecked, OnDestroy { } scrollToBottom(): void { + this.changedetectorRef.detectChanges() this.logContainer?.nativeElement.scroll({ top: this.logContainer.nativeElement.scrollHeight, left: 0,