# All files / src/app/ceph/block/rbd-form rbd-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
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    3183x

     <div class="col-sm-12 col-lg-6">
      <form name="rbdForm"
            class="form-horizontal"
            #formDir="ngForm"
            [formGroup]="rbdForm"
            novalidate>
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 i18n="form title|Example: Create Pool@@formTitle"
                class="panel-title">{{ action | titlecase }} {{ resource | upperFirst }}</h3>
          </div>
          <div class="panel-body">

            <!-- Parent -->
            <div class="form-group"
                 *ngIf="rbdForm.getValue('parent')">
              <label i18n
                     class="control-label col-sm-3"
                     for="name">{{ action | titlecase }} from</label>
              <div class="col-sm-9">
                <input class="form-control"
                       type="text"
                       id="parent"
                       name="parent"
                       formControlName="parent">
                <hr>
              </div>
            </div>

            <!-- Name -->
            <div class="form-group"
                 [ngClass]="{'has-error': rbdForm.showError('name', formDir)}">
              <label class="control-label col-sm-3"
                     for="name">
                <ng-container i18n>Name</ng-container>
                <span class="required"></span>
              </label>
              <div class="col-sm-9">
                <input class="form-control"
                       type="text"
                       placeholder="Name..."
                       id="name"
                       name="name"
                       formControlName="name"
                       autofocus>
                <span class="help-block"
                      *ngIf="rbdForm.showError('name', formDir, 'required')">
                  <ng-container i18n>This field is required.</ng-container>
                </span>
                <span class="help-block"
                      *ngIf="rbdForm.showError('name', formDir, 'pattern')">
                  <ng-container i18n>'/' and '@' are not allowed.</ng-container>
                </span>
              </div>
            </div>

            <!-- Pool -->
            <div class="form-group"
                 [ngClass]="{'has-error': rbdForm.showError('pool', formDir)}"
                 (change)="onPoolChange($event.target.value)">
              <label class="control-label col-sm-3"
                     for="pool">
                Pool
                <span class="required"
                      *ngIf="mode !== 'editing'"></span>
              </label>
              <div class="col-sm-9">
                <input class="form-control"
                       type="text"
                       placeholder="Pool name..."
                       id="pool"
                       name="pool"
                       formControlName="pool"
                       *ngIf="mode === 'editing' || !poolPermission.read">
                <select id="pool"
                        name="pool"
                        class="form-control"
                        formControlName="pool"
                        *ngIf="mode !== 'editing' && poolPermission.read">
                  <option *ngIf="pools === null"
                          [ngValue]="null"
                          i18n>Loading...</option>
                  <option *ngIf="pools !== null && pools.length === 0"
                          [ngValue]="null"
                          i18n>-- No rbd pools available --</option>
                  <option *ngIf="pools !== null && pools.length > 0"
                          [ngValue]="null"
                          i18n>-- Select a pool --</option>
                  <option *ngFor="let pool of pools"
                          [value]="pool.pool_name">{{ pool.pool_name }}</option>
                </select>
                <span *ngIf="rbdForm.showError('pool', formDir, 'required')"
                      class="help-block"
                      i18n>This field is required.</span>
              </div>
            </div>

            <!-- Use a dedicated pool -->
            <div class="form-group">
              <div class="col-sm-offset-3 col-sm-9">
                <div class="checkbox checkbox-primary">
                  <input type="checkbox"
                         id="useDataPool"
                         name="useDataPool"
                         formControlName="useDataPool"
                         (change)="onUseDataPoolChange()">
                  <label i18n
                         for="useDataPool">Use a dedicated data pool</label>
                </div>
              </div>
            </div>

            <!-- Data Pool -->
            <div class="form-group"
                 [ngClass]="{'has-error': rbdForm.showError('dataPool', formDir)}"
                 *ngIf="rbdForm.getValue('useDataPool')">
              <label class="control-label col-sm-3"
                     for="dataPool">
                <ng-container i18n>Data pool</ng-container>
                <span class="required"
                      *ngIf="mode !== 'editing'"></span>
                <cd-helper i18n-html
                           html="Dedicated pool that stores the object-data of the RBD.">
                </cd-helper>
              </label>
              <div class="col-sm-9">
                <input class="form-control"
                       type="text"
                       placeholder="Data pool name..."
                       id="dataPool"
                       name="dataPool"
                       formControlName="dataPool"
                       *ngIf="mode === 'editing' || !poolPermission.read">
                <select id="dataPool"
                        name="dataPool"
                        class="form-control"
                        formControlName="dataPool"
                        (change)="onDataPoolChange($event.target.value)"
                        *ngIf="mode !== 'editing' && poolPermission.read">
                  <option *ngIf="dataPools === null"
                          [ngValue]="null"
                          i18n>Loading...</option>
                  <option *ngIf="dataPools !== null && dataPools.length === 0"
                          [ngValue]="null"
                          i18n>-- No data pools available --</option>
                  <option *ngIf="dataPools !== null && dataPools.length > 0"
                          [ngValue]="null">-- Select a data pool --
                  </option>
                  <option *ngFor="let dataPool of dataPools"
                          [value]="dataPool.pool_name">{{ dataPool.pool_name }}</option>
                </select>
                <span class="help-block"
                      *ngIf="rbdForm.showError('dataPool', formDir, 'required')"
                      i18n>This field is required.</span>
              </div>
            </div>

            <!-- Size -->
            <div class="form-group"
                 [ngClass]="{'has-error': rbdForm.showError('size', formDir)}">
              <label class="control-label col-sm-3"
                     for="size">
                <ng-container i18n>Size</ng-container>
                <span class="required"></span>
              </label>
              <div class="col-sm-9">
                <input id="size"
                       name="size"
                       class="form-control"
                       type="text"
                       formControlName="size"
                       i18n-placeholder
                       placeholder="e.g., 10GiB"
                       defaultUnit="GiB"
                       cdDimlessBinary>
                <span class="help-block"
                      *ngIf="rbdForm.showError('size', formDir, 'required')"
                      i18n>This field is required.</span>
                <span class="help-block"
                      *ngIf="rbdForm.showError('size', formDir, 'invalidSizeObject')"
                      i18n>You have to increase the size.</span>
              </div>
            </div>

            <!-- Features -->
            <div class="form-group"
                 [ngClass]="{'has-error': (formDir.submitted || featuresFormGroups.dirty) && featuresFormGroups.invalid}"
                 formGroupName="features">
              <label i18n
                     class="col-sm-3 control-label"
                     for="features">Features</label>
              <div class="col-sm-9">
                <div class="checkbox checkbox-primary"
                     *ngFor="let feature of featuresList">
                  <input type="checkbox"
                         id="{{ feature.key }}"
                         name="{{ feature.key }}"
                         formControlName="{{ feature.key }}">
                  <label for="{{ feature.key }}">{{ feature.desc }}</label>
                  <cd-helper *ngIf="feature.helperHtml"
                             html="{{ feature.helperHtml }}">
                  </cd-helper>
                </div>
              </div>
            </div>

            <!-- Advanced -->
            <div class="row">
              <div class="col-sm-12">
                <a class="pull-right margin-right-md"
                   (click)="advancedEnabled = true"
                   *ngIf="!advancedEnabled"
                   i18n>Advanced...</a>
              </div>
            </div>
            <div [hidden]="!advancedEnabled">

              <h2 i18n
                  class="page-header">Advanced</h2>

              <div class="section">
                <h3 class="page-header" i18n>Striping</h3>

                <!-- Object Size -->
                <div class="form-group"
                     [ngClass]="{'has-error': rbdForm.showError('obj_size', formDir)}">
                  <label i18n
                         class="control-label col-sm-3"
                         for="size">Object size</label>
                  <div class="col-sm-9">
                    <select id="obj_size"
                            name="obj_size"
                            class="form-control"
                            formControlName="obj_size">
                      <option *ngFor="let objectSize of objectSizes"
                              [value]="objectSize">{{ objectSize }}</option>
                    </select>
                  </div>
                </div>

                <!-- Stripe Unit -->
                <div class="form-group"
                     [ngClass]="{'has-error': rbdForm.showError('stripingUnit', formDir)}">
                  <label class="control-label col-sm-3"
                         for="stripingUnit">
                    <span i18n>Stripe unit</span>
                    <span class="required"
                          *ngIf="rbdForm.getValue('stripingCount')">
                  </span>
                  </label>
                  <div class="col-sm-9">
                    <select id="stripingUnit"
                            name="stripingUnit"
                            class="form-control"
                            formControlName="stripingUnit">
                      <option i18n
                              [ngValue]="null">-- Select stripe unit --</option>
                      <option *ngFor="let objectSize of objectSizes"
                              [value]="objectSize">{{ objectSize }}</option>
                    </select>
                    <span class="help-block"
                          *ngIf="rbdForm.showError('stripingUnit', formDir, 'required')"
                          i18n>This field is required because stripe count is defined!</span>
                    <span class="help-block"
                          *ngIf="rbdForm.showError('stripingUnit', formDir, 'invalidStripingUnit')"
                          i18n>Stripe unit is greater than object size.</span>
                  </div>
                </div>

                <!-- Stripe Count -->
                <div class="form-group"
                     [ngClass]="{'has-error': rbdForm.showError('stripingCount', formDir)}">
                  <label class="control-label col-sm-3"
                         for="stripingCount">
                    <span i18n>Stripe count</span>
                    <span class="required"
                          *ngIf="rbdForm.getValue('stripingUnit')">
                  </span>
                  </label>
                  <div class="col-sm-9">
                    <input id="stripingCount"
                           name="stripingCount"
                           formControlName="stripingCount"
                           class="form-control"
                           type="number">
                    <span class="help-block"
                          *ngIf="rbdForm.showError('stripingCount', formDir, 'required')"
                          i18n>This field is required because stripe unit is defined!</span>
                    <span class="help-block"
                          *ngIf="rbdForm.showError('stripingCount', formDir, 'min')"
                          i18n>Stripe count must be greater than 0.</span>
                  </div>
                </div>
              </div>

              <div class="section">
                <cd-rbd-configuration-form [form]="rbdForm"
                                           [initializeData]="initializeConfigData"
                                           (changes)="getDirtyConfigurationValues = $event"></cd-rbd-configuration-form>
              </div>

            </div>

          </div>
          <div class="panel-footer">
            <div class="button-group text-right">
              <cd-submit-button
                [form]="formDir"
                (submitAction)="submit()"
                i18n="form action button|Example: Create Pool@@formActionButton"
                type="button">{{ action | titlecase }} {{ resource | upperFirst }}</cd-submit-button>
              <cd-back-button></cd-back-button>
            </div>
          </div>
        </div>
      </form>
    </div>