]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Client: fix progress bar and tags validation issues
authorChocobozzz <florian.bigard@gmail.com>
Fri, 7 Oct 2016 12:52:18 +0000 (14:52 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Fri, 7 Oct 2016 12:52:18 +0000 (14:52 +0200)
client/package.json
client/src/app/shared/forms/form-validators/video.ts
client/src/app/videos/video-add/video-add.component.ts

index 08f2e357b6cbab3e009218b9082caa9a1f1b2f53..be448d555ab3a587208d194d086682c903dc3e82 100644 (file)
@@ -54,7 +54,7 @@
     "intl": "^1.2.4",
     "json-loader": "^0.5.4",
     "ng2-bootstrap": "1.1.5",
-    "ng2-file-upload": "^1.0.3",
+    "ng2-file-upload": "^1.1.0",
     "node-sass": "^3.10.0",
     "normalize.css": "^4.1.1",
     "raw-loader": "^0.5.1",
index 3766d4018b4df670a4a2541139c41836b03a9d66..b2e612c62a4d39bb7504a87a3f203f277b2d303b 100644 (file)
@@ -18,7 +18,7 @@ export const VIDEO_DESCRIPTION = {
 };
 
 export const VIDEO_TAGS = {
-  VALIDATORS: [ Validators.pattern('^[a-zA-Z0-9]{2,10}$') ],
+  VALIDATORS: [ Validators.pattern('^[a-zA-Z0-9]{0,10}$') ],
   MESSAGES: {
     'pattern': 'A tag should be between 2 and 10 alphanumeric characters long.'
   }
index d12a7d572481365dc311818bde864f91426d7a05..0a8b8293b914f31a264ebd649ebedeed7dc9ed11 100644 (file)
@@ -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();
   }
 }