feat: add health check endpoint and refactor templates for consistent header usage
This commit is contained in:
@@ -737,6 +737,15 @@ async def home(request: Request) -> HTMLResponse:
|
|||||||
return await _dashboard_response(request)
|
return await _dashboard_response(request)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/dashboard/health", response_class=HTMLResponse)
|
||||||
|
async def dashboard_health_page(request: Request) -> HTMLResponse:
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
request=request,
|
||||||
|
name="health.html",
|
||||||
|
context={"title": "Arbitrade Health Check"},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/dashboard", response_class=HTMLResponse)
|
@router.get("/dashboard", response_class=HTMLResponse)
|
||||||
async def dashboard(request: Request) -> HTMLResponse:
|
async def dashboard(request: Request) -> HTMLResponse:
|
||||||
return await _dashboard_response(request)
|
return await _dashboard_response(request)
|
||||||
|
|||||||
@@ -140,7 +140,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main class="{% block main_class %}shell{% endblock %}">
|
<main class="{% block main_class %}shell{% endblock %}">
|
||||||
{% block content %}{% endblock %}
|
{% block header %}{% endblock %} {% block content %}{% endblock %}
|
||||||
</main>
|
</main>
|
||||||
{% block scripts %}{% endblock %}
|
{% block scripts %}{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<section class="hero">
|
||||||
|
<div>
|
||||||
|
<h1 class="title">{{ page_title }}</h1>
|
||||||
|
<p class="subtitle">{{ page_subtitle }}</p>
|
||||||
|
</div>
|
||||||
|
{% set nav_links = [ {"url": "/dashboard", "label": "Dashboard", "class":
|
||||||
|
"secondary"}, {"url": "/dashboard/config", "label": "Config", "class":
|
||||||
|
"secondary"}, {"url": "/dashboard/backtesting", "label": "Backtesting",
|
||||||
|
"class": "secondary"}, {"url": "/dashboard/health", "label": "Health",
|
||||||
|
"class": "secondary"}, ] %}
|
||||||
|
<div class="toolbar">
|
||||||
|
{% for link in nav_links %}
|
||||||
|
<a
|
||||||
|
class="button{% if link.class %} {{ link.class }}{% endif %}"
|
||||||
|
href="{{ link.url }}"
|
||||||
|
{%
|
||||||
|
if
|
||||||
|
link.hx_get
|
||||||
|
%}hx-get="{{ link.hx_get }}"
|
||||||
|
hx-target="{{ link.hx_target }}"
|
||||||
|
hx-swap="{{ link.hx_swap | default('outerHTML') }}"
|
||||||
|
{%
|
||||||
|
endif
|
||||||
|
%}
|
||||||
|
>
|
||||||
|
{{ link.label }}
|
||||||
|
</a>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@@ -1,19 +1,8 @@
|
|||||||
{% extends "base.html" %} {% block title %}Audit Trail{% endblock %} {% block
|
{% extends "_base.html" %} {% block title %}Audit Trail{% endblock %} {% block
|
||||||
main_class %}shell{% endblock %} {% block content %}
|
main_class %}shell{% endblock %} {% block header %} {% with page_title="Audit
|
||||||
<section class="hero">
|
Trail", page_subtitle="System activity, configuration changes, and execution
|
||||||
<div>
|
decisions." %} {% include "_header.html" %} {% endwith %} {% endblock %} {%
|
||||||
<h1 class="title">Audit Trail</h1>
|
block content %}
|
||||||
<p class="subtitle">
|
|
||||||
System activity, configuration changes, and execution decisions.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="toolbar">
|
|
||||||
<a class="button secondary" href="/dashboard">Dashboard</a>
|
|
||||||
<a class="button secondary" href="/dashboard/config">Config</a>
|
|
||||||
<a class="button secondary" href="/dashboard/backtesting">Backtesting</a>
|
|
||||||
<a class="button secondary" href="/health">Health</a>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section
|
<section
|
||||||
id="audit-shell"
|
id="audit-shell"
|
||||||
|
|||||||
@@ -1,16 +1,8 @@
|
|||||||
{% extends "base.html" %} {% block title %}{{ title }}{% endblock %} {% block
|
{% extends "_base.html" %} {% block title %}{{ title }}{% endblock %} {% block
|
||||||
content %}
|
main_class %}shell{% endblock %} {% block header %} {% with
|
||||||
<section class="hero">
|
page_title="Backtesting", page_subtitle="Replay controls, run status, and recent
|
||||||
<div>
|
summary reports." %} {% include "_header.html" %} {% endwith %} {% endblock %}
|
||||||
<h1 class="title">Backtesting</h1>
|
{% block content %}
|
||||||
<p class="subtitle">
|
|
||||||
Replay controls, run status, and recent summary reports.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="toolbar">
|
|
||||||
<a class="button secondary" href="{{ dashboard_endpoint }}">Dashboard</a>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section
|
<section
|
||||||
id="backtesting-shell"
|
id="backtesting-shell"
|
||||||
|
|||||||
@@ -1,19 +1,8 @@
|
|||||||
{% extends "base.html" %} {% block title %}{{ title }}{% endblock %} {% block
|
{% extends "_base.html" %} {% block title %}{{ title }}{% endblock %} {% block
|
||||||
main_class %}shell{% endblock %} {% block content %}
|
main_class %}shell{% endblock %} {% block header %} {% with
|
||||||
<section class="hero">
|
page_title="Configuration", page_subtitle="Runtime settings, alerts, exchange,
|
||||||
<div>
|
risk, and strategy." %} {% include "_header.html" %} {% endwith %} {% endblock
|
||||||
<h1 class="title">Configuration</h1>
|
%} {% block content %}
|
||||||
<p class="subtitle">
|
|
||||||
Runtime settings, alerts, exchange, risk, and strategy.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="toolbar">
|
|
||||||
<a class="button secondary" href="/dashboard">Dashboard</a>
|
|
||||||
<a class="button secondary" href="/dashboard/backtesting">Backtesting</a>
|
|
||||||
<a class="button secondary" href="/dashboard/audit">Audit</a>
|
|
||||||
<a class="button secondary" href="/health">Health</a>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section
|
<section
|
||||||
id="fees-shell"
|
id="fees-shell"
|
||||||
|
|||||||
@@ -1,28 +1,11 @@
|
|||||||
{% extends "base.html" %} {% block title %}{{ title }}{% endblock %} {% block
|
{% extends "_base.html" %} {% block title %}{{ title }}{% endblock %} {% block
|
||||||
head_scripts %}
|
head_scripts %}
|
||||||
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.3/dist/chart.umd.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.3/dist/chart.umd.min.js"></script>
|
||||||
{% endblock %} {% block main_class %}shell{% endblock %} {% block content %}
|
{% endblock %} {% block header %} {% with page_title="Arbitrade Dashboard",
|
||||||
<section class="hero">
|
page_subtitle="Live execution, P&L, and system state." %} {% include
|
||||||
<div>
|
"_header.html" %} {% endwith %} {% endblock %} {% block main_class %}shell{%
|
||||||
<h1 class="title">Arbitrade Dashboard</h1>
|
endblock %} {% block content %}
|
||||||
<p class="subtitle">Live execution, P&L, and system state.</p>
|
|
||||||
</div>
|
|
||||||
<div class="toolbar">
|
|
||||||
<a
|
|
||||||
class="button"
|
|
||||||
href="{{ metrics_endpoint }}"
|
|
||||||
hx-get="{{ metrics_endpoint }}"
|
|
||||||
hx-target="#metrics-panel"
|
|
||||||
hx-swap="outerHTML"
|
|
||||||
>Refresh metrics</a
|
|
||||||
>
|
|
||||||
<a class="button secondary" href="/health">Health</a>
|
|
||||||
<a class="button secondary" href="/dashboard/config">Config</a>
|
|
||||||
<a class="button secondary" href="/dashboard/backtesting">Backtesting</a>
|
|
||||||
<a class="button secondary" href="/dashboard/audit">Audit</a>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section
|
<section
|
||||||
id="metrics-shell"
|
id="metrics-shell"
|
||||||
|
|||||||
@@ -1,14 +1,21 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "_base.html" %} {% block title %}Arbitrade Health Check{% endblock %}
|
||||||
|
{% block header %} {% with page_title="Arbitrade Health Check",
|
||||||
{% block content %}
|
page_subtitle="Live system state." %} {% include "_header.html" %} {% endwith %}
|
||||||
<section class="card">
|
{% endblock %} {% block main_class %}shell{% endblock %} {% block content %}
|
||||||
<h1>Arbitrade Bootstrap Complete</h1>
|
<section class="card">
|
||||||
<p><span class="badge">Status: {{ status }}</span></p>
|
<h1>Arbitrade Bootstrap Complete</h1>
|
||||||
<p>UTC: {{ time }}</p>
|
<p><span class="badge">Status: {{ status }}</span></p>
|
||||||
<p>
|
<p>UTC: {{ time }}</p>
|
||||||
Health JSON:
|
<p>
|
||||||
<a href="/health" hx-get="/health" hx-target="#health-json" hx-swap="innerHTML">refresh</a>
|
Health JSON:
|
||||||
</p>
|
<a
|
||||||
<pre id="health-json">{"status":"ok","service":"arbitrade"}</pre>
|
href="/health"
|
||||||
</section>
|
hx-get="/health"
|
||||||
{% endblock %}
|
hx-target="#health-json"
|
||||||
|
hx-swap="innerHTML"
|
||||||
|
>refresh</a
|
||||||
|
>
|
||||||
|
</p>
|
||||||
|
<pre id="health-json">{"status":"ok","service":"arbitrade"}</pre>
|
||||||
|
</section>
|
||||||
|
{% endblock %} {% block scripts %}{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user