diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-11-23 10:45:42 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-12-03 10:15:49 +0100 |
commit | d4132d3f56b392a2e4e632db59e6644e4851228e (patch) | |
tree | be903734aa9ce3d669c40656a0f81bd3e9c7978c /client/src/app/core/notification | |
parent | 4a54a93941d1c095bf249331df799c51e39c3774 (diff) | |
download | PeerTube-d4132d3f56b392a2e4e632db59e6644e4851228e.tar.gz PeerTube-d4132d3f56b392a2e4e632db59e6644e4851228e.tar.zst PeerTube-d4132d3f56b392a2e4e632db59e6644e4851228e.zip |
more explicit error messages for file uploads
Diffstat (limited to 'client/src/app/core/notification')
-rw-r--r-- | client/src/app/core/notification/notifier.service.ts | 20 |
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 | } |