X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=client%2Fsrc%2Fapp%2Fvideos%2Fvideo-add%2Fvideo-add.component.ts;h=0a8b8293b914f31a264ebd649ebedeed7dc9ed11;hb=1a00504203d16a0d29cc1650bd3f58ecab128ec3;hp=16a8409be1da6fb55096dea3c5a9c23e6e610204;hpb=4b2f33f3c6d109365090b08244d7f99ad4e69025;p=github%2FChocobozzz%2FPeerTube.git 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 16a8409be..0a8b8293b 100644 --- a/client/src/app/videos/video-add/video-add.component.ts +++ b/client/src/app/videos/video-add/video-add.component.ts @@ -8,8 +8,8 @@ import { AuthService, FormReactive, VIDEO_NAME, VIDEO_DESCRIPTION, VIDEO_TAGS } @Component({ selector: 'my-videos-add', - styles: [ require('./video-add.component.scss') ], - template: require('./video-add.component.html') + styleUrls: [ './video-add.component.scss' ], + templateUrl: './video-add.component.html' }) export class VideoAddComponent extends FormReactive implements OnInit { @@ -110,7 +110,7 @@ export class VideoAddComponent extends FormReactive implements OnInit { if (event.keyCode === 13) { // Check if the tag is valid and does not already exist if ( - currentTag !== '' && + currentTag.length >= 2 && this.form.controls['currentTag'].valid && this.tags.indexOf(currentTag) === -1 ) { @@ -137,7 +137,13 @@ export class VideoAddComponent extends FormReactive implements OnInit { // TODO: wait for https://github.com/valor-software/ng2-file-upload/pull/242 item.alias = 'videofile'; + // FIXME: remove + // Run detection change for progress bar + const interval = setInterval(() => { ; }, 250); + item.onSuccess = () => { + clearInterval(interval); + console.log('Video uploaded.'); // Print all the videos once it's finished @@ -145,6 +151,8 @@ export class VideoAddComponent extends FormReactive implements OnInit { }; item.onError = (response: string, status: number) => { + clearInterval(interval); + // We need to handle manually these cases beceause we use the FileUpload component if (status === 400) { this.error = response; @@ -163,7 +171,6 @@ export class VideoAddComponent extends FormReactive implements OnInit { } }; - this.uploader.uploadAll(); } }