mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-09 16:25:33 +01:00
add a simple log viewer to the front end
This commit is contained in:
parent
2b0b3a70a7
commit
323e0fa348
9 changed files with 124 additions and 3 deletions
|
|
@ -1,4 +1,7 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { kMaxLength } from 'buffer';
|
||||
import { LOG_LEVELS, PaperlessLog } from 'src/app/data/paperless-log';
|
||||
import { LogService } from 'src/app/services/rest/log.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-logs',
|
||||
|
|
@ -7,9 +10,26 @@ import { Component, OnInit } from '@angular/core';
|
|||
})
|
||||
export class LogsComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
constructor(private logService: LogService) { }
|
||||
|
||||
logs: PaperlessLog[] = []
|
||||
|
||||
ngOnInit(): void {
|
||||
this.logService.list(1, 50).subscribe(result => this.logs = result.results)
|
||||
}
|
||||
|
||||
getLevelText(level: number) {
|
||||
return LOG_LEVELS.find(l => l.id == level)?.name
|
||||
}
|
||||
|
||||
onScroll() {
|
||||
let lastCreated = null
|
||||
if (this.logs.length > 0) {
|
||||
lastCreated = this.logs[this.logs.length-1].created
|
||||
}
|
||||
this.logService.list(1, 25, null, {'created__lt': lastCreated}).subscribe(result => {
|
||||
this.logs.push(...result.results)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue