From 566c125d6eee3bd907404523d94e1e0b5e403a46 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 11 Dec 2019 14:14:01 +0100 Subject: Serve audit logs to client --- .../src/app/+admin/system/logs/logs.component.ts | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'client/src/app/+admin/system/logs/logs.component.ts') diff --git a/client/src/app/+admin/system/logs/logs.component.ts b/client/src/app/+admin/system/logs/logs.component.ts index b2aca8461..b63f11953 100644 --- a/client/src/app/+admin/system/logs/logs.component.ts +++ b/client/src/app/+admin/system/logs/logs.component.ts @@ -17,9 +17,11 @@ export class LogsComponent implements OnInit { 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, @@ -30,6 +32,7 @@ export class LogsComponent implements OnInit { ngOnInit (): void { this.buildTimeChoices() this.buildLevelChoices() + this.buildLogTypeChoices() this.load() } @@ -42,7 +45,7 @@ export class LogsComponent implements OnInit { 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 @@ -58,6 +61,10 @@ export class LogsComponent implements OnInit { ) } + isAuditLog () { + return this.logType === 'audit' + } + buildTimeChoices () { const lastHour = new Date() lastHour.setHours(lastHour.getHours() - 1) @@ -108,4 +115,19 @@ export class LogsComponent implements OnInit { this.level = 'warn' } + + buildLogTypeChoices () { + this.logTypeChoices = [ + { + id: 'standard', + label: this.i18n('Standard logs') + }, + { + id: 'audit', + label: this.i18n('Audit logs') + } + ] + + this.logType = 'audit' + } } -- cgit v1.2.3