优化项目整合内容

This commit is contained in:
2025-08-05 19:56:38 +08:00
parent 3f78ce7365
commit 4a0800a776
7 changed files with 2608 additions and 364 deletions

View File

@@ -128,6 +128,99 @@
max-width: 600px !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}
/* 拖拽区域样式 */
#dropZone {
transition: all 0.3s ease;
}
#dropZone:hover {
border-color: #dc143c !important;
background-color: #fff8f8;
}
#dropZone.dragover {
border-color: #dc143c !important;
background-color: #fff8f8;
transform: scale(1.02);
}
/* 配置预览样式 */
.config-preview-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 5px 0;
border-bottom: 1px solid #eee;
}
.config-preview-item:last-child {
border-bottom: none;
}
.config-preview-label {
font-weight: 600;
color: #495057;
}
.config-preview-value {
color: #6c757d;
font-family: 'Courier New', monospace;
font-size: 0.9em;
}
/* Redis日志分组样式 */
.redis-log-group {
border: 1px solid #dee2e6;
border-radius: 8px;
overflow: hidden;
}
.redis-log-group .card-header {
transition: background-color 0.2s ease;
}
.redis-log-group .card-header:hover {
background-color: rgba(0, 123, 255, 0.1) !important;
}
.redis-log-content {
max-height: 400px;
overflow-y: auto;
}
.log-item {
background-color: #f8f9fa;
border-radius: 4px;
transition: all 0.2s ease;
}
.log-item:hover {
background-color: #e9ecef;
transform: translateX(2px);
}
.log-item .badge {
min-width: 60px;
font-size: 0.75em;
}
/* 日志级别边框颜色 */
.border-info {
border-color: #0dcaf0 !important;
}
.border-warning {
border-color: #ffc107 !important;
}
.border-danger {
border-color: #dc3545 !important;
}
.border-secondary {
border-color: #6c757d !important;
}
</style>
</head>
<body>
@@ -196,52 +289,34 @@
</div>
</div>
<div class="row">
<div class="col-4">
<div class="col-6">
<button class="btn btn-success btn-sm w-100" onclick="showSaveRedisConfigDialog()">
<i class="fas fa-save"></i> 保存配置组
</button>
</div>
<div class="col-4">
<div class="col-6">
<button class="btn btn-info btn-sm w-100" onclick="showManageRedisConfigDialog()">
<i class="fas fa-cog"></i> 管理配置组
</button>
</div>
</div>
<div class="row mt-2">
<div class="col-4">
<button class="btn btn-warning btn-sm w-100" onclick="showImportRedisConfigDialog()">
<i class="fas fa-file-import"></i> 导入配置
<button class="btn btn-warning btn-sm w-100" onclick="showRedisQueryHistoryDialog()">
<i class="fas fa-history"></i> 查询历史
</button>
</div>
</div>
<!-- 查询历史和日志 -->
<div class="row mt-3">
<div class="col-12">
<h6><i class="fas fa-history"></i> 历史记录与日志</h6>
</div>
</div>
<div class="row mb-3">
<div class="col-8">
<select class="form-select form-select-sm" id="redisHistorySelect">
<option value="">选择查询历史...</option>
</select>
</div>
<div class="col-4">
<button class="btn btn-warning btn-sm w-100" onclick="loadSelectedRedisHistory()">
<i class="fas fa-download"></i> 加载
</button>
</div>
</div>
<div class="row">
<div class="col-6">
<button class="btn btn-info btn-sm w-100" onclick="showManageRedisHistoryDialog()">
<i class="fas fa-history"></i> 管理历史
</button>
</div>
<div class="col-6">
<button class="btn btn-outline-info btn-sm w-100" onclick="showRedisQueryLogsDialog()">
<button class="btn btn-info btn-sm w-100" onclick="showRedisQueryLogsDialog()">
<i class="fas fa-file-alt"></i> 查询日志
</button>
</div>
<div class="col-4">
<button class="btn btn-secondary btn-sm w-100" onclick="showSaveRedisHistoryDialog()">
<i class="fas fa-bookmark"></i> 保存历史
</button>
</div>
</div>
</div>
</div>
@@ -254,7 +329,12 @@
<div class="card-body">
<!-- 集群1配置 -->
<div class="cluster-config mb-3">
<h6 class="text-primary"><i class="fas fa-server"></i> 集群1 (生产)</h6>
<div class="d-flex justify-content-between align-items-center mb-2">
<h6 class="text-primary mb-0"><i class="fas fa-server"></i> 集群1 (生产)</h6>
<button type="button" class="btn btn-outline-primary btn-sm" onclick="showImportConfigDialog('cluster1')" title="导入YAML配置">
<i class="fas fa-file-import"></i> 导入配置
</button>
</div>
<div class="row mb-2">
<div class="col-12">
<label class="form-label">集群名称</label>
@@ -276,13 +356,29 @@
<i class="fas fa-plus"></i> 添加节点
</button>
</div>
<div class="row">
<div class="col-6">
<div class="row mb-2">
<div class="col-12">
<label class="form-label">密码</label>
<input type="password" class="form-control form-control-sm" id="cluster1Password" placeholder="可选">
</div>
<div class="col-6">
<button class="btn btn-outline-primary btn-sm mt-4 w-100" onclick="testConnection('cluster1')">
</div>
<div class="row mb-2">
<div class="col-4">
<label class="form-label">连接超时(秒)</label>
<input type="number" class="form-control form-control-sm" id="cluster1SocketTimeout" value="3" min="1" max="60">
</div>
<div class="col-4">
<label class="form-label">建立超时(秒)</label>
<input type="number" class="form-control form-control-sm" id="cluster1SocketConnectTimeout" value="3" min="1" max="60">
</div>
<div class="col-4">
<label class="form-label">最大连接数</label>
<input type="number" class="form-control form-control-sm" id="cluster1MaxConnectionsPerNode" value="16" min="1" max="100">
</div>
</div>
<div class="row">
<div class="col-12">
<button class="btn btn-outline-primary btn-sm w-100" onclick="testConnection('cluster1')">
<i class="fas fa-plug"></i> 测试连接
</button>
</div>
@@ -291,7 +387,12 @@
<!-- 集群2配置 -->
<div class="cluster-config">
<h6 class="text-success"><i class="fas fa-server"></i> 集群2 (测试)</h6>
<div class="d-flex justify-content-between align-items-center mb-2">
<h6 class="text-success mb-0"><i class="fas fa-server"></i> 集群2 (测试)</h6>
<button type="button" class="btn btn-outline-success btn-sm" onclick="showImportConfigDialog('cluster2')" title="导入YAML配置">
<i class="fas fa-file-import"></i> 导入配置
</button>
</div>
<div class="row mb-2">
<div class="col-12">
<label class="form-label">集群名称</label>
@@ -313,13 +414,29 @@
<i class="fas fa-plus"></i> 添加节点
</button>
</div>
<div class="row">
<div class="col-6">
<div class="row mb-2">
<div class="col-12">
<label class="form-label">密码</label>
<input type="password" class="form-control form-control-sm" id="cluster2Password" placeholder="可选">
</div>
<div class="col-6">
<button class="btn btn-outline-primary btn-sm mt-4 w-100" onclick="testConnection('cluster2')">
</div>
<div class="row mb-2">
<div class="col-4">
<label class="form-label">连接超时(秒)</label>
<input type="number" class="form-control form-control-sm" id="cluster2SocketTimeout" value="3" min="1" max="60">
</div>
<div class="col-4">
<label class="form-label">建立超时(秒)</label>
<input type="number" class="form-control form-control-sm" id="cluster2SocketConnectTimeout" value="3" min="1" max="60">
</div>
<div class="col-4">
<label class="form-label">最大连接数</label>
<input type="number" class="form-control form-control-sm" id="cluster2MaxConnectionsPerNode" value="16" min="1" max="100">
</div>
</div>
<div class="row">
<div class="col-12">
<button class="btn btn-outline-primary btn-sm w-100" onclick="testConnection('cluster2')">
<i class="fas fa-plug"></i> 测试连接
</button>
</div>
@@ -574,44 +691,149 @@
</div>
</div>
<!-- 历史记录管理对话-->
<div class="modal fade" id="manageRedisHistoryModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-xl">
<!-- 导入配置模态-->
<div class="modal fade" id="importConfigModal" tabindex="-1" aria-labelledby="importConfigModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">管理Redis查询历史</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
<h5 class="modal-title" id="importConfigModalLabel">
<i class="fas fa-file-import redis-logo"></i> 导入Redis配置
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div id="redisHistoryList">
<!-- 历史记录列表将在这里动态生成 -->
<div class="mb-3">
<h6 class="mb-2">导入方式</h6>
<div class="btn-group w-100" role="group">
<input type="radio" class="btn-check" name="importMethod" id="importMethodText" checked>
<label class="btn btn-outline-primary" for="importMethodText">
<i class="fas fa-keyboard"></i> 文本粘贴
</label>
<input type="radio" class="btn-check" name="importMethod" id="importMethodFile">
<label class="btn btn-outline-primary" for="importMethodFile">
<i class="fas fa-file-upload"></i> 文件上传
</label>
</div>
</div>
<!-- 文本粘贴方式 -->
<div id="textImportSection">
<div class="mb-3">
<label for="configYamlText" class="form-label">YAML配置内容</label>
<textarea class="form-control" id="configYamlText" rows="8" placeholder="请粘贴YAML格式的配置内容例如&#10;clusterName: &quot;redis-test&quot;&#10;clusterAddress: &quot;10.20.2.109:6470,10.20.2.109:6570&quot;&#10;clusterPassword: &quot;&quot;"></textarea>
</div>
</div>
<!-- 文件上传方式 -->
<div id="fileImportSection" style="display: none;">
<div class="mb-3">
<label for="configYamlFile" class="form-label">选择YAML配置文件</label>
<input type="file" class="form-control" id="configYamlFile" accept=".yml,.yaml,.txt">
</div>
<div class="border rounded p-3 text-center" id="dropZone" style="border-style: dashed !important; min-height: 100px; cursor: pointer;">
<i class="fas fa-cloud-upload-alt fa-2x text-muted mb-2"></i>
<p class="text-muted mb-0">点击选择文件或拖拽文件到此处</p>
</div>
</div>
<!-- 配置预览 -->
<div id="configPreview" style="display: none;">
<hr>
<h6><i class="fas fa-eye"></i> 配置预览</h6>
<div class="alert alert-info">
<div id="previewContent"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary me-2" onclick="previewConfig()">
<i class="fas fa-eye"></i> 预览配置
</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
<button type="button" class="btn btn-redis" onclick="importConfig()">
<i class="fas fa-file-import"></i> 导入
</button>
</div>
</div>
</div>
</div>
<!-- 查询日志对话-->
<div class="modal fade" id="redisQueryLogsModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-lg">
<!-- Redis查询历史模态-->
<div class="modal fade" id="redisQueryHistoryModal" tabindex="-1" aria-labelledby="redisQueryHistoryModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Redis查询日志</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
<h5 class="modal-title" id="redisQueryHistoryModalLabel">
<i class="fas fa-history redis-logo"></i> Redis查询历史管理
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="d-flex justify-content-end mb-3">
<button class="btn btn-sm btn-outline-primary me-2" onclick="refreshRedisQueryLogs()">
<i class="fas fa-sync-alt"></i> 刷新
</button>
<button class="btn btn-sm btn-outline-danger" onclick="clearRedisQueryLogs()">
<i class="fas fa-trash"></i> 清空日志
</button>
<div class="d-flex justify-content-between align-items-center mb-3">
<h6 class="mb-0">历史查询记录</h6>
<div>
<button class="btn btn-sm btn-outline-primary me-2" onclick="refreshRedisQueryHistory()">
<i class="fas fa-sync-alt"></i> 刷新
</button>
<button class="btn btn-sm btn-outline-danger" onclick="clearAllRedisHistory()">
<i class="fas fa-trash"></i> 清空全部
</button>
</div>
</div>
<div class="log-viewer" id="redisQueryLogs">
<!-- 查询日志将在这里动态生成 -->
<div id="redisHistoryList" style="max-height: 600px; overflow-y: auto;">
<!-- Redis历史记录列表将在这里动态生成 -->
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<!-- Redis查询日志模态框 -->
<div class="modal fade" id="redisQueryLogsModal" tabindex="-1" aria-labelledby="redisQueryLogsModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="redisQueryLogsModalLabel">
<i class="fas fa-file-alt redis-logo"></i> Redis查询日志管理
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="d-flex justify-content-between align-items-center mb-3">
<div class="d-flex align-items-center">
<h6 class="mb-0 me-3">Redis查询执行日志</h6>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="redis-modal-log-level-info" checked onchange="filterRedisModalLogsByLevel()">
<label class="form-check-label text-primary" for="redis-modal-log-level-info">INFO</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="redis-modal-log-level-warning" checked onchange="filterRedisModalLogsByLevel()">
<label class="form-check-label text-warning" for="redis-modal-log-level-warning">WARNING</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="redis-modal-log-level-error" checked onchange="filterRedisModalLogsByLevel()">
<label class="form-check-label text-danger" for="redis-modal-log-level-error">ERROR</label>
</div>
</div>
<div>
<button class="btn btn-sm btn-outline-primary me-2" onclick="refreshRedisQueryLogs()">
<i class="fas fa-sync-alt"></i> 刷新
</button>
<button class="btn btn-sm btn-outline-danger" onclick="clearRedisQueryLogs()">
<i class="fas fa-trash"></i> 清空
</button>
</div>
</div>
<div id="redis-modal-query-logs" style="max-height: 600px; overflow-y: auto;">
<!-- Redis查询日志将在这里动态生成 -->
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
@@ -662,6 +884,98 @@
</div>
</div>
<!-- 保存Redis配置组模态框 -->
<div class="modal fade" id="saveRedisConfigModal" tabindex="-1" aria-labelledby="saveRedisConfigModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="saveRedisConfigModalLabel">
<i class="fas fa-save redis-logo"></i> 保存Redis配置组
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form id="saveRedisConfigForm">
<div class="mb-3">
<label for="redisConfigName" class="form-label">配置组名称 <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="redisConfigName" required>
</div>
<div class="mb-3">
<label for="redisConfigDescription" class="form-label">配置描述</label>
<textarea class="form-control" id="redisConfigDescription" rows="3" placeholder="请输入配置组的详细描述..."></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
<button type="button" class="btn btn-redis" onclick="saveRedisConfigGroup()">
<i class="fas fa-save"></i> 保存
</button>
</div>
</div>
</div>
</div>
<!-- 管理Redis配置组模态框 -->
<div class="modal fade" id="manageRedisConfigModal" tabindex="-1" aria-labelledby="manageRedisConfigModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="manageRedisConfigModalLabel">
<i class="fas fa-cog redis-logo"></i> 管理Redis配置组
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="d-flex justify-content-between align-items-center mb-3">
<h6 class="mb-0">已保存的配置组</h6>
<button class="btn btn-sm btn-outline-primary" onclick="refreshRedisConfigGroups()">
<i class="fas fa-sync-alt"></i> 刷新
</button>
</div>
<div id="redisConfigGroupsList" style="max-height: 600px; overflow-y: auto;">
<!-- Redis配置组列表将在这里动态生成 -->
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
<!-- 保存Redis查询历史模态框 -->
<div class="modal fade" id="saveRedisHistoryModal" tabindex="-1" aria-labelledby="saveRedisHistoryModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="saveRedisHistoryModalLabel">
<i class="fas fa-bookmark redis-logo"></i> 保存Redis查询历史
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form id="saveRedisHistoryForm">
<div class="mb-3">
<label for="redisHistoryName" class="form-label">历史记录名称 <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="redisHistoryName" required>
</div>
<div class="mb-3">
<label for="redisHistoryDescription" class="form-label">历史描述</label>
<textarea class="form-control" id="redisHistoryDescription" rows="3" placeholder="请输入查询历史的详细描述..."></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
<button type="button" class="btn btn-redis" onclick="saveRedisQueryHistory()">
<i class="fas fa-bookmark"></i> 保存
</button>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="/static/js/redis_compare.js"></script>
</body>