Console log component modified

This commit is contained in:
Piotr Pekala 2019-08-28 07:43:49 -07:00
parent aef6d044b3
commit f257992ffc
2 changed files with 6 additions and 10 deletions

View File

@ -2,14 +2,6 @@
<div class="consoleHeader"> <div class="consoleHeader">
<div class="consoleFiltering"> <div class="consoleFiltering">
<div class="consoleName">Console</div> <div class="consoleName">Console</div>
<!-- <mat-form-field>
<mat-label>Select filter</mat-label>
<mat-select [(ngModel)]="selectedFilter" name="filter" (selectionChange)="applyFilter()">
<mat-option *ngFor="let filter of filters" [value]="filter">
{{filter}}
</mat-option>
</mat-select>
</mat-form-field> -->
<button class="filterButton" [matMenuTriggerFor]="filterMenu"> <button class="filterButton" [matMenuTriggerFor]="filterMenu">
<mat-icon>keyboard_arrow_down</mat-icon> <mat-icon>keyboard_arrow_down</mat-icon>
</button> </button>
@ -29,7 +21,7 @@
</div> </div>
<div #console class="console"> <div #console class="console">
<span *ngFor="let event of filteredEvents"> <span class="console-item" *ngFor="let event of filteredEvents">
{{event.message}} <br/> {{event.message}} <br/>
</span> </span>
</div> </div>

View File

@ -187,7 +187,7 @@ export class LogConsoleComponent implements OnInit, AfterViewInit, OnDestroy {
clearConsole() { clearConsole() {
this.filteredEvents = []; this.filteredEvents = [];
this.console.nativeElement.scrollTop = this.console.nativeElement.scrollHeight * 2; this.console.nativeElement.scrollTop = this.console.nativeElement.scrollHeight;
} }
showCommand(message: string) { showCommand(message: string) {
@ -201,6 +201,10 @@ export class LogConsoleComponent implements OnInit, AfterViewInit, OnDestroy {
this.logEventsDataSource.add(event); this.logEventsDataSource.add(event);
this.filteredEvents = this.getFilteredEvents(); this.filteredEvents = this.getFilteredEvents();
this.console.nativeElement.scrollTop = this.console.nativeElement.scrollHeight; this.console.nativeElement.scrollTop = this.console.nativeElement.scrollHeight;
setTimeout( () => {
this.console.nativeElement.scrollTop = this.console.nativeElement.scrollHeight;
}, 100 );
} }
getFilteredEvents(): LogEvent[] { getFilteredEvents(): LogEvent[] {