Skip to content

Commit

Permalink
Merge pull request #75 from UST-QuAntiL/fix/empty-tab-names
Browse files Browse the repository at this point in the history
fix(template tab): disallow empty tab names
  • Loading branch information
infacc authored Oct 26, 2023
2 parents 4feccb9 + 93ed15a commit 9e5e91f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ <h2>Template Tab</h2>
</mat-form-field>
<mat-form-field class="form-field">
<mat-label>Name:</mat-label>
<input matInput formControlName="name" required>
<input matInput formControlName="name">
<mat-error *ngIf="templateForm.controls['name'].invalid">Invalid tab name!</mat-error>
</mat-form-field>
<mat-form-field class="form-field">
<mat-label>Description:</mat-label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class TemplateDetailsComponent implements OnInit {
};

templateForm: FormGroup = this.fb.group({
name: [this.initialValues.name, Validators.required],
name: [this.initialValues.name, [Validators.required, Validators.minLength(1)]],
description: this.initialValues.description,
sortKey: this.initialValues.sortKey,
location: [this.initialValues.location, [Validators.required, isInSetValidator(Object.keys(TAB_GROUP_NAME_OVERRIDES))]]
Expand All @@ -59,6 +59,9 @@ export class TemplateDetailsComponent implements OnInit {
async onSubmit() {
let findString: string;
let response: ApiResponse<TemplateApiObject | TemplateTabApiObject> | null;
if (this.templateForm.invalid) {
return;
}
if (this.templateLink != null) {
findString = "create";
response = await this.registry.getByApiLink<TemplateApiObject>(this.templateLink);
Expand Down

0 comments on commit 9e5e91f

Please sign in to comment.