]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: The max. buckets field in RGW user form should be pre-filled 35795/head
authorVolker Theile <vtheile@suse.com>
Thu, 23 Apr 2020 12:47:53 +0000 (14:47 +0200)
committerLaura Paduano <lpaduano@suse.com>
Fri, 26 Jun 2020 11:35:05 +0000 (13:35 +0200)
Fixes: https://tracker.ceph.com/issues/45204
Signed-off-by: Volker Theile <vtheile@suse.com>
(cherry picked from commit a08dad6b18873cf12aac964d69233bd2f4af535a)

src/pybind/mgr/dashboard/frontend/cypress/integration/rgw/users.po.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts

index f65464537ac4355c940fc5dd2eafba05906a5085..6796ff5be5d523aaa33568d0cfc0548b0cfcd834 100644 (file)
@@ -21,6 +21,7 @@ export class UsersPageHelper extends PageHelper {
 
     // Enter max buckets
     this.selectOption('max_buckets_mode', 'Custom');
+    cy.get('#max_buckets').should('exist').should('have.value', '1000');
     cy.get('#max_buckets').click().clear().type(maxbuckets);
 
     // Click the create button and wait for user to be made
@@ -102,7 +103,7 @@ export class UsersPageHelper extends PageHelper {
     const uname = '000invalid_edit_user';
     // creating this user to edit for the test
     this.navigateTo('create');
-    this.create(uname, 'xxx', 'xxx@xxx', '1');
+    this.create(uname, 'xxx', 'xxx@xxx', '50');
 
     this.navigateEdit(name);
 
@@ -120,7 +121,10 @@ export class UsersPageHelper extends PageHelper {
     cy.contains('#display_name + .invalid-feedback', 'This field is required.');
 
     // put negative max buckets to make field invalid
-    this.expectSelectOption('max_buckets_mode', 'Custom');
+    this.selectOption('max_buckets_mode', 'Disabled');
+    cy.get('#max_buckets').should('not.exist');
+    this.selectOption('max_buckets_mode', 'Custom');
+    cy.get('#max_buckets').should('exist').should('have.value', '50');
     cy.get('#max_buckets').clear().type('-5').blur().should('have.class', 'ng-invalid');
     cy.contains('#max_buckets + .invalid-feedback', 'The entered value must be >= 1.');
 
index ce638cceb962424905383bc3f1bb680a1874cacd..f7191fbdd7136c8491b864ca7ccee1961d832e9d 100644 (file)
@@ -82,7 +82,8 @@
             <select class="form-control custom-select"
                     formControlName="max_buckets_mode"
                     name="max_buckets_mode"
-                    id="max_buckets_mode">
+                    id="max_buckets_mode"
+                    (change)="onMaxBucketsModeChange($event.target.value)">
               <option i18n
                       value="-1">Disabled</option>
               <option i18n
index 77321d6578b8ba572ba31b78941c9695a7fb781b..c1bf31244eae5df24f0f530cbd61a17980eaa0b8 100644 (file)
@@ -705,4 +705,17 @@ export class RgwUserFormComponent implements OnInit {
     result = _.uniq(result);
     return result;
   }
+
+  onMaxBucketsModeChange(mode: string) {
+    if (mode === '1') {
+      // If 'Custom' mode is selected, then ensure that the form field
+      // 'Max. buckets' contains a valid value. Set it to default if
+      // necessary.
+      if (!this.userForm.get('max_buckets').valid) {
+        this.userForm.patchValue({
+          max_buckets: 1000
+        });
+      }
+    }
+  }
 }