]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: RGW User Form is validating disabled fields 39543/head
authorAashish Sharma <aashishsharma@localhost.localdomain>
Thu, 10 Dec 2020 06:00:36 +0000 (11:30 +0530)
committerAashish Sharma <aashishsharma@localhost.localdomain>
Thu, 18 Feb 2021 09:35:45 +0000 (15:05 +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>
(cherry picked from commit 071d1f317de547bf8fae68a0700d429900d3a741)

src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts

index cd58b593fc40f99728d358a7a79928ead2612237..6e517864ee153d87ab0ab68f761e6c26d14c8b5d 100644 (file)
@@ -62,6 +62,8 @@ export class RgwUserFormComponent implements OnInit {
     this.subuserLabel = this.i18n('subuser');
     this.s3keyLabel = this.i18n('S3 Key');
     this.capabilityLabel = this.i18n('capability');
+    this.editing = this.router.url.startsWith(`/rgw/user/${URLVerbs.EDIT}`);
+    this.action = this.editing ? this.actionLabels.EDIT : this.actionLabels.CREATE;
     this.createForm();
   }
 
@@ -71,7 +73,7 @@ export class RgwUserFormComponent 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: [
@@ -145,8 +147,6 @@ export class RgwUserFormComponent 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')) {