aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-edit/video-update.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-update.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-update.component.ts')
-rw-r--r--client/src/app/videos/+video-edit/video-update.component.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts
index ad6452835..de34555ab 100644
--- a/client/src/app/videos/+video-edit/video-update.component.ts
+++ b/client/src/app/videos/+video-edit/video-update.component.ts
@@ -1,6 +1,7 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { FormBuilder, FormGroup } from '@angular/forms' 2import { FormBuilder, FormGroup } from '@angular/forms'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { LoadingBarService } from '@ngx-loading-bar/core'
4import { NotificationsService } from 'angular2-notifications' 5import { NotificationsService } from 'angular2-notifications'
5import 'rxjs/add/observable/forkJoin' 6import 'rxjs/add/observable/forkJoin'
6import { VideoPrivacy } from '../../../../../shared/models/videos' 7import { VideoPrivacy } from '../../../../../shared/models/videos'
@@ -21,6 +22,7 @@ import { VideoService } from '../../shared/video/video.service'
21export class VideoUpdateComponent extends FormReactive implements OnInit { 22export class VideoUpdateComponent extends FormReactive implements OnInit {
22 video: VideoEdit 23 video: VideoEdit
23 24
25 isUpdatingVideo = false
24 form: FormGroup 26 form: FormGroup
25 formErrors: { [ id: string ]: string } = {} 27 formErrors: { [ id: string ]: string } = {}
26 validationMessages: ValidatorMessage = {} 28 validationMessages: ValidatorMessage = {}
@@ -34,7 +36,8 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
34 private notificationsService: NotificationsService, 36 private notificationsService: NotificationsService,
35 private serverService: ServerService, 37 private serverService: ServerService,
36 private videoService: VideoService, 38 private videoService: VideoService,
37 private authService: AuthService 39 private authService: AuthService,
40 private loadingBar: LoadingBarService
38 ) { 41 ) {
39 super() 42 super()
40 } 43 }
@@ -98,14 +101,19 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
98 101
99 this.video.patch(this.form.value) 102 this.video.patch(this.form.value)
100 103
104 this.loadingBar.start()
105 this.isUpdatingVideo = true
101 this.videoService.updateVideo(this.video) 106 this.videoService.updateVideo(this.video)
102 .subscribe( 107 .subscribe(
103 () => { 108 () => {
109 this.isUpdatingVideo = false
110 this.loadingBar.complete()
104 this.notificationsService.success('Success', 'Video updated.') 111 this.notificationsService.success('Success', 'Video updated.')
105 this.router.navigate([ '/videos/watch', this.video.uuid ]) 112 this.router.navigate([ '/videos/watch', this.video.uuid ])
106 }, 113 },
107 114
108 err => { 115 err => {
116 this.isUpdatingVideo = false
109 this.notificationsService.error('Error', err.message) 117 this.notificationsService.error('Error', err.message)
110 console.error(err) 118 console.error(err)
111 } 119 }