});
});
+ it('should remove "pseudo" requirement when NFS v4 disabled', () => {
+ component.nfsForm.patchValue({
+ protocolNfsv4: false,
+ pseudo: ''
+ });
+
+ component.nfsForm.updateValueAndValidity({ emitEvent: false });
+ expect(component.nfsForm.valid).toBeTruthy();
+ });
+
it('should call update', () => {
activatedRoute.setParams({ cluster_id: 'cluster1', export_id: '1' });
component.isEdit = true;
}),
tag: new FormControl(''),
pseudo: new FormControl('', {
- validators: [Validators.required, Validators.pattern('^/[^><|&()]*$')]
+ validators: [
+ CdValidators.requiredIf({ protocolNfsv4: true }),
+ Validators.pattern('^/[^><|&()]*$')
+ ]
}),
access_type: new FormControl('RW', {
validators: [Validators.required]
CdValidators.requiredIf({ security_label: true, 'fsal.name': 'CEPH' })
)
});
+
+ this.nfsForm.get('protocolNfsv4').valueChanges.subscribe(() => {
+ this.nfsForm.get('pseudo').updateValueAndValidity({ emitEvent: false });
+ });
}
resolveModel(res) {
@classmethod
def format_path(cls, path):
- path = path.strip()
- if len(path) > 1 and path[-1] == '/':
- path = path[:-1]
+ if path is not None:
+ path = path.strip()
+ if len(path) > 1 and path[-1] == '/':
+ path = path[:-1]
return path
def validate(self, export):