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

Fix Request.Status.toString causing 500 errors for filters

- Filters seem to crash because the toString method for the NOTFOUND status
  contained a whitespace.
- The name of the toString() function was changed to displayName() to use the
  no longer use as the default for serialization.
parent 61ac34d4
No related merge requests found
...@@ -608,10 +608,14 @@ public class Request implements RecordsEvents<Request>, Serializable, Comparable ...@@ -608,10 +608,14 @@ public class Request implements RecordsEvents<Request>, Serializable, Comparable
CANCELLED, CANCELLED,
NOTFOUND { NOTFOUND {
@Override @Override
public String toString() { public String displayName() {
return "NOT FOUND"; return "NOT FOUND";
} }
}; };
public String displayName() {
return name();
}
} }
public String toSentence() { public String toSentence() {
... ...
......
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
<label class="form-control-label" for="statusSelect">Status</label> <label class="form-control-label" for="statusSelect">Status</label>
<select multiple class="selectpicker" id="statusSelect" name="status"> <select multiple class="selectpicker" id="statusSelect" name="status">
<th:block th:each="status : ${T(nl.tudelft.ewi.queue.model.Request.Status).values()}"> <th:block th:each="status : ${T(nl.tudelft.ewi.queue.model.Request.Status).values()}">
<option th:value="${status}" th:text="${status}" <option th:value="${status}" th:text="${status.displayName()}"
th:selected="${#filter.valueInMultiMap('status', status, state)}"></option> th:selected="${#filter.valueInMultiMap('status', status, state)}"></option>
</th:block> </th:block>
</select> </select>
... ...
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</tr> </tr>
<th:block th:each="request : ${requests.content}"> <th:block th:each="request : ${requests.content}">
<tr class="text-white" th:classappend="${#filter.mapStatusToBootstrapColor(request.status)}" th:id="'request-' + ${request.id}"> <tr class="text-white" th:classappend="${#filter.mapStatusToBootstrapColor(request.status)}" th:id="'request-' + ${request.id}">
<td><span class="badge badge-pill bg-info" th:text="${request.status}" th:id="'status-' + ${request.id}"></span></td> <td><span class="badge badge-pill bg-info" th:text="${request.status.displayName()}" th:id="'status-' + ${request.id}"></span></td>
<td><a href="#" class="text-white" th:href="@{/request/{id}(id=${request.id})}" <td><a href="#" class="text-white" th:href="@{/request/{id}(id=${request.id})}"
th:text="${request.toSentence()}"> th:text="${request.toSentence()}">
Request Request
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment