i18n>This field is required!</span>
<span *ngIf="form.showError('name', formDir, 'pattern')"
class="invalid-feedback"
- i18n>File System name should start with a letter and can only contain letters, numbers, '.', '-' or '_'</span>
+ i18n>File System name should start with a letter or dot (.) and can only contain letters, numbers, '.', '-' or '_'</span>
</div>
</div>
});
it('should validate proper names', fakeAsync(() => {
- const validNames = ['test', 'test1234', 'test_1234', 'test-1234', 'test.1234', 'test12test'];
+ const validNames = [
+ 'test',
+ 'test1234',
+ 'test_1234',
+ 'test-1234',
+ 'test.1234',
+ 'test12test',
+ '.test'
+ ];
const invalidNames = ['1234', 'test@', 'test)'];
for (const validName of validNames) {
});
this.form = this.formBuilder.group({
name: new FormControl('', {
- validators: [Validators.pattern(/^[a-zA-Z][.A-Za-z0-9_-]+$/), Validators.required]
+ validators: [
+ Validators.pattern(/^(?:[.][A-Za-z0-9_-]+|[A-Za-z][.A-Za-z0-9_-]*)$/),
+ Validators.required
+ ]
}),
placement: ['hosts'],
hosts: [[]],