}
createForm() {
+ const groupNameValidators = [
+ Validators.required,
+ (control: any) => {
+ const value = control.value;
+ return value && /[^a-zA-Z0-9_-]/.test(value) ? { invalidChars: true } : null;
+ }
+ ];
+
+ const groupNameAsyncValidators = this.editing
+ ? []
+ : [CdValidators.unique(this.nvmeofService.exists, this.nvmeofService)];
+
this.groupForm = new CdFormGroup({
- groupName: new UntypedFormControl(
- null,
- [
- Validators.required,
- (control) => {
- const value = control.value;
- return value && /[^a-zA-Z0-9_-]/.test(value) ? { invalidChars: true } : null;
- }
- ],
- [CdValidators.unique(this.nvmeofService.exists, this.nvmeofService)]
- ),
+ groupName: new UntypedFormControl(null, groupNameValidators, groupNameAsyncValidators),
unmanaged: new UntypedFormControl(false),
+ enable_auth: new UntypedFormControl(false),
enableEncryption: new UntypedFormControl(false),
encryptionConfig: new UntypedFormControl(null),
encryptionKey: new UntypedFormControl(null),