diff options
Diffstat (limited to 'client/src/app/videos/+video-edit/video-add.component.ts')
-rw-r--r-- | client/src/app/videos/+video-edit/video-add.component.ts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts index 3a9d932b8..75d608162 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts | |||
@@ -4,6 +4,7 @@ import { FormBuilder, FormGroup } from '@angular/forms' | |||
4 | import { Router } from '@angular/router' | 4 | import { Router } from '@angular/router' |
5 | import { UserService } from '@app/shared' | 5 | import { UserService } from '@app/shared' |
6 | import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' | 6 | import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' |
7 | import { LoadingBarService } from '@ngx-loading-bar/core' | ||
7 | import { NotificationsService } from 'angular2-notifications' | 8 | import { NotificationsService } from 'angular2-notifications' |
8 | import { BytesPipe } from 'ngx-pipes' | 9 | import { BytesPipe } from 'ngx-pipes' |
9 | import { Subscription } from 'rxjs/Subscription' | 10 | import { Subscription } from 'rxjs/Subscription' |
@@ -28,6 +29,7 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy | |||
28 | @ViewChild('videofileInput') videofileInput | 29 | @ViewChild('videofileInput') videofileInput |
29 | 30 | ||
30 | isUploadingVideo = false | 31 | isUploadingVideo = false |
32 | isUpdatingVideo = false | ||
31 | videoUploaded = false | 33 | videoUploaded = false |
32 | videoUploadObservable: Subscription = null | 34 | videoUploadObservable: Subscription = null |
33 | videoUploadPercents = 0 | 35 | videoUploadPercents = 0 |
@@ -53,7 +55,8 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy | |||
53 | private authService: AuthService, | 55 | private authService: AuthService, |
54 | private userService: UserService, | 56 | private userService: UserService, |
55 | private serverService: ServerService, | 57 | private serverService: ServerService, |
56 | private videoService: VideoService | 58 | private videoService: VideoService, |
59 | private loadingBar: LoadingBarService | ||
57 | ) { | 60 | ) { |
58 | super() | 61 | super() |
59 | } | 62 | } |
@@ -203,15 +206,21 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy | |||
203 | video.id = this.videoUploadedIds.id | 206 | video.id = this.videoUploadedIds.id |
204 | video.uuid = this.videoUploadedIds.uuid | 207 | video.uuid = this.videoUploadedIds.uuid |
205 | 208 | ||
209 | this.isUpdatingVideo = true | ||
210 | this.loadingBar.start() | ||
206 | this.videoService.updateVideo(video) | 211 | this.videoService.updateVideo(video) |
207 | .subscribe( | 212 | .subscribe( |
208 | () => { | 213 | () => { |
214 | this.isUpdatingVideo = false | ||
209 | this.isUploadingVideo = false | 215 | this.isUploadingVideo = false |
216 | this.loadingBar.complete() | ||
217 | |||
210 | this.notificationsService.success('Success', 'Video published.') | 218 | this.notificationsService.success('Success', 'Video published.') |
211 | this.router.navigate([ '/videos/watch', video.uuid ]) | 219 | this.router.navigate([ '/videos/watch', video.uuid ]) |
212 | }, | 220 | }, |
213 | 221 | ||
214 | err => { | 222 | err => { |
223 | this.isUpdatingVideo = false | ||
215 | this.notificationsService.error('Error', err.message) | 224 | this.notificationsService.error('Error', err.message) |
216 | console.error(err) | 225 | console.error(err) |
217 | } | 226 | } |