styleUrls: [ './logs.component.scss' ]
})
export class LogsComponent implements OnInit {
- @ViewChild('logsElement') logsElement: ElementRef<HTMLElement>
+ @ViewChild('logsElement', { static: true }) logsElement: ElementRef<HTMLElement>
loading = false
logs: LogRow[] = []
timeChoices: { id: string, label: string }[] = []
levelChoices: { id: LogLevel, label: string }[] = []
+ logTypeChoices: { id: 'audit' | 'standard', label: string }[] = []
startDate: string
level: LogLevel
+ logType: 'audit' | 'standard'
constructor (
private logsService: LogsService,
ngOnInit (): void {
this.buildTimeChoices()
this.buildLevelChoices()
+ this.buildLogTypeChoices()
this.load()
}
load () {
this.loading = true
- this.logsService.getLogs(this.level, this.startDate)
+ this.logsService.getLogs({ isAuditLog: this.isAuditLog(), level: this.level, startDate: this.startDate })
.subscribe(
logs => {
this.logs = logs
)
}
+ isAuditLog () {
+ return this.logType === 'audit'
+ }
+
buildTimeChoices () {
const lastHour = new Date()
lastHour.setHours(lastHour.getHours() - 1)
this.level = 'warn'
}
+
+ buildLogTypeChoices () {
+ this.logTypeChoices = [
+ {
+ id: 'standard',
+ label: this.i18n('Standard logs')
+ },
+ {
+ id: 'audit',
+ label: this.i18n('Audit logs')
+ }
+ ]
+
+ this.logType = 'audit'
+ }
}