fix(webui): suppress empty queue copy on fetch failure (#458)
When Gitea credentials are missing or the queue fetch fails closed, show "Not loaded" instead of "No open items." and keep pagination marked unavailable. Successful empty inventories still show the empty state with complete pagination proof. Closes #458
This commit is contained in:
@@ -38,7 +38,13 @@ def _queue_table(
|
||||
title: str,
|
||||
items: tuple[QueueItem, ...],
|
||||
columns: tuple[tuple[str, str], ...],
|
||||
fetch_failed: bool = False,
|
||||
) -> str:
|
||||
if fetch_failed:
|
||||
return (
|
||||
f"<h3>{html.escape(title)}</h3>"
|
||||
"<p class='muted'>Not loaded — queue fetch did not complete.</p>"
|
||||
)
|
||||
if not items:
|
||||
return f"<h3>{html.escape(title)}</h3><p class='muted'>No open items.</p>"
|
||||
|
||||
@@ -73,9 +79,11 @@ def render_queue_page(snapshot: QueueSnapshot) -> str:
|
||||
f"{html.escape(snapshot.fetch_error)}</p></div>"
|
||||
)
|
||||
|
||||
fetch_failed = bool(snapshot.fetch_error)
|
||||
pr_section = _queue_table(
|
||||
title="Open pull requests",
|
||||
items=snapshot.prs,
|
||||
fetch_failed=fetch_failed,
|
||||
columns=(
|
||||
("number", "#"),
|
||||
("title", "Title"),
|
||||
@@ -88,6 +96,7 @@ def render_queue_page(snapshot: QueueSnapshot) -> str:
|
||||
issue_section = _queue_table(
|
||||
title="Open issues",
|
||||
items=snapshot.issues,
|
||||
fetch_failed=fetch_failed,
|
||||
columns=(
|
||||
("number", "#"),
|
||||
("title", "Title"),
|
||||
|
||||
Reference in New Issue
Block a user