aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-edit/video-update.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-05 10:58:45 +0200
committerChocobozzz <me@florianbigard.com>2018-06-05 10:58:45 +0200
commitd18d64787b3ea174f7dc2740c8c8c9555625047e (patch)
treee65089e0ca81117c1ada981b9b8a524afa8d70f5 /client/src/app/videos/+video-edit/video-update.component.ts
parent25acef90a85c1584880dec96aa402f896af8364a (diff)
downloadPeerTube-d18d64787b3ea174f7dc2740c8c8c9555625047e.tar.gz
PeerTube-d18d64787b3ea174f7dc2740c8c8c9555625047e.tar.zst
PeerTube-d18d64787b3ea174f7dc2740c8c8c9555625047e.zip
Form validators refractoring
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.ts15
1 files changed, 3 insertions, 12 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 e37dd526f..0266164af 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,5 @@
1import { map, switchMap } from 'rxjs/operators' 1import { map, switchMap } from 'rxjs/operators'
2import { Component, OnInit } from '@angular/core' 2import { Component, OnInit } from '@angular/core'
3import { FormBuilder, FormGroup } from '@angular/forms'
4import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
5import { LoadingBarService } from '@ngx-loading-bar/core' 4import { LoadingBarService } from '@ngx-loading-bar/core'
6import { NotificationsService } from 'angular2-notifications' 5import { NotificationsService } from 'angular2-notifications'
@@ -8,11 +7,11 @@ import { VideoPrivacy } from '../../../../../shared/models/videos'
8import { ServerService } from '../../core' 7import { ServerService } from '../../core'
9import { AuthService } from '../../core/auth' 8import { AuthService } from '../../core/auth'
10import { FormReactive } from '../../shared' 9import { FormReactive } from '../../shared'
11import { ValidatorMessage } from '../../shared/forms/form-validators/validator-message'
12import { VideoEdit } from '../../shared/video/video-edit.model' 10import { VideoEdit } from '../../shared/video/video-edit.model'
13import { VideoService } from '../../shared/video/video.service' 11import { VideoService } from '../../shared/video/video.service'
14import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' 12import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
15import { I18n } from '@ngx-translate/i18n-polyfill' 13import { I18n } from '@ngx-translate/i18n-polyfill'
14import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
16 15
17@Component({ 16@Component({
18 selector: 'my-videos-update', 17 selector: 'my-videos-update',
@@ -23,14 +22,11 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
23 video: VideoEdit 22 video: VideoEdit
24 23
25 isUpdatingVideo = false 24 isUpdatingVideo = false
26 form: FormGroup
27 formErrors: { [ id: string ]: string } = {}
28 validationMessages: ValidatorMessage = {}
29 videoPrivacies = [] 25 videoPrivacies = []
30 userVideoChannels = [] 26 userVideoChannels = []
31 27
32 constructor ( 28 constructor (
33 private formBuilder: FormBuilder, 29 protected formValidatorService: FormValidatorService,
34 private route: ActivatedRoute, 30 private route: ActivatedRoute,
35 private router: Router, 31 private router: Router,
36 private notificationsService: NotificationsService, 32 private notificationsService: NotificationsService,
@@ -44,13 +40,8 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
44 super() 40 super()
45 } 41 }
46 42
47 buildForm () {
48 this.form = this.formBuilder.group({})
49 this.form.valueChanges.subscribe(data => this.onValueChanged(data))
50 }
51
52 ngOnInit () { 43 ngOnInit () {
53 this.buildForm() 44 this.buildForm({})
54 45
55 this.serverService.videoPrivaciesLoaded 46 this.serverService.videoPrivaciesLoaded
56 .subscribe(() => this.videoPrivacies = this.serverService.getVideoPrivacies()) 47 .subscribe(() => this.videoPrivacies = this.serverService.getVideoPrivacies())