Skip to content

Commit

Permalink
fix(front): Properly validate repository name
Browse files Browse the repository at this point in the history
  • Loading branch information
dominik003 committed Nov 7, 2023
1 parent 7af54dd commit 3eb619c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@
<mat-form-field appearance="fill">
<mat-label>Repository</mat-label>
<input matInput formControlName="t4cRepositoryName" />
<mat-error *ngIf="t4cRepositoryNameControl.errors?.uniqueName"
>Repository already exists</mat-error
>
<mat-error *ngIf="t4cRepositoryNameControl.errors?.uniqueName">
Repository already exists
</mat-error>
<mat-error *ngIf="t4cRepositoryNameControl.errors?.pattern">
The following characters are allowed: A-Z, a-z, 0-9, _, -
</mat-error>
</mat-form-field>
</fieldset>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@ export class CreateT4cModelNewRepositoryComponent implements OnInit {
t4cInstanceId: new FormControl<number | null>(null, Validators.required),
t4cRepositoryName: new FormControl<string | null>(
{ value: null, disabled: true },
Validators.required,
this.t4cRepoService.asyncNameValidator(),
{
validators: [
Validators.required,
Validators.pattern(/^[-a-zA-Z0-9_]+$/),
],
asyncValidators: this.t4cRepoService.asyncNameValidator(),
},
),
t4cProjectName: new FormControl<string | null>(
{ value: null, disabled: true },
Expand Down

0 comments on commit 3eb619c

Please sign in to comment.