]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
Refractor notification service
[github/Chocobozzz/PeerTube.git] / client / src / app / +admin / config / edit-custom-config / edit-custom-config.component.ts
index 25b303f44f18929a75eb6ed46e5b96c093a53806..ee877ee31e328ced59439cd3c48e2f4a7b2437e1 100644 (file)
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'
 import { ConfigService } from '@app/+admin/config/shared/config.service'
 import { ServerService } from '@app/core/server/server.service'
 import { CustomConfigValidatorsService, FormReactive, UserValidatorsService } from '@app/shared'
-import { NotificationsService } from 'angular2-notifications'
+import { Notifier } from '@app/core'
 import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model'
 import { I18n } from '@ngx-translate/i18n-polyfill'
 import { BuildFormDefaultValues, FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
@@ -25,7 +25,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
     protected formValidatorService: FormValidatorService,
     private customConfigValidatorsService: CustomConfigValidatorsService,
     private userValidatorsService: UserValidatorsService,
-    private notificationsService: NotificationsService,
+    private notifier: Notifier,
     private configService: ConfigService,
     private serverService: ServerService,
     private i18n: I18n
@@ -62,7 +62,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
   }
 
   ngOnInit () {
-    const formGroupData = {
+    const formGroupData: { [key: string]: any } = {
       instanceName: this.customConfigValidatorsService.INSTANCE_NAME,
       instanceShortDescription: this.customConfigValidatorsService.INSTANCE_SHORT_DESCRIPTION,
       instanceDescription: null,
@@ -82,6 +82,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
       userVideoQuota: this.userValidatorsService.USER_VIDEO_QUOTA,
       userVideoQuotaDaily: this.userValidatorsService.USER_VIDEO_QUOTA_DAILY,
       transcodingThreads: this.customConfigValidatorsService.TRANSCODING_THREADS,
+      transcodingAllowAdditionalExtensions: null,
       transcodingEnabled: null,
       customizationJavascript: null,
       customizationCSS: null
@@ -109,7 +110,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
           this.forceCheck()
         },
 
-        err => this.notificationsService.error(this.i18n('Error'), err.message)
+        err => this.notifier.error(err.message)
       )
   }
 
@@ -163,6 +164,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
       },
       transcoding: {
         enabled: this.form.value['transcodingEnabled'],
+        allowAdditionalExtensions: this.form.value['transcodingAllowAdditionalExtensions'],
         threads: this.form.value['transcodingThreads'],
         resolutions: {
           '240p': this.form.value[this.getResolutionKey('240p')],
@@ -194,15 +196,15 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
 
           this.updateForm()
 
-          this.notificationsService.success(this.i18n('Success'), this.i18n('Configuration updated.'))
+          this.notifier.success(this.i18n('Configuration updated.'))
         },
 
-        err => this.notificationsService.error(this.i18n('Error'), err.message)
+        err => this.notifier.error(err.message)
       )
   }
 
   private updateForm () {
-    const data = {
+    const data: { [key: string]: any } = {
       instanceName: this.customConfig.instance.name,
       instanceShortDescription: this.customConfig.instance.shortDescription,
       instanceDescription: this.customConfig.instance.description,
@@ -221,6 +223,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
       userVideoQuotaDaily: this.customConfig.user.videoQuotaDaily,
       transcodingThreads: this.customConfig.transcoding.threads,
       transcodingEnabled: this.customConfig.transcoding.enabled,
+      transcodingAllowAdditionalExtensions: this.customConfig.transcoding.allowAdditionalExtensions,
       customizationJavascript: this.customConfig.instance.customizations.javascript,
       customizationCSS: this.customConfig.instance.customizations.css,
       importVideosHttpEnabled: this.customConfig.import.videos.http.enabled,