summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form-data.ts
blob: 2c5dc57eb5b30fcc7d37cbad687cc3f72b9456e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Validators } from '@angular/forms';

import { SelectMessages } from '~/app/shared/components/select/select-messages.model';
import { Pool } from '../pool';

export class PoolFormData {
  poolTypes: string[];
  erasureInfo = false;
  crushInfo = false;
  applications: any;

  constructor() {
    this.poolTypes = ['erasure', 'replicated'];
    this.applications = {
      selected: [],
      default: ['cephfs', 'rbd', 'rgw'],
      available: [], // Filled during runtime
      validators: [Validators.pattern('[A-Za-z0-9_]+'), Validators.maxLength(128)],
      messages: new SelectMessages({
        empty: $localize`No applications added`,
        selectionLimit: {
          text: $localize`Applications limit reached`,
          tooltip: $localize`A pool can only have up to four applications definitions.`
        },
        customValidations: {
          pattern: $localize`Allowed characters '_a-zA-Z0-9'`,
          maxlength: $localize`Maximum length is 128 characters`
        },
        filter: $localize`Filter or add applications'`,
        add: $localize`Add application`
      })
    };
  }

  pgs = 1;
  pool: Pool; // Only available during edit mode
}