# All files / src/app/ceph/nfs/nfs-form-client nfs-form-client.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
    1057x

     <div class="form-group">
      <label class="col-sm-3 control-label"
             i18n>Clients</label>

      <div class="col-sm-9"
           [formGroup]="form"
           #formDir="ngForm">
        <span *ngIf="form.get('clients').value.length === 0"
              class="form-control no-border text-muted">
          <span class="text-muted"
                i18n>Any client can access</span>
        </span>

        <ng-container formArrayName="clients">
          <div *ngFor="let item of form.get('clients').value; let index = index; trackBy: trackByFn">
            <div class="panel panel-default"
                 [formGroupName]="index">
              <div class="panel-heading">
                <h3 class="panel-title">{{ (index + 1) | ordinal }}
                  <span class="pull-right clickable"
                        (click)="removeClient(index)"
                        tooltip="Remove">&times;</span>
                </h3>
              </div>

              <div class="panel-body">
                <!-- Addresses -->
                <div class="form-group"
                     [ngClass]="{ 'has-error': showError(index, 'addresses', formDir) }">
                  <label i18n
                         class="col-sm-3 control-label"
                         for="addresses">Addresses</label>
                  <div class="col-sm-9">
                    <input type="text"
                           class="form-control"
                           name="addresses"
                           id="addresses"
                           formControlName="addresses"
                           placeholder="192.168.0.10, 192.168.1.0/8">
                    <span class="help-block">
                      <span *ngIf="showError(index, 'addresses', formDir, 'required')"
                            i18n>Required field</span>

                      <span *ngIf="showError(index, 'addresses', formDir, 'pattern')">
                        <ng-container i18n>Must contain one or more comma-separated values</ng-container>
                        <br>
                        <ng-container i18n>For example:</ng-container> 192.168.0.10, 192.168.1.0/8
                      </span>
                    </span>
                  </div>
                </div>

                <!-- Access Type-->
                <div class="form-group">
                  <label i18n
                         class="col-sm-3 control-label"
                         for="access_type">Access Type</label>
                  <div class="col-sm-9">
                    <select class="form-control"
                            name="access_type"
                            id="access_type"
                            formControlName="access_type">
                      <option [value]="form.getValue('access_type')">{{ getNoAccessTypeDescr() }}</option>
                      <option *ngFor="let item of nfsAccessType"
                              [value]="item.value">{{ item.value }}</option>
                    </select>
                    <span class="help-block"
                          *ngIf="getValue(index, 'access_type')">
                      {{ getAccessTypeHelp(index) }}
                    </span>
                  </div>
                </div>

                <!-- Squash -->
                <div class="form-group">
                  <label i18n
                         class="col-sm-3 control-label"
                         for="squash">Squash</label>
                  <div class="col-sm-9">
                    <select class="form-control"
                            name="squash"
                            id="squash"
                            formControlName="squash">
                      <option [value]="form.getValue('squash')">{{ getNoSquashDescr() }}</option>
                      <option *ngFor="let squash of nfsSquash"
                              [value]="squash">{{ squash }}</option>
                    </select>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </ng-container>

        <span class="form-control no-border">
          <button class="btn btn-default btn-label pull-right"
                  (click)="addClient()">
            <i class="fa fa-fw fa-plus"></i>
            <ng-container i18n>Add clients</ng-container>
          </button>
        </span>
        <hr>
      </div>
    </div>