X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Badmin%2Fsystem%2Flogs%2Flogs.component.ts;h=b63f1195310fb09cc9b7a22e000bc864b14d696a;hb=566c125d6eee3bd907404523d94e1e0b5e403a46;hp=b2aca8461e590883c2e8a5568f931bb028474073;hpb=f36da21e40104a50acb00132920b835240cebb38;p=github%2FChocobozzz%2FPeerTube.git 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' + } }