aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/+admin/system/logs/logs.component.ts18
-rw-r--r--client/src/app/core/wrappers/storage.service.ts4
2 files changed, 17 insertions, 5 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}
diff --git a/client/src/app/core/wrappers/storage.service.ts b/client/src/app/core/wrappers/storage.service.ts
index ad3aca6b8..e0563c611 100644
--- a/client/src/app/core/wrappers/storage.service.ts
+++ b/client/src/app/core/wrappers/storage.service.ts
@@ -11,8 +11,8 @@ abstract class StorageService {
11 return StorageService.storageSub.asObservable().pipe(filter(val => keys ? keys.includes(val) : true)) 11 return StorageService.storageSub.asObservable().pipe(filter(val => keys ? keys.includes(val) : true))
12 } 12 }
13 13
14 getItem (key: string) { 14 getItem <T extends string> (key: string) {
15 return this.instance.getItem(key) 15 return this.instance.getItem(key) as T
16 } 16 }
17 17
18 setItem (key: string, data: any, notifyOfUpdate = true) { 18 setItem (key: string, data: any, notifyOfUpdate = true) {