Handle search errors
This commit is contained in:
parent
7f9f1d0f66
commit
e885f90876
|
@ -77,8 +77,12 @@ def return_tracker(tracker, access, **kwargs):
|
|||
.options(subqueryload(Ticket.submitter))
|
||||
.order_by(Ticket.updated.desc()))
|
||||
|
||||
terms = request.args.get("search")
|
||||
tickets = apply_search(tickets, terms, tracker, current_user)
|
||||
try:
|
||||
terms = request.args.get("search")
|
||||
tickets = apply_search(tickets, terms, tracker, current_user)
|
||||
except ValueError as e:
|
||||
kwargs["search_error"] = str(e)
|
||||
|
||||
tickets, pagination = paginate_query(tickets, results_per_page=25)
|
||||
|
||||
# Find which tickets were seen by the user since last update
|
||||
|
|
|
@ -154,11 +154,14 @@
|
|||
name="search"
|
||||
type="text"
|
||||
placeholder="Search tickets... status:closed label:label order:updated submitter:me"
|
||||
class="form-control"
|
||||
class="form-control{% if search_error %} is-invalid{% endif %}"
|
||||
{% if not another %}
|
||||
autofocus
|
||||
{% endif %}
|
||||
value="{{ search if search else "" }}" />
|
||||
{% if search_error %}
|
||||
<div class="invalid-feedback">{{ search_error }}</div>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% if len(tickets) %}
|
||||
<div class="ticket-list">
|
||||
|
|
Loading…
Reference in New Issue