diff options
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r-- | client/src/app/+admin/system/logs/logs.component.ts | 18 |
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 @@ | |||
1 | import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' |
2 | import { Notifier } from '@app/core' | 2 | import { LocalStorageService, Notifier } from '@app/core' |
3 | import { LogLevel } from '@shared/models' | 3 | import { LogLevel } from '@shared/models' |
4 | import { LogRow } from './log-row.model' | 4 | import { LogRow } from './log-row.model' |
5 | import { LogsService } from './logs.service' | 5 | import { 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 | }) |
11 | export class LogsComponent implements OnInit { | 11 | export 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 | } |