import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
import { VideoCaptionEdit } from '@app/shared/shared-main'
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
-import { ServerConfig, VideoConstant } from '@shared/models'
+import { HTMLServerConfig, VideoConstant } from '@shared/models'
@Component({
selector: 'my-video-caption-add-modal',
export class VideoCaptionAddModalComponent extends FormReactive implements OnInit {
@Input() existingCaptions: string[]
- @Input() serverConfig: ServerConfig
+ @Input() serverConfig: HTMLServerConfig
@Output() captionAdded = new EventEmitter<VideoCaptionEdit>()
return this.serverConfig.videoCaption.file.size.max
}
+ getReactiveFileButtonTooltip () {
+ return `(extensions: ${this.videoCaptionExtensions.join(', ')})`
+ }
+
ngOnInit () {
this.serverService.getVideoLanguages()
.subscribe(languages => this.videoCaptionLanguages = languages)
isReplacingExistingCaption () {
if (this.closingModal === true) return false
- const languageId = this.form.value[ 'language' ]
+ const languageId = this.form.value['language']
- return languageId && this.existingCaptions.indexOf(languageId) !== -1
+ return languageId && this.existingCaptions.includes(languageId)
}
- async addCaption () {
- const languageId = this.form.value[ 'language' ]
+ addCaption () {
+ const languageId = this.form.value['language']
const languageObject = this.videoCaptionLanguages.find(l => l.id === languageId)
this.captionAdded.emit({
language: languageObject,
- captionfile: this.form.value[ 'captionfile' ]
+ captionfile: this.form.value['captionfile'],
+ action: 'CREATE'
})
this.hide()