aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/package.json2
-rw-r--r--client/src/app/shared/forms/form-validators/video.ts2
-rw-r--r--client/src/app/videos/video-add/video-add.component.ts11
3 files changed, 11 insertions, 4 deletions
diff --git a/client/package.json b/client/package.json
index 08f2e357b..be448d555 100644
--- a/client/package.json
+++ b/client/package.json
@@ -54,7 +54,7 @@
54 "intl": "^1.2.4", 54 "intl": "^1.2.4",
55 "json-loader": "^0.5.4", 55 "json-loader": "^0.5.4",
56 "ng2-bootstrap": "1.1.5", 56 "ng2-bootstrap": "1.1.5",
57 "ng2-file-upload": "^1.0.3", 57 "ng2-file-upload": "^1.1.0",
58 "node-sass": "^3.10.0", 58 "node-sass": "^3.10.0",
59 "normalize.css": "^4.1.1", 59 "normalize.css": "^4.1.1",
60 "raw-loader": "^0.5.1", 60 "raw-loader": "^0.5.1",
diff --git a/client/src/app/shared/forms/form-validators/video.ts b/client/src/app/shared/forms/form-validators/video.ts
index 3766d4018..b2e612c62 100644
--- a/client/src/app/shared/forms/form-validators/video.ts
+++ b/client/src/app/shared/forms/form-validators/video.ts
@@ -18,7 +18,7 @@ export const VIDEO_DESCRIPTION = {
18}; 18};
19 19
20export const VIDEO_TAGS = { 20export const VIDEO_TAGS = {
21 VALIDATORS: [ Validators.pattern('^[a-zA-Z0-9]{2,10}$') ], 21 VALIDATORS: [ Validators.pattern('^[a-zA-Z0-9]{0,10}$') ],
22 MESSAGES: { 22 MESSAGES: {
23 'pattern': 'A tag should be between 2 and 10 alphanumeric characters long.' 23 'pattern': 'A tag should be between 2 and 10 alphanumeric characters long.'
24 } 24 }
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 {
110 if (event.keyCode === 13) { 110 if (event.keyCode === 13) {
111 // Check if the tag is valid and does not already exist 111 // Check if the tag is valid and does not already exist
112 if ( 112 if (
113 currentTag !== '' && 113 currentTag.length >= 2 &&
114 this.form.controls['currentTag'].valid && 114 this.form.controls['currentTag'].valid &&
115 this.tags.indexOf(currentTag) === -1 115 this.tags.indexOf(currentTag) === -1
116 ) { 116 ) {
@@ -137,7 +137,13 @@ export class VideoAddComponent extends FormReactive implements OnInit {
137 // TODO: wait for https://github.com/valor-software/ng2-file-upload/pull/242 137 // TODO: wait for https://github.com/valor-software/ng2-file-upload/pull/242
138 item.alias = 'videofile'; 138 item.alias = 'videofile';
139 139
140 // FIXME: remove
141 // Run detection change for progress bar
142 const interval = setInterval(() => { ; }, 250);
143
140 item.onSuccess = () => { 144 item.onSuccess = () => {
145 clearInterval(interval);
146
141 console.log('Video uploaded.'); 147 console.log('Video uploaded.');
142 148
143 // Print all the videos once it's finished 149 // Print all the videos once it's finished
@@ -145,6 +151,8 @@ export class VideoAddComponent extends FormReactive implements OnInit {
145 }; 151 };
146 152
147 item.onError = (response: string, status: number) => { 153 item.onError = (response: string, status: number) => {
154 clearInterval(interval);
155
148 // We need to handle manually these cases beceause we use the FileUpload component 156 // We need to handle manually these cases beceause we use the FileUpload component
149 if (status === 400) { 157 if (status === 400) {
150 this.error = response; 158 this.error = response;
@@ -163,7 +171,6 @@ export class VideoAddComponent extends FormReactive implements OnInit {
163 } 171 }
164 }; 172 };
165 173
166
167 this.uploader.uploadAll(); 174 this.uploader.uploadAll();
168 } 175 }
169} 176}