diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-05 10:58:45 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-05 10:58:45 +0200 |
commit | d18d64787b3ea174f7dc2740c8c8c9555625047e (patch) | |
tree | e65089e0ca81117c1ada981b9b8a524afa8d70f5 /client/src/app/videos/+video-edit/video-update.component.ts | |
parent | 25acef90a85c1584880dec96aa402f896af8364a (diff) | |
download | PeerTube-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.ts | 15 |
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 @@ | |||
1 | import { map, switchMap } from 'rxjs/operators' | 1 | import { map, switchMap } from 'rxjs/operators' |
2 | import { Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
3 | import { FormBuilder, FormGroup } from '@angular/forms' | ||
4 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
5 | import { LoadingBarService } from '@ngx-loading-bar/core' | 4 | import { LoadingBarService } from '@ngx-loading-bar/core' |
6 | import { NotificationsService } from 'angular2-notifications' | 5 | import { NotificationsService } from 'angular2-notifications' |
@@ -8,11 +7,11 @@ import { VideoPrivacy } from '../../../../../shared/models/videos' | |||
8 | import { ServerService } from '../../core' | 7 | import { ServerService } from '../../core' |
9 | import { AuthService } from '../../core/auth' | 8 | import { AuthService } from '../../core/auth' |
10 | import { FormReactive } from '../../shared' | 9 | import { FormReactive } from '../../shared' |
11 | import { ValidatorMessage } from '../../shared/forms/form-validators/validator-message' | ||
12 | import { VideoEdit } from '../../shared/video/video-edit.model' | 10 | import { VideoEdit } from '../../shared/video/video-edit.model' |
13 | import { VideoService } from '../../shared/video/video.service' | 11 | import { VideoService } from '../../shared/video/video.service' |
14 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' | 12 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' |
15 | import { I18n } from '@ngx-translate/i18n-polyfill' | 13 | import { I18n } from '@ngx-translate/i18n-polyfill' |
14 | import { 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()) |