249 lines
7.9 KiB
HTML
249 lines
7.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>系统初始化 - 数据可视化展示大屏</title>
|
|
<link rel="stylesheet" href="/css/style.css">
|
|
<style>
|
|
body {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-height: 100vh;
|
|
margin: 0;
|
|
}
|
|
.init-container {
|
|
background: var(--bg-card);
|
|
border: 1px solid var(--border);
|
|
border-radius: 12px;
|
|
padding: 40px;
|
|
width: 100%;
|
|
max-width: 460px;
|
|
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
|
|
z-index: 10;
|
|
}
|
|
.init-header {
|
|
text-align: center;
|
|
margin-bottom: 28px;
|
|
}
|
|
.init-header h2 {
|
|
margin: 0 0 10px 0;
|
|
color: var(--text-main);
|
|
font-size: 24px;
|
|
}
|
|
.init-header p {
|
|
margin: 0;
|
|
color: var(--text-muted);
|
|
font-size: 14px;
|
|
}
|
|
.form-message {
|
|
margin-top: 16px;
|
|
padding: 12px;
|
|
border-radius: 6px;
|
|
display: none;
|
|
font-size: 14px;
|
|
word-break: break-all;
|
|
}
|
|
.form-message.success {
|
|
display: block;
|
|
background: rgba(16, 185, 129, 0.1);
|
|
color: #10b981;
|
|
border: 1px solid rgba(16, 185, 129, 0.2);
|
|
}
|
|
.form-message.error {
|
|
display: block;
|
|
background: rgba(239, 68, 68, 0.1);
|
|
color: #ef4444;
|
|
border: 1px solid rgba(239, 68, 68, 0.2);
|
|
}
|
|
.actions {
|
|
display: flex;
|
|
gap: 12px;
|
|
margin-top: 24px;
|
|
}
|
|
.actions .btn {
|
|
flex: 1;
|
|
justify-content: center;
|
|
padding: 10px 0;
|
|
}
|
|
|
|
@media (max-width: 480px) {
|
|
body {
|
|
align-items: flex-start;
|
|
padding: 16px 12px;
|
|
}
|
|
.init-container {
|
|
padding: 24px 18px;
|
|
border-radius: 10px;
|
|
max-width: 100%;
|
|
}
|
|
.init-header h2 {
|
|
font-size: 18px;
|
|
}
|
|
.init-header p {
|
|
font-size: 12px;
|
|
}
|
|
.form-row {
|
|
flex-direction: column;
|
|
}
|
|
.actions {
|
|
flex-direction: column;
|
|
}
|
|
.actions .btn {
|
|
width: 100%;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<!-- Animated Background -->
|
|
<div class="bg-grid"></div>
|
|
<div class="bg-glow bg-glow-1"></div>
|
|
<div class="bg-glow bg-glow-2"></div>
|
|
|
|
<div class="init-container">
|
|
<div class="init-header">
|
|
<h2>系统初始化</h2>
|
|
<p>请配置您的 MySQL 数据库连接信息以完成首次设置</p>
|
|
</div>
|
|
|
|
<div class="init-form" id="initForm">
|
|
<div class="form-row">
|
|
<div class="form-group" style="flex: 2;">
|
|
<label for="host">数据库地址 (Host)</label>
|
|
<input type="text" id="host" value="localhost" autocomplete="off">
|
|
</div>
|
|
<div class="form-group" style="flex: 1;">
|
|
<label for="port">端口 (Port)</label>
|
|
<input type="number" id="port" value="3306" autocomplete="off">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group form-group-wide">
|
|
<label for="user">用户名 (User)</label>
|
|
<input type="text" id="user" value="root" autocomplete="off">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group form-group-wide">
|
|
<label for="password">密码 (Password)</label>
|
|
<input type="password" id="password" placeholder="留空则无密码">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group form-group-wide">
|
|
<label for="database">数据库名 (Database)</label>
|
|
<input type="text" id="database" value="display_wall" autocomplete="off">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="init-header" style="margin: 24px 0 16px 0; text-align: left;">
|
|
<h3 style="font-size: 16px; color: var(--text-main); margin: 0;">Valkey / Redis 缓存配置 (可选)</h3>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group" style="flex: 2;">
|
|
<label for="vHost">Valkey 地址</label>
|
|
<input type="text" id="vHost" value="localhost" placeholder="localhost" autocomplete="off">
|
|
</div>
|
|
<div class="form-group" style="flex: 1;">
|
|
<label for="vPort">端口</label>
|
|
<input type="number" id="vPort" value="6379" placeholder="6379" autocomplete="off">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group form-group-wide">
|
|
<label for="vPassword">Valkey 密码</label>
|
|
<input type="password" id="vPassword" placeholder="留空则无密码">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-message" id="messageBox"></div>
|
|
|
|
<div class="actions" style="flex-wrap: wrap;">
|
|
<button class="btn btn-test" id="btnTest" style="flex: 1 1 45%;">测试 MySQL</button>
|
|
<button class="btn btn-test" id="btnTestValkey" style="flex: 1 1 45%;">测试 Valkey</button>
|
|
<button class="btn btn-add" id="btnInit" style="flex: 1 1 100%;">确认并初始化系统</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="init-form" id="adminForm" style="display: none;">
|
|
<div class="init-header" style="margin-bottom: 20px;">
|
|
<h2 style="font-size: 20px;">创建管理员账户</h2>
|
|
<p>请设置系统的第一个管理员账号和密码</p>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group form-group-wide">
|
|
<label for="adminUsername">管理员用户名</label>
|
|
<input type="text" id="adminUsername" placeholder="请输入用户名" value="admin" autocomplete="username">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group form-group-wide">
|
|
<label for="adminPassword">登录密码</label>
|
|
<input type="password" id="adminPassword" placeholder="请输入密码" autocomplete="new-password">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group form-group-wide">
|
|
<label for="adminPasswordConfirm">确认密码</label>
|
|
<input type="password" id="adminPasswordConfirm" placeholder="请再次输入密码" autocomplete="new-password">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-message" id="adminMessageBox"></div>
|
|
|
|
<div class="actions">
|
|
<button class="btn btn-add" id="btnAdminCreate">创建账户</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="init-form" id="promForm" style="display: none;">
|
|
<div class="init-header" style="margin-bottom: 20px;">
|
|
<h2 style="font-size: 20px;">设置数据源 (可选)</h2>
|
|
<p>您可以现在添加一个 Prometheus 数据源,或者稍后在系统中配置</p>
|
|
</div>
|
|
<div class="form-row">
|
|
<div class="form-group form-group-wide">
|
|
<label for="promSourceName">数据源名称</label>
|
|
<input type="text" id="promSourceName" name="p-source-name-init" placeholder="例如:生产环境" autocomplete="one-time-code">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group form-group-wide">
|
|
<label for="promUrl">Prometheus URL</label>
|
|
<input type="url" id="promUrl" placeholder="http://ip:9090" autocomplete="off">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
<div class="form-group form-group-wide">
|
|
<label for="promDesc">描述 (Description)</label>
|
|
<input type="text" id="promDesc" placeholder="可选" autocomplete="off">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-message" id="promMessageBox"></div>
|
|
|
|
<div class="actions">
|
|
<button class="btn btn-test" id="btnPromTest">测试连接</button>
|
|
<button class="btn btn-add" id="btnPromAdd">保存并应用</button>
|
|
</div>
|
|
<div style="text-align: center; margin-top: 15px;">
|
|
<a href="/" style="color: var(--text-muted); font-size: 14px; text-decoration: none;">跳过此步,直接进入系统</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="/js/init.js"></script>
|
|
</body>
|
|
</html>
|