From 1a00504203d16a0d29cc1650bd3f58ecab128ec3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 7 Oct 2016 14:52:18 +0200 Subject: Client: fix progress bar and tags validation issues --- client/src/app/videos/video-add/video-add.component.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'client/src/app/videos') 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 d12a7d572..0a8b8293b 100644 --- a/client/src/app/videos/video-add/video-add.component.ts +++ b/client/src/app/videos/video-add/video-add.component.ts @@ -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(); } } -- cgit v1.2.3