<span class="invalid-feedback"
*ngIf="form.showError('name', formDir, 'uniqueName')"
i18n>The chosen Ceph pool name is already in use.</span>
+ <span *ngIf="form.showError('name', formDir, 'rbdPool')"
+ class="invalid-feedback"
+ i18n>It's not possible to create an RBD pool with '/' in the name.
+ Please change the name or remove 'rbd' from the applications list.</span>
</div>
</div>
(changes)="currentConfigurationValues = $event()">
</cd-rbd-configuration-form>
</div>
-
- <div class="form-group">
- <div class="offset-sm-3 col-sm-9"
- *ngIf="form.hasError('rbdPool')">
- <br>
- <span class="invalid-feedback"
- i18n>It's not possible to create an RBD pool with '/' in the name.</span>
- <span class="invalid-feedback"
- i18n>Please change the name or remove 'rbd' from the applications list.</span>
- </div>
- </div>
</div>
<div class="card-footer">
<div class="button-group text-right">
this.form = new CdFormGroup(
{
name: new FormControl('', {
- validators: [Validators.pattern(/^[.A-Za-z0-9_/-]+$/), Validators.required]
+ validators: [
+ Validators.pattern(/^[.A-Za-z0-9_/-]+$/),
+ Validators.required,
+ CdValidators.custom('rbdPool', () => {
+ return (
+ this.form &&
+ this.form.getValue('name').includes('/') &&
+ this.data &&
+ this.data.applications.selected.indexOf('rbd') !== -1
+ );
+ })
+ ]
}),
poolType: new FormControl('', {
validators: [Validators.required]
validators: [Validators.min(0)]
})
},
- [
- CdValidators.custom('form', () => null),
- CdValidators.custom('rbdPool', () => {
- return (
- this.form &&
- this.form.getValue('name').includes('/') &&
- this.data &&
- this.data.applications.selected.indexOf('rbd') !== -1
- );
- })
- ]
+ [CdValidators.custom('form', () => null)]
);
}
}
appSelection() {
- this.form.updateValueAndValidity({ emitEvent: false, onlySelf: true });
+ this.form.get('name').updateValueAndValidity({ emitEvent: false, onlySelf: true });
}
}