aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/core')
-rw-r--r--client/src/app/core/notification/notifier.service.ts20
1 files changed, 12 insertions, 8 deletions
diff --git a/client/src/app/core/notification/notifier.service.ts b/client/src/app/core/notification/notifier.service.ts
index f736672bb..165bb0c76 100644
--- a/client/src/app/core/notification/notifier.service.ts
+++ b/client/src/app/core/notification/notifier.service.ts
@@ -7,31 +7,35 @@ export class Notifier {
7 7
8 constructor (private messageService: MessageService) { } 8 constructor (private messageService: MessageService) { }
9 9
10 info (text: string, title?: string, timeout?: number) { 10 info (text: string, title?: string, timeout?: number, sticky?: boolean) {
11 if (!title) title = $localize`Info` 11 if (!title) title = $localize`Info`
12 12
13 return this.notify('info', text, title, timeout) 13 console.info(`${title}: ${text}`)
14 return this.notify('info', text, title, timeout, sticky)
14 } 15 }
15 16
16 error (text: string, title?: string, timeout?: number) { 17 error (text: string, title?: string, timeout?: number, sticky?: boolean) {
17 if (!title) title = $localize`Error` 18 if (!title) title = $localize`Error`
18 19
19 return this.notify('error', text, title, timeout) 20 console.error(`${title}: ${text}`)
21 return this.notify('error', text, title, timeout, sticky)
20 } 22 }
21 23
22 success (text: string, title?: string, timeout?: number) { 24 success (text: string, title?: string, timeout?: number, sticky?: boolean) {
23 if (!title) title = $localize`Success` 25 if (!title) title = $localize`Success`
24 26
25 return this.notify('success', text, title, timeout) 27 console.log(`${title}: ${text}`)
28 return this.notify('success', text, title, timeout, sticky)
26 } 29 }
27 30
28 private notify (severity: 'success' | 'info' | 'warn' | 'error', text: string, title: string, timeout?: number) { 31 private notify (severity: 'success' | 'info' | 'warn' | 'error', text: string, title: string, timeout?: number, sticky?: boolean) {
29 this.messageService.add({ 32 this.messageService.add({
30 severity, 33 severity,
31 summary: title, 34 summary: title,
32 detail: text, 35 detail: text,
33 closable: true, 36 closable: true,
34 life: timeout || this.TIMEOUT 37 life: timeout || this.TIMEOUT,
38 sticky
35 }) 39 })
36 } 40 }
37} 41}