diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-01-27 16:14:11 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-01-27 16:14:11 +0100 |
commit | 7ddd02c9b8c1e088f6679a2227f105e6439fc992 (patch) | |
tree | a1ff7af17f2a95abe85a2380834957e44032e8c2 /client/src/app/videos/video-list | |
parent | cddadde81f91219204cec1f4057a191c02a70894 (diff) | |
download | PeerTube-7ddd02c9b8c1e088f6679a2227f105e6439fc992.tar.gz PeerTube-7ddd02c9b8c1e088f6679a2227f105e6439fc992.tar.zst PeerTube-7ddd02c9b8c1e088f6679a2227f105e6439fc992.zip |
Client: better notifications for a beautiful world
Diffstat (limited to 'client/src/app/videos/video-list')
-rw-r--r-- | client/src/app/videos/video-list/video-list.component.ts | 6 | ||||
-rw-r--r-- | client/src/app/videos/video-list/video-miniature.component.ts | 10 |
2 files changed, 13 insertions, 3 deletions
diff --git a/client/src/app/videos/video-list/video-list.component.ts b/client/src/app/videos/video-list/video-list.component.ts index 6c42ba5be..b3780f8b6 100644 --- a/client/src/app/videos/video-list/video-list.component.ts +++ b/client/src/app/videos/video-list/video-list.component.ts | |||
@@ -2,6 +2,8 @@ import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core'; | |||
2 | import { ActivatedRoute, Router } from '@angular/router'; | 2 | import { ActivatedRoute, Router } from '@angular/router'; |
3 | import { BehaviorSubject } from 'rxjs/BehaviorSubject'; | 3 | import { BehaviorSubject } from 'rxjs/BehaviorSubject'; |
4 | 4 | ||
5 | import { NotificationsService } from 'angular2-notifications'; | ||
6 | |||
5 | import { | 7 | import { |
6 | SortField, | 8 | SortField, |
7 | Video, | 9 | Video, |
@@ -33,6 +35,7 @@ export class VideoListComponent implements OnInit, OnDestroy { | |||
33 | private subSearch: any; | 35 | private subSearch: any; |
34 | 36 | ||
35 | constructor( | 37 | constructor( |
38 | private notificationsService: NotificationsService, | ||
36 | private authService: AuthService, | 39 | private authService: AuthService, |
37 | private changeDetector: ChangeDetectorRef, | 40 | private changeDetector: ChangeDetectorRef, |
38 | private router: Router, | 41 | private router: Router, |
@@ -91,7 +94,7 @@ export class VideoListComponent implements OnInit, OnDestroy { | |||
91 | 94 | ||
92 | this.loading.next(false); | 95 | this.loading.next(false); |
93 | }, | 96 | }, |
94 | error => alert(error.text) | 97 | error => this.notificationsService.error('Error', error.text) |
95 | ); | 98 | ); |
96 | } | 99 | } |
97 | 100 | ||
@@ -107,6 +110,7 @@ export class VideoListComponent implements OnInit, OnDestroy { | |||
107 | } | 110 | } |
108 | 111 | ||
109 | onRemoved(video: Video) { | 112 | onRemoved(video: Video) { |
113 | this.notificationsService.success('Success', `Video ${video.name} deleted.`); | ||
110 | this.getVideos(); | 114 | this.getVideos(); |
111 | } | 115 | } |
112 | 116 | ||
diff --git a/client/src/app/videos/video-list/video-miniature.component.ts b/client/src/app/videos/video-list/video-miniature.component.ts index 398d2db75..ca4afc451 100644 --- a/client/src/app/videos/video-list/video-miniature.component.ts +++ b/client/src/app/videos/video-list/video-miniature.component.ts | |||
@@ -1,5 +1,7 @@ | |||
1 | import { Component, Input, Output, EventEmitter } from '@angular/core'; | 1 | import { Component, Input, Output, EventEmitter } from '@angular/core'; |
2 | 2 | ||
3 | import { NotificationsService } from 'angular2-notifications'; | ||
4 | |||
3 | import { SortField, Video, VideoService } from '../shared'; | 5 | import { SortField, Video, VideoService } from '../shared'; |
4 | import { User } from '../../shared'; | 6 | import { User } from '../../shared'; |
5 | 7 | ||
@@ -18,7 +20,10 @@ export class VideoMiniatureComponent { | |||
18 | 20 | ||
19 | hovering = false; | 21 | hovering = false; |
20 | 22 | ||
21 | constructor(private videoService: VideoService) {} | 23 | constructor( |
24 | private notificationsService: NotificationsService, | ||
25 | private videoService: VideoService | ||
26 | ) {} | ||
22 | 27 | ||
23 | displayRemoveIcon() { | 28 | displayRemoveIcon() { |
24 | return this.hovering && this.video.isRemovableBy(this.user); | 29 | return this.hovering && this.video.isRemovableBy(this.user); |
@@ -36,7 +41,8 @@ export class VideoMiniatureComponent { | |||
36 | if (confirm('Do you really want to remove this video?')) { | 41 | if (confirm('Do you really want to remove this video?')) { |
37 | this.videoService.removeVideo(id).subscribe( | 42 | this.videoService.removeVideo(id).subscribe( |
38 | status => this.removed.emit(true), | 43 | status => this.removed.emit(true), |
39 | error => alert(error.text) | 44 | |
45 | error => this.notificationsService.error('Error', error.text) | ||
40 | ); | 46 | ); |
41 | } | 47 | } |
42 | } | 48 | } |