More features for search.
This commit is contained in:
parent
9a39ae25df
commit
3a9dd7b915
3 changed files with 8 additions and 3 deletions
|
|
@ -840,6 +840,9 @@ def _format_value(val: Any, fmt: Optional[str]) -> Any:
|
||||||
if fmt is None:
|
if fmt is None:
|
||||||
return val
|
return val
|
||||||
try:
|
try:
|
||||||
|
if callable(fmt):
|
||||||
|
return fmt(val)
|
||||||
|
|
||||||
if fmt == "yesno":
|
if fmt == "yesno":
|
||||||
return "Yes" if bool(val) else "No"
|
return "Yes" if bool(val) else "No"
|
||||||
if fmt == "date":
|
if fmt == "date":
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,8 @@ def init_search_routes(app):
|
||||||
"link": {"endpoint": "entry.entry", "params": {"id": "{work_item.id}", "model": "inventory"}}},
|
"link": {"endpoint": "entry.entry", "params": {"id": "{work_item.id}", "model": "inventory"}}},
|
||||||
{"field": "complete", "format": "yesno"},
|
{"field": "complete", "format": "yesno"},
|
||||||
{"field": "start_time", "format": "datetime"},
|
{"field": "start_time", "format": "datetime"},
|
||||||
{"field": "end_time", "format": "datetime"}
|
{"field": "end_time", "format": "datetime"},
|
||||||
|
{"field": "updates", "format": lambda x: len(x)},
|
||||||
]
|
]
|
||||||
worklog_results = worklog_service.list({
|
worklog_results = worklog_service.list({
|
||||||
'contact.label|work_item.label__icontains': q,
|
'contact.label|work_item.label__icontains': q,
|
||||||
|
|
@ -81,7 +82,8 @@ def init_search_routes(app):
|
||||||
"work_item.label",
|
"work_item.label",
|
||||||
"complete",
|
"complete",
|
||||||
"start_time",
|
"start_time",
|
||||||
"end_time"
|
"end_time",
|
||||||
|
"updates",
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
<div class="display-4 mb-3 text-center">
|
<div class="display-4 mb-3 text-center">
|
||||||
Search results for "{{ q }}"
|
Search Results For "{{ q }}"
|
||||||
</div>
|
</div>
|
||||||
<ul class="nav nav-pills nav-fill justify-content-center fw-bold px-5 mx-5 mb-3" id="resultsTab">
|
<ul class="nav nav-pills nav-fill justify-content-center fw-bold px-5 mx-5 mb-3" id="resultsTab">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue