diff --git a/src/app/pages/base-page/base-page.component.ts b/src/app/pages/base-page/base-page.component.ts
index 3bf51dc..a1680b5 100644
--- a/src/app/pages/base-page/base-page.component.ts
+++ b/src/app/pages/base-page/base-page.component.ts
@@ -238,4 +238,21 @@ export abstract class BasePageComponent implements AfterContentInit, OnDestroy {
console.log(`old height: ${currentHeight}, left: ${left} new height: ${newHeight}`);
}
+
+ public scrollTableContentToBottom(): void {
+ setTimeout(() => {
+ const elements = document.getElementsByClassName('tab-content tab-grow');
+
+ if (elements.length === 0) {
+ console.warn("Could not find logs tab");
+ return;
+ }
+
+ let tabContent: HTMLDivElement = elements[0] as HTMLDivElement;
+
+ if (tabContent) {
+ tabContent.scrollTo(0, tabContent.scrollHeight);
+ }
+ }, 100);
+ }
}
diff --git a/src/app/pages/logs/logs.component.html b/src/app/pages/logs/logs.component.html
index 0e26af0..8a5ea2e 100644
--- a/src/app/pages/logs/logs.component.html
+++ b/src/app/pages/logs/logs.component.html
@@ -21,13 +21,6 @@
0" class="terminal bg-dark text-light p-3 m-4" #logTerminal>
{{ logs }}
-
diff --git a/src/app/pages/logs/logs.component.scss b/src/app/pages/logs/logs.component.scss
index 9730174..80f7a25 100644
--- a/src/app/pages/logs/logs.component.scss
+++ b/src/app/pages/logs/logs.component.scss
@@ -1,5 +1,4 @@
.terminal {
- max-height: 600px;
overflow-y: auto;
font-family: monospace;
border: 1px solid #333;
diff --git a/src/app/pages/logs/logs.component.ts b/src/app/pages/logs/logs.component.ts
index d3a1117..356fbd0 100644
--- a/src/app/pages/logs/logs.component.ts
+++ b/src/app/pages/logs/logs.component.ts
@@ -61,23 +61,10 @@ export class LogsComponent extends BasePageComponent implements AfterViewInit {
return this.initing ? '' : this.lines.join("\n");
}
- private scrollToBottom(): void {
- this.ngZone.run(() => {
- setTimeout(() => {
- const terminalOutput = document.getElementById('terminalOutput');
- if (terminalOutput) {
- terminalOutput.style.width = `${window.innerWidth}`;
- //console.log(`scrolling from ${terminalOutput.offsetTop} to ${terminalOutput.scrollHeight}`)
- terminalOutput.scrollBy(0, terminalOutput.scrollHeight)
- }
- }, 100);
- });
- }
-
private onLog(): void {
if (this.logTerminal) this.logTerminal.nativeElement.scrollTop = this.logTerminal.nativeElement.scrollHeight;
// Scorri automaticamente in basso
- this.scrollToBottom();
+ this.scrollTableContentToBottom();
}
public trackByFn(index: number, item: string): number {
@@ -90,11 +77,11 @@ export class LogsComponent extends BasePageComponent implements AfterViewInit {
public ngAfterViewInit(): void {
this.initing = true;
setTimeout(() => {
- this.scrollToBottom();
+ this.scrollTableContentToBottom();
this.initing = false;
setTimeout(() => {
- this.scrollToBottom();
+ this.scrollTableContentToBottom();
}, 500);
}, 500);
}