}
this.buildForm(formGroupData)
-
- forkJoin([
- this.configService.getCustomConfig(),
- this.serverService.getVideoLanguages(),
- this.serverService.getVideoCategories()
- ]).subscribe(
- ([ config, languages, categories ]) => {
- this.customConfig = config
-
- this.languageItems = languages.map(l => ({ label: l.label, value: l.id }))
- this.categoryItems = categories.map(l => ({ label: l.label, value: l.id }))
-
- this.updateForm()
- // Force form validation
- this.forceCheck()
- },
-
- err => this.notifier.error(err.message)
- )
+ this.loadForm()
+ this.checkTranscodingFields()
}
isTranscodingEnabled () {
}
async formValidated () {
- this.configService.updateCustomConfig(this.form.value)
- .pipe(
- )
+ this.configService.updateCustomConfig(this.form.getRawValue())
.subscribe(
res => {
this.customConfig = res
private updateForm () {
this.form.patchValue(this.customConfig)
}
+
+ private loadForm () {
+ forkJoin([
+ this.configService.getCustomConfig(),
+ this.serverService.getVideoLanguages(),
+ this.serverService.getVideoCategories()
+ ]).subscribe(
+ ([ config, languages, categories ]) => {
+ this.customConfig = config
+
+ this.languageItems = languages.map(l => ({ label: l.label, value: l.id }))
+ this.categoryItems = categories.map(l => ({ label: l.label, value: l.id }))
+
+ this.updateForm()
+ // Force form validation
+ this.forceCheck()
+ },
+
+ err => this.notifier.error(err.message)
+ )
+ }
+
+ private checkTranscodingFields () {
+ const hlsControl = this.form.get('transcoding.hls.enabled')
+ const webtorrentControl = this.form.get('transcoding.webtorrent.enabled')
+
+ webtorrentControl.valueChanges
+ .subscribe(newValue => {
+ if (newValue === false && !hlsControl.disabled) {
+ hlsControl.disable()
+ }
+
+ if (newValue === true && !hlsControl.enabled) {
+ hlsControl.enable()
+ }
+ })
+
+ hlsControl.valueChanges
+ .subscribe(newValue => {
+ if (newValue === false && !webtorrentControl.disabled) {
+ webtorrentControl.disable()
+ }
+
+ if (newValue === true && !webtorrentControl.enabled) {
+ webtorrentControl.enable()
+ }
+ })
+ }
}
body('transcoding.resolutions.1080p').isBoolean().withMessage('Should have a valid transcoding 1080p resolution enabled boolean'),
body('transcoding.webtorrent.enabled').isBoolean().withMessage('Should have a valid webtorrent transcoding enabled boolean'),
- body('transcoding.hls.enabled').isBoolean().withMessage('Should have a valid webtorrent transcoding enabled boolean'),
+ body('transcoding.hls.enabled').isBoolean().withMessage('Should have a valid hls transcoding enabled boolean'),
body('import.videos.http.enabled').isBoolean().withMessage('Should have a valid import video http enabled boolean'),
body('import.videos.torrent.enabled').isBoolean().withMessage('Should have a valid import video torrent enabled boolean'),