From ead64cdf8d917fa0d6a20271e42378f38e5f2407 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 9 Feb 2021 16:35:48 +0100 Subject: Support custom value in ng-select --- .../edit-custom-config.component.html | 61 ++++++++++------------ .../edit-custom-config.component.scss | 3 +- .../edit-custom-config.component.ts | 42 +++++++-------- 3 files changed, 49 insertions(+), 57 deletions(-) (limited to 'client/src/app/+admin') diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html index 5f0a5ff6c..844620ca2 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html @@ -445,13 +445,11 @@ allows to import multiple videos in parallel. ⚠️ Requires a PeerTube restart. -
- +
+ + jobs in parallel
+
{{ formErrors.import.concurrency }}
@@ -892,13 +890,13 @@ will claim at least {{ getTotalTranscodingThreads().value }} {{ getTotalTranscodingThreads().unit }} with live transcoding -
- -
+ +
{{ formErrors.transcoding.threads }}
@@ -908,13 +906,11 @@ allows to transcode multiple files in parallel. ⚠️ Requires a PeerTube restart. -
- +
+ + jobs in parallel
+
{{ formErrors.transcoding.concurrency }}
@@ -922,7 +918,7 @@ new transcoding profiles can be added by PeerTube plugins - x264, targeting maximum device compatibility - +
{{ formErrors.transcoding.profile }}
@@ -1007,10 +1003,10 @@
- + bindLabel="label" bindValue="value" [clearable]="false" [searchable]="true" + >
@@ -1069,13 +1065,12 @@ will claim at least {{ getTotalTranscodingThreads().value }} {{ getTotalTranscodingThreads().unit }} with VOD transcoding -
- -
+
{{ formErrors.live.transcoding.threads }}
@@ -1083,7 +1078,7 @@ new live transcoding profiles can be added by PeerTube plugins - x264, targeting maximum device compatibility - +
{{ formErrors.live.transcoding.profile }}
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss index 665247368..c12465d45 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.scss @@ -42,7 +42,8 @@ input[type=checkbox] { @include peertube-select-container($form-base-input-width); } -ng-select, +my-select-options, +my-select-custom-value, my-select-checkbox { @include responsive-width($form-base-input-width); diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index 48fb86968..a9f72d7db 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts @@ -37,12 +37,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A resolutions: { id: string, label: string, description?: string }[] = [] liveResolutions: { id: string, label: string, description?: string }[] = [] - concurrencyOptions: number[] = [] - transcodingThreadOptions: { label: string, value: number }[] = [] - liveMaxDurationOptions: { label: string, value: number }[] = [] - vodTranscodingProfileOptions: string[] = [] - liveTranscodingProfileOptions: string[] = [] + transcodingThreadOptions: SelectOptionsItem[] = [] + liveMaxDurationOptions: SelectOptionsItem[] = [] languageItems: SelectOptionsItem[] = [] categoryItems: SelectOptionsItem[] = [] @@ -99,23 +96,22 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A this.liveResolutions = this.resolutions.filter(r => r.id !== '0p') this.transcodingThreadOptions = [ - { value: 0, label: $localize`Auto (via ffmpeg)` }, - { value: 1, label: '1' }, - { value: 2, label: '2' }, - { value: 4, label: '4' }, - { value: 8, label: '8' } + { id: 0, label: $localize`Auto (via ffmpeg)` }, + { id: 1, label: '1' }, + { id: 2, label: '2' }, + { id: 4, label: '4' }, + { id: 8, label: '8' }, + { id: 12, label: '12' }, + { id: 16, label: '16' }, + { id: 32, label: '32' } ] - this.concurrencyOptions = [ 1, 2, 3, 4, 5, 6 ] - - this.vodTranscodingProfileOptions = [ 'default' ] - this.liveTranscodingProfileOptions = [ 'default' ] this.liveMaxDurationOptions = [ - { value: -1, label: $localize`No limit` }, - { value: 1000 * 3600, label: $localize`1 hour` }, - { value: 1000 * 3600 * 3, label: $localize`3 hours` }, - { value: 1000 * 3600 * 5, label: $localize`5 hours` }, - { value: 1000 * 3600 * 10, label: $localize`10 hours` } + { id: -1, label: $localize`No limit` }, + { id: 1000 * 3600, label: $localize`1 hour` }, + { id: 1000 * 3600 * 3, label: $localize`3 hours` }, + { id: 1000 * 3600 * 5, label: $localize`5 hours` }, + { id: 1000 * 3600 * 10, label: $localize`10 hours` } ] } @@ -137,11 +133,11 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A } getAvailableTranscodingProfile (type: 'live' | 'vod') { - if (type === 'live') { - return this.serverConfig.live.transcoding.availableProfiles - } + const profiles = type === 'live' + ? this.serverConfig.live.transcoding.availableProfiles + : this.serverConfig.transcoding.availableProfiles - return this.serverConfig.transcoding.availableProfiles + return profiles.map(p => ({ id: p, label: p })) } getTotalTranscodingThreads () { -- cgit v1.2.3