Files
mc-gateway/cmd/gateway/admin_static/index.html
tursom f508ecc1b9
Some checks failed
Go / build (.exe, 386, windows, windows-386) (push) Has been cancelled
Go / build (.exe, amd64, windows, windows-amd64) (push) Has been cancelled
Go / build (.exe, arm64, windows, windows-arm64) (push) Has been cancelled
Go / build (386, freebsd, freebsd-386) (push) Has been cancelled
Go / build (386, linux, linux-386) (push) Has been cancelled
Go / build (386, netbsd, netbsd-386) (push) Has been cancelled
Go / build (386, openbsd, openbsd-386) (push) Has been cancelled
Go / build (386, plan9, plan9-386) (push) Has been cancelled
Go / build (amd64, darwin, darwin-amd64) (push) Has been cancelled
Go / build (amd64, dragonfly, dragonfly-amd64) (push) Has been cancelled
Go / build (amd64, freebsd, freebsd-amd64) (push) Has been cancelled
Go / build (amd64, illumos, illumos-amd64) (push) Has been cancelled
Go / build (amd64, linux, linux-amd64) (push) Has been cancelled
Go / build (amd64, netbsd, netbsd-amd64) (push) Has been cancelled
Go / build (amd64, openbsd, openbsd-amd64) (push) Has been cancelled
Go / build (amd64, plan9, plan9-amd64) (push) Has been cancelled
Go / build (amd64, solaris, solaris-amd64) (push) Has been cancelled
Go / build (arm, 6, linux, linux-armv6) (push) Has been cancelled
Go / build (arm, 7, linux, linux-armv7) (push) Has been cancelled
Go / build (arm, freebsd, freebsd-arm) (push) Has been cancelled
Go / build (arm, netbsd, netbsd-arm) (push) Has been cancelled
Go / build (arm, openbsd, openbsd-arm) (push) Has been cancelled
Go / build (arm, plan9, plan9-arm) (push) Has been cancelled
Go / build (arm64, darwin, darwin-arm64) (push) Has been cancelled
Go / build (arm64, freebsd, freebsd-arm64) (push) Has been cancelled
Go / build (arm64, linux, linux-arm64) (push) Has been cancelled
Go / build (arm64, netbsd, netbsd-arm64) (push) Has been cancelled
Go / build (arm64, openbsd, openbsd-arm64) (push) Has been cancelled
Go / build (loong64, linux, linux-loong64) (push) Has been cancelled
Go / build (mips, linux, linux-mips) (push) Has been cancelled
Go / build (mips64, linux, linux-mips64) (push) Has been cancelled
Go / build (mips64le, linux, linux-mips64le) (push) Has been cancelled
Go / build (mipsle, linux, linux-mipsle) (push) Has been cancelled
Go / build (ppc64, aix, aix-ppc64) (push) Has been cancelled
Go / build (ppc64, linux, linux-ppc64) (push) Has been cancelled
Go / build (ppc64, openbsd, openbsd-ppc64) (push) Has been cancelled
Go / build (ppc64le, linux, linux-ppc64le) (push) Has been cancelled
Go / build (riscv64, freebsd, freebsd-riscv64) (push) Has been cancelled
Go / build (riscv64, linux, linux-riscv64) (push) Has been cancelled
Go / build (riscv64, openbsd, openbsd-riscv64) (push) Has been cancelled
Go / build (s390x, linux, linux-s390x) (push) Has been cancelled
Docker Image / docker (push) Has been cancelled
Go / merge-artifacts (push) Has been cancelled
docs: 补充中文代码注释
2026-06-27 20:15:29 +08:00

240 lines
8.6 KiB
HTML

<!-- cmd/gateway/admin_static/index.html 提供嵌入式管理端 HTML 外壳,包含对话框、标签页和运行时 API 前缀注入。 -->
<!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="plugins" type="button" data-i18n="plugins">Plugins</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="pluginsTab" class="tab-panel hidden">
<div class="toolbar">
<label class="file-button">
<span data-i18n="uploadPlugin">Upload plugin</span>
<input id="pluginUploadInput" type="file" accept=".mcgp">
</label>
<button id="refreshPluginsBtn" class="secondary" type="button" data-i18n="refresh">Refresh</button>
</div>
<div id="pluginServicePanel" class="plugin-service-panel"></div>
<div class="table-wrap">
<table>
<thead>
<tr>
<th data-i18n="pluginID">Plugin ID</th>
<th data-i18n="name">Name</th>
<th data-i18n="version">Version</th>
<th data-i18n="artifact">Artifact</th>
<th data-i18n="runtime">Runtime</th>
<th data-i18n="desired">Desired</th>
<th data-i18n="active">Active</th>
<th data-i18n="desiredArtifact">Desired artifact</th>
<th data-i18n="extensions">Extensions</th>
<th data-i18n="priority">Priority</th>
<th data-i18n="restart">Restart</th>
<th data-i18n="health">Health</th>
</tr>
</thead>
<tbody id="pluginsBody"></tbody>
</table>
</div>
<div id="pluginDetail" class="plugin-detail"></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>