import { Component, HostListener, OnInit } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
import { Notifier } from '@app/core'
-import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
+import { FormReactive, FormValidatorService, SelectChannelItem } from '@app/shared/shared-forms'
import { VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main'
import { LoadingBarService } from '@ngx-loading-bar/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoPrivacy } from '@shared/models'
@Component({
video: VideoEdit
isUpdatingVideo = false
- userVideoChannels: { id: number, label: string, support: string }[] = []
+ userVideoChannels: SelectChannelItem[] = []
schedulePublicationPossible = false
videoCaptions: VideoCaptionEdit[] = []
waitTranscodingEnabled = true
private notifier: Notifier,
private videoService: VideoService,
private loadingBar: LoadingBarService,
- private videoCaptionService: VideoCaptionService,
- private i18n: I18n
- ) {
+ private videoCaptionService: VideoCaptionService
+ ) {
super()
}
canDeactivate (): { canDeactivate: boolean, text?: string } {
if (this.updateDone === true) return { canDeactivate: true }
- const text = this.i18n('You have unsaved changes! If you leave, your changes will be lost.')
+ const text = $localize`You have unsaved changes! If you leave, your changes will be lost.`
for (const caption of this.videoCaptions) {
if (caption.action) return { canDeactivate: false, text }
this.updateDone = true
this.isUpdatingVideo = false
this.loadingBar.useRef().complete()
- this.notifier.success(this.i18n('Video updated.'))
+ this.notifier.success($localize`Video updated.`)
this.router.navigate([ '/videos/watch', this.video.uuid ])
},
)
}
+ hydratePluginFieldsFromVideo () {
+ if (!this.video.pluginData) return
+
+ this.form.patchValue({
+ pluginData: this.video.pluginData
+ })
+ }
+
private hydrateFormFromVideo () {
this.form.patchValue(this.video.toFormPatch())