aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-edit/video-add.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-16 17:24:47 +0100
committerChocobozzz <me@florianbigard.com>2018-02-16 17:24:47 +0100
commit68e24d727969a73a13e3c29b4d3bcfe50c3c52be (patch)
tree9908a5b6f26dfc0fd80aa123e843ea11f39c7501 /client/src/app/videos/+video-edit/video-add.component.ts
parent6de36768980ef6063b8fcd730b59fa685dd2b99c (diff)
downloadPeerTube-68e24d727969a73a13e3c29b4d3bcfe50c3c52be.tar.gz
PeerTube-68e24d727969a73a13e3c29b4d3bcfe50c3c52be.tar.zst
PeerTube-68e24d727969a73a13e3c29b4d3bcfe50c3c52be.zip
Add loading bar when updating a video
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.ts11
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'
4import { Router } from '@angular/router' 4import { Router } from '@angular/router'
5import { UserService } from '@app/shared' 5import { UserService } from '@app/shared'
6import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' 6import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service'
7import { LoadingBarService } from '@ngx-loading-bar/core'
7import { NotificationsService } from 'angular2-notifications' 8import { NotificationsService } from 'angular2-notifications'
8import { BytesPipe } from 'ngx-pipes' 9import { BytesPipe } from 'ngx-pipes'
9import { Subscription } from 'rxjs/Subscription' 10import { 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 }