mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix(operations): Jobs dates carry the year and time zone, filters match part of a name
Job dates showed no year and no time zone, unlike the Logs page; they now read 2026-10-13 23:04:00 under "Created (time zone)". The host filter matched only a whole host name and the user filter only an exact username; both now ignore case and take the start of a host or any part of a name.
This commit is contained in:
parent
2c974e2aed
commit
76afc672fc
4 changed files with 27 additions and 12 deletions
|
|
@ -30,9 +30,12 @@ def _get(user, pk):
|
|||
def jobs(request):
|
||||
qs = _visible(request.user)
|
||||
if request.user.is_superuser:
|
||||
# the host and the user as typed: the start of the host, any part of the name
|
||||
if compute := request.GET.get("compute"):
|
||||
qs = qs.filter(resource_label__startswith=f"{compute}/")
|
||||
for field in ("state", "kind", "username"):
|
||||
qs = qs.filter(resource_label__istartswith=compute)
|
||||
if username := request.GET.get("username"):
|
||||
qs = qs.filter(username__icontains=username)
|
||||
for field in ("state", "kind"):
|
||||
if value := request.GET.get(field):
|
||||
qs = qs.filter(**{field: value})
|
||||
page = Paginator(qs, 50).get_page(request.GET.get("page"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue