]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Show warning when replicated size is 1
authorSebastian Krah <skrah@suse.com>
Fri, 2 Oct 2020 09:07:40 +0000 (11:07 +0200)
committerSebastian Krah <skrah@suse.com>
Fri, 2 Oct 2020 11:16:52 +0000 (13:16 +0200)
Issues a warning when creating a replicated pool and the replicated size
is 1. It won't stop the user from creating the pool, but will give the
user a hint that no replication will be created.

Fixes: https://tracker.ceph.com/issues/42404
Signed-off-by: Sebastian Krah <skrah@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.spec.ts
src/pybind/mgr/dashboard/frontend/src/styles/defaults/_bootstrap-defaults.scss

index 397c1829c9ddbcaa7426103589e8247e747ff30d..bb1e0f9679a74ff81f02f3fa26cd98487b9f0d72 100644 (file)
                     *ngIf="form.showError('size', formDir)"
                     i18n>The size specified is out of range. A value from
                 {{ getMinSize() }} to {{ getMaxSize() }} is usable.</span>
+              <span class="text-warning-dark"
+                    *ngIf="form.getValue('size') === 1"
+                    i18n>A size of 1 will not create a replication of the
+                object. The 'Replicated size' includes the object itself.</span>
             </div>
           </div>
 
index cfb42ecd9b839a596b519427599b45892322ea6f..6e72d76dfd2b9a0f275c8e976001b3ad5bdca8fc 100644 (file)
@@ -319,6 +319,17 @@ describe('PoolFormComponent', () => {
       formHelper.expectValidChange('size', 2);
     });
 
+    it('validates if warning is displayed when size is 1', () => {
+      formHelper.setValue('poolType', 'replicated');
+      formHelper.expectValid('size');
+
+      formHelper.setValue('size', 1, true);
+      expect(fixtureHelper.getElementByCss('#size ~ .text-warning-dark')).toBeTruthy();
+
+      formHelper.setValue('size', 2, true);
+      expect(fixtureHelper.getElementByCss('#size ~ .text-warning-dark')).toBeFalsy();
+    });
+
     it('validates compression mode default value', () => {
       expect(form.getValue('mode')).toBe('none');
     });
index 42adf5f02e99148d4d1487f1ba78ee45f4ada475..52cc443b982b679fe827503b09ecbf779f5c56e9 100644 (file)
@@ -38,7 +38,8 @@ $fg-color-over-dark-bg: $white;
 $fg-hover-color-over-dark-bg: $gray-500;
 
 $theme-colors: (
-  'accent': #ef5c55
+  'accent': #ef5c55,
+  'warning-dark': $orange
 );
 
 // Body