From b06f1ead3b599a0315053572a6cf5811e533fc49 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 8 Apr 2021 14:41:15 +0200 Subject: Fix updating transcoding profiles --- .../edit-live-configuration.component.html | 2 +- .../edit-live-configuration.component.ts | 14 +++++++++++--- .../edit-custom-config/edit-vod-transcoding.component.html | 2 +- .../edit-custom-config/edit-vod-transcoding.component.ts | 13 ++++++++++--- 4 files changed, 23 insertions(+), 8 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.html b/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.html index 5d826fbe9..10d5278c1 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.html @@ -153,7 +153,7 @@ diff --git a/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts index 3328d28a9..72372ffac 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-live-configuration.component.ts @@ -1,6 +1,6 @@ import { SelectOptionsItem } from 'src/types/select-options-item.model' -import { Component, Input, OnInit } from '@angular/core' +import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' import { FormGroup } from '@angular/forms' import { ServerConfig } from '@shared/models' import { ConfigService } from '../shared/config.service' @@ -11,12 +11,14 @@ import { EditConfigurationService, ResolutionOption } from './edit-configuration templateUrl: './edit-live-configuration.component.html', styleUrls: [ './edit-custom-config.component.scss' ] }) -export class EditLiveConfigurationComponent implements OnInit { +export class EditLiveConfigurationComponent implements OnInit, OnChanges { @Input() form: FormGroup @Input() formErrors: any @Input() serverConfig: ServerConfig transcodingThreadOptions: SelectOptionsItem[] = [] + transcodingProfiles: SelectOptionsItem[] = [] + liveMaxDurationOptions: SelectOptionsItem[] = [] liveResolutions: ResolutionOption[] = [] @@ -39,7 +41,13 @@ export class EditLiveConfigurationComponent implements OnInit { this.liveResolutions = this.editConfigurationService.getLiveResolutions() } - getAvailableTranscodingProfile () { + ngOnChanges (changes: SimpleChanges) { + if (changes['serverConfig']) { + this.transcodingProfiles = this.buildAvailableTranscodingProfile() + } + } + + buildAvailableTranscodingProfile () { const profiles = this.serverConfig.live.transcoding.availableProfiles return profiles.map(p => { diff --git a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html index cf13b27bb..1c5d6a9b4 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.html @@ -181,7 +181,7 @@ diff --git a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts index b864f1bc4..a2dc3e52a 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-vod-transcoding.component.ts @@ -1,6 +1,6 @@ import { SelectOptionsItem } from 'src/types/select-options-item.model' -import { Component, Input, OnInit } from '@angular/core' +import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' import { FormGroup } from '@angular/forms' import { ServerConfig } from '@shared/models' import { ConfigService } from '../shared/config.service' @@ -11,12 +11,13 @@ import { EditConfigurationService, ResolutionOption } from './edit-configuration templateUrl: './edit-vod-transcoding.component.html', styleUrls: [ './edit-custom-config.component.scss' ] }) -export class EditVODTranscodingComponent implements OnInit { +export class EditVODTranscodingComponent implements OnInit, OnChanges { @Input() form: FormGroup @Input() formErrors: any @Input() serverConfig: ServerConfig transcodingThreadOptions: SelectOptionsItem[] = [] + transcodingProfiles: SelectOptionsItem[] = [] resolutions: ResolutionOption[] = [] constructor ( @@ -31,7 +32,13 @@ export class EditVODTranscodingComponent implements OnInit { this.checkTranscodingFields() } - getAvailableTranscodingProfile () { + ngOnChanges (changes: SimpleChanges) { + if (changes['serverConfig']) { + this.transcodingProfiles = this.buildAvailableTranscodingProfile() + } + } + + buildAvailableTranscodingProfile () { const profiles = this.serverConfig.transcoding.availableProfiles return profiles.map(p => { -- cgit v1.2.3