Merge pull request #38519 from rhcs-dashboard/fix-47727-master

mgr/dashboard: RGW User Form is validating disabled fields

Reviewed-by: Avan Thakkar <athakkar@redhat.com>
Reviewed-by: Nizamudeen A <nia@redhat.com>
Reviewed-by: Volker Theile <vtheile@suse.com>
This commit is contained in:
Ernesto Puerta 2020-12-11 17:14:50 +01:00 committed by GitHub
commit 6a40305be4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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')) {