# All files / src/app/ceph/cluster/mgr-modules/mgr-module-form mgr-module-form.component.html

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

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
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    1246x

     <cd-loading-panel *ngIf="loading && !error"
                      i18n>Loading configuration...</cd-loading-panel>
    <cd-error-panel *ngIf="loading && error"
                    i18n>The configuration could not be loaded.</cd-error-panel>

    <div class="col-sm-12 col-lg-6"
         *ngIf="!loading && !error">
      <form name="mgrModuleForm"
            class="form-horizontal"
            #frm="ngForm"
            [formGroup]="mgrModuleForm"
            novalidate>
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title" i18n>Edit Manager module</h3>
          </div>
          <div class="panel-body">
            <div class="form-group"
                 [ngClass]="{'has-error': mgrModuleForm.showError(moduleOption.value.name, frm)}"
                 *ngFor="let moduleOption of moduleOptions | keyvalue">

              <!-- Field label -->
              <label class="control-label col-sm-3"
                     for="{{ moduleOption.value.name }}">
                {{ moduleOption.value.name }}
                <cd-helper *ngIf="moduleOption.value.long_desc || moduleOption.value.desc">
                  {{ moduleOption.value.long_desc || moduleOption.value.desc | upperFirst }}
                </cd-helper>
              </label>

              <!-- Field control -->
              <!-- bool -->
              <div class="col-sm-7"
                   *ngIf="moduleOption.value.type === 'bool'">
                <div class="checkbox checkbox-primary">
                  <input id="{{ moduleOption.value.name }}"
                         type="checkbox"
                         formControlName="{{ moduleOption.value.name }}">
                  <label for="{{ moduleOption.value.name }}"></label>
                </div>
              </div>

              <!-- addr|str|uuid -->
              <div class="col-sm-7"
                   *ngIf="['addr', 'str', 'uuid'].includes(moduleOption.value.type)">
                <input id="{{ moduleOption.value.name }}"
                       class="form-control"
                       type="text"
                       formControlName="{{ moduleOption.value.name }}"
                       *ngIf="moduleOption.value.enum_allowed.length === 0">
                <select id="{{ moduleOption.value.name }}"
                        class="form-control"
                        formControlName="{{ moduleOption.value.name }}"
                        *ngIf="moduleOption.value.enum_allowed.length > 0">
                  <option *ngFor="let value of moduleOption.value.enum_allowed"
                          [ngValue]="value">
                    {{ value }}
                  </option>
                </select>
                <span class="help-block"
                      *ngIf="mgrModuleForm.showError(moduleOption.value.name, frm, 'invalidUuid')"
                      i18n>The entered value is not a valid UUID, e.g.: 67dcac9f-2c03-4d6c-b7bd-1210b3a259a8</span>
                <span class="help-block"
                      *ngIf="mgrModuleForm.showError(moduleOption.value.name, frm, 'pattern')"
                      i18n>The entered value needs to be a valid IP address.</span>
              </div>

              <!-- uint|int|size|secs -->
              <div class="col-sm-7"
                   *ngIf="['uint', 'int', 'size', 'secs'].includes(moduleOption.value.type)">
                <input id="{{ moduleOption.value.name }}"
                       class="form-control"
                       type="number"
                       formControlName="{{ moduleOption.value.name }}"
                       min="{{ moduleOption.value.min }}"
                       max="{{ moduleOption.value.max }}">
                <span class="help-block"
                      *ngIf="mgrModuleForm.showError(moduleOption.value.name, frm, 'required')"
                      i18n>This field is required.</span>
                <span class="help-block"
                      *ngIf="mgrModuleForm.showError(moduleOption.value.name, frm, 'max')"
                      i18n>The entered value is too high! It must be lower or equal to {{ moduleOption.value.max }}.</span>
                <span class="help-block"
                      *ngIf="mgrModuleForm.showError(moduleOption.value.name, frm, 'min')"
                      i18n>The entered value is too low! It must be greater or equal to {{ moduleOption.value.min }}.</span>
                <span class="help-block"
                      *ngIf="mgrModuleForm.showError(moduleOption.value.name, frm, 'pattern')"
                      i18n>The entered value needs to be a number.</span>
              </div>

              <!-- float -->
              <div class="col-sm-7"
                   *ngIf="moduleOption.value.type === 'float'">
                <input id="{{ moduleOption.value.name }}"
                       class="form-control"
                       type="number"
                       formControlName="{{ moduleOption.value.name }}">
                <span class="help-block"
                      *ngIf="mgrModuleForm.showError(moduleOption.value.name, frm, 'required')"
                      i18n>This field is required.</span>
                <span class="help-block"
                      *ngIf="mgrModuleForm.showError(moduleOption.value.name, frm, 'pattern')"
                      i18n>The entered value needs to be a number or decimal.</span>
              </div>

            </div>
          </div>
          <div class="panel-footer">
            <div class="button-group text-right">
              <cd-submit-button type="button"
                                (submitAction)="onSubmit()"
                                [form]="mgrModuleForm">
                <ng-container i18n>Update</ng-container>
              </cd-submit-button>
              <button type="button"
                      class="btn btn-sm btn-default"
                      routerLink="/mgr-modules"
                      i18n>Back</button>
            </div>
          </div>
        </div>
      </form>
    </div>