aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-10-07 14:52:18 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-10-07 14:52:18 +0200
commit1a00504203d16a0d29cc1650bd3f58ecab128ec3 (patch)
tree6ef039517c227d877891b8a17d8515ac43be910a /client/src
parentbf94b6f0a1ac2cd5304f5cc7f85434120489cab8 (diff)
downloadPeerTube-1a00504203d16a0d29cc1650bd3f58ecab128ec3.tar.gz
PeerTube-1a00504203d16a0d29cc1650bd3f58ecab128ec3.tar.zst
PeerTube-1a00504203d16a0d29cc1650bd3f58ecab128ec3.zip
Client: fix progress bar and tags validation issues
Diffstat (limited to 'client/src')
-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
2 files changed, 10 insertions, 3 deletions
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}