# All files / src/app/ceph/pool/pool-form pool-form-data.ts

100% Statements 11/11
100% Branches 0/0
100% Functions 2/2
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    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
    38
    39
    40
    41
    42
    43
    44
    45
    46
    472x

    2x
    2x

    2x

    82x
    82x

    82x
    82x

    82x

    2x
     import { Validators } from '@angular/forms';

    import { I18n } from '@ngx-translate/i18n-polyfill';

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

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

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

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