explorer / templates /admin.html
noobpwnftw's picture
Deploy ChessTB Explorer on Hugging Face Spaces
e16348e
Raw History Blame
3.73 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ChessTB — Admin Dashboard</title>
<link rel="stylesheet" href="{{ url_for('static', filename='dist/admin.css') }}">
</head>
<body class="admin-page">
{% if not authenticated %}
<!-- Shown when GET /admin has no valid session cookie. Submits the token
to POST /admin/login (static/js/admin.js's login()); on success the
page reloads and this branch renders the dashboard instead. -->
<div class="login-card">
<h1>
♟ ChessTB Admin
{% if source_repository_url %}
<a href="{{ source_repository_url }}" class="site-header__link site-header__link--icon"
title="Source repository" aria-label="Source repository" target="_blank" rel="noopener">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M7 8.5v7m10-7V10a4 4 0 0 1-4 4H7" />
<circle cx="7" cy="6" r="2.5" />
<circle cx="7" cy="18" r="2.5" />
<circle cx="17" cy="6" r="2.5" />
</svg>
</a>
{% endif %}
</h1>
{% if not admin_configured %}
<p class="status err">Admin panel disabled: ADMIN_TOKEN is not configured.</p>
{% else %}
<p class="login-card__hint">Enter the admin token to continue.</p>
<input type="password" id="login-token-input" class="login-input"
placeholder="Admin token" autocomplete="current-password">
<button class="btn btn--apply" id="login-btn">Log in</button>
<div class="status" id="login-status"></div>
{% endif %}
<a href="/" class="login-card__back">← Back to explorer</a>
</div>
{% else %}
<h1>
♟ ChessTB Cache Dashboard
{% if source_repository_url %}
<a href="{{ source_repository_url }}" class="site-header__link site-header__link--icon"
title="Source repository" aria-label="Source repository" target="_blank" rel="noopener">
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M7 8.5v7m10-7V10a4 4 0 0 1-4 4H7" />
<circle cx="7" cy="6" r="2.5" />
<circle cx="7" cy="18" r="2.5" />
<circle cx="17" cy="6" r="2.5" />
</svg>
</a>
{% endif %}
<button class="btn" id="logout-btn">Log out</button>
<a href="/" class="admin-page__back-link">← Back to explorer</a>
</h1>
<div class="toolbar-row">
<button class="btn" id="refresh-btn">Refresh</button>
<button class="btn danger" id="clear-btn">Clear all caches</button>
</div>
<div class="refresh-row">
<span id="next-refresh">Auto-refreshes every 5 s</span>
<span id="last-updated"></span>
</div>
<div class="grid">
<div class="card" id="card-eval">
<h2>Root Probe Cache (evaluate_fen)</h2>
<div class="bar-wrap"><div class="bar-fill" id="bar-eval" style="width:0%"></div></div>
<div id="stats-eval"><div class="stat"><span class="label">Loading…</span></div></div>
</div>
<div class="card" id="card-probe">
<h2>Child Probe Cache (_probe_fen)</h2>
<div class="bar-wrap"><div class="bar-fill" id="bar-probe" style="width:0%"></div></div>
<div id="stats-probe"><div class="stat"><span class="label">Loading…</span></div></div>
</div>
</div>
<div class="card" style="margin-bottom:16px">
<h2>Thread Pool &amp; Configuration</h2>
<div id="stats-pool"><div class="stat"><span class="label">Loading…</span></div></div>
</div>
<div class="status" id="status-msg"></div>
{% endif %}
<script src="{{ url_for('static', filename='js/admin.js') }}"></script>
</body>
</html>