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