]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/form-validators/custom-config-validators.ts
Add transcoding fail message in client
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / form-validators / custom-config-validators.ts
1 import { Validators } from '@angular/forms'
2 import { BuildFormValidator } from './form-validator.model'
3
4 export const INSTANCE_NAME_VALIDATOR: BuildFormValidator = {
5 VALIDATORS: [ Validators.required ],
6 MESSAGES: {
7 required: $localize`Instance name is required.`
8 }
9 }
10
11 export const INSTANCE_SHORT_DESCRIPTION_VALIDATOR: BuildFormValidator = {
12 VALIDATORS: [ Validators.max(250) ],
13 MESSAGES: {
14 max: $localize`Short description should not be longer than 250 characters.`
15 }
16 }
17
18 export const SERVICES_TWITTER_USERNAME_VALIDATOR: BuildFormValidator = {
19 VALIDATORS: [ Validators.required ],
20 MESSAGES: {
21 required: $localize`Twitter username is required.`
22 }
23 }
24
25 export const CACHE_PREVIEWS_SIZE_VALIDATOR: BuildFormValidator = {
26 VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ],
27 MESSAGES: {
28 required: $localize`Previews cache size is required.`,
29 min: $localize`Previews cache size must be greater than 1.`,
30 pattern: $localize`Previews cache size must be a number.`
31 }
32 }
33
34 export const CACHE_CAPTIONS_SIZE_VALIDATOR: BuildFormValidator = {
35 VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ],
36 MESSAGES: {
37 required: $localize`Captions cache size is required.`,
38 min: $localize`Captions cache size must be greater than 1.`,
39 pattern: $localize`Captions cache size must be a number.`
40 }
41 }
42
43 export const SIGNUP_LIMIT_VALIDATOR: BuildFormValidator = {
44 VALIDATORS: [ Validators.required, Validators.min(-1), Validators.pattern('-?[0-9]+') ],
45 MESSAGES: {
46 required: $localize`Signup limit is required.`,
47 min: $localize`Signup limit must be greater than 1. Use -1 to disable it.`,
48 pattern: $localize`Signup limit must be a number.`
49 }
50 }
51
52 export const SIGNUP_MINIMUM_AGE_VALIDATOR: BuildFormValidator = {
53 VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ],
54 MESSAGES: {
55 required: $localize`Signup minimum age is required.`,
56 min: $localize`Signup minimum age must be greater than 1.`,
57 pattern: $localize`Signup minimum age must be a number.`
58 }
59 }
60
61 export const ADMIN_EMAIL_VALIDATOR: BuildFormValidator = {
62 VALIDATORS: [ Validators.required, Validators.email ],
63 MESSAGES: {
64 required: $localize`Admin email is required.`,
65 email: $localize`Admin email must be valid.`
66 }
67 }
68
69 export const TRANSCODING_THREADS_VALIDATOR: BuildFormValidator = {
70 VALIDATORS: [ Validators.required, Validators.min(0) ],
71 MESSAGES: {
72 required: $localize`Transcoding threads is required.`,
73 min: $localize`Transcoding threads must be greater or equal to 0.`
74 }
75 }
76
77 export const MAX_LIVE_DURATION_VALIDATOR: BuildFormValidator = {
78 VALIDATORS: [ Validators.required, Validators.min(-1) ],
79 MESSAGES: {
80 required: $localize`Max live duration is required.`,
81 min: $localize`Max live duration should be greater or equal to -1.`
82 }
83 }
84
85 export const MAX_INSTANCE_LIVES_VALIDATOR: BuildFormValidator = {
86 VALIDATORS: [ Validators.required, Validators.min(-1) ],
87 MESSAGES: {
88 required: $localize`Max instance lives is required.`,
89 min: $localize`Max instance lives should be greater or equal to -1.`
90 }
91 }
92
93 export const MAX_USER_LIVES_VALIDATOR: BuildFormValidator = {
94 VALIDATORS: [ Validators.required, Validators.min(-1) ],
95 MESSAGES: {
96 required: $localize`Max user lives is required.`,
97 min: $localize`Max user lives should be greater or equal to -1.`
98 }
99 }
100
101 export const MAX_VIDEO_CHANNELS_PER_USER_VALIDATOR: BuildFormValidator = {
102 VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ],
103 MESSAGES: {
104 required: $localize`Max video channels per user is required.`,
105 min: $localize`Max video channels per user must be greater or equal to 1.`,
106 pattern: $localize`Max video channels per user must be a number.`
107 }
108 }
109
110 export const CONCURRENCY_VALIDATOR: BuildFormValidator = {
111 VALIDATORS: [ Validators.required, Validators.min(1) ],
112 MESSAGES: {
113 required: $localize`Concurrency is required.`,
114 min: $localize`Concurrency should be greater or equal to 1.`
115 }
116 }
117
118 export const INDEX_URL_VALIDATOR: BuildFormValidator = {
119 VALIDATORS: [ Validators.pattern(/^https:\/\//) ],
120 MESSAGES: {
121 pattern: $localize`Index URL should be a URL`
122 }
123 }
124
125 export const SEARCH_INDEX_URL_VALIDATOR: BuildFormValidator = {
126 VALIDATORS: [ Validators.pattern(/^https?:\/\//) ],
127 MESSAGES: {
128 pattern: $localize`Search index URL should be a URL`
129 }
130 }