修复比对错误
This commit is contained in:
@@ -900,9 +900,9 @@ async function loadRedisConfigGroupsForManagement() {
|
||||
const response = await fetch('/api/redis/config-groups');
|
||||
const result = await response.json();
|
||||
|
||||
const container = document.getElementById('redisConfigGroupList');
|
||||
const container = document.getElementById('redisConfigGroupsList');
|
||||
if (!container) {
|
||||
console.error('Redis配置组列表容器未找到: redisConfigGroupList');
|
||||
console.error('Redis配置组列表容器未找到: redisConfigGroupsList');
|
||||
showAlert('Redis配置组列表容器未找到,请检查页面结构', 'danger');
|
||||
return;
|
||||
}
|
||||
@@ -938,7 +938,7 @@ async function loadRedisConfigGroupsForManagement() {
|
||||
console.log('没有找到Redis配置组数据');
|
||||
}
|
||||
} catch (error) {
|
||||
const container = document.getElementById('redisConfigGroupList');
|
||||
const container = document.getElementById('redisConfigGroupsList');
|
||||
if (container) {
|
||||
container.innerHTML = '<div class="alert alert-danger">加载失败: ' + error.message + '</div>';
|
||||
}
|
||||
@@ -2195,80 +2195,6 @@ async function saveRedisConfigGroup() {
|
||||
}
|
||||
}
|
||||
|
||||
// 显示管理Redis配置组对话框
|
||||
function showManageRedisConfigDialog() {
|
||||
loadRedisConfigGroupsForManagement();
|
||||
new bootstrap.Modal(document.getElementById('manageRedisConfigModal')).show();
|
||||
}
|
||||
|
||||
// 为管理界面加载Redis配置组
|
||||
async function loadRedisConfigGroupsForManagement() {
|
||||
try {
|
||||
const response = await fetch('/api/redis/config-groups');
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
displayRedisConfigGroupsForManagement(result.data);
|
||||
} else {
|
||||
showAlert(`加载配置组失败: ${result.error}`, 'danger');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载Redis配置组失败:', error);
|
||||
showAlert(`加载失败: ${error.message}`, 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
// 显示Redis配置组管理列表
|
||||
function displayRedisConfigGroupsForManagement(configGroups) {
|
||||
const container = document.getElementById('redisConfigGroupsList');
|
||||
|
||||
if (!configGroups || configGroups.length === 0) {
|
||||
container.innerHTML = '<div class="text-center text-muted py-4">暂无保存的配置组</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
let html = '';
|
||||
configGroups.forEach(config => {
|
||||
html += `
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between align-items-start">
|
||||
<div class="flex-grow-1">
|
||||
<h6 class="card-title mb-2">
|
||||
<i class="fas fa-cog redis-logo me-2"></i>${config.name}
|
||||
</h6>
|
||||
<p class="card-text text-muted small mb-2">${config.description || '无描述'}</p>
|
||||
<div class="small text-muted">
|
||||
<i class="fas fa-clock me-1"></i>创建时间: ${config.created_at}
|
||||
${config.updated_at !== config.created_at ? `<br><i class="fas fa-edit me-1"></i>更新时间: ${config.updated_at}` : ''}
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group-vertical btn-group-sm">
|
||||
<button class="btn btn-outline-primary btn-sm mb-1" onclick="loadRedisConfigGroup(${config.id})" title="加载配置">
|
||||
<i class="fas fa-download"></i> 加载
|
||||
</button>
|
||||
<button class="btn btn-outline-success btn-sm mb-1" onclick="exportRedisConfigGroup(${config.id}, '${config.name}')" title="导出YAML">
|
||||
<i class="fas fa-file-export"></i> 导出
|
||||
</button>
|
||||
<button class="btn btn-outline-info btn-sm mb-1" onclick="copyRedisConfigGroup(${config.id}, '${config.name}')" title="复制配置">
|
||||
<i class="fas fa-copy"></i> 复制
|
||||
</button>
|
||||
<button class="btn btn-outline-warning btn-sm mb-1" onclick="testRedisConfigConnection(${config.id})" title="测试连接">
|
||||
<i class="fas fa-plug"></i> 测试
|
||||
</button>
|
||||
<button class="btn btn-outline-danger btn-sm" onclick="deleteRedisConfigGroup(${config.id}, '${config.name}')" title="删除配置">
|
||||
<i class="fas fa-trash"></i> 删除
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
|
||||
container.innerHTML = html;
|
||||
}
|
||||
|
||||
// 刷新Redis配置组列表
|
||||
function refreshRedisConfigGroups() {
|
||||
loadRedisConfigGroupsForManagement();
|
||||
|
@@ -674,22 +674,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 配置组管理对话框 -->
|
||||
<div class="modal fade" id="manageRedisConfigModal" tabindex="-1" 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>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="redisConfigGroupList">
|
||||
<!-- 配置组列表将在这里动态生成 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 导入配置模态框 -->
|
||||
<div class="modal fade" id="importConfigModal" tabindex="-1" aria-labelledby="importConfigModalLabel" aria-hidden="true">
|
||||
|
Reference in New Issue
Block a user