Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions autohands/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,10 @@ def _render_html(snapshot: dict) -> str:
f"render:</p><ul class='meta'>{items}</ul></div>")
heart = _heart_board_url(snapshot)
hero = t_.hero(BOARD_KEY, "Dashboard", _LEDE, navigation=[
{"href": "#libraries", "label": "Libraries"},
{"href": "#release-train", "label": "Release train"},
{"href": "#libraries", "label": "Libraries",
"count": len(snapshot["libraries"]) if snapshot.get("libraries") is not None and not snapshot.get("errors") else None},
{"href": "#release-train", "label": "Release train",
"count": len(snapshot["train"][:TRAIN_RUNS_SHOWN]) if snapshot.get("train") is not None and not snapshot.get("errors") else None},
])
# The way back from the Pages board to the repository front door; owner
# and repo come from the snapshot (the git remote), so nothing is
Expand All @@ -566,7 +568,7 @@ def _render_html(snapshot: dict) -> str:
github_link = (f' · <a href="https://github.com/{gh_owner}/{gh_repo}'
'/blob/main/README.md">GitHub Page</a>'
if gh_owner and gh_repo else "")
return f"""<!doctype html>
return t_.section_layout(f"""<!doctype html>
<html lang="en"><head><meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PyAutoHands Dashboard</title>
Expand All @@ -590,7 +592,7 @@ def _render_html(snapshot: dict) -> str:
APIs · generated {_html.escape(str(snapshot.get('generated') or '?'))}.</footer>
<script>{t_.JS}</script>
</body></html>
"""
""")


def badge_endpoint(snapshot: dict) -> dict:
Expand Down
9 changes: 8 additions & 1 deletion tests/test_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def test_orchestration_panel_uses_executor_remote_and_preserves_actions():
assert html_module.unescape(preview) == (
board.CHECKIN_PROMPT.format(owner=SNAP["owner"]) + "\n\nWork on GitHub:\n"
"- SomeHands: https://github.com/SomeOrg/SomeHands")
assert page.index('class="board-nav"') < page.index('id="orchestration-hands"')
assert page.index('class="board-nav"') > page.index('id="orchestration-hands"')
assert page.index('id="orchestration-hands"') < page.index('<p class="verdict">')
assert board.theme().prompt_heading("hands", heading_id="orchestration-hands-heading") in page
for _, payload in board.ACTION_CHIPS:
Expand All @@ -351,3 +351,10 @@ def test_panel_refresh_uses_capture_not_release_time(monkeypatch):

board.render({**SNAP, "errors": ["release collection unavailable"]}, "html")
assert calls[-1]["refreshed_at"] is None


def test_failed_collection_does_not_claim_zero_items_in_section_counts():
snapshot = dict(SNAP, libraries=[], train=[], errors=['Collection unavailable'])
page = board._render_html(snapshot)
nav = re.search(r'<nav class="board-nav".*?</nav>', page, re.S).group()
assert 'board-nav-count' not in nav
Loading