aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/system/logs/logs.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-12-11 14:14:01 +0100
committerChocobozzz <me@florianbigard.com>2019-12-11 14:14:01 +0100
commit566c125d6eee3bd907404523d94e1e0b5e403a46 (patch)
treec477cdd2ba745015d80052968c37927b1bca1254 /client/src/app/+admin/system/logs/logs.component.ts
parent92e0f42e8ce5f1ab5e4023900b8194627231a11b (diff)
downloadPeerTube-566c125d6eee3bd907404523d94e1e0b5e403a46.tar.gz
PeerTube-566c125d6eee3bd907404523d94e1e0b5e403a46.tar.zst
PeerTube-566c125d6eee3bd907404523d94e1e0b5e403a46.zip
Serve audit logs to client
Diffstat (limited to 'client/src/app/+admin/system/logs/logs.component.ts')
-rw-r--r--client/src/app/+admin/system/logs/logs.component.ts24
1 files changed, 23 insertions, 1 deletions
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 {
17 logs: LogRow[] = [] 17 logs: LogRow[] = []
18 timeChoices: { id: string, label: string }[] = [] 18 timeChoices: { id: string, label: string }[] = []
19 levelChoices: { id: LogLevel, label: string }[] = [] 19 levelChoices: { id: LogLevel, label: string }[] = []
20 logTypeChoices: { id: 'audit' | 'standard', label: string }[] = []
20 21
21 startDate: string 22 startDate: string
22 level: LogLevel 23 level: LogLevel
24 logType: 'audit' | 'standard'
23 25
24 constructor ( 26 constructor (
25 private logsService: LogsService, 27 private logsService: LogsService,
@@ -30,6 +32,7 @@ export class LogsComponent implements OnInit {
30 ngOnInit (): void { 32 ngOnInit (): void {
31 this.buildTimeChoices() 33 this.buildTimeChoices()
32 this.buildLevelChoices() 34 this.buildLevelChoices()
35 this.buildLogTypeChoices()
33 36
34 this.load() 37 this.load()
35 } 38 }
@@ -42,7 +45,7 @@ export class LogsComponent implements OnInit {
42 load () { 45 load () {
43 this.loading = true 46 this.loading = true
44 47
45 this.logsService.getLogs(this.level, this.startDate) 48 this.logsService.getLogs({ isAuditLog: this.isAuditLog(), level: this.level, startDate: this.startDate })
46 .subscribe( 49 .subscribe(
47 logs => { 50 logs => {
48 this.logs = logs 51 this.logs = logs
@@ -58,6 +61,10 @@ export class LogsComponent implements OnInit {
58 ) 61 )
59 } 62 }
60 63
64 isAuditLog () {
65 return this.logType === 'audit'
66 }
67
61 buildTimeChoices () { 68 buildTimeChoices () {
62 const lastHour = new Date() 69 const lastHour = new Date()
63 lastHour.setHours(lastHour.getHours() - 1) 70 lastHour.setHours(lastHour.getHours() - 1)
@@ -108,4 +115,19 @@ export class LogsComponent implements OnInit {
108 115
109 this.level = 'warn' 116 this.level = 'warn'
110 } 117 }
118
119 buildLogTypeChoices () {
120 this.logTypeChoices = [
121 {
122 id: 'standard',
123 label: this.i18n('Standard logs')
124 },
125 {
126 id: 'audit',
127 label: this.i18n('Audit logs')
128 }
129 ]
130
131 this.logType = 'audit'
132 }
111} 133}