修复图表时间和查询区间不匹配问题
This commit is contained in:
620
backend/static_backup/index.html
Normal file
620
backend/static_backup/index.html
Normal file
@@ -0,0 +1,620 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>监控系统仪表盘</title>
|
||||
<!-- Tailwind CSS -->
|
||||
<script src="js/vendor/tailwind.js"></script>
|
||||
<!-- Chart.js -->
|
||||
<script src="js/vendor/chart.min.js"></script>
|
||||
|
||||
<!-- 自定义样式 -->
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
}
|
||||
.chart-container {
|
||||
position: relative;
|
||||
height: 300px;
|
||||
width: 100%;
|
||||
}
|
||||
.status-card {
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.status-card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
.metric-value {
|
||||
font-feature-settings: "tnum";
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="bg-gray-50">
|
||||
<!-- 顶部导航栏 -->
|
||||
<header class="bg-white shadow-lg border-b border-gray-200">
|
||||
<div class="container mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="flex items-center justify-between h-16">
|
||||
<div class="flex items-center">
|
||||
<h1 class="text-2xl font-bold text-gray-900">监控系统</h1>
|
||||
</div>
|
||||
<!-- 导航菜单 -->
|
||||
<nav class="flex items-center space-x-4">
|
||||
<a href="#home" class="px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 transition-all duration-200 shadow-sm hover:shadow-md">首页</a>
|
||||
<a href="#dashboard" class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-all duration-200 shadow-sm hover:shadow-md">仪表盘</a>
|
||||
<a href="#devices" class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-all duration-200 shadow-sm hover:shadow-md">设备管理</a>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 导航栏下方的操作栏,仅在仪表盘显示 -->
|
||||
<div id="dashboardActions" class="bg-white shadow-sm border-b border-gray-200 hidden">
|
||||
<div class="container mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="flex flex-wrap items-center gap-4 py-3">
|
||||
<!-- 设备选择 -->
|
||||
<div class="relative flex-1 min-w-[200px]">
|
||||
<select id="deviceSelect" class="w-full px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
|
||||
<!-- 设备选项将通过JavaScript动态加载 -->
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- 时间设置选择器 -->
|
||||
<div class="relative flex-1 min-w-[200px]">
|
||||
<select id="timeSettings" class="w-full px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
|
||||
<!-- 时间区间选项 -->
|
||||
<option value="5s">5s</option>
|
||||
<option value="10s">10s</option>
|
||||
<option value="15s">15s</option>
|
||||
<option value="30s" selected>30s</option>
|
||||
<option value="1h">1h</option>
|
||||
<option value="3h">3h</option>
|
||||
<option value="5h">5h</option>
|
||||
<option value="24h">24h</option>
|
||||
<option value="1d">1d</option>
|
||||
<option value="3d">3d</option>
|
||||
<option value="5d">5d</option>
|
||||
<option value="custom">自定义</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- 自定义时间范围 -->
|
||||
<div id="customTimeRange" class="hidden flex flex-wrap items-center gap-2 flex-1 min-w-[200px]">
|
||||
<input type="datetime-local" id="startTime" class="flex-1 min-w-[150px] px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
|
||||
<span class="text-gray-500">至</span>
|
||||
<input type="datetime-local" id="endTime" class="flex-1 min-w-[150px] px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
|
||||
<button id="applyCustomRange" class="px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-lg hover:bg-blue-700 transition-all duration-200 shadow-sm hover:shadow-md">应用</button>
|
||||
</div>
|
||||
|
||||
<!-- 刷新按钮 -->
|
||||
<button id="refreshBtn" class="flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 rounded-lg hover:bg-gray-200 transition-all duration-200 shadow-sm hover:shadow-md">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"></path>
|
||||
</svg>
|
||||
刷新
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 主要内容区域 -->
|
||||
<main class="container mx-auto px-4 py-6">
|
||||
<!-- 首页内容 -->
|
||||
<div id="homeContent">
|
||||
<!-- 监控资源概览 -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6">
|
||||
<!-- 业务系统 -->
|
||||
<div class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
|
||||
<div class="flex justify-between items-start">
|
||||
<div>
|
||||
<p class="text-gray-500 text-sm font-medium">业务系统</p>
|
||||
<h3 class="text-3xl font-bold text-gray-900 metric-value">355</h3>
|
||||
</div>
|
||||
<div class="p-3 bg-blue-100 rounded-full">
|
||||
<svg class="w-6 h-6 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 数据库 -->
|
||||
<div class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
|
||||
<div class="flex justify-between items-start">
|
||||
<div>
|
||||
<p class="text-gray-500 text-sm font-medium">数据库</p>
|
||||
<h3 class="text-3xl font-bold text-gray-900 metric-value">59</h3>
|
||||
</div>
|
||||
<div class="p-3 bg-yellow-100 rounded-full">
|
||||
<svg class="w-6 h-6 text-yellow-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 7v10c0 2.21 3.582 4 8 4s8-1.79 8-4V7M4 7c0 2.21 3.582 4 8 4s8-1.79 8-4M4 7c0-2.21 3.582-4 8-4s8 1.79 8 4m0 5c0 2.21-3.582 4-8 4s-8-1.79-8-4"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 服务器 -->
|
||||
<div id="serverCard" class="status-card bg-white rounded-xl shadow-lg p-6 cursor-pointer transition-all duration-300 hover:shadow-xl hover:-translate-y-1" onclick="window.location.hash='#servers'">
|
||||
<div class="flex justify-between items-start">
|
||||
<div>
|
||||
<p class="text-gray-500 text-sm font-medium">服务器</p>
|
||||
<h3 id="serverCount" class="text-3xl font-bold text-gray-900 metric-value">0</h3>
|
||||
<div class="flex items-center gap-4 mt-2">
|
||||
<div class="flex items-center">
|
||||
<span class="text-red-600 font-bold text-lg">12</span>
|
||||
<span class="text-gray-500 text-xs ml-1">警告</span>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<span class="text-yellow-600 font-bold text-lg">8</span>
|
||||
<span class="text-gray-500 text-xs ml-1">提醒</span>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<span class="text-green-600 font-bold text-lg">25</span>
|
||||
<span class="text-gray-500 text-xs ml-1">正常</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-3 bg-green-100 rounded-full">
|
||||
<svg class="w-6 h-6 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 告警统计和趋势图 -->
|
||||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-6">
|
||||
<!-- 告警统计 -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-6">
|
||||
<!-- 当前告警 -->
|
||||
<div class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
|
||||
<div class="flex justify-between items-start">
|
||||
<div>
|
||||
<p class="text-gray-500 text-sm font-medium">当前告警</p>
|
||||
<h3 class="text-3xl font-bold text-red-600 metric-value">112</h3>
|
||||
</div>
|
||||
<div class="p-3 bg-red-100 rounded-full">
|
||||
<svg class="w-6 h-6 text-red-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 当前提醒 -->
|
||||
<div class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
|
||||
<div class="flex justify-between items-start">
|
||||
<div>
|
||||
<p class="text-gray-500 text-sm font-medium">当前提醒</p>
|
||||
<h3 class="text-3xl font-bold text-yellow-600 metric-value">38</h3>
|
||||
</div>
|
||||
<div class="p-3 bg-yellow-100 rounded-full">
|
||||
<svg class="w-6 h-6 text-yellow-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 超时未跟进 -->
|
||||
<div class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
|
||||
<div class="flex justify-between items-start">
|
||||
<div>
|
||||
<p class="text-gray-500 text-sm font-medium">超时未跟进</p>
|
||||
<h3 class="text-3xl font-bold text-orange-600 metric-value">100</h3>
|
||||
</div>
|
||||
<div class="p-3 bg-orange-100 rounded-full">
|
||||
<svg class="w-6 h-6 text-orange-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 超时未处置 -->
|
||||
<div class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
|
||||
<div class="flex justify-between items-start">
|
||||
<div>
|
||||
<p class="text-gray-500 text-sm font-medium">超时未处置</p>
|
||||
<h3 class="text-3xl font-bold text-pink-600 metric-value">144</h3>
|
||||
</div>
|
||||
<div class="p-3 bg-pink-100 rounded-full">
|
||||
<svg class="w-6 h-6 text-pink-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 近一周告警/跟进走势 -->
|
||||
<div class="status-card bg-white rounded-xl shadow-lg p-6 lg:col-span-2 transition-all duration-300 hover:shadow-xl">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h2 class="text-lg font-semibold text-gray-900">近一周告警/跟进走势</h2>
|
||||
<div class="flex items-center gap-4">
|
||||
<span class="text-xs text-red-600 flex items-center gap-1">
|
||||
<div class="w-2 h-2 bg-red-600 rounded-full"></div>
|
||||
报警
|
||||
</span>
|
||||
<span class="text-xs text-orange-600 flex items-center gap-1">
|
||||
<div class="w-2 h-2 bg-orange-600 rounded-full"></div>
|
||||
提醒
|
||||
</span>
|
||||
<span class="text-xs text-yellow-600 flex items-center gap-1">
|
||||
<div class="w-2 h-2 bg-yellow-600 rounded-full"></div>
|
||||
登记
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-container h-80">
|
||||
<canvas id="alarmTrendChart"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 业务视图和告警列表 -->
|
||||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
||||
<!-- 业务视图 -->
|
||||
<div class="status-card bg-white rounded-xl shadow-lg p-6 lg:col-span-2 transition-all duration-300 hover:shadow-xl">
|
||||
<div class="flex flex-wrap items-center justify-between mb-6 gap-4">
|
||||
<h2 class="text-lg font-semibold text-gray-900">业务视图</h2>
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<select class="text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
|
||||
<option>全部分组</option>
|
||||
</select>
|
||||
<select class="text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
|
||||
<option>全部级别</option>
|
||||
</select>
|
||||
<select class="text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
|
||||
<option>全部标识</option>
|
||||
</select>
|
||||
<div class="relative">
|
||||
<input type="text" placeholder="输入关键字查询" class="text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm pl-10 pr-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
|
||||
<svg class="w-4 h-4 text-gray-400 absolute left-3 top-1/2 transform -translate-y-1/2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="overflow-x-auto rounded-lg border border-gray-200">
|
||||
<table class="min-w-full divide-y divide-gray-200">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">业务名称</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">IP地址</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作系统</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">重要标识</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">状态</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">CPU告警</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white divide-y divide-gray-200" id="businessViewTableBody">
|
||||
<!-- 业务视图数据将通过JavaScript动态添加 -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 告警列表 -->
|
||||
<div class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h2 class="text-lg font-semibold text-gray-900">告警列表</h2>
|
||||
<div class="flex items-center gap-3">
|
||||
<span class="text-xs font-medium text-red-600">112</span>
|
||||
<span class="text-xs font-medium text-orange-600">38</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="space-y-4" id="alarmList">
|
||||
<!-- 告警列表数据将通过JavaScript动态添加 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 仪表盘内容 -->
|
||||
<div id="dashboardContent" class="hidden">
|
||||
<!-- 状态卡片 -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6 mb-6">
|
||||
<!-- CPU 状态卡片 -->
|
||||
<div id="cpuCard" class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
|
||||
<div class="flex justify-between items-start">
|
||||
<div>
|
||||
<p class="text-gray-500 text-sm font-medium">CPU 使用率</p>
|
||||
<h3 id="cpuValue" class="text-3xl font-bold text-gray-900 metric-value">0.0%</h3>
|
||||
<p id="cpuTrend" class="text-xs mt-1 text-green-600">
|
||||
<svg class="inline w-3 h-3 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"></path>
|
||||
</svg>
|
||||
较上次 +0.0%
|
||||
</p>
|
||||
</div>
|
||||
<div class="p-3 bg-blue-100 rounded-full">
|
||||
<svg class="w-6 h-6 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 内存 状态卡片 -->
|
||||
<div id="memoryCard" class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
|
||||
<div class="flex justify-between items-start">
|
||||
<div>
|
||||
<p class="text-gray-500 text-sm font-medium">内存使用率</p>
|
||||
<h3 id="memoryValue" class="text-3xl font-bold text-gray-900 metric-value">0.0%</h3>
|
||||
<p id="memoryTrend" class="text-xs mt-1 text-green-600">
|
||||
<svg class="inline w-3 h-3 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"></path>
|
||||
</svg>
|
||||
较上次 +0.0%
|
||||
</p>
|
||||
</div>
|
||||
<div class="p-3 bg-green-100 rounded-full">
|
||||
<svg class="w-6 h-6 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 磁盘 状态卡片 -->
|
||||
<div id="diskCard" class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
|
||||
<div class="flex justify-between items-start">
|
||||
<div>
|
||||
<p class="text-gray-500 text-sm font-medium">磁盘使用率</p>
|
||||
<h3 id="diskValue" class="text-3xl font-bold text-gray-900 metric-value">0.0%</h3>
|
||||
<p id="diskTrend" class="text-xs mt-1 text-green-600">
|
||||
<svg class="inline w-3 h-3 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"></path>
|
||||
</svg>
|
||||
较上次 +0.0%
|
||||
</p>
|
||||
</div>
|
||||
<div class="p-3 bg-yellow-100 rounded-full">
|
||||
<svg class="w-6 h-6 text-yellow-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 网络 状态卡片 -->
|
||||
<div id="networkCard" class="status-card bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl hover:-translate-y-1">
|
||||
<div class="flex justify-between items-start">
|
||||
<div>
|
||||
<p class="text-gray-500 text-sm font-medium">网络流量</p>
|
||||
<h3 id="networkValue" class="text-3xl font-bold text-gray-900 metric-value">0.0 MB/s</h3>
|
||||
<p class="text-xs mt-1 text-gray-600">
|
||||
发送: <span id="networkSent">0.0</span> MB/s | 接收: <span id="networkReceived">0.0</span> MB/s
|
||||
</p>
|
||||
</div>
|
||||
<div class="p-3 bg-purple-100 rounded-full">
|
||||
<svg class="w-6 h-6 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 图表区域 -->
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6">
|
||||
<!-- CPU 图表 -->
|
||||
<div class="bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h2 class="text-lg font-semibold text-gray-900">CPU 使用率趋势</h2>
|
||||
<span class="text-sm text-gray-600">过去24小时</span>
|
||||
</div>
|
||||
<div class="chart-container h-80">
|
||||
<canvas id="cpuChart"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 内存 图表 -->
|
||||
<div class="bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h2 class="text-lg font-semibold text-gray-900">内存 使用率趋势</h2>
|
||||
<span class="text-sm text-gray-600">过去24小时</span>
|
||||
</div>
|
||||
<div class="chart-container h-80">
|
||||
<canvas id="memoryChart"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 磁盘 图表 -->
|
||||
<div class="bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h2 class="text-lg font-semibold text-gray-900">磁盘 使用率趋势</h2>
|
||||
<span class="text-sm text-gray-600">过去24小时</span>
|
||||
</div>
|
||||
<div class="chart-container h-80">
|
||||
<canvas id="diskChart"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 网络 流量趋势图表 -->
|
||||
<div class="bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h2 class="text-lg font-semibold text-gray-900">网络 流量趋势</h2>
|
||||
<span class="text-sm text-gray-600">过去24小时</span>
|
||||
</div>
|
||||
<div class="chart-container h-80">
|
||||
<canvas id="networkChart"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 网络 速率图表 -->
|
||||
<div class="bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h2 class="text-lg font-semibold text-gray-900">网络 速率</h2>
|
||||
<span class="text-sm text-gray-600">过去24小时</span>
|
||||
</div>
|
||||
<div class="chart-container h-80">
|
||||
<canvas id="networkRateChart"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 设备状态概览表 -->
|
||||
<div class="bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl">
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<h2 class="text-lg font-semibold text-gray-900">设备状态概览</h2>
|
||||
<span class="text-sm text-gray-600">实时更新</span>
|
||||
</div>
|
||||
<div class="overflow-x-auto rounded-lg border border-gray-200">
|
||||
<table class="min-w-full divide-y divide-gray-200">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">设备名称</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">设备ID</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">CPU使用率</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">内存使用率</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">磁盘使用率</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">发送流量</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">接收流量</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">状态</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="devicesTableBody" class="bg-white divide-y divide-gray-200">
|
||||
<!-- 设备状态将通过JavaScript动态添加 -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 服务器详情页面 -->
|
||||
<div id="serversContent" class="hidden">
|
||||
<div class="bg-white rounded-xl shadow-lg p-6 mb-6">
|
||||
<h2 class="text-xl font-bold text-gray-900 mb-6">服务器详情</h2>
|
||||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
||||
<!-- 服务器品牌分布 -->
|
||||
<div class="bg-white rounded-xl shadow-lg p-6 transition-all duration-300 hover:shadow-xl">
|
||||
<h3 class="text-lg font-semibold text-gray-900 mb-4">服务器品牌分布</h3>
|
||||
<div class="chart-container h-80">
|
||||
<canvas id="serverBrandChart"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 近一周告警趋势 -->
|
||||
<div class="bg-white rounded-xl shadow-lg p-6 lg:col-span-2 transition-all duration-300 hover:shadow-xl">
|
||||
<h3 class="text-lg font-semibold text-gray-900 mb-4">近一周告警趋势</h3>
|
||||
<div class="chart-container h-80">
|
||||
<canvas id="serverAlarmTrendChart"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 服务器型号分类表 -->
|
||||
<div class="bg-white rounded-xl shadow-lg p-6 mt-6 transition-all duration-300 hover:shadow-xl">
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<h3 class="text-lg font-semibold text-gray-900">服务器型号分类</h3>
|
||||
<div class="flex items-center gap-3">
|
||||
<select class="text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
|
||||
<option>全部品牌</option>
|
||||
<option>戴尔</option>
|
||||
<option>惠普</option>
|
||||
<option>联想</option>
|
||||
<option>华为</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 设备管理页面 -->
|
||||
<div id="devicesContent" class="hidden">
|
||||
<div class="bg-white rounded-xl shadow-lg p-6 mb-6">
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<h2 class="text-xl font-bold text-gray-900">设备管理</h2>
|
||||
<button id="addDeviceBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 shadow-sm hover:shadow-md">
|
||||
添加设备
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 设备过滤 -->
|
||||
<div class="flex flex-wrap gap-6 mb-6">
|
||||
<div class="flex-1 min-w-[200px]">
|
||||
<label for="statusFilter" class="block text-sm font-medium text-gray-700 mb-2">状态过滤</label>
|
||||
<select id="statusFilter" class="w-full text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
|
||||
<option value="all">全部状态</option>
|
||||
<option value="active">活跃</option>
|
||||
<option value="inactive">非活跃</option>
|
||||
<option value="offline">离线</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex-1 min-w-[200px]">
|
||||
<label for="searchDevice" class="block text-sm font-medium text-gray-700 mb-2">搜索设备</label>
|
||||
<input type="text" id="searchDevice" placeholder="输入设备名称或ID" class="w-full text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 设备列表 -->
|
||||
<div class="overflow-x-auto rounded-lg border border-gray-200">
|
||||
<table class="min-w-full divide-y divide-gray-200">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">设备名称</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">设备ID</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">IP地址</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">认证令牌</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">状态</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">创建时间</th>
|
||||
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="deviceManagementTableBody" class="bg-white divide-y divide-gray-200">
|
||||
<!-- 设备列表将通过JavaScript动态添加 -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 添加/编辑设备模态框 -->
|
||||
<div id="deviceModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50">
|
||||
<div class="bg-white rounded-xl shadow-xl p-6 w-full max-w-md transform transition-all duration-300 scale-100">
|
||||
<h3 id="modalTitle" class="text-xl font-bold text-gray-900 mb-6">添加设备</h3>
|
||||
<form id="deviceForm">
|
||||
<input type="hidden" id="deviceId">
|
||||
<div class="mb-5">
|
||||
<label for="deviceName" class="block text-sm font-medium text-gray-700 mb-2">设备名称</label>
|
||||
<input type="text" id="deviceName" name="name" required class="w-full text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
|
||||
</div>
|
||||
<div class="mb-5">
|
||||
<label for="deviceIdInput" class="block text-sm font-medium text-gray-700 mb-2">设备ID</label>
|
||||
<input type="text" id="deviceIdInput" name="id" required class="w-full text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
|
||||
</div>
|
||||
<div class="mb-5">
|
||||
<label for="deviceIp" class="block text-sm font-medium text-gray-700 mb-2">IP地址</label>
|
||||
<input type="text" id="deviceIp" name="ip" class="w-full text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
|
||||
</div>
|
||||
<div class="mb-6">
|
||||
<label for="deviceStatus" class="block text-sm font-medium text-gray-700 mb-2">状态</label>
|
||||
<select id="deviceStatus" name="status" class="w-full text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg shadow-sm px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200">
|
||||
<option value="active">活跃</option>
|
||||
<option value="inactive">非活跃</option>
|
||||
<option value="offline">离线</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex justify-end gap-3">
|
||||
<button type="button" id="cancelBtn" class="bg-gray-100 hover:bg-gray-200 text-gray-800 px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200">
|
||||
取消
|
||||
</button>
|
||||
<button type="submit" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 shadow-sm hover:shadow-md">
|
||||
保存
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- JavaScript 文件 -->
|
||||
<script src="js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user