741 lines
27 KiB
HTML
741 lines
27 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>AI Town 服务器管理面板</title>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
background-color: #f5f5f5;
|
|
color: #333;
|
|
}
|
|
|
|
.header {
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: white;
|
|
padding: 1rem 2rem;
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.header h1 {
|
|
font-size: 1.8rem;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.container {
|
|
max-width: 1200px;
|
|
margin: 2rem auto;
|
|
padding: 0 1rem;
|
|
}
|
|
|
|
.dashboard {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
gap: 1.5rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.card {
|
|
background: white;
|
|
border-radius: 8px;
|
|
padding: 1.5rem;
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
border: 1px solid #e1e5e9;
|
|
}
|
|
|
|
.card h2 {
|
|
font-size: 1.2rem;
|
|
margin-bottom: 1rem;
|
|
color: #2c3e50;
|
|
border-bottom: 2px solid #3498db;
|
|
padding-bottom: 0.5rem;
|
|
}
|
|
|
|
.status-indicator {
|
|
display: inline-block;
|
|
width: 12px;
|
|
height: 12px;
|
|
border-radius: 50%;
|
|
margin-right: 8px;
|
|
}
|
|
|
|
.status-healthy { background-color: #27ae60; }
|
|
.status-warning { background-color: #f39c12; }
|
|
.status-critical { background-color: #e74c3c; }
|
|
|
|
.metric {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 0.5rem 0;
|
|
border-bottom: 1px solid #ecf0f1;
|
|
}
|
|
|
|
.metric:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.metric-label {
|
|
font-weight: 500;
|
|
color: #555;
|
|
}
|
|
|
|
.metric-value {
|
|
font-weight: 600;
|
|
color: #2c3e50;
|
|
}
|
|
|
|
.btn {
|
|
background: #3498db;
|
|
color: white;
|
|
border: none;
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 0.9rem;
|
|
margin: 0.25rem;
|
|
transition: background-color 0.2s;
|
|
}
|
|
|
|
.btn:hover {
|
|
background: #2980b9;
|
|
}
|
|
|
|
.btn-success { background: #27ae60; }
|
|
.btn-success:hover { background: #229954; }
|
|
|
|
.btn-warning { background: #f39c12; }
|
|
.btn-warning:hover { background: #e67e22; }
|
|
|
|
.btn-danger { background: #e74c3c; }
|
|
.btn-danger:hover { background: #c0392b; }
|
|
|
|
.log-entry {
|
|
font-family: 'Courier New', monospace;
|
|
font-size: 0.8rem;
|
|
padding: 0.5rem;
|
|
background: #f8f9fa;
|
|
border-left: 3px solid #3498db;
|
|
margin: 0.5rem 0;
|
|
white-space: pre-wrap;
|
|
}
|
|
|
|
.backup-item {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
padding: 0.75rem;
|
|
background: #f8f9fa;
|
|
border-radius: 4px;
|
|
margin: 0.5rem 0;
|
|
}
|
|
|
|
.backup-info {
|
|
flex: 1;
|
|
}
|
|
|
|
.backup-actions {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.loading {
|
|
text-align: center;
|
|
padding: 2rem;
|
|
color: #666;
|
|
}
|
|
|
|
.error {
|
|
background: #fee;
|
|
color: #c33;
|
|
padding: 1rem;
|
|
border-radius: 4px;
|
|
margin: 1rem 0;
|
|
}
|
|
|
|
.success {
|
|
background: #efe;
|
|
color: #363;
|
|
padding: 1rem;
|
|
border-radius: 4px;
|
|
margin: 1rem 0;
|
|
}
|
|
|
|
.tabs {
|
|
display: flex;
|
|
border-bottom: 2px solid #e1e5e9;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.tab {
|
|
padding: 0.75rem 1.5rem;
|
|
background: none;
|
|
border: none;
|
|
cursor: pointer;
|
|
font-size: 1rem;
|
|
color: #666;
|
|
border-bottom: 2px solid transparent;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.tab.active {
|
|
color: #3498db;
|
|
border-bottom-color: #3498db;
|
|
}
|
|
|
|
.tab-content {
|
|
display: none;
|
|
}
|
|
|
|
.tab-content.active {
|
|
display: block;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.dashboard {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.container {
|
|
padding: 0 0.5rem;
|
|
}
|
|
|
|
.header {
|
|
padding: 1rem;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="header">
|
|
<h1>🏢 AI Town 服务器管理面板</h1>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<div class="dashboard">
|
|
<!-- 系统健康状态 -->
|
|
<div class="card">
|
|
<h2>🏥 系统健康状态</h2>
|
|
<div id="health-status" class="loading">加载中...</div>
|
|
</div>
|
|
|
|
<!-- 连接统计 -->
|
|
<div class="card">
|
|
<h2>🔗 连接统计</h2>
|
|
<div id="connection-stats" class="loading">加载中...</div>
|
|
</div>
|
|
|
|
<!-- 系统信息 -->
|
|
<div class="card">
|
|
<h2>💻 系统信息</h2>
|
|
<div id="system-info" class="loading">加载中...</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 管理功能标签页 -->
|
|
<div class="card">
|
|
<div class="tabs">
|
|
<button class="tab active" onclick="showTab('backups')">📦 备份管理</button>
|
|
<button class="tab" onclick="showTab('logs')">📋 日志分析</button>
|
|
<button class="tab" onclick="showTab('maintenance')">🔧 维护任务</button>
|
|
</div>
|
|
|
|
<!-- 备份管理 -->
|
|
<div id="backups" class="tab-content active">
|
|
<div style="margin-bottom: 1rem;">
|
|
<button class="btn btn-success" onclick="createBackup()">创建备份</button>
|
|
<button class="btn" onclick="loadBackups()">刷新列表</button>
|
|
</div>
|
|
<div id="backup-list" class="loading">加载中...</div>
|
|
</div>
|
|
|
|
<!-- 日志分析 -->
|
|
<div id="logs" class="tab-content">
|
|
<div style="margin-bottom: 1rem;">
|
|
<button class="btn" onclick="analyzeLogs()">分析日志</button>
|
|
<button class="btn" onclick="loadLogFiles()">日志文件</button>
|
|
</div>
|
|
<div id="log-analysis" class="loading">点击"分析日志"开始分析</div>
|
|
</div>
|
|
|
|
<!-- 维护任务 -->
|
|
<div id="maintenance" class="tab-content">
|
|
<div style="margin-bottom: 1rem;">
|
|
<button class="btn btn-warning" onclick="toggleMaintenanceMode()">维护模式</button>
|
|
<button class="btn" onclick="loadTasks()">刷新任务</button>
|
|
</div>
|
|
<div id="maintenance-tasks" class="loading">加载中...</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// 动态获取API基础URL
|
|
const API_BASE = window.location.protocol + '//' + window.location.hostname + ':8081';
|
|
const AUTH_TOKEN = 'admin123'; // 在生产环境中应该从安全的地方获取
|
|
|
|
// API请求封装
|
|
async function apiRequest(endpoint, options = {}) {
|
|
const response = await fetch(`${API_BASE}${endpoint}`, {
|
|
...options,
|
|
headers: {
|
|
'Authorization': `Bearer ${AUTH_TOKEN}`,
|
|
'Content-Type': 'application/json',
|
|
...options.headers
|
|
}
|
|
});
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`API请求失败: ${response.status}`);
|
|
}
|
|
|
|
return response.json();
|
|
}
|
|
|
|
// 显示错误信息
|
|
function showError(element, error) {
|
|
element.innerHTML = `<div class="error">错误: ${error.message}</div>`;
|
|
}
|
|
|
|
// 显示成功信息
|
|
function showSuccess(element, message) {
|
|
element.innerHTML = `<div class="success">${message}</div>`;
|
|
}
|
|
|
|
// 格式化字节数
|
|
function formatBytes(bytes) {
|
|
if (bytes === 0) return '0 Bytes';
|
|
const k = 1024;
|
|
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
|
}
|
|
|
|
// 格式化时间
|
|
function formatTime(timestamp) {
|
|
return new Date(timestamp).toLocaleString('zh-CN');
|
|
}
|
|
|
|
// 标签页切换
|
|
function showTab(tabName) {
|
|
// 隐藏所有标签页内容
|
|
document.querySelectorAll('.tab-content').forEach(tab => {
|
|
tab.classList.remove('active');
|
|
});
|
|
|
|
// 移除所有标签的active类
|
|
document.querySelectorAll('.tab').forEach(tab => {
|
|
tab.classList.remove('active');
|
|
});
|
|
|
|
// 显示选中的标签页
|
|
document.getElementById(tabName).classList.add('active');
|
|
event.target.classList.add('active');
|
|
|
|
// 加载对应的数据
|
|
if (tabName === 'backups') {
|
|
loadBackups();
|
|
} else if (tabName === 'logs') {
|
|
// 日志分析需要手动触发
|
|
} else if (tabName === 'maintenance') {
|
|
loadTasks();
|
|
}
|
|
}
|
|
|
|
// 加载系统健康状态
|
|
async function loadHealthStatus() {
|
|
try {
|
|
const data = await apiRequest('/health');
|
|
const element = document.getElementById('health-status');
|
|
|
|
const statusClass = `status-${data.status}`;
|
|
const statusText = {
|
|
'healthy': '健康',
|
|
'warning': '警告',
|
|
'critical': '严重'
|
|
}[data.status] || data.status;
|
|
|
|
let html = `
|
|
<div class="metric">
|
|
<span class="metric-label">
|
|
<span class="status-indicator ${statusClass}"></span>
|
|
系统状态
|
|
</span>
|
|
<span class="metric-value">${statusText}</span>
|
|
</div>
|
|
<div class="metric">
|
|
<span class="metric-label">内存使用</span>
|
|
<span class="metric-value">${data.metrics.memory.percentage.toFixed(1)}%</span>
|
|
</div>
|
|
<div class="metric">
|
|
<span class="metric-label">CPU使用</span>
|
|
<span class="metric-value">${data.metrics.cpu.usage.toFixed(1)}%</span>
|
|
</div>
|
|
<div class="metric">
|
|
<span class="metric-label">存储使用</span>
|
|
<span class="metric-value">${data.metrics.storage.percentage.toFixed(1)}%</span>
|
|
</div>
|
|
<div class="metric">
|
|
<span class="metric-label">运行时间</span>
|
|
<span class="metric-value">${Math.floor(data.metrics.uptime / 1000 / 60)} 分钟</span>
|
|
</div>
|
|
`;
|
|
|
|
if (data.issues && data.issues.length > 0) {
|
|
html += '<div style="margin-top: 1rem;"><strong>问题:</strong><ul>';
|
|
data.issues.forEach(issue => {
|
|
html += `<li style="color: #e74c3c;">${issue}</li>`;
|
|
});
|
|
html += '</ul></div>';
|
|
}
|
|
|
|
element.innerHTML = html;
|
|
} catch (error) {
|
|
showError(document.getElementById('health-status'), error);
|
|
}
|
|
}
|
|
|
|
// 加载连接统计
|
|
async function loadConnectionStats() {
|
|
try {
|
|
const data = await apiRequest('/system/info');
|
|
const element = document.getElementById('connection-stats');
|
|
|
|
element.innerHTML = `
|
|
<div class="metric">
|
|
<span class="metric-label">活跃连接</span>
|
|
<span class="metric-value">${data.connections.active}</span>
|
|
</div>
|
|
<div class="metric">
|
|
<span class="metric-label">总连接数</span>
|
|
<span class="metric-value">${data.connections.total}</span>
|
|
</div>
|
|
<div class="metric">
|
|
<span class="metric-label">维护模式</span>
|
|
<span class="metric-value">${data.maintenanceMode ? '开启' : '关闭'}</span>
|
|
</div>
|
|
`;
|
|
} catch (error) {
|
|
showError(document.getElementById('connection-stats'), error);
|
|
}
|
|
}
|
|
|
|
// 加载系统信息
|
|
async function loadSystemInfo() {
|
|
try {
|
|
const data = await apiRequest('/system/info');
|
|
const element = document.getElementById('system-info');
|
|
const info = data.systemInfo;
|
|
|
|
element.innerHTML = `
|
|
<div class="metric">
|
|
<span class="metric-label">平台</span>
|
|
<span class="metric-value">${info.platform}</span>
|
|
</div>
|
|
<div class="metric">
|
|
<span class="metric-label">架构</span>
|
|
<span class="metric-value">${info.arch}</span>
|
|
</div>
|
|
<div class="metric">
|
|
<span class="metric-label">Node.js版本</span>
|
|
<span class="metric-value">${info.nodeVersion}</span>
|
|
</div>
|
|
<div class="metric">
|
|
<span class="metric-label">CPU核心数</span>
|
|
<span class="metric-value">${info.cpus}</span>
|
|
</div>
|
|
<div class="metric">
|
|
<span class="metric-label">总内存</span>
|
|
<span class="metric-value">${formatBytes(info.totalMemory)}</span>
|
|
</div>
|
|
`;
|
|
} catch (error) {
|
|
showError(document.getElementById('system-info'), error);
|
|
}
|
|
}
|
|
|
|
// 加载备份列表
|
|
async function loadBackups() {
|
|
try {
|
|
const data = await apiRequest('/backups');
|
|
const element = document.getElementById('backup-list');
|
|
|
|
if (data.backups.length === 0) {
|
|
element.innerHTML = '<p>暂无备份</p>';
|
|
return;
|
|
}
|
|
|
|
let html = '';
|
|
data.backups.forEach(backup => {
|
|
html += `
|
|
<div class="backup-item">
|
|
<div class="backup-info">
|
|
<strong>${backup.id}</strong><br>
|
|
<small>${backup.description || '无描述'}</small><br>
|
|
<small>时间: ${formatTime(backup.timestamp)} | 大小: ${formatBytes(backup.size)}</small>
|
|
</div>
|
|
<div class="backup-actions">
|
|
<button class="btn btn-success" onclick="restoreBackup('${backup.id}')">恢复</button>
|
|
<button class="btn btn-danger" onclick="deleteBackup('${backup.id}')">删除</button>
|
|
</div>
|
|
</div>
|
|
`;
|
|
});
|
|
|
|
element.innerHTML = html;
|
|
} catch (error) {
|
|
showError(document.getElementById('backup-list'), error);
|
|
}
|
|
}
|
|
|
|
// 创建备份
|
|
async function createBackup() {
|
|
try {
|
|
const description = prompt('请输入备份描述(可选):');
|
|
const data = await apiRequest('/backups', {
|
|
method: 'POST',
|
|
body: JSON.stringify({ description })
|
|
});
|
|
|
|
showSuccess(document.getElementById('backup-list'), '备份创建成功!');
|
|
setTimeout(loadBackups, 1000);
|
|
} catch (error) {
|
|
showError(document.getElementById('backup-list'), error);
|
|
}
|
|
}
|
|
|
|
// 恢复备份
|
|
async function restoreBackup(backupId) {
|
|
if (!confirm(`确定要恢复备份 ${backupId} 吗?这将覆盖当前数据!`)) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
const data = await apiRequest(`/backups/${backupId}`, {
|
|
method: 'POST'
|
|
});
|
|
|
|
if (data.success) {
|
|
showSuccess(document.getElementById('backup-list'), '备份恢复成功!');
|
|
} else {
|
|
showError(document.getElementById('backup-list'), new Error('备份恢复失败'));
|
|
}
|
|
} catch (error) {
|
|
showError(document.getElementById('backup-list'), error);
|
|
}
|
|
}
|
|
|
|
// 删除备份
|
|
async function deleteBackup(backupId) {
|
|
if (!confirm(`确定要删除备份 ${backupId} 吗?`)) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
const data = await apiRequest(`/backups/${backupId}`, {
|
|
method: 'DELETE'
|
|
});
|
|
|
|
if (data.success) {
|
|
showSuccess(document.getElementById('backup-list'), '备份删除成功!');
|
|
setTimeout(loadBackups, 1000);
|
|
} else {
|
|
showError(document.getElementById('backup-list'), new Error('备份删除失败'));
|
|
}
|
|
} catch (error) {
|
|
showError(document.getElementById('backup-list'), error);
|
|
}
|
|
}
|
|
|
|
// 分析日志
|
|
async function analyzeLogs() {
|
|
try {
|
|
const data = await apiRequest('/logs/analyze');
|
|
const element = document.getElementById('log-analysis');
|
|
const analytics = data.analytics;
|
|
|
|
let html = `
|
|
<h3>日志分析结果</h3>
|
|
<div class="metric">
|
|
<span class="metric-label">总条目数</span>
|
|
<span class="metric-value">${analytics.totalEntries}</span>
|
|
</div>
|
|
<div class="metric">
|
|
<span class="metric-label">错误数</span>
|
|
<span class="metric-value">${analytics.levelCounts[3] || 0}</span>
|
|
</div>
|
|
<div class="metric">
|
|
<span class="metric-label">警告数</span>
|
|
<span class="metric-value">${analytics.levelCounts[2] || 0}</span>
|
|
</div>
|
|
<div class="metric">
|
|
<span class="metric-label">连接数</span>
|
|
<span class="metric-value">${analytics.connectionStats.totalConnections}</span>
|
|
</div>
|
|
`;
|
|
|
|
if (analytics.topErrors.length > 0) {
|
|
html += '<h4>主要错误:</h4>';
|
|
analytics.topErrors.forEach(error => {
|
|
html += `<div class="log-entry">${error.message} (${error.count}次)</div>`;
|
|
});
|
|
}
|
|
|
|
element.innerHTML = html;
|
|
} catch (error) {
|
|
showError(document.getElementById('log-analysis'), error);
|
|
}
|
|
}
|
|
|
|
// 加载日志文件
|
|
async function loadLogFiles() {
|
|
try {
|
|
const data = await apiRequest('/logs/files');
|
|
const element = document.getElementById('log-analysis');
|
|
|
|
let html = '<h3>日志文件列表</h3>';
|
|
data.logFiles.forEach(file => {
|
|
html += `
|
|
<div class="backup-item">
|
|
<div class="backup-info">
|
|
<strong>${file.name}</strong><br>
|
|
<small>大小: ${formatBytes(file.size)} | 修改时间: ${formatTime(file.modified)}</small>
|
|
</div>
|
|
</div>
|
|
`;
|
|
});
|
|
|
|
element.innerHTML = html;
|
|
} catch (error) {
|
|
showError(document.getElementById('log-analysis'), error);
|
|
}
|
|
}
|
|
|
|
// 加载维护任务
|
|
async function loadTasks() {
|
|
try {
|
|
const data = await apiRequest('/maintenance/tasks');
|
|
const element = document.getElementById('maintenance-tasks');
|
|
|
|
let html = '';
|
|
data.tasks.forEach(task => {
|
|
const priorityColor = {
|
|
'low': '#95a5a6',
|
|
'medium': '#f39c12',
|
|
'high': '#e67e22',
|
|
'critical': '#e74c3c'
|
|
}[task.priority] || '#95a5a6';
|
|
|
|
html += `
|
|
<div class="backup-item">
|
|
<div class="backup-info">
|
|
<strong>${task.name}</strong>
|
|
<span style="color: ${priorityColor}; margin-left: 10px;">[${task.priority}]</span><br>
|
|
<small>${task.description}</small><br>
|
|
<small>调度: ${task.schedule} | 状态: ${task.enabled ? '启用' : '禁用'}</small>
|
|
${task.lastRun ? `<br><small>上次运行: ${formatTime(task.lastRun)}</small>` : ''}
|
|
</div>
|
|
<div class="backup-actions">
|
|
<button class="btn" onclick="runTask('${task.id}')">运行</button>
|
|
<button class="btn btn-warning" onclick="toggleTask('${task.id}', ${!task.enabled})">
|
|
${task.enabled ? '禁用' : '启用'}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
`;
|
|
});
|
|
|
|
element.innerHTML = html;
|
|
} catch (error) {
|
|
showError(document.getElementById('maintenance-tasks'), error);
|
|
}
|
|
}
|
|
|
|
// 运行任务
|
|
async function runTask(taskId) {
|
|
try {
|
|
const data = await apiRequest(`/maintenance/tasks/${taskId}`, {
|
|
method: 'POST'
|
|
});
|
|
|
|
if (data.success) {
|
|
showSuccess(document.getElementById('maintenance-tasks'), '任务执行成功!');
|
|
setTimeout(loadTasks, 1000);
|
|
} else {
|
|
showError(document.getElementById('maintenance-tasks'), new Error(data.error || '任务执行失败'));
|
|
}
|
|
} catch (error) {
|
|
showError(document.getElementById('maintenance-tasks'), error);
|
|
}
|
|
}
|
|
|
|
// 切换任务状态
|
|
async function toggleTask(taskId, enabled) {
|
|
try {
|
|
const data = await apiRequest('/maintenance/tasks', {
|
|
method: 'PUT',
|
|
body: JSON.stringify({ taskId, updates: { enabled } })
|
|
});
|
|
|
|
if (data.success) {
|
|
showSuccess(document.getElementById('maintenance-tasks'), '任务状态更新成功!');
|
|
setTimeout(loadTasks, 1000);
|
|
} else {
|
|
showError(document.getElementById('maintenance-tasks'), new Error('任务状态更新失败'));
|
|
}
|
|
} catch (error) {
|
|
showError(document.getElementById('maintenance-tasks'), error);
|
|
}
|
|
}
|
|
|
|
// 切换维护模式
|
|
async function toggleMaintenanceMode() {
|
|
try {
|
|
const systemInfo = await apiRequest('/system/info');
|
|
const currentMode = systemInfo.maintenanceMode;
|
|
const newMode = !currentMode;
|
|
|
|
if (newMode && !confirm('确定要进入维护模式吗?这将影响用户访问。')) {
|
|
return;
|
|
}
|
|
|
|
const reason = newMode ? prompt('请输入维护原因:') || '手动维护' : '';
|
|
|
|
const data = await apiRequest('/maintenance/mode', {
|
|
method: 'POST',
|
|
body: JSON.stringify({ enabled: newMode, reason })
|
|
});
|
|
|
|
showSuccess(document.getElementById('maintenance-tasks'), data.message);
|
|
setTimeout(() => {
|
|
loadConnectionStats();
|
|
loadTasks();
|
|
}, 1000);
|
|
} catch (error) {
|
|
showError(document.getElementById('maintenance-tasks'), error);
|
|
}
|
|
}
|
|
|
|
// 页面加载时初始化
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
loadHealthStatus();
|
|
loadConnectionStats();
|
|
loadSystemInfo();
|
|
loadBackups();
|
|
|
|
// 定期刷新健康状态
|
|
setInterval(() => {
|
|
loadHealthStatus();
|
|
loadConnectionStats();
|
|
}, 30000); // 30秒
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |