Fix queue sorting for real
It was passing the display text to the sort function, not the enum value, so only worked by accident. Refactor/rename things a bit to make this more clear. Also give the unknown/unprocessed state a higher priority, so it shows up before the finished builds. Same for manual builds, since they require user action.
This commit is contained in:
parent
2adcca84ae
commit
04fbe06c18
@ -79,12 +79,12 @@
|
|||||||
<td>→</td>
|
<td>→</td>
|
||||||
<td class="text-version">{{ srcinfo.build_version }}</td>
|
<td class="text-version">{{ srcinfo.build_version }}</td>
|
||||||
<td class="mytooltip text-{{ status[0].category or 'muted' }}">
|
<td class="mytooltip text-{{ status[0].category or 'muted' }}">
|
||||||
{{ status[0].status }}
|
{{ status[0].status_text }}
|
||||||
{% for s in status %}
|
{% for s in status %}
|
||||||
<small class="text-muted">
|
<small class="text-muted">
|
||||||
{% if s.urls %}
|
{% if s.urls %}
|
||||||
<br>
|
<br>
|
||||||
{{ s.type }}:
|
{{ s.build_type }}:
|
||||||
{% for key, value in s.urls.items() -%}
|
{% for key, value in s.urls.items() -%}
|
||||||
{% if not loop.first %} / {% endif %}<a href="{{ s.urls[key] }}">{{ key }}</a>
|
{% if not loop.first %} / {% endif %}<a href="{{ s.urls[key] }}">{{ key }}</a>
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
@ -95,7 +95,7 @@
|
|||||||
<template class="mytooltip-content">
|
<template class="mytooltip-content">
|
||||||
<dl>
|
<dl>
|
||||||
{% for s in status %}
|
{% for s in status %}
|
||||||
<dt>{{ s.type }}: <span class="text-{{ s.category or 'muted' }}">{{ s.status }}</span></dt>
|
<dt>{{ s.build_type }}: <span class="text-{{ s.category or 'muted' }}">{{ s.status_text }}</span></dt>
|
||||||
<dd><small class="text-muted">
|
<dd><small class="text-muted">
|
||||||
{% if s.details %}
|
{% if s.details %}
|
||||||
{{ s.details }}
|
{{ s.details }}
|
||||||
|
|||||||
31
app/web.py
31
app/web.py
@ -42,11 +42,22 @@ class PackageStatus(Enum):
|
|||||||
|
|
||||||
|
|
||||||
class PackageBuildStatus(NamedTuple):
|
class PackageBuildStatus(NamedTuple):
|
||||||
type: str
|
build_type: str
|
||||||
status: str
|
status_key: str
|
||||||
details: str
|
details: str
|
||||||
urls: dict[str, str]
|
urls: dict[str, str]
|
||||||
category: str
|
|
||||||
|
@property
|
||||||
|
def status_text(self) -> str:
|
||||||
|
return get_status_text(self.status_key)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def category(self) -> str:
|
||||||
|
return get_status_category(self.status_key)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def priority(self) -> tuple[int, str]:
|
||||||
|
return get_status_priority(self.status_key)
|
||||||
|
|
||||||
|
|
||||||
async def get_etag(request: Request) -> str:
|
async def get_etag(request: Request) -> str:
|
||||||
@ -582,13 +593,13 @@ def get_status_priority(key: str) -> tuple[int, str]:
|
|||||||
return (-1, key)
|
return (-1, key)
|
||||||
|
|
||||||
order = [
|
order = [
|
||||||
PackageStatus.UNKNOWN,
|
|
||||||
PackageStatus.FINISHED,
|
PackageStatus.FINISHED,
|
||||||
PackageStatus.MANUAL_BUILD_REQUIRED,
|
|
||||||
PackageStatus.FINISHED_BUT_INCOMPLETE,
|
PackageStatus.FINISHED_BUT_INCOMPLETE,
|
||||||
PackageStatus.FINISHED_BUT_BLOCKED,
|
PackageStatus.FINISHED_BUT_BLOCKED,
|
||||||
PackageStatus.WAITING_FOR_BUILD,
|
PackageStatus.WAITING_FOR_BUILD,
|
||||||
PackageStatus.WAITING_FOR_DEPENDENCIES,
|
PackageStatus.WAITING_FOR_DEPENDENCIES,
|
||||||
|
PackageStatus.UNKNOWN,
|
||||||
|
PackageStatus.MANUAL_BUILD_REQUIRED,
|
||||||
PackageStatus.FAILED_TO_BUILD,
|
PackageStatus.FAILED_TO_BUILD,
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -632,16 +643,14 @@ def get_build_status(srcinfo: SrcInfoPackage, build_types: set[str] = set()) ->
|
|||||||
continue
|
continue
|
||||||
results.append(
|
results.append(
|
||||||
PackageBuildStatus(
|
PackageBuildStatus(
|
||||||
build_type, get_status_text(status_key),
|
build_type, status_key,
|
||||||
status.desc or "", status.urls,
|
status.desc or "", status.urls)
|
||||||
get_status_category(status_key))
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if not results:
|
if not results:
|
||||||
for build in build_types:
|
for build in build_types:
|
||||||
key = "unknown"
|
|
||||||
results.append(
|
results.append(
|
||||||
PackageBuildStatus(build, get_status_text(key), "", {}, get_status_category(key)))
|
PackageBuildStatus(build, PackageStatus.UNKNOWN.value, "", {}))
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
@ -693,7 +702,7 @@ async def queue(request: Request, response: Response, build_type: str = "") -> R
|
|||||||
updates: list[UpdateEntry] = []
|
updates: list[UpdateEntry] = []
|
||||||
updates = list(grouped.values())
|
updates = list(grouped.values())
|
||||||
updates.sort(
|
updates.sort(
|
||||||
key=lambda i: (get_status_priority(i[3][0].status), i[0].date, i[0].pkgbase, i[0].pkgname),
|
key=lambda i: (i[3][0].priority, i[0].date, i[0].pkgbase, i[0].pkgname),
|
||||||
reverse=True)
|
reverse=True)
|
||||||
|
|
||||||
# get all packages in the pacman repo which are no in GIT
|
# get all packages in the pacman repo which are no in GIT
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user