Files
mc-gateway/cmd/gateway/admin_static/index.html
tursom ecb682bb41
Some checks failed
Docker Image / docker (push) Has been cancelled
Refactor admin frontend build
2026-06-25 21:16:11 +08:00

204 lines
7.0 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>mc-gateway admin</title>
<link rel="stylesheet" href="app.css">
</head>
<body>
<main class="shell">
<header class="topbar">
<div>
<h1>mc-gateway</h1>
<p id="subtitle">Admin</p>
</div>
<div class="session">
<label class="language-field">
<span data-i18n="language">Language</span>
<select id="languageSelect" aria-label="Language">
<option value="en" data-i18n="languageEnglish">English</option>
<option value="zh" data-i18n="languageChinese">中文</option>
</select>
</label>
<span id="sessionUser"></span>
<button id="logoutBtn" class="ghost hidden" type="button" data-i18n="logout">Logout</button>
</div>
</header>
<section id="alert" class="alert hidden"></section>
<section id="setupView" class="auth-view hidden">
<form id="setupForm" class="panel compact">
<h2 data-i18n="initialAdmin">Initial admin</h2>
<label>
<span data-i18n="username">Username</span>
<input name="username" autocomplete="username" value="admin">
</label>
<label>
<span data-i18n="password">Password</span>
<input name="password" autocomplete="new-password" type="password" required>
</label>
<button type="submit" data-i18n="createAdmin">Create admin</button>
</form>
</section>
<section id="loginView" class="auth-view hidden">
<form id="loginForm" class="panel compact">
<h2 data-i18n="login">Login</h2>
<label>
<span data-i18n="username">Username</span>
<input name="username" autocomplete="username" required>
</label>
<label>
<span data-i18n="password">Password</span>
<input name="password" autocomplete="current-password" type="password" required>
</label>
<button type="submit" data-i18n="login">Login</button>
</form>
</section>
<section id="appView" class="hidden">
<section id="statusGrid" class="status-grid"></section>
<nav class="tabs">
<button data-tab="routes" class="active" type="button" data-i18n="routes">Routes</button>
<button data-tab="services" type="button" data-i18n="services">Services</button>
<button data-tab="users" type="button" data-i18n="users">Users</button>
<button data-tab="metrics" type="button" data-i18n="metrics">Metrics</button>
<button data-tab="audit" type="button" data-i18n="audit">Audit</button>
</nav>
<section id="routesTab" class="tab-panel">
<div class="toolbar">
<input id="routeSearch" placeholder="Search host, upstream, note" data-i18n-placeholder="routeSearch">
<button id="newRouteBtn" type="button" data-i18n="newRoute">New route</button>
</div>
<div class="table-wrap">
<table>
<thead>
<tr>
<th data-i18n="host">Host</th>
<th data-i18n="upstream">Upstream</th>
<th data-i18n="enabled">Enabled</th>
<th data-i18n="note">Note</th>
<th class="actions" data-i18n="actions">Actions</th>
</tr>
</thead>
<tbody id="routesBody"></tbody>
</table>
</div>
</section>
<section id="servicesTab" class="tab-panel hidden">
<div id="servicesGrid" class="service-grid"></div>
</section>
<section id="usersTab" class="tab-panel hidden">
<div class="toolbar">
<button id="newUserBtn" type="button" data-i18n="newUser">New user</button>
</div>
<div class="table-wrap">
<table>
<thead>
<tr>
<th data-i18n="username">Username</th>
<th data-i18n="role">Role</th>
<th data-i18n="disabled">Disabled</th>
<th class="actions" data-i18n="actions">Actions</th>
</tr>
</thead>
<tbody id="usersBody"></tbody>
</table>
</div>
</section>
<section id="metricsTab" class="tab-panel hidden">
<div id="metricsGrid" class="status-grid"></div>
<div class="panel">
<h2 data-i18n="routeHits">Route hits</h2>
<div id="routeHits" class="chips"></div>
</div>
</section>
<section id="auditTab" class="tab-panel hidden">
<div class="table-wrap">
<table>
<thead>
<tr>
<th data-i18n="time">Time</th>
<th data-i18n="actor">Actor</th>
<th data-i18n="action">Action</th>
<th data-i18n="target">Target</th>
<th data-i18n="result">Result</th>
<th data-i18n="message">Message</th>
</tr>
</thead>
<tbody id="auditBody"></tbody>
</table>
</div>
</section>
</section>
</main>
<dialog id="routeDialog">
<form id="routeForm" method="dialog">
<h2 data-i18n="route">Route</h2>
<label>
<span data-i18n="host">Host</span>
<input name="host" required>
</label>
<label>
<span data-i18n="upstream">Upstream</span>
<input name="upstream" required placeholder="127.0.0.1:25565">
</label>
<label class="inline">
<input name="enabled" type="checkbox" checked>
<span data-i18n="enabled">Enabled</span>
</label>
<label>
<span data-i18n="note">Note</span>
<input name="note">
</label>
<div class="dialog-actions">
<button type="button" data-close data-i18n="cancel">Cancel</button>
<button type="submit" data-i18n="save">Save</button>
</div>
</form>
</dialog>
<dialog id="userDialog">
<form id="userForm" method="dialog">
<h2 data-i18n="user">User</h2>
<label>
<span data-i18n="username">Username</span>
<input name="username" required>
</label>
<label>
<span data-i18n="role">Role</span>
<select name="role">
<option value="admin" data-i18n="roleAdmin">Admin</option>
<option value="member" data-i18n="roleMember">Member</option>
<option value="guest" data-i18n="roleGuest">Guest</option>
</select>
</label>
<label>
<span data-i18n="password">Password</span>
<input name="password" type="password">
</label>
<label class="inline">
<input name="disabled" type="checkbox">
<span data-i18n="disabled">Disabled</span>
</label>
<div class="dialog-actions">
<button type="button" data-close data-i18n="cancel">Cancel</button>
<button type="submit" data-i18n="save">Save</button>
</div>
</form>
</dialog>
<script src="config.js"></script>
<script type="module" src="js/main.js"></script>
</body>
</html>