]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: "Promote" CRUSH options in pool form
authorRicardo Marques <rimarques@suse.com>
Thu, 12 Dec 2019 11:48:43 +0000 (11:48 +0000)
committerRicardo Marques <rimarques@suse.com>
Fri, 10 Jan 2020 10:13:05 +0000 (10:13 +0000)
Fixes: https://tracker.ceph.com/issues/43261
Signed-off-by: Ricardo Marques <rimarques@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts

index 3fab6ebf3de11aeb19fd6d6a8cadb47863227486..f3cca0fcfab90410494b0dc794476aba7dc414cc 100644 (file)
             </div>
           </div>
 
-          <!-- Crush ruleset selection -->
-          <div class="form-group row"
-               *ngIf="form.getValue('poolType') && current.rules.length > 0">
-            <label class="col-form-label col-sm-3"
-                   for="crushRule"
-                   i18n>Crush ruleset</label>
-            <div class="col-sm-9">
-              <div class="input-group">
-                <select class="form-control custom-select"
-                        id="crushRule"
-                        formControlName="crushRule"
-                        name="crushSet">
-                  <option [ngValue]="null"
-                          i18n>-- Select a crush rule --</option>
-                  <option *ngFor="let rule of current.rules"
-                          [ngValue]="rule">
-                    {{ rule.rule_name }}
-                  </option>
-                </select>
-                <span class="input-group-append">
-                  <button class="btn btn-light"
-                          [ngClass]="{'active': data.crushInfo}"
-                          id="crush-info-button"
-                          type="button"
-                          (click)="data.crushInfo = !data.crushInfo">
-                    <i [ngClass]="[icons.questionCircle]"
-                       aria-hidden="true"></i>
-                  </button>
-                </span>
-              </div>
-              <span class="form-text text-muted"
-                    id="crush-info-block"
-                    *ngIf="data.crushInfo && form.getValue('crushRule')">
-                <tabset>
-                  <tab i18n-heading
-                       heading="Crush rule"
-                       class="crush-rule-info">
-                    <cd-table-key-value [renderObjects]="true"
-                                        [data]="form.getValue('crushRule')"
-                                        [autoReload]="false">
-                    </cd-table-key-value>
-                  </tab>
-                  <tab i18n-heading
-                       heading="Crush steps"
-                       class="crush-rule-steps">
-                    <ol>
-                      <li *ngFor="let step of form.get('crushRule').value.steps">
-                        {{ describeCrushStep(step) }}
-                      </li>
-                    </ol>
-                  </tab>
-                </tabset>
-              </span>
-              <span class="invalid-feedback"
-                    *ngIf="form.showError('crushRule', formDir, 'tooFewOsds')"
-                    i18n>The rule can't be used in the current cluster as it has
-                to few OSDs to meet the minimum required OSD by this rule.</span>
-            </div>
-          </div>
-
           <!-- Replica Size -->
           <div class="form-group row"
                *ngIf="form.getValue('poolType') === 'replicated'">
             </div>
           </div>
 
+          <!-- Flags -->
+          <div class="form-group row"
+               *ngIf="info.is_all_bluestore && form.getValue('poolType') === 'erasure'">
+            <label i18n
+                   class="col-form-label col-sm-3">Flags</label>
+            <div class="col-sm-9">
+              <div class="custom-control custom-checkbox">
+                <input type="checkbox"
+                       class="custom-control-input"
+                       id="ec-overwrites"
+                       formControlName="ecOverwrites">
+                <label class="custom-control-label"
+                       for="ec-overwrites"
+                       i18n>EC Overwrites</label>
+              </div>
+            </div>
+          </div>
+
+        </div>
+        <!-- Applications -->
+        <div class="form-group row">
+          <label i18n
+                 class="col-sm-3 col-form-label"
+                 for="applications">Applications</label>
+          <div class="col-sm-9">
+            <cd-select-badges id="applications"
+                              [customBadges]="true"
+                              [customBadgeValidators]="data.applications.validators"
+                              [messages]="data.applications.messages"
+                              [data]="data.applications.selected"
+                              [options]="data.applications.available"
+                              [selectionLimit]="4"
+                              (selection)="appSelection()">
+            </cd-select-badges>
+          </div>
+        </div>
+
+        <!-- CRUSH -->
+        <div *ngIf="form.getValue('poolType')">
+
+          <legend i18n>CRUSH</legend>
+
           <!-- Erasure Profile select -->
           <div class="form-group row"
                *ngIf="form.getValue('poolType') === 'erasure'">
             </div>
           </div>
 
-          <!-- Flags -->
-          <div class="form-group row"
-               *ngIf="info.is_all_bluestore && form.getValue('poolType') === 'erasure'">
-            <label i18n
-                   class="col-form-label col-sm-3">Flags</label>
+          <!-- Crush ruleset selection -->
+          <div class="form-group row">
+            <label class="col-form-label col-sm-3"
+                   for="crushRule"
+                   i18n>Crush ruleset</label>
             <div class="col-sm-9">
-              <div class="custom-control custom-checkbox">
-                <input type="checkbox"
-                       class="custom-control-input"
-                       id="ec-overwrites"
-                       formControlName="ecOverwrites">
-                <label class="custom-control-label"
-                       for="ec-overwrites"
-                       i18n>EC Overwrites</label>
+              <ng-template #noRules>
+                <span class="form-text text-muted">
+                  <span i18n>There are no rules.</span>&nbsp;
+                  <span *ngIf="form.getValue('poolType') === 'erasure'"
+                        i18n>A new crush ruleset will be implicitly created.</span>
+                </span>
+              </ng-template>
+              <div *ngIf="current.rules.length > 0; else noRules">
+                <div class="input-group">
+                  <select class="form-control custom-select"
+                          id="crushRule"
+                          formControlName="crushRule"
+                          name="crushSet">
+                    <option [ngValue]="null"
+                            i18n>-- Select a crush rule --</option>
+                    <option *ngFor="let rule of current.rules"
+                            [ngValue]="rule">
+                      {{ rule.rule_name }}
+                    </option>
+                  </select>
+                  <span class="input-group-append">
+                    <button class="btn btn-light"
+                            [ngClass]="{'active': data.crushInfo}"
+                            id="crush-info-button"
+                            type="button"
+                            (click)="data.crushInfo = !data.crushInfo">
+                      <i [ngClass]="[icons.questionCircle]"
+                         aria-hidden="true"></i>
+                    </button>
+                  </span>
+                </div>
+                <span class="form-text text-muted"
+                      id="crush-info-block"
+                      *ngIf="data.crushInfo && form.getValue('crushRule')">
+                  <tabset>
+                    <tab i18n-heading
+                         heading="Crush rule"
+                         class="crush-rule-info">
+                      <cd-table-key-value [renderObjects]="true"
+                                          [data]="form.getValue('crushRule')"
+                                          [autoReload]="false">
+                      </cd-table-key-value>
+                    </tab>
+                    <tab i18n-heading
+                         heading="Crush steps"
+                         class="crush-rule-steps">
+                      <ol>
+                        <li *ngFor="let step of form.get('crushRule').value.steps">
+                          {{ describeCrushStep(step) }}
+                        </li>
+                      </ol>
+                    </tab>
+                  </tabset>
+                </span>
+                <span class="invalid-feedback"
+                      *ngIf="form.showError('crushRule', formDir, 'tooFewOsds')"
+                      i18n>The rule can't be used in the current cluster as it has
+                  too few OSDs to meet the minimum required OSD by this rule.</span>
               </div>
             </div>
           </div>
 
         </div>
-        <!-- Applications -->
-        <div class="form-group row">
-          <label i18n
-                 class="col-sm-3 col-form-label"
-                 for="applications">Applications</label>
-          <div class="col-sm-9">
-            <cd-select-badges id="applications"
-                              [customBadges]="true"
-                              [customBadgeValidators]="data.applications.validators"
-                              [messages]="data.applications.messages"
-                              [data]="data.applications.selected"
-                              [options]="data.applications.available"
-                              [selectionLimit]="4"
-                              (selection)="appSelection()">
-            </cd-select-badges>
-          </div>
-        </div>
 
         <!-- Compression -->
         <div *ngIf="info.is_all_bluestore"
index ba58a296140c78f050444965dd0fd62108ef4baa..ce02f7c4b66f518e0afb9b97e53af4447f35788f 100644 (file)
@@ -255,6 +255,7 @@ export class PoolFormComponent implements OnInit {
     this.data.pgs = this.form.getValue('pgNum');
     this.setAvailableApps(this.data.applications.default.concat(pool.application_metadata));
     this.data.applications.selected = pool.application_metadata;
+    this.rulesChange();
   }
 
   private setAvailableApps(apps: string[] = this.data.applications.default) {