Fix updating transcoding profiles

This commit is contained in:
Chocobozzz 2021-04-08 14:41:15 +02:00
parent 4c7449d2ad
commit b06f1ead3b
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
5 changed files with 25 additions and 14 deletions

View File

@ -153,7 +153,7 @@
<my-select-options
id="liveTranscodingProfile"
formControlName="profile"
[items]="getAvailableTranscodingProfile()"
[items]="transcodingProfiles"
[clearable]="false"
>
</my-select-options>

View File

@ -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 => {

View File

@ -181,7 +181,7 @@
<my-select-options
id="transcodingProfile"
formControlName="profile"
[items]="getAvailableTranscodingProfile()"
[items]="transcodingProfiles"
[clearable]="false"
></my-select-options>

View File

@ -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 => {

View File

@ -1,5 +1,4 @@
import { DatePipe } from '@angular/common'
import { Component, Input, OnChanges, OnInit } from '@angular/core'
import { Component, Input, OnChanges } from '@angular/core'
import { FromNowPipe } from '../angular/from-now.pipe'
@Component({
@ -14,10 +13,7 @@ export class DateToggleComponent implements OnChanges {
dateRelative: string
dateAbsolute: string
constructor (
private datePipe: DatePipe,
private fromNowPipe: FromNowPipe
) { }
constructor (private fromNowPipe: FromNowPipe) { }
ngOnChanges () {
this.updateDates()