diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-08 14:41:15 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-04-08 14:41:15 +0200 |
commit | b06f1ead3b599a0315053572a6cf5811e533fc49 (patch) | |
tree | 60ee83ad75a0b332b53c99cf73087c9a2c9fa513 | |
parent | 4c7449d2add412e2cef4d55b357d58abaa0ae83b (diff) | |
download | PeerTube-b06f1ead3b599a0315053572a6cf5811e533fc49.tar.gz PeerTube-b06f1ead3b599a0315053572a6cf5811e533fc49.tar.zst PeerTube-b06f1ead3b599a0315053572a6cf5811e533fc49.zip |
Fix updating transcoding profiles
5 files changed, 25 insertions, 14 deletions
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 @@ | |||
153 | <my-select-options | 153 | <my-select-options |
154 | id="liveTranscodingProfile" | 154 | id="liveTranscodingProfile" |
155 | formControlName="profile" | 155 | formControlName="profile" |
156 | [items]="getAvailableTranscodingProfile()" | 156 | [items]="transcodingProfiles" |
157 | [clearable]="false" | 157 | [clearable]="false" |
158 | > | 158 | > |
159 | </my-select-options> | 159 | </my-select-options> |
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 @@ | |||
1 | 1 | ||
2 | import { SelectOptionsItem } from 'src/types/select-options-item.model' | 2 | import { SelectOptionsItem } from 'src/types/select-options-item.model' |
3 | import { Component, Input, OnInit } from '@angular/core' | 3 | import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' |
4 | import { FormGroup } from '@angular/forms' | 4 | import { FormGroup } from '@angular/forms' |
5 | import { ServerConfig } from '@shared/models' | 5 | import { ServerConfig } from '@shared/models' |
6 | import { ConfigService } from '../shared/config.service' | 6 | import { ConfigService } from '../shared/config.service' |
@@ -11,12 +11,14 @@ import { EditConfigurationService, ResolutionOption } from './edit-configuration | |||
11 | templateUrl: './edit-live-configuration.component.html', | 11 | templateUrl: './edit-live-configuration.component.html', |
12 | styleUrls: [ './edit-custom-config.component.scss' ] | 12 | styleUrls: [ './edit-custom-config.component.scss' ] |
13 | }) | 13 | }) |
14 | export class EditLiveConfigurationComponent implements OnInit { | 14 | export class EditLiveConfigurationComponent implements OnInit, OnChanges { |
15 | @Input() form: FormGroup | 15 | @Input() form: FormGroup |
16 | @Input() formErrors: any | 16 | @Input() formErrors: any |
17 | @Input() serverConfig: ServerConfig | 17 | @Input() serverConfig: ServerConfig |
18 | 18 | ||
19 | transcodingThreadOptions: SelectOptionsItem[] = [] | 19 | transcodingThreadOptions: SelectOptionsItem[] = [] |
20 | transcodingProfiles: SelectOptionsItem[] = [] | ||
21 | |||
20 | liveMaxDurationOptions: SelectOptionsItem[] = [] | 22 | liveMaxDurationOptions: SelectOptionsItem[] = [] |
21 | liveResolutions: ResolutionOption[] = [] | 23 | liveResolutions: ResolutionOption[] = [] |
22 | 24 | ||
@@ -39,7 +41,13 @@ export class EditLiveConfigurationComponent implements OnInit { | |||
39 | this.liveResolutions = this.editConfigurationService.getLiveResolutions() | 41 | this.liveResolutions = this.editConfigurationService.getLiveResolutions() |
40 | } | 42 | } |
41 | 43 | ||
42 | getAvailableTranscodingProfile () { | 44 | ngOnChanges (changes: SimpleChanges) { |
45 | if (changes['serverConfig']) { | ||
46 | this.transcodingProfiles = this.buildAvailableTranscodingProfile() | ||
47 | } | ||
48 | } | ||
49 | |||
50 | buildAvailableTranscodingProfile () { | ||
43 | const profiles = this.serverConfig.live.transcoding.availableProfiles | 51 | const profiles = this.serverConfig.live.transcoding.availableProfiles |
44 | 52 | ||
45 | return profiles.map(p => { | 53 | 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 @@ | |||
181 | <my-select-options | 181 | <my-select-options |
182 | id="transcodingProfile" | 182 | id="transcodingProfile" |
183 | formControlName="profile" | 183 | formControlName="profile" |
184 | [items]="getAvailableTranscodingProfile()" | 184 | [items]="transcodingProfiles" |
185 | [clearable]="false" | 185 | [clearable]="false" |
186 | ></my-select-options> | 186 | ></my-select-options> |
187 | 187 | ||
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 @@ | |||
1 | 1 | ||
2 | import { SelectOptionsItem } from 'src/types/select-options-item.model' | 2 | import { SelectOptionsItem } from 'src/types/select-options-item.model' |
3 | import { Component, Input, OnInit } from '@angular/core' | 3 | import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core' |
4 | import { FormGroup } from '@angular/forms' | 4 | import { FormGroup } from '@angular/forms' |
5 | import { ServerConfig } from '@shared/models' | 5 | import { ServerConfig } from '@shared/models' |
6 | import { ConfigService } from '../shared/config.service' | 6 | import { ConfigService } from '../shared/config.service' |
@@ -11,12 +11,13 @@ import { EditConfigurationService, ResolutionOption } from './edit-configuration | |||
11 | templateUrl: './edit-vod-transcoding.component.html', | 11 | templateUrl: './edit-vod-transcoding.component.html', |
12 | styleUrls: [ './edit-custom-config.component.scss' ] | 12 | styleUrls: [ './edit-custom-config.component.scss' ] |
13 | }) | 13 | }) |
14 | export class EditVODTranscodingComponent implements OnInit { | 14 | export class EditVODTranscodingComponent implements OnInit, OnChanges { |
15 | @Input() form: FormGroup | 15 | @Input() form: FormGroup |
16 | @Input() formErrors: any | 16 | @Input() formErrors: any |
17 | @Input() serverConfig: ServerConfig | 17 | @Input() serverConfig: ServerConfig |
18 | 18 | ||
19 | transcodingThreadOptions: SelectOptionsItem[] = [] | 19 | transcodingThreadOptions: SelectOptionsItem[] = [] |
20 | transcodingProfiles: SelectOptionsItem[] = [] | ||
20 | resolutions: ResolutionOption[] = [] | 21 | resolutions: ResolutionOption[] = [] |
21 | 22 | ||
22 | constructor ( | 23 | constructor ( |
@@ -31,7 +32,13 @@ export class EditVODTranscodingComponent implements OnInit { | |||
31 | this.checkTranscodingFields() | 32 | this.checkTranscodingFields() |
32 | } | 33 | } |
33 | 34 | ||
34 | getAvailableTranscodingProfile () { | 35 | ngOnChanges (changes: SimpleChanges) { |
36 | if (changes['serverConfig']) { | ||
37 | this.transcodingProfiles = this.buildAvailableTranscodingProfile() | ||
38 | } | ||
39 | } | ||
40 | |||
41 | buildAvailableTranscodingProfile () { | ||
35 | const profiles = this.serverConfig.transcoding.availableProfiles | 42 | const profiles = this.serverConfig.transcoding.availableProfiles |
36 | 43 | ||
37 | return profiles.map(p => { | 44 | return profiles.map(p => { |
diff --git a/client/src/app/shared/shared-main/date/date-toggle.component.ts b/client/src/app/shared/shared-main/date/date-toggle.component.ts index 53f25f0ad..0c3949f11 100644 --- a/client/src/app/shared/shared-main/date/date-toggle.component.ts +++ b/client/src/app/shared/shared-main/date/date-toggle.component.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { DatePipe } from '@angular/common' | 1 | import { Component, Input, OnChanges } from '@angular/core' |
2 | import { Component, Input, OnChanges, OnInit } from '@angular/core' | ||
3 | import { FromNowPipe } from '../angular/from-now.pipe' | 2 | import { FromNowPipe } from '../angular/from-now.pipe' |
4 | 3 | ||
5 | @Component({ | 4 | @Component({ |
@@ -14,10 +13,7 @@ export class DateToggleComponent implements OnChanges { | |||
14 | dateRelative: string | 13 | dateRelative: string |
15 | dateAbsolute: string | 14 | dateAbsolute: string |
16 | 15 | ||
17 | constructor ( | 16 | constructor (private fromNowPipe: FromNowPipe) { } |
18 | private datePipe: DatePipe, | ||
19 | private fromNowPipe: FromNowPipe | ||
20 | ) { } | ||
21 | 17 | ||
22 | ngOnChanges () { | 18 | ngOnChanges () { |
23 | this.updateDates() | 19 | this.updateDates() |