aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-06-04 20:37:38 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-06-04 20:37:38 +0200
commit1cdb5c0f582502eac4d851cecc015e81cf16316b (patch)
tree79d5b8de99e72c61d55585fa1e243d9a847dd107 /client
parentfe3b20cdaf54125674afd3c3d0aa8e9411bb0722 (diff)
downloadPeerTube-1cdb5c0f582502eac4d851cecc015e81cf16316b.tar.gz
PeerTube-1cdb5c0f582502eac4d851cecc015e81cf16316b.tar.zst
PeerTube-1cdb5c0f582502eac4d851cecc015e81cf16316b.zip
Handle error for the video upload
Diffstat (limited to 'client')
-rw-r--r--client/src/app/videos/video-add/video-add.component.html2
-rw-r--r--client/src/app/videos/video-add/video-add.component.ts13
-rw-r--r--client/src/app/videos/video-list/video-list.component.html6
3 files changed, 20 insertions, 1 deletions
diff --git a/client/src/app/videos/video-add/video-add.component.html b/client/src/app/videos/video-add/video-add.component.html
index 80d229cb8..cbe274e8a 100644
--- a/client/src/app/videos/video-add/video-add.component.html
+++ b/client/src/app/videos/video-add/video-add.component.html
@@ -1,5 +1,7 @@
1<h3>Upload a video</h3> 1<h3>Upload a video</h3>
2 2
3<div *ngIf="error" class="alert alert-danger">{{ error }}</div>
4
3<form (ngSubmit)="uploadFile()" #videoForm="ngForm"> 5<form (ngSubmit)="uploadFile()" #videoForm="ngForm">
4 <div class="form-group"> 6 <div class="form-group">
5 <label for="name">Video name</label> 7 <label for="name">Video name</label>
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 8df4f951b..144879a54 100644
--- a/client/src/app/videos/video-add/video-add.component.ts
+++ b/client/src/app/videos/video-add/video-add.component.ts
@@ -18,6 +18,7 @@ import { AuthService, User } from '../../shared';
18}) 18})
19 19
20export class VideoAddComponent implements OnInit { 20export class VideoAddComponent implements OnInit {
21 error: string = null;
21 fileToUpload: any; 22 fileToUpload: any;
22 progressBar: { value: number; max: number; } = { value: 0, max: 0 }; 23 progressBar: { value: number; max: number; } = { value: 0, max: 0 };
23 user: User; 24 user: User;
@@ -57,11 +58,23 @@ export class VideoAddComponent implements OnInit {
57 58
58 // Print all the videos once it's finished 59 // Print all the videos once it's finished
59 this.router.navigate(['VideosList']); 60 this.router.navigate(['VideosList']);
61 },
62
63 fail: (e, data) => {
64 const xhr = data.jqXHR;
65 if (xhr.status === 400) {
66 this.error = xhr.responseText;
67 } else {
68 this.error = 'Unknow error';
69 }
70
71 console.error(data);
60 } 72 }
61 }); 73 });
62 } 74 }
63 75
64 uploadFile() { 76 uploadFile() {
77 this.error = null;
65 this.form.formData = jQuery(this.elementRef.nativeElement).find('form').serializeArray(); 78 this.form.formData = jQuery(this.elementRef.nativeElement).find('form').serializeArray();
66 this.form.headers = this.authService.getRequestHeader().toJSON(); 79 this.form.headers = this.authService.getRequestHeader().toJSON();
67 this.form.submit(); 80 this.form.submit();
diff --git a/client/src/app/videos/video-list/video-list.component.html b/client/src/app/videos/video-list/video-list.component.html
index 155025b5e..00392a81f 100644
--- a/client/src/app/videos/video-list/video-list.component.html
+++ b/client/src/app/videos/video-list/video-list.component.html
@@ -1,5 +1,9 @@
1<div class="row videos-info"> 1<div class="row videos-info">
2 <div class="col-md-9 videos-total-results"> {{ pagination.total }} videos</div> 2 <div class="col-md-9 videos-total-results">
3 {{ pagination.total }} videos
4
5 <my-loader [loading]="loading"></my-loader>
6 </div>
3 <my-video-sort class="col-md-3" [currentSort]="sort" (sort)="onSort($event)"></my-video-sort> 7 <my-video-sort class="col-md-3" [currentSort]="sort" (sort)="onSort($event)"></my-video-sort>
4</div> 8</div>
5 9