aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-10 11:42:10 +0100
committerChocobozzz <me@florianbigard.com>2021-02-10 11:42:10 +0100
commit4e55c132a007aa5466e1ac95a998df3ca88f3fb7 (patch)
tree845f51d40432be80e1cb464046c0b0559ee8aa89 /client/src/app
parent4e9835e63260aa6c2b7ce233de83a53f19563581 (diff)
downloadPeerTube-4e55c132a007aa5466e1ac95a998df3ca88f3fb7.tar.gz
PeerTube-4e55c132a007aa5466e1ac95a998df3ca88f3fb7.tar.zst
PeerTube-4e55c132a007aa5466e1ac95a998df3ca88f3fb7.zip
Add missing live config validators
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html2
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts13
-rw-r--r--client/src/app/shared/form-validators/custom-config-validators.ts24
3 files changed, 34 insertions, 5 deletions
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 534b03517..4596a130e 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
@@ -56,6 +56,8 @@
56 <div class="col-md-5 col-xl-5"> 56 <div class="col-md-5 col-xl-5">
57 <span class="form-error submit-error" i18n *ngIf="!form.valid"> 57 <span class="form-error submit-error" i18n *ngIf="!form.valid">
58 It seems like the configuration is invalid. Please search for potential errors in the different tabs. 58 It seems like the configuration is invalid. Please search for potential errors in the different tabs.
59
60 {{ formErrors }}
59 </span> 61 </span>
60 62
61 <span class="form-error submit-error" i18n *ngIf="!hasLiveAllowReplayConsistentOptions()"> 63 <span class="form-error submit-error" i18n *ngIf="!hasLiveAllowReplayConsistentOptions()">
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 a5eddf6c2..bbdf1bfbe 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
@@ -1,4 +1,6 @@
1 1
2import { forkJoin } from 'rxjs'
3import { SelectOptionsItem } from 'src/types/select-options-item.model'
2import { Component, OnInit } from '@angular/core' 4import { Component, OnInit } from '@angular/core'
3import { ActivatedRoute, Router } from '@angular/router' 5import { ActivatedRoute, Router } from '@angular/router'
4import { ConfigService } from '@app/+admin/config/shared/config.service' 6import { ConfigService } from '@app/+admin/config/shared/config.service'
@@ -12,6 +14,9 @@ import {
12 INDEX_URL_VALIDATOR, 14 INDEX_URL_VALIDATOR,
13 INSTANCE_NAME_VALIDATOR, 15 INSTANCE_NAME_VALIDATOR,
14 INSTANCE_SHORT_DESCRIPTION_VALIDATOR, 16 INSTANCE_SHORT_DESCRIPTION_VALIDATOR,
17 MAX_INSTANCE_LIVES_VALIDATOR,
18 MAX_LIVE_DURATION_VALIDATOR,
19 MAX_USER_LIVES_VALIDATOR,
15 SEARCH_INDEX_URL_VALIDATOR, 20 SEARCH_INDEX_URL_VALIDATOR,
16 SERVICES_TWITTER_USERNAME_VALIDATOR, 21 SERVICES_TWITTER_USERNAME_VALIDATOR,
17 SIGNUP_LIMIT_VALIDATOR, 22 SIGNUP_LIMIT_VALIDATOR,
@@ -20,8 +25,6 @@ import {
20import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators' 25import { USER_VIDEO_QUOTA_DAILY_VALIDATOR, USER_VIDEO_QUOTA_VALIDATOR } from '@app/shared/form-validators/user-validators'
21import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 26import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
22import { CustomConfig, ServerConfig } from '@shared/models' 27import { CustomConfig, ServerConfig } from '@shared/models'
23import { forkJoin } from 'rxjs'
24import { SelectOptionsItem } from 'src/types/select-options-item.model'
25import { EditConfigurationService } from './edit-configuration.service' 28import { EditConfigurationService } from './edit-configuration.service'
26 29
27@Component({ 30@Component({
@@ -156,9 +159,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
156 live: { 159 live: {
157 enabled: null, 160 enabled: null,
158 161
159 maxDuration: null, 162 maxDuration: MAX_LIVE_DURATION_VALIDATOR,
160 maxInstanceLives: null, 163 maxInstanceLives: MAX_INSTANCE_LIVES_VALIDATOR,
161 maxUserLives: null, 164 maxUserLives: MAX_USER_LIVES_VALIDATOR,
162 allowReplay: null, 165 allowReplay: null,
163 166
164 transcoding: { 167 transcoding: {
diff --git a/client/src/app/shared/form-validators/custom-config-validators.ts b/client/src/app/shared/form-validators/custom-config-validators.ts
index 23f2156c2..d6ce6db22 100644
--- a/client/src/app/shared/form-validators/custom-config-validators.ts
+++ b/client/src/app/shared/form-validators/custom-config-validators.ts
@@ -65,6 +65,30 @@ export const TRANSCODING_THREADS_VALIDATOR: BuildFormValidator = {
65 } 65 }
66} 66}
67 67
68export const MAX_LIVE_DURATION_VALIDATOR: BuildFormValidator = {
69 VALIDATORS: [Validators.required, Validators.min(-1)],
70 MESSAGES: {
71 'required': $localize`Max live duration is required.`,
72 'min': $localize`Max live duration should be greater or equal to -1.`
73 }
74}
75
76export const MAX_INSTANCE_LIVES_VALIDATOR: BuildFormValidator = {
77 VALIDATORS: [Validators.required, Validators.min(-1)],
78 MESSAGES: {
79 'required': $localize`Max instance lives is required.`,
80 'min': $localize`Max instance lives should be greater or equal to -1.`
81 }
82}
83
84export const MAX_USER_LIVES_VALIDATOR: BuildFormValidator = {
85 VALIDATORS: [Validators.required, Validators.min(-1)],
86 MESSAGES: {
87 'required': $localize`Max user lives is required.`,
88 'min': $localize`Max user lives should be greater or equal to -1.`
89 }
90}
91
68export const CONCURRENCY_VALIDATOR: BuildFormValidator = { 92export const CONCURRENCY_VALIDATOR: BuildFormValidator = {
69 VALIDATORS: [Validators.required, Validators.min(1)], 93 VALIDATORS: [Validators.required, Validators.min(1)],
70 MESSAGES: { 94 MESSAGES: {