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