Prettier code cleanup for .ts files

See #182
This commit is contained in:
Michael Shamoon
2022-03-11 10:53:32 -08:00
parent d56c9dc94b
commit bd4a705769
159 changed files with 3882 additions and 2716 deletions

View File

@@ -1,14 +1,19 @@
import { Component, ElementRef, OnInit, AfterViewChecked, ViewChild } from '@angular/core';
import { LogService } from 'src/app/services/rest/log.service';
import {
Component,
ElementRef,
OnInit,
AfterViewChecked,
ViewChild,
} from '@angular/core'
import { LogService } from 'src/app/services/rest/log.service'
@Component({
selector: 'app-logs',
templateUrl: './logs.component.html',
styleUrls: ['./logs.component.scss']
styleUrls: ['./logs.component.scss'],
})
export class LogsComponent implements OnInit, AfterViewChecked {
constructor(private logService: LogService) { }
constructor(private logService: LogService) {}
logs: string[] = []
@@ -19,7 +24,7 @@ export class LogsComponent implements OnInit, AfterViewChecked {
@ViewChild('logContainer') logContainer: ElementRef
ngOnInit(): void {
this.logService.list().subscribe(result => {
this.logService.list().subscribe((result) => {
this.logFiles = result
if (this.logFiles.length > 0) {
this.activeLog = this.logFiles[0]
@@ -29,25 +34,28 @@ export class LogsComponent implements OnInit, AfterViewChecked {
}
ngAfterViewChecked() {
this.scrollToBottom();
this.scrollToBottom()
}
reloadLogs() {
this.logService.get(this.activeLog).subscribe(result => {
this.logs = result
}, error => {
this.logs = []
})
this.logService.get(this.activeLog).subscribe(
(result) => {
this.logs = result
},
(error) => {
this.logs = []
}
)
}
getLogLevel(log: string) {
if (log.indexOf("[DEBUG]") != -1) {
if (log.indexOf('[DEBUG]') != -1) {
return 10
} else if (log.indexOf("[WARNING]") != -1) {
} else if (log.indexOf('[WARNING]') != -1) {
return 30
} else if (log.indexOf("[ERROR]") != -1) {
} else if (log.indexOf('[ERROR]') != -1) {
return 40
} else if (log.indexOf("[CRITICAL]") != -1) {
} else if (log.indexOf('[CRITICAL]') != -1) {
return 50
} else {
return 20
@@ -58,8 +66,7 @@ export class LogsComponent implements OnInit, AfterViewChecked {
this.logContainer?.nativeElement.scroll({
top: this.logContainer.nativeElement.scrollHeight,
left: 0,
behavior: 'auto'
});
behavior: 'auto',
})
}
}