From 64553e8809271df1113e9143426a27f234410a74 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 20 Oct 2021 14:23:32 +0200 Subject: Add ability to filter logs by tags --- .../src/app/+admin/system/logs/logs.component.ts | 33 ++++++++++++++-------- 1 file changed, 21 insertions(+), 12 deletions(-) (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 865ab80a2..06237522a 100644 --- a/client/src/app/+admin/system/logs/logs.component.ts +++ b/client/src/app/+admin/system/logs/logs.component.ts @@ -23,6 +23,7 @@ export class LogsComponent implements OnInit { startDate: string level: LogLevel logType: 'audit' | 'standard' + tagsOneOf: string[] = [] constructor ( private logsService: LogsService, @@ -51,20 +52,28 @@ export class LogsComponent implements OnInit { load () { this.loading = true - this.logsService.getLogs({ isAuditLog: this.isAuditLog(), level: this.level, startDate: this.startDate }) - .subscribe({ - next: logs => { - this.logs = logs - - setTimeout(() => { - this.logsElement.nativeElement.scrollIntoView({ block: 'end', inline: 'nearest' }) - }) - }, + const tagsOneOf = this.tagsOneOf.length !== 0 + ? this.tagsOneOf + : undefined + + this.logsService.getLogs({ + isAuditLog: this.isAuditLog(), + level: this.level, + startDate: this.startDate, + tagsOneOf + }).subscribe({ + next: logs => { + this.logs = logs + + setTimeout(() => { + this.logsElement.nativeElement.scrollIntoView({ block: 'end', inline: 'nearest' }) + }) + }, - error: err => this.notifier.error(err.message), + error: err => this.notifier.error(err.message), - complete: () => this.loading = false - }) + complete: () => this.loading = false + }) } isAuditLog () { -- cgit v1.2.3