aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-27 16:14:11 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-27 16:14:11 +0100
commit7ddd02c9b8c1e088f6679a2227f105e6439fc992 (patch)
treea1ff7af17f2a95abe85a2380834957e44032e8c2 /client/src/app/videos
parentcddadde81f91219204cec1f4057a191c02a70894 (diff)
downloadPeerTube-7ddd02c9b8c1e088f6679a2227f105e6439fc992.tar.gz
PeerTube-7ddd02c9b8c1e088f6679a2227f105e6439fc992.tar.zst
PeerTube-7ddd02c9b8c1e088f6679a2227f105e6439fc992.zip
Client: better notifications for a beautiful world
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/video-add/video-add.component.ts6
-rw-r--r--client/src/app/videos/video-list/video-list.component.ts6
-rw-r--r--client/src/app/videos/video-list/video-miniature.component.ts10
-rw-r--r--client/src/app/videos/video-watch/video-report.component.ts11
-rw-r--r--client/src/app/videos/video-watch/video-watch.component.ts8
5 files changed, 29 insertions, 12 deletions
diff --git a/client/src/app/videos/video-add/video-add.component.ts b/client/src/app/videos/video-add/video-add.component.ts
index 1e700ae48..cd6bb9989 100644
--- a/client/src/app/videos/video-add/video-add.component.ts
+++ b/client/src/app/videos/video-add/video-add.component.ts
@@ -3,6 +3,7 @@ import { FormBuilder, FormGroup } from '@angular/forms';
3import { Router } from '@angular/router'; 3import { Router } from '@angular/router';
4 4
5import { FileUploader } from 'ng2-file-upload/ng2-file-upload'; 5import { FileUploader } from 'ng2-file-upload/ng2-file-upload';
6import { NotificationsService } from 'angular2-notifications';
6 7
7import { AuthService } from '../../core'; 8import { AuthService } from '../../core';
8import { FormReactive, VIDEO_NAME, VIDEO_DESCRIPTION, VIDEO_TAGS } from '../../shared'; 9import { FormReactive, VIDEO_NAME, VIDEO_DESCRIPTION, VIDEO_TAGS } from '../../shared';
@@ -38,7 +39,8 @@ export class VideoAddComponent extends FormReactive implements OnInit {
38 private authService: AuthService, 39 private authService: AuthService,
39 private elementRef: ElementRef, 40 private elementRef: ElementRef,
40 private formBuilder: FormBuilder, 41 private formBuilder: FormBuilder,
41 private router: Router 42 private router: Router,
43 private notificationsService: NotificationsService
42 ) { 44 ) {
43 super(); 45 super();
44 } 46 }
@@ -151,6 +153,8 @@ export class VideoAddComponent extends FormReactive implements OnInit {
151 clearInterval(interval); 153 clearInterval(interval);
152 154
153 console.log('Video uploaded.'); 155 console.log('Video uploaded.');
156 this.notificationsService.success('Success', 'Video uploaded.');
157
154 158
155 // Print all the videos once it's finished 159 // Print all the videos once it's finished
156 this.router.navigate(['/videos/list']); 160 this.router.navigate(['/videos/list']);
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';
2import { ActivatedRoute, Router } from '@angular/router'; 2import { ActivatedRoute, Router } from '@angular/router';
3import { BehaviorSubject } from 'rxjs/BehaviorSubject'; 3import { BehaviorSubject } from 'rxjs/BehaviorSubject';
4 4
5import { NotificationsService } from 'angular2-notifications';
6
5import { 7import {
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 @@
1import { Component, Input, Output, EventEmitter } from '@angular/core'; 1import { Component, Input, Output, EventEmitter } from '@angular/core';
2 2
3import { NotificationsService } from 'angular2-notifications';
4
3import { SortField, Video, VideoService } from '../shared'; 5import { SortField, Video, VideoService } from '../shared';
4import { User } from '../../shared'; 6import { 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 }
diff --git a/client/src/app/videos/video-watch/video-report.component.ts b/client/src/app/videos/video-watch/video-report.component.ts
index 7a125f53e..19a7af148 100644
--- a/client/src/app/videos/video-watch/video-report.component.ts
+++ b/client/src/app/videos/video-watch/video-report.component.ts
@@ -2,6 +2,7 @@ import { Component, Input, OnInit, ViewChild } from '@angular/core';
2import { FormBuilder, FormGroup } from '@angular/forms'; 2import { FormBuilder, FormGroup } from '@angular/forms';
3 3
4import { ModalDirective } from 'ng2-bootstrap/modal'; 4import { ModalDirective } from 'ng2-bootstrap/modal';
5import { NotificationsService } from 'angular2-notifications';
5 6
6import { FormReactive, VideoAbuseService, VIDEO_ABUSE_REASON } from '../../shared'; 7import { FormReactive, VideoAbuseService, VIDEO_ABUSE_REASON } from '../../shared';
7import { Video, VideoService } from '../shared'; 8import { Video, VideoService } from '../shared';
@@ -26,7 +27,8 @@ export class VideoReportComponent extends FormReactive implements OnInit {
26 27
27 constructor( 28 constructor(
28 private formBuilder: FormBuilder, 29 private formBuilder: FormBuilder,
29 private videoAbuseService: VideoAbuseService 30 private videoAbuseService: VideoAbuseService,
31 private notificationsService: NotificationsService
30 ) { 32 ) {
31 super(); 33 super();
32 } 34 }
@@ -56,13 +58,12 @@ export class VideoReportComponent extends FormReactive implements OnInit {
56 58
57 this.videoAbuseService.reportVideo(this.video.id, reason) 59 this.videoAbuseService.reportVideo(this.video.id, reason)
58 .subscribe( 60 .subscribe(
59 // TODO: move alert to beautiful notifications 61 () => {
60 ok => { 62 this.notificationsService.success('Success', 'Video reported.');
61 alert('Video reported.');
62 this.hide(); 63 this.hide();
63 }, 64 },
64 65
65 err => alert(err.text) 66 err => this.notificationsService.error('Error', err.text);
66 ) 67 )
67 } 68 }
68} 69}
diff --git a/client/src/app/videos/video-watch/video-watch.component.ts b/client/src/app/videos/video-watch/video-watch.component.ts
index 5cd7550be..c27133f74 100644
--- a/client/src/app/videos/video-watch/video-watch.component.ts
+++ b/client/src/app/videos/video-watch/video-watch.component.ts
@@ -1,8 +1,9 @@
1import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core'; 1import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core';
2import { ActivatedRoute } from '@angular/router'; 2import { ActivatedRoute } from '@angular/router';
3 3
4import { MetaService } from 'ng2-meta';
5import * as videojs from 'video.js'; 4import * as videojs from 'video.js';
5import { MetaService } from 'ng2-meta';
6import { NotificationsService } from 'angular2-notifications';
6 7
7import { AuthService } from '../../core'; 8import { AuthService } from '../../core';
8import { VideoMagnetComponent } from './video-magnet.component'; 9import { VideoMagnetComponent } from './video-magnet.component';
@@ -45,7 +46,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
45 private videoService: VideoService, 46 private videoService: VideoService,
46 private metaService: MetaService, 47 private metaService: MetaService,
47 private webTorrentService: WebTorrentService, 48 private webTorrentService: WebTorrentService,
48 private authService: AuthService 49 private authService: AuthService,
50 private notificationsService: NotificationsService
49 ) {} 51 ) {}
50 52
51 ngOnInit() { 53 ngOnInit() {
@@ -117,7 +119,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
117 console.log('Added ' + this.video.magnetUri + '.'); 119 console.log('Added ' + this.video.magnetUri + '.');
118 torrent.files[0].renderTo(this.playerElement, { autoplay: true }, (err) => { 120 torrent.files[0].renderTo(this.playerElement, { autoplay: true }, (err) => {
119 if (err) { 121 if (err) {
120 alert('Cannot append the file.'); 122 this.notificationsService.error('Error', 'Cannot append the file in the video element.');
121 console.error(err); 123 console.error(err);
122 } 124 }
123 }); 125 });