]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Show warning when replicated size is 1 37578/head
authorSebastian Krah <skrah@suse.com>
Fri, 2 Oct 2020 09:07:40 +0000 (11:07 +0200)
committerLaura Paduano <lpaduano@suse.com>
Tue, 20 Oct 2020 06:48:49 +0000 (08:48 +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>
(cherry picked from commit af1a7dbfe2b0e2e40650d64d4c3247f4961743c2)

 Conflicts:
src/pybind/mgr/dashboard/frontend/src/styles/defaults/_bootstrap-defaults.scss
- The file does not exist in octopus, moving a slightly changed version of the diff
  to src/pybind/mgr/dashboard/frontend/src/styles.scss instead

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.scss

index 398a535bf8c6d4cf842cb82ce4820714a6af4a12..0f988ded1342c19283434a74ec8cd9c835df5910 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 a44571b78281033d625a04d94c7c55a25545bb2f..4d570f102df4a5bba8c0f80d2761a480327ff7f0 100644 (file)
@@ -310,6 +310,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 096533658708734961c03e0e070d8832f307a1af..212d10c92f173f6c2f7422ccc443d0269903b50d 100644 (file)
@@ -9,10 +9,12 @@ $fa-font-path: '~fork-awesome/fonts';
 $font-family-icon: 'ForkAwesome';
 
 // Bootstrap
+$warning-dark: #fd7e14;
 $theme-colors: (
   'primary': $color-primary,
   'secondary': $color-accent,
-  'dark': $color-mild-gray
+  'dark': $color-mild-gray,
+  'warning-dark': $warning-dark
 );
 
 $font-family-sans-serif: 'Helvetica Neue', Helvetica, Arial, 'Noto Sans', sans-serif,