aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-18 14:24:30 +0100
committerChocobozzz <me@florianbigard.com>2021-02-18 14:24:30 +0100
commit288bcd7a6002ebefc280d889c550b038d9dad502 (patch)
treec76c8731db334d31bd87f775bb62aae695f86576 /client/src/app/+admin
parent53c06121a45a2ec943002833a0152bbfd4856ee4 (diff)
downloadPeerTube-288bcd7a6002ebefc280d889c550b038d9dad502.tar.gz
PeerTube-288bcd7a6002ebefc280d889c550b038d9dad502.tar.zst
PeerTube-288bcd7a6002ebefc280d889c550b038d9dad502.zip
Remember last log type
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/system/logs/logs.component.ts18
1 files changed, 15 insertions, 3 deletions
diff --git a/client/src/app/+admin/system/logs/logs.component.ts b/client/src/app/+admin/system/logs/logs.component.ts
index ad9d702d8..48318f07b 100644
--- a/client/src/app/+admin/system/logs/logs.component.ts
+++ b/client/src/app/+admin/system/logs/logs.component.ts
@@ -1,5 +1,5 @@
1import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' 1import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'
2import { Notifier } from '@app/core' 2import { LocalStorageService, Notifier } from '@app/core'
3import { LogLevel } from '@shared/models' 3import { LogLevel } from '@shared/models'
4import { LogRow } from './log-row.model' 4import { LogRow } from './log-row.model'
5import { LogsService } from './logs.service' 5import { LogsService } from './logs.service'
@@ -9,6 +9,8 @@ import { LogsService } from './logs.service'
9 styleUrls: [ './logs.component.scss' ] 9 styleUrls: [ './logs.component.scss' ]
10}) 10})
11export class LogsComponent implements OnInit { 11export class LogsComponent implements OnInit {
12 private static LOCAL_STORAGE_LOG_TYPE_CHOICE_KEY = 'admin-logs-log-type-choice'
13
12 @ViewChild('logsElement', { static: true }) logsElement: ElementRef<HTMLElement> 14 @ViewChild('logsElement', { static: true }) logsElement: ElementRef<HTMLElement>
13 15
14 loading = false 16 loading = false
@@ -24,7 +26,8 @@ export class LogsComponent implements OnInit {
24 26
25 constructor ( 27 constructor (
26 private logsService: LogsService, 28 private logsService: LogsService,
27 private notifier: Notifier 29 private notifier: Notifier,
30 private localStorage: LocalStorageService
28 ) { } 31 ) { }
29 32
30 ngOnInit (): void { 33 ngOnInit (): void {
@@ -32,11 +35,16 @@ export class LogsComponent implements OnInit {
32 this.buildLevelChoices() 35 this.buildLevelChoices()
33 this.buildLogTypeChoices() 36 this.buildLogTypeChoices()
34 37
38 this.loadPreviousChoices()
39
35 this.load() 40 this.load()
36 } 41 }
37 42
38 refresh () { 43 refresh () {
39 this.logs = [] 44 this.logs = []
45
46 this.localStorage.setItem(LogsComponent.LOCAL_STORAGE_LOG_TYPE_CHOICE_KEY, this.logType)
47
40 this.load() 48 this.load()
41 } 49 }
42 50
@@ -128,7 +136,11 @@ export class LogsComponent implements OnInit {
128 label: $localize`Audit logs` 136 label: $localize`Audit logs`
129 } 137 }
130 ] 138 ]
139 }
140
141 private loadPreviousChoices () {
142 this.logType = this.localStorage.getItem(LogsComponent.LOCAL_STORAGE_LOG_TYPE_CHOICE_KEY)
131 143
132 this.logType = 'audit' 144 if (this.logType !== 'standard' && this.logType !== 'audit') this.logType = 'audit'
133 } 145 }
134} 146}