Skip to content

Commit

Permalink
webadmin: Add validation to new template
Browse files Browse the repository at this point in the history
In PR [1], the validation of a new template was
removed from the UI in assumption that the backend
can validate the template properly. However,
the backend does not contain validation for the name
and if the name is not provided, it fails on inserting
null to a not null database column.

This patch adds the name validation back to the fronted.

1: oVirt#621
  • Loading branch information
ljelinkova committed Sep 23, 2022
1 parent 1f8b4d0 commit a090df7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3250,7 +3250,7 @@ public void fireValidationCompleteEvent() {
ValidationCompleteEvent.fire(getEventBus(), this);
}

private boolean validateNaming() {
public boolean validateNaming() {
getName().validateEntity(
new IValidation[] {
new NotEmptyValidation(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,10 @@ private void onNewTemplate() {
return;
}

if (!model.validateNaming()) {
return;
}

if (model.getIsSubTemplate().getEntity()) {
postNameUniqueCheck();
} else {
Expand Down

0 comments on commit a090df7

Please sign in to comment.