]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/video-add/video-add.component.ts
Client: fix progress bar and tags validation issues
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / video-add / video-add.component.ts
index 16a8409be1da6fb55096dea3c5a9c23e6e610204..0a8b8293b914f31a264ebd649ebedeed7dc9ed11 100644 (file)
@@ -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();
   }
 }