Skip to content
Snippets Groups Projects
Commit 4dfc91c7 authored by Chris Lemaire's avatar Chris Lemaire
Browse files

Add default options for the enqueueing form

Adds defaults for requestType and assignment. Corrects validation
to handle empty values properly.
parent d5e7c9b3
No related branches found
No related tags found
1 merge request!183Use Real IPs instead of Proxy IP for Sentry (#250)
......@@ -69,6 +69,7 @@ public class Request implements RecordsEvents<Request>, Serializable, Comparable
@JsonView(View.Summary.class)
private Room room;
@NotNull
@JsonView(View.Summary.class)
@OneToOne
private RequestType requestType;
......
......@@ -24,6 +24,8 @@ import javax.validation.constraints.Size;
import nl.tudelft.ewi.queue.views.View;
import org.hibernate.validator.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonView;
@Entity
......@@ -35,6 +37,7 @@ public class RequestType implements Serializable {
@GeneratedValue
private Long id;
@NotBlank
@JsonView(View.Summary.class)
@Size(max = 250)
private String name;
......
......@@ -70,6 +70,7 @@
<div class="col-sm-8">
<select class="form-control" th:classappend="${#fields.hasErrors('assignment')} ? 'is-invalid'"
id="inputAssignment" th:field="*{assignment}">
<option value="" th:selected="selected">Choose an assignment</option>
<option th:each="assignment : ${lab.assignments}" th:value="${assignment.id}"
th:text="${assignment.name}">Assembly programming
</option>
......@@ -101,6 +102,7 @@
<div class="col-sm-8">
<select class="form-control" id="inputType" th:field="*{requestType}"
th:classappend="${#fields.hasErrors('requestType')} ? 'is-invalid'">
<option value="" th:selected="selected">Choose the type</option>
<option th:each="requestType : ${lab.allowedRequestTypes}" th:value="${requestType.id}"
th:text="${requestType.name}"></option>
</select>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment