]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: RGW User Form is validating disabled fields 38519/head
authorAashish Sharma <aashishsharma@localhost.localdomain>
Thu, 10 Dec 2020 06:00:36 +0000 (11:30 +0530)
committerAashish Sharma <aashishsharma@localhost.localdomain>
Thu, 10 Dec 2020 06:00:36 +0000 (11:30 +0530)
When you try to submit a non valid form, angular is checking all the fields of the form, resulting in some wrong validations.

Fixes:https://tracker.ceph.com/issues/47727
Signed-off-by: Aashish Sharma <aasharma@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts

index 0b3103c9f8de9b9d89fbceab8eddb0c4a46b355b..75dd109cd12379b6ac43e4bad4ec47d14179bd2f 100644 (file)
@@ -61,6 +61,8 @@ export class RgwUserFormComponent extends CdForm implements OnInit {
     this.subuserLabel = $localize`subuser`;
     this.s3keyLabel = $localize`S3 Key`;
     this.capabilityLabel = $localize`capability`;
+    this.editing = this.router.url.startsWith(`/rgw/user/${URLVerbs.EDIT}`);
+    this.action = this.editing ? this.actionLabels.EDIT : this.actionLabels.CREATE;
     this.createForm();
   }
 
@@ -70,7 +72,7 @@ export class RgwUserFormComponent extends CdForm implements OnInit {
       uid: [
         null,
         [Validators.required],
-        [CdValidators.unique(this.rgwUserService.exists, this.rgwUserService)]
+        this.editing ? [] : [CdValidators.unique(this.rgwUserService.exists, this.rgwUserService)]
       ],
       display_name: [null, [Validators.required]],
       email: [
@@ -148,8 +150,6 @@ export class RgwUserFormComponent extends CdForm implements OnInit {
   }
 
   ngOnInit() {
-    this.editing = this.router.url.startsWith(`/rgw/user/${URLVerbs.EDIT}`);
-    this.action = this.editing ? this.actionLabels.EDIT : this.actionLabels.CREATE;
     // Process route parameters.
     this.route.params.subscribe((params: { uid: string }) => {
       if (!params.hasOwnProperty('uid')) {