UI a menu a FA

This commit is contained in:
JiriUhlir
2026-06-15 09:57:24 +02:00
parent 40069c8969
commit 3bb762d08a
8 changed files with 117 additions and 38 deletions
+21 -18
View File
@@ -12,33 +12,34 @@ def page(title: str, body: str, user=None) -> str:
if user:
username = html.escape(user.get("username", ""))
display_name = html.escape(user.get("display_name") or user.get("username", ""))
admin_links = ""
admin_menu = ""
if (user.get("role") or "").lower() == "admin":
admin_links = '<a href="/portal/admin/users">Users</a>'
nav = f"""
<nav>
<a class="nav-link" href="/portal/operations">Přehled</a>
<a class="nav-link" href="/portal/apps">Služby</a>
admin_menu = """
<div class="nav-menu">
<button type="button" class="nav-menu-button">Provoz</button>
<button type="button" class="nav-menu-button">Admin</button>
<div class="nav-menu-panel">
<a href="/portal/jobs">Úlohy</a>
<a href="/portal/operations">P&rcaron;ehled</a>
<a href="/portal/apps">Slu&zcaron;by</a>
<a href="/portal/jobs">&Uacute;lohy</a>
<a href="/portal/scheduled-scripts">Pl&aacute;novan&eacute; skripty</a>
<a href="/portal/migration-readiness">Migration Readiness</a>
<a href="/portal/alerting/rules">Alerting</a>
<a href="/portal/deployments">Nasazení</a>
<a href="/portal/migration-readiness">Migration Readiness</a>
<a href="/portal/deployments">Nasazen&iacute;</a>
<a href="/portal/incidents">Incidenty</a>
<a href="/portal/workers">Workery</a>
</div>
</div>
<div class="nav-menu">
<button type="button" class="nav-menu-button">Správa</button>
<div class="nav-menu-panel">
{admin_links}
<a href="/portal/admin/users">Users</a>
<a href="/portal/audit">Audit</a>
<a href="/portal/backups">Zálohy</a>
<a href="/portal/backups">Z&aacute;lohy</a>
</div>
</div>
"""
nav = f"""
<nav>
<a class="nav-link" href="/portal/apps">Slu&zcaron;by</a>
<a class="nav-link" href="/portal/jobs">&Uacute;lohy</a>
<a class="nav-link" href="/portal/scheduled-scripts">Pl&aacute;novan&eacute; skripty</a>
<a class="nav-link" href="/portal/alerting/rules">Alerting</a>
{admin_menu}
</nav>
"""
user_panel = f"""
@@ -55,12 +56,14 @@ def page(title: str, body: str, user=None) -> str:
<html>
<head>
<title>{APP_NAME} - {html.escape(title)}</title>
<link rel="stylesheet" href="{PORTAL_PREFIX}/static/vendor/fontawesome/css/fontawesome.min.css">
<link rel="stylesheet" href="{PORTAL_PREFIX}/static/vendor/fontawesome/css/solid.min.css">
<link rel="stylesheet" href="{PORTAL_PREFIX}/static/styles.css">
<script src="{PORTAL_PREFIX}/static/portal.js"></script>
</head>
<body>
<header>
<a class="brand" href="/portal/operations" aria-label="{APP_NAME}">
<a class="brand" href="/portal/apps" aria-label="{APP_NAME}">
<img src="{PORTAL_PREFIX}/static/csbot-logo.svg" alt="CSBOT">
<span>{APP_NAME}</span>
</a>