diff options
Diffstat (limited to 'client/src/app/shared/shared-forms/form-validators/custom-config-validators.service.ts')
-rw-r--r-- | client/src/app/shared/shared-forms/form-validators/custom-config-validators.service.ts | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/client/src/app/shared/shared-forms/form-validators/custom-config-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/custom-config-validators.service.ts deleted file mode 100644 index 862ff5470..000000000 --- a/client/src/app/shared/shared-forms/form-validators/custom-config-validators.service.ts +++ /dev/null | |||
@@ -1,97 +0,0 @@ | |||
1 | import { Injectable } from '@angular/core' | ||
2 | import { Validators } from '@angular/forms' | ||
3 | import { BuildFormValidator } from './form-validator.service' | ||
4 | |||
5 | @Injectable() | ||
6 | export class CustomConfigValidatorsService { | ||
7 | readonly INSTANCE_NAME: BuildFormValidator | ||
8 | readonly INSTANCE_SHORT_DESCRIPTION: BuildFormValidator | ||
9 | readonly SERVICES_TWITTER_USERNAME: BuildFormValidator | ||
10 | readonly CACHE_PREVIEWS_SIZE: BuildFormValidator | ||
11 | readonly CACHE_CAPTIONS_SIZE: BuildFormValidator | ||
12 | readonly SIGNUP_LIMIT: BuildFormValidator | ||
13 | readonly ADMIN_EMAIL: BuildFormValidator | ||
14 | readonly TRANSCODING_THREADS: BuildFormValidator | ||
15 | readonly INDEX_URL: BuildFormValidator | ||
16 | readonly SEARCH_INDEX_URL: BuildFormValidator | ||
17 | |||
18 | constructor () { | ||
19 | this.INSTANCE_NAME = { | ||
20 | VALIDATORS: [ Validators.required ], | ||
21 | MESSAGES: { | ||
22 | 'required': $localize`Instance name is required.` | ||
23 | } | ||
24 | } | ||
25 | |||
26 | this.INSTANCE_SHORT_DESCRIPTION = { | ||
27 | VALIDATORS: [ Validators.max(250) ], | ||
28 | MESSAGES: { | ||
29 | 'max': $localize`Short description should not be longer than 250 characters.` | ||
30 | } | ||
31 | } | ||
32 | |||
33 | this.SERVICES_TWITTER_USERNAME = { | ||
34 | VALIDATORS: [ Validators.required ], | ||
35 | MESSAGES: { | ||
36 | 'required': $localize`Twitter username is required.` | ||
37 | } | ||
38 | } | ||
39 | |||
40 | this.CACHE_PREVIEWS_SIZE = { | ||
41 | VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ], | ||
42 | MESSAGES: { | ||
43 | 'required': $localize`Previews cache size is required.`, | ||
44 | 'min': $localize`Previews cache size must be greater than 1.`, | ||
45 | 'pattern': $localize`Previews cache size must be a number.` | ||
46 | } | ||
47 | } | ||
48 | |||
49 | this.CACHE_CAPTIONS_SIZE = { | ||
50 | VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ], | ||
51 | MESSAGES: { | ||
52 | 'required': $localize`Captions cache size is required.`, | ||
53 | 'min': $localize`Captions cache size must be greater than 1.`, | ||
54 | 'pattern': $localize`Captions cache size must be a number.` | ||
55 | } | ||
56 | } | ||
57 | |||
58 | this.SIGNUP_LIMIT = { | ||
59 | VALIDATORS: [ Validators.required, Validators.min(-1), Validators.pattern('-?[0-9]+') ], | ||
60 | MESSAGES: { | ||
61 | 'required': $localize`Signup limit is required.`, | ||
62 | 'min': $localize`Signup limit must be greater than 1.`, | ||
63 | 'pattern': $localize`Signup limit must be a number.` | ||
64 | } | ||
65 | } | ||
66 | |||
67 | this.ADMIN_EMAIL = { | ||
68 | VALIDATORS: [ Validators.required, Validators.email ], | ||
69 | MESSAGES: { | ||
70 | 'required': $localize`Admin email is required.`, | ||
71 | 'email': $localize`Admin email must be valid.` | ||
72 | } | ||
73 | } | ||
74 | |||
75 | this.TRANSCODING_THREADS = { | ||
76 | VALIDATORS: [ Validators.required, Validators.min(0) ], | ||
77 | MESSAGES: { | ||
78 | 'required': $localize`Transcoding threads is required.`, | ||
79 | 'min': $localize`Transcoding threads must be greater or equal to 0.` | ||
80 | } | ||
81 | } | ||
82 | |||
83 | this.INDEX_URL = { | ||
84 | VALIDATORS: [ Validators.pattern(/^https:\/\//) ], | ||
85 | MESSAGES: { | ||
86 | 'pattern': $localize`Index URL should be a URL` | ||
87 | } | ||
88 | } | ||
89 | |||
90 | this.SEARCH_INDEX_URL = { | ||
91 | VALIDATORS: [ Validators.pattern(/^https?:\/\//) ], | ||
92 | MESSAGES: { | ||
93 | 'pattern': $localize`Search index URL should be a URL` | ||
94 | } | ||
95 | } | ||
96 | } | ||
97 | } | ||