121 lines
7 KiB
HTML
121 lines
7 KiB
HTML
{{define "layout"}}
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>LLM Gateway</title>
|
|
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
|
|
<script src="https://unpkg.com/htmx-ext-json-enc@2.0.3/json-enc.js"></script>
|
|
<script src="https://unpkg.com/htmx-ext-sse@2.2.2/sse.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js@4"></script>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0f172a; color: #e2e8f0; min-height: 100vh; display: flex; }
|
|
|
|
/* Sidebar */
|
|
.sidebar { width: 220px; background: #1e293b; border-right: 1px solid #334155; min-height: 100vh; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; }
|
|
.sidebar-brand { padding: 20px 16px; font-size: 1.1rem; font-weight: 700; color: #f8fafc; border-bottom: 1px solid #334155; }
|
|
.sidebar-nav { flex: 1; padding: 12px 0; }
|
|
.sidebar-nav a { display: block; padding: 10px 20px; color: #94a3b8; text-decoration: none; font-size: 0.9rem; transition: all 0.15s; }
|
|
.sidebar-nav a:hover { background: #334155; color: #e2e8f0; }
|
|
.sidebar-nav a.active { background: #3b82f620; color: #3b82f6; border-right: 3px solid #3b82f6; }
|
|
.sidebar-footer { padding: 16px; border-top: 1px solid #334155; }
|
|
.sidebar-footer .user-info { font-size: 0.85rem; color: #94a3b8; margin-bottom: 8px; }
|
|
.sidebar-footer a { display: block; padding: 6px 0; color: #94a3b8; text-decoration: none; font-size: 0.85rem; }
|
|
.sidebar-footer a:hover { color: #f87171; }
|
|
|
|
/* Main content */
|
|
.main { flex: 1; margin-left: 220px; padding: 24px; min-height: 100vh; max-width: calc(100vw - 220px); overflow-x: hidden; }
|
|
|
|
/* Cards & tables */
|
|
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; max-width: 100%; }
|
|
.card { background: #1e293b; border-radius: 8px; padding: 16px; }
|
|
.card .label { font-size: 0.75rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; }
|
|
.card .value { font-size: 1.5rem; font-weight: 700; margin-top: 4px; }
|
|
.card .sub { font-size: 0.75rem; color: #64748b; margin-top: 2px; }
|
|
.section { background: #1e293b; border-radius: 8px; padding: 16px; margin-bottom: 16px; overflow-x: auto; }
|
|
.section h2 { font-size: 1.1rem; margin-bottom: 12px; color: #cbd5e1; }
|
|
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
|
|
.tabs button { background: #1e293b; border: 1px solid #334155; color: #94a3b8; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 0.8rem; }
|
|
.tabs button.active { background: #3b82f6; border-color: #3b82f6; color: #fff; }
|
|
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
|
|
th { text-align: left; padding: 8px; color: #94a3b8; border-bottom: 1px solid #334155; font-weight: 500; }
|
|
td { padding: 8px; border-bottom: 1px solid #334155; }
|
|
.green { color: #4ade80; }
|
|
.red { color: #f87171; }
|
|
.blue { color: #60a5fa; }
|
|
|
|
/* Buttons */
|
|
.btn { display: inline-block; padding: 10px 20px; border-radius: 6px; border: none; cursor: pointer; font-size: 0.9rem; font-weight: 500; text-decoration: none; }
|
|
.btn-primary { background: #3b82f6; color: #fff; }
|
|
.btn-primary:hover { background: #2563eb; }
|
|
.btn-danger { background: #ef4444; color: #fff; }
|
|
.btn-danger:hover { background: #dc2626; }
|
|
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
|
|
.btn-outline { background: transparent; border: 1px solid #334155; color: #94a3b8; }
|
|
.btn-outline:hover { border-color: #64748b; color: #e2e8f0; }
|
|
|
|
/* Forms */
|
|
.form-group { margin-bottom: 16px; }
|
|
.form-group label { display: block; font-size: 0.85rem; color: #94a3b8; margin-bottom: 4px; }
|
|
.form-group input, .form-group select { width: 100%; padding: 10px 12px; background: #0f172a; border: 1px solid #334155; border-radius: 6px; color: #e2e8f0; font-size: 0.95rem; }
|
|
.form-group input:focus { outline: none; border-color: #3b82f6; }
|
|
.error-msg { background: #7f1d1d40; border: 1px solid #991b1b; color: #fca5a5; padding: 10px; border-radius: 6px; margin-bottom: 16px; font-size: 0.85rem; }
|
|
.success-msg { background: #14532d40; border: 1px solid #166534; color: #86efac; padding: 10px; border-radius: 6px; margin-bottom: 16px; font-size: 0.85rem; }
|
|
|
|
/* Modal */
|
|
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: #00000080; display: none; align-items: center; justify-content: center; z-index: 100; }
|
|
.modal-overlay.show { display: flex; }
|
|
.modal { background: #1e293b; border-radius: 12px; padding: 24px; width: 100%; max-width: 440px; }
|
|
.modal h2 { margin-bottom: 16px; color: #cbd5e1; }
|
|
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
|
|
|
|
/* Token display */
|
|
.token-key { background: #0f172a; padding: 8px 12px; border-radius: 6px; font-family: monospace; font-size: 0.85rem; word-break: break-all; margin: 8px 0; display: flex; align-items: center; gap: 8px; }
|
|
.token-key code { flex: 1; }
|
|
.copy-btn { background: #334155; border: none; color: #94a3b8; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 0.75rem; }
|
|
.copy-btn:hover { color: #e2e8f0; }
|
|
|
|
/* Badge */
|
|
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.7rem; font-weight: 600; }
|
|
.badge-admin { background: #3b82f620; color: #60a5fa; }
|
|
.badge-user { background: #4ade8020; color: #4ade80; }
|
|
.badge-totp { background: #a78bfa20; color: #a78bfa; }
|
|
|
|
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
|
|
.page-header h1 { font-size: 1.3rem; color: #f8fafc; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="sidebar">
|
|
<div class="sidebar-brand">LLM Gateway</div>
|
|
<nav class="sidebar-nav">
|
|
<a href="/dashboard" hx-get="/dashboard" hx-target="#content" hx-push-url="true" {{if eq .ActivePage "dashboard"}}class="active"{{end}}>Dashboard</a>
|
|
<a href="/tokens" hx-get="/tokens" hx-target="#content" hx-push-url="true" {{if eq .ActivePage "tokens"}}class="active"{{end}}>API Tokens</a>
|
|
{{if .User.IsAdmin}}
|
|
<a href="/users" hx-get="/users" hx-target="#content" hx-push-url="true" {{if eq .ActivePage "users"}}class="active"{{end}}>Users</a>
|
|
{{end}}
|
|
<a href="/settings" hx-get="/settings" hx-target="#content" hx-push-url="true" {{if eq .ActivePage "settings"}}class="active"{{end}}>Settings</a>
|
|
</nav>
|
|
<div class="sidebar-footer">
|
|
<div class="user-info">{{.User.Username}}</div>
|
|
<a href="#" hx-post="/api/auth/logout" hx-swap="none" onclick="setTimeout(()=>window.location='/login',100)">Logout</a>
|
|
</div>
|
|
</div>
|
|
<div class="main">
|
|
<div id="content">
|
|
{{template "content" .}}
|
|
</div>
|
|
</div>
|
|
<script>
|
|
// Update active sidebar link on HTMX navigation
|
|
document.body.addEventListener('htmx:pushedIntoHistory', function(e) {
|
|
document.querySelectorAll('.sidebar-nav a').forEach(function(a) {
|
|
a.classList.toggle('active', a.getAttribute('href') === window.location.pathname);
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|
|
{{end}}
|