from __future__ import annotations from .components import _event_label from .html_utils import attr, escape def _account_row(account: dict[str, str | int | None], csrf: str = "", admin_path: str = "/admin") -> str: hostname = escape(account["hostname"]) status = "Active" if account.get("accepted_at") else "Pending" ipv4 = escape(account.get("ipv4") or "-") ipv6 = escape(account.get("ipv6") or "-") updated = escape(account.get("updated_at") or "Never") safe_admin_path = attr(admin_path) return f""" {hostname}{escape(status)}{ipv4}{ipv6}{updated}
""" def _admin_table_toolbar(table_id: str, search_label: str) -> str: safe_id = attr(table_id) safe_label = attr(search_label) return f"""
0-0 of 0
""" def _admin_table_pagination() -> str: return """
""" def _event_row(event: dict[str, str | int | None]) -> str: created = escape(event.get("created_at") or "-") hostname = escape(event.get("hostname") or "-") status = escape(_event_label(event.get("status"))) ipv4 = escape(event.get("ipv4") or "-") ipv6 = escape(event.get("ipv6") or "-") count = escape(event.get("count") or 1) detail = escape(event.get("detail") or "-") return f"{created}{hostname}{status}{ipv4}{ipv6}{count}{detail}"