]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Do not fetch pool list on RBD edit
authorRicardo Marques <rimarques@suse.com>
Mon, 4 Jun 2018 19:44:21 +0000 (20:44 +0100)
committerRicardo Marques <rimarques@suse.com>
Mon, 4 Jun 2018 21:44:56 +0000 (22:44 +0100)
Signed-off-by: Ricardo Marques <rimarques@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts

index 5fc0f3f2d3164ec793f25e80a93979dd54119def..5e4f4af377a007f45e53b1a2e83c1b019852843a 100644 (file)
             <span class="required"></span>
           </label>
           <div class="col-sm-9">
+            <input class="form-control"
+                   type="text"
+                   id="pool"
+                   name="pool"
+                   formControlName="pool"
+                   *ngIf="mode === 'editing'">
             <select id="pool"
                     name="pool"
                     class="form-control"
-                    formControlName="pool">
+                    formControlName="pool"
+                    *ngIf="mode !== 'editing'">
               <option *ngIf="pools === null"
                       [ngValue]="null">Loading...
               </option>
             </cd-helper>
           </label>
           <div class="col-sm-9">
+            <input class="form-control"
+                   type="text"
+                   id="dataPool"
+                   name="dataPool"
+                   formControlName="dataPool"
+                   *ngIf="mode === 'editing'">
             <select id="dataPool"
                     name="dataPool"
                     class="form-control"
                     formControlName="dataPool"
-                    (change)="onDataPoolChange($event.target.value)">
+                    (change)="onDataPoolChange($event.target.value)"
+                    *ngIf="mode !== 'editing'">
               <option *ngIf="dataPools === null"
                       [ngValue]="null">Loading...
               </option>
index 2a7333cbf53132a67c0a4c4c46dd90962a9f2bd2..be8d5922e599361e3fe8f91804ab7dd226f626c0 100644 (file)
@@ -219,32 +219,34 @@ export class RbdFormComponent implements OnInit {
           this.setFeatures(defaultFeatures);
         });
     }
-    this.poolService.list(['pool_name', 'type', 'flags_names', 'application_metadata']).then(
-      resp => {
-        const pools = [];
-        const dataPools = [];
-        for (const pool of resp) {
-          if (_.indexOf(pool.application_metadata, 'rbd') !== -1) {
-            if (pool.type === 'replicated') {
-              pools.push(pool);
-              dataPools.push(pool);
-            } else if (pool.type === 'erasure' &&
-              pool.flags_names.indexOf('ec_overwrites') !== -1) {
-              dataPools.push(pool);
+    if (this.mode !== this.rbdFormMode.editing) {
+      this.poolService.list(['pool_name', 'type', 'flags_names', 'application_metadata']).then(
+        resp => {
+          const pools = [];
+          const dataPools = [];
+          for (const pool of resp) {
+            if (_.indexOf(pool.application_metadata, 'rbd') !== -1) {
+              if (pool.type === 'replicated') {
+                pools.push(pool);
+                dataPools.push(pool);
+              } else if (pool.type === 'erasure' &&
+                pool.flags_names.indexOf('ec_overwrites') !== -1) {
+                dataPools.push(pool);
+              }
             }
           }
+          this.pools = pools;
+          this.allPools = pools;
+          this.dataPools = dataPools;
+          this.allDataPools = dataPools;
+          if (this.pools.length === 1) {
+            const poolName = this.pools[0]['pool_name'];
+            this.rbdForm.get('pool').setValue(poolName);
+            this.onPoolChange(poolName);
+          }
         }
-        this.pools = pools;
-        this.allPools = pools;
-        this.dataPools = dataPools;
-        this.allDataPools = dataPools;
-        if (this.pools.length === 1) {
-          const poolName = this.pools[0]['pool_name'];
-          this.rbdForm.get('pool').setValue(poolName);
-          this.onPoolChange(poolName);
-        }
-      }
-    );
+      );
+    }
     this.deepFlattenFormControl.valueChanges.subscribe((value) => {
       this.watchDataFeatures('deep-flatten', value);
     });