aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/system/logs/logs.component.html2
-rw-r--r--client/src/app/+admin/system/logs/logs.component.scss4
-rw-r--r--client/src/app/+admin/system/logs/logs.component.ts33
-rw-r--r--client/src/app/+admin/system/logs/logs.service.ts9
4 files changed, 30 insertions, 18 deletions
diff --git a/client/src/app/+admin/system/logs/logs.component.html b/client/src/app/+admin/system/logs/logs.component.html
index b2c7f84bc..18011b205 100644
--- a/client/src/app/+admin/system/logs/logs.component.html
+++ b/client/src/app/+admin/system/logs/logs.component.html
@@ -28,6 +28,8 @@
28 </ng-option> 28 </ng-option>
29 </ng-select> 29 </ng-select>
30 30
31 <my-select-tags i18n-placeholder placeholder="Filter logs by tags" [(ngModel)]="tagsOneOf" (ngModelChange)="refresh()"></my-select-tags>
32
31 <my-button i18n-label label="Refresh" icon="refresh" (click)="refresh()"></my-button> 33 <my-button i18n-label label="Refresh" icon="refresh" (click)="refresh()"></my-button>
32</div> 34</div>
33 35
diff --git a/client/src/app/+admin/system/logs/logs.component.scss b/client/src/app/+admin/system/logs/logs.component.scss
index fefa7efc2..be66d563b 100644
--- a/client/src/app/+admin/system/logs/logs.component.scss
+++ b/client/src/app/+admin/system/logs/logs.component.scss
@@ -52,9 +52,7 @@
52 @include peertube-select-container(150px); 52 @include peertube-select-container(150px);
53 } 53 }
54 54
55 my-button, 55 > * {
56 .peertube-select-container,
57 ng-select {
58 @include margin-left(10px); 56 @include margin-left(10px);
59 } 57 }
60} 58}
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 {
23 startDate: string 23 startDate: string
24 level: LogLevel 24 level: LogLevel
25 logType: 'audit' | 'standard' 25 logType: 'audit' | 'standard'
26 tagsOneOf: string[] = []
26 27
27 constructor ( 28 constructor (
28 private logsService: LogsService, 29 private logsService: LogsService,
@@ -51,20 +52,28 @@ export class LogsComponent implements OnInit {
51 load () { 52 load () {
52 this.loading = true 53 this.loading = true
53 54
54 this.logsService.getLogs({ isAuditLog: this.isAuditLog(), level: this.level, startDate: this.startDate }) 55 const tagsOneOf = this.tagsOneOf.length !== 0
55 .subscribe({ 56 ? this.tagsOneOf
56 next: logs => { 57 : undefined
57 this.logs = logs 58
58 59 this.logsService.getLogs({
59 setTimeout(() => { 60 isAuditLog: this.isAuditLog(),
60 this.logsElement.nativeElement.scrollIntoView({ block: 'end', inline: 'nearest' }) 61 level: this.level,
61 }) 62 startDate: this.startDate,
62 }, 63 tagsOneOf
64 }).subscribe({
65 next: logs => {
66 this.logs = logs
67
68 setTimeout(() => {
69 this.logsElement.nativeElement.scrollIntoView({ block: 'end', inline: 'nearest' })
70 })
71 },
63 72
64 error: err => this.notifier.error(err.message), 73 error: err => this.notifier.error(err.message),
65 74
66 complete: () => this.loading = false 75 complete: () => this.loading = false
67 }) 76 })
68 } 77 }
69 78
70 isAuditLog () { 79 isAuditLog () {
diff --git a/client/src/app/+admin/system/logs/logs.service.ts b/client/src/app/+admin/system/logs/logs.service.ts
index 0c222cad2..ea7e08b9b 100644
--- a/client/src/app/+admin/system/logs/logs.service.ts
+++ b/client/src/app/+admin/system/logs/logs.service.ts
@@ -2,7 +2,7 @@ import { Observable } from 'rxjs'
2import { catchError, map } from 'rxjs/operators' 2import { catchError, map } from 'rxjs/operators'
3import { HttpClient, HttpParams } from '@angular/common/http' 3import { HttpClient, HttpParams } from '@angular/common/http'
4import { Injectable } from '@angular/core' 4import { Injectable } from '@angular/core'
5import { RestExtractor } from '@app/core' 5import { RestExtractor, RestService } from '@app/core'
6import { LogLevel } from '@shared/models' 6import { LogLevel } from '@shared/models'
7import { environment } from '../../../../environments/environment' 7import { environment } from '../../../../environments/environment'
8import { LogRow } from './log-row.model' 8import { LogRow } from './log-row.model'
@@ -14,22 +14,25 @@ export class LogsService {
14 14
15 constructor ( 15 constructor (
16 private authHttp: HttpClient, 16 private authHttp: HttpClient,
17 private restService: RestService,
17 private restExtractor: RestExtractor 18 private restExtractor: RestExtractor
18 ) {} 19 ) {}
19 20
20 getLogs (options: { 21 getLogs (options: {
21 isAuditLog: boolean 22 isAuditLog: boolean
22 startDate: string 23 startDate: string
24 tagsOneOf?: string[]
23 level?: LogLevel 25 level?: LogLevel
24 endDate?: string 26 endDate?: string
25 }): Observable<any[]> { 27 }): Observable<any[]> {
26 const { isAuditLog, startDate } = options 28 const { isAuditLog, startDate, endDate, tagsOneOf } = options
27 29
28 let params = new HttpParams() 30 let params = new HttpParams()
29 params = params.append('startDate', startDate) 31 params = params.append('startDate', startDate)
30 32
31 if (!isAuditLog) params = params.append('level', options.level) 33 if (!isAuditLog) params = params.append('level', options.level)
32 if (options.endDate) params.append('endDate', options.endDate) 34 if (endDate) params = params.append('endDate', options.endDate)
35 if (tagsOneOf) params = this.restService.addArrayParams(params, 'tagsOneOf', tagsOneOf)
33 36
34 const path = isAuditLog 37 const path = isAuditLog
35 ? LogsService.BASE_AUDIT_LOG_URL 38 ? LogsService.BASE_AUDIT_LOG_URL