From 70e335158499b0ac9e6da2193219d87512759876 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 10 Feb 2021 11:27:36 +0100 Subject: Small edit config refactor --- .../edit-advanced-configuration.component.html | 8 +++- .../edit-advanced-configuration.component.ts | 4 ++ .../edit-basic-configuration.component.html | 32 +++++++++---- .../edit-basic-configuration.component.ts | 12 +++++ .../edit-instance-information.component.html | 15 +++++++ .../edit-live-configuration.component.html | 46 +++++++++++-------- .../edit-live-configuration.component.ts | 16 ++++++- .../edit-vod-transcoding.component.html | 52 ++++++++++------------ .../edit-vod-transcoding.component.ts | 12 ++++- 9 files changed, 136 insertions(+), 61 deletions(-) (limited to 'client/src/app') diff --git a/client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.html b/client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.html index db3036c4e..6018ff5e0 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.html @@ -13,25 +13,29 @@
+
- {form.value['cache']['previews']['size'], plural, =1 {cached image} other {cached images}} + {getCacheSize('previews'), plural, =1 {cached image} other {cached images}}
+
{{ formErrors.cache.previews.size }}
+
- {form.value['cache']['captions']['size'], plural, =1 {cached image} other {cached images}} + {getCacheSize('captions'), plural, =1 {cached caption} other {cached captions}}
+
{{ formErrors.cache.captions.size }}
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.ts index a37b7b7d5..934438a50 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.ts @@ -11,4 +11,8 @@ import { FormGroup } from '@angular/forms' export class EditAdvancedConfigurationComponent { @Input() form: FormGroup @Input() formErrors: any + + getCacheSize (type: 'captions' | 'previews') { + return this.form.value['cache'][type]['size'] + } } diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html index ac1a11b4d..21a719d42 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.html @@ -25,6 +25,7 @@
+
+
{{ formErrors.instance.defaultClientRoute }}
@@ -48,6 +50,7 @@ +
+
{{ formErrors.trending.videos.algorithms.default }}
@@ -92,6 +96,7 @@
+
+
{{ formErrors.broadcastMessage.level }}
+ +
{{ formErrors.broadcastMessage.message }}
@@ -139,13 +147,14 @@ - -
+
+
{form.value['signup']['limit'], plural, =1 {user} other {users}}
+
{{ formErrors.signup.limit }}
- Signup won't be limited to a fixed number of users. + + Signup won't be limited to a fixed number of users.
@@ -207,9 +218,7 @@
- - allows to import multiple videos in parallel. ⚠️ Requires a PeerTube restart. - + allows to import multiple videos in parallel. ⚠️ Requires a PeerTube restart.
@@ -307,24 +316,26 @@ -
+
+ +
{{ formErrors.search.searchIndex.url }}
-
- @@ -433,10 +444,12 @@
+ +
{{ formErrors.admin.email }}
@@ -471,6 +484,7 @@ type="text" id="servicesTwitterUsername" class="form-control" formControlName="username" [ngClass]="{ 'input-error': formErrors['services.twitter.username'] }" > +
{{ formErrors.services.twitter.username }}
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts index 9a19c2913..34d05f9f3 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-basic-configuration.component.ts @@ -50,10 +50,22 @@ export class EditBasicConfigurationComponent implements OnInit { return this.form.value['signup']['enabled'] === true } + getDisabledSignupClass () { + return { 'disabled-checkbox-extra': !this.isSignupEnabled() } + } + + hasUnlimitedSignup () { + return this.form.value['signup']['limit'] === -1 + } + isSearchIndexEnabled () { return this.form.value['search']['searchIndex']['enabled'] === true } + getDisabledSearchIndexClass () { + return { 'disabled-checkbox-extra': !this.isSearchIndexEnabled() } + } + isAutoFollowIndexEnabled () { return this.form.value['followings']['instance']['autoFollowIndex']['enabled'] === true } diff --git a/client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.html b/client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.html index 6f19ede0a..35b42e742 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.html +++ b/client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.html @@ -11,28 +11,34 @@
+ +
{{ formErrors.instance.name }}
+ +
{{ formErrors.instance.shortDescription }}
+ +
{{ formErrors.instance.description }}
@@ -111,24 +117,29 @@
+
{{ formErrors.instance.defaultNSFWPolicy }}
+ +
{{ formErrors.instance.terms }}
+ +
{{ formErrors.instance.codeOfConduct }}
@@ -140,6 +151,7 @@ name="instanceModerationInformation" formControlName="moderationInformation" textareaMaxWidth="500px" [ngClass]="{ 'input-error': formErrors['instance.moderationInformation'] }" > +
{{ formErrors.instance.moderationInformation }}
@@ -173,6 +185,7 @@ name="instanceCreationReason" formControlName="creationReason" textareaMaxWidth="500px" [ngClass]="{ 'input-error': formErrors['instance.creationReason'] }" > +
{{ formErrors.instance.creationReason }}
@@ -184,6 +197,7 @@ name="instanceMaintenanceLifetime" formControlName="maintenanceLifetime" textareaMaxWidth="500px" [ngClass]="{ 'input-error': formErrors['instance.maintenanceLifetime'] }" > +
{{ formErrors.instance.maintenanceLifetime }}
@@ -195,6 +209,7 @@ name="instanceBusinessModel" formControlName="businessModel" textareaMaxWidth="500px" [ngClass]="{ 'input-error': formErrors['instance.businessModel'] }" > +
{{ formErrors.instance.businessModel }}
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 4b1a55245..65fc31412 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 @@ -25,7 +25,7 @@ -
+
-
- +
+ +
{form.value['live']['maxInstanceLives'], plural, =1 {live} other {lives}}
-
- +
+ +
{form.value['live']['maxUserLives'], plural, =1 {live} other {lives}}
-
+
-
+
@@ -91,11 +97,12 @@
-
+
+
+
-
+
+ - will claim at most {{ getTotalTranscodingThreads().value }} {{ getTotalTranscodingThreads().unit }} with VOD transcoding - will claim at least {{ getTotalTranscodingThreads().value }} {{ getTotalTranscodingThreads().unit }} with VOD transcoding + + will claim at most {{ getTotalTranscodingThreads().value }} {{ getTotalTranscodingThreads().unit }} with VOD transcoding + + + + will claim at least {{ getTotalTranscodingThreads().value }} {{ getTotalTranscodingThreads().unit }} with VOD transcoding + {{ formErrors.live.transcoding.threads }}
-
+
new live transcoding profiles can be added by PeerTube plugins @@ -136,14 +150,8 @@ [items]="getAvailableTranscodingProfile()" [clearable]="false" > - - {{ item }} - -
- x264, targeting maximum device compatibility -
-
+
{{ formErrors.live.transcoding.profile }}
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 a82a40a84..3328d28a9 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 @@ -42,7 +42,13 @@ export class EditLiveConfigurationComponent implements OnInit { getAvailableTranscodingProfile () { const profiles = this.serverConfig.live.transcoding.availableProfiles - return profiles.map(p => ({ id: p, label: p })) + return profiles.map(p => { + const description = p === 'default' + ? $localize`x264, targeting maximum device compatibility` + : '' + + return { id: p, label: p, description } + }) } getResolutionKey (resolution: string) { @@ -57,6 +63,14 @@ export class EditLiveConfigurationComponent implements OnInit { return this.editConfigurationService.isLiveEnabled(this.form) } + getDisabledLiveClass () { + return { 'disabled-checkbox-extra': !this.isLiveEnabled() } + } + + getDisabledLiveTranscodingClass () { + return { 'disabled-checkbox-extra': !this.isLiveEnabled() || !this.isLiveTranscodingEnabled() } + } + isLiveTranscodingEnabled () { return this.editConfigurationService.isLiveTranscodingEnabled(this.form) } 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 a51909865..5669b81ce 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 @@ -13,7 +13,9 @@
@@ -43,7 +45,7 @@
-
+
-
+
Output formats -
+
- -

If you also enabled HLS support, it will multiply videos storage by 2

- -
- - If disabled, breaks federation with PeerTube instances < 2.1 + +

If you also enabled HLS support, it will multiply videos storage by 2

@@ -90,7 +88,7 @@ -
+
-
+
@@ -142,11 +140,16 @@
-
+
- will claim at most {{ getTotalTranscodingThreads().value }} {{ getTotalTranscodingThreads().unit }} with live transcoding - will claim at least {{ getTotalTranscodingThreads().value }} {{ getTotalTranscodingThreads().unit }} with live transcoding + + will claim at most {{ getTotalTranscodingThreads().value }} {{ getTotalTranscodingThreads().unit }} with live transcoding + + + + will claim at least {{ getTotalTranscodingThreads().value }} {{ getTotalTranscodingThreads().unit }} with live transcoding + {{ formErrors.transcoding.threads }}
-
+
- - allows to transcode multiple files in parallel. ⚠️ Requires a PeerTube restart. - + allows to transcode multiple files in parallel. ⚠️ Requires a PeerTube restart
@@ -173,7 +174,7 @@
{{ formErrors.transcoding.concurrency }}
-
+
new transcoding profiles can be added by PeerTube plugins @@ -182,15 +183,8 @@ formControlName="profile" [items]="getAvailableTranscodingProfile()" [clearable]="false" - > - - {{ item }} - -
- x264, targeting maximum device compatibility -
-
- + > +
{{ formErrors.transcoding.profile }}
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 d745912a0..b864f1bc4 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 @@ -34,7 +34,13 @@ export class EditVODTranscodingComponent implements OnInit { getAvailableTranscodingProfile () { const profiles = this.serverConfig.transcoding.availableProfiles - return profiles.map(p => ({ id: p, label: p })) + return profiles.map(p => { + const description = p === 'default' + ? $localize`x264, targeting maximum device compatibility` + : '' + + return { id: p, label: p, description } + }) } getResolutionKey (resolution: string) { @@ -45,6 +51,10 @@ export class EditVODTranscodingComponent implements OnInit { return this.editConfigurationService.isTranscodingEnabled(this.form) } + getTranscodingDisabledClass () { + return { 'disabled-checkbox-extra': !this.isTranscodingEnabled() } + } + getTotalTranscodingThreads () { return this.editConfigurationService.getTotalTranscodingThreads(this.form) } -- cgit v1.2.3