X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fvideos%2F%2Bvideo-edit%2Fvideo-add.component.ts;h=3ddeda1095f87aedb1f99095513c65bf4d1baf15;hb=0c237b19fdf9c614293c1442f0ab95a81ce05735;hp=a615fd92c3ecdf6ad0853be472c77bbd08cc2c4b;hpb=b1d40cff89f7cff565a98cdbcea9a624196a169a;p=github%2FChocobozzz%2FPeerTube.git 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 a615fd92c..3ddeda109 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts @@ -1,6 +1,5 @@ import { HttpEventType, HttpResponse } from '@angular/common/http' import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core' -import { FormBuilder, FormGroup } from '@angular/forms' import { Router } from '@angular/router' import { UserService } from '@app/shared' import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.service' @@ -11,11 +10,11 @@ import { Subscription } from 'rxjs' import { VideoPrivacy } from '../../../../../shared/models/videos' import { AuthService, ServerService } from '../../core' import { FormReactive } from '../../shared' -import { ValidatorMessage } from '../../shared/forms/form-validators/validator-message' import { populateAsyncUserVideoChannels } from '../../shared/misc/utils' import { VideoEdit } from '../../shared/video/video-edit.model' import { VideoService } from '../../shared/video/video.service' import { I18n } from '@ngx-translate/i18n-polyfill' +import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' @Component({ selector: 'my-videos-add', @@ -28,6 +27,9 @@ import { I18n } from '@ngx-translate/i18n-polyfill' export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy, CanComponentDeactivate { @ViewChild('videofileInput') videofileInput + // So that it can be accessed in the template + readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY + isUploadingVideo = false isUpdatingVideo = false videoUploaded = false @@ -39,10 +41,6 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy } videoFileName: string - form: FormGroup - formErrors: { [ id: string ]: string } = {} - validationMessages: ValidatorMessage = {} - userVideoChannels: { id: number, label: string, support: string }[] = [] userVideoQuotaUsed = 0 videoPrivacies = [] @@ -50,7 +48,7 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy firstStepChannelId = 0 constructor ( - private formBuilder: FormBuilder, + protected formValidatorService: FormValidatorService, private router: Router, private notificationsService: NotificationsService, private authService: AuthService, @@ -67,13 +65,8 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy return this.serverService.getConfig().video.file.extensions.join(',') } - buildForm () { - this.form = this.formBuilder.group({}) - this.form.valueChanges.subscribe(data => this.onValueChanged(data)) - } - ngOnInit () { - this.buildForm() + this.buildForm({}) populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) .then(() => this.firstStepChannelId = this.userVideoChannels[0].id) @@ -174,6 +167,7 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy const privacy = this.firstStepPrivacyId.toString() const nsfw = false + const waitTranscoding = true const commentsEnabled = true const channelId = this.firstStepChannelId.toString() @@ -183,6 +177,7 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy formData.append('privacy', VideoPrivacy.PRIVATE.toString()) formData.append('nsfw', '' + nsfw) formData.append('commentsEnabled', '' + commentsEnabled) + formData.append('waitTranscoding', '' + waitTranscoding) formData.append('channelId', '' + channelId) formData.append('videofile', videofile)