]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | import { Validators } from '@angular/forms'; |
2 | ||
3 | import { I18n } from '@ngx-translate/i18n-polyfill'; | |
4 | ||
5 | import { SelectMessages } from '../../../shared/components/select/select-messages.model'; | |
6 | import { SelectOption } from '../../../shared/components/select/select-option.model'; | |
7 | import { Pool } from '../pool'; | |
8 | ||
9 | export class PoolFormData { | |
10 | poolTypes: string[]; | |
11 | erasureInfo = false; | |
12 | crushInfo = false; | |
13 | applications: any; | |
14 | ||
15 | constructor(i18n: I18n) { | |
16 | this.poolTypes = ['erasure', 'replicated']; | |
17 | this.applications = { | |
18 | selected: [], | |
19 | available: [ | |
20 | new SelectOption(false, 'cephfs', ''), | |
21 | new SelectOption(false, 'rbd', ''), | |
22 | new SelectOption(false, 'rgw', '') | |
23 | ], | |
24 | validators: [Validators.pattern('[A-Za-z0-9_]+'), Validators.maxLength(128)], | |
25 | messages: new SelectMessages( | |
26 | { | |
27 | empty: i18n('No applications added'), | |
28 | selectionLimit: { | |
29 | text: i18n('Applications limit reached'), | |
30 | tooltip: i18n('A pool can only have up to four applications definitions.') | |
31 | }, | |
32 | customValidations: { | |
33 | pattern: i18n(`Allowed characters '_a-zA-Z0-9'`), | |
34 | maxlength: i18n('Maximum length is 128 characters') | |
35 | }, | |
36 | filter: i18n('Filter or add applications'), | |
37 | add: i18n('Add application') | |
38 | }, | |
39 | i18n | |
40 | ) | |
41 | }; | |
42 | } | |
43 | ||
44 | pgs = 1; | |
45 | pool: Pool; // Only available during edit mode | |
46 | } |