完整查询历史
This commit is contained in:
@@ -2531,10 +2531,58 @@ async function loadHistoryRecord(historyId) {
|
|||||||
document.getElementById('test_keyspace').value = history.test_config.keyspace || '';
|
document.getElementById('test_keyspace').value = history.test_config.keyspace || '';
|
||||||
document.getElementById('test_table').value = history.test_config.table || '';
|
document.getElementById('test_table').value = history.test_config.table || '';
|
||||||
|
|
||||||
// 填充查询配置
|
// 填充查询配置 - 使用与配置组加载相同的逻辑
|
||||||
document.getElementById('keys').value = (history.query_config.keys || []).join(',');
|
if (history.query_config) {
|
||||||
document.getElementById('fields_to_compare').value = (history.query_config.fields_to_compare || []).join(',');
|
console.log('loadHistoryRecord - 设置keys字段:', history.query_config.keys);
|
||||||
document.getElementById('exclude_fields').value = (history.query_config.exclude_fields || []).join(',');
|
const keysElement = document.getElementById('keys');
|
||||||
|
console.log('loadHistoryRecord - keys元素:', keysElement);
|
||||||
|
|
||||||
|
if (keysElement) {
|
||||||
|
keysElement.value = (history.query_config.keys || []).join(',');
|
||||||
|
console.log('loadHistoryRecord - keys字段设置后的值:', keysElement.value);
|
||||||
|
|
||||||
|
// 强制触发多种事件以确保UI更新
|
||||||
|
keysElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||||
|
keysElement.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
|
|
||||||
|
// 添加延迟更新,确保模态框关闭后再次设置
|
||||||
|
setTimeout(() => {
|
||||||
|
keysElement.value = (history.query_config.keys || []).join(',');
|
||||||
|
keysElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||||
|
console.log('loadHistoryRecord - 延迟设置后的值:', keysElement.value);
|
||||||
|
}, 100);
|
||||||
|
} else {
|
||||||
|
console.error('loadHistoryRecord - 未找到keys输入元素!');
|
||||||
|
}
|
||||||
|
|
||||||
|
const fieldsToCompareElement = document.getElementById('fields_to_compare');
|
||||||
|
const excludeFieldsElement = document.getElementById('exclude_fields');
|
||||||
|
|
||||||
|
if (fieldsToCompareElement) {
|
||||||
|
fieldsToCompareElement.value = (history.query_config.fields_to_compare || []).join(',');
|
||||||
|
fieldsToCompareElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||||
|
fieldsToCompareElement.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
|
setTimeout(() => {
|
||||||
|
fieldsToCompareElement.value = (history.query_config.fields_to_compare || []).join(',');
|
||||||
|
fieldsToCompareElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (excludeFieldsElement) {
|
||||||
|
excludeFieldsElement.value = (history.query_config.exclude_fields || []).join(',');
|
||||||
|
excludeFieldsElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||||
|
excludeFieldsElement.dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
|
setTimeout(() => {
|
||||||
|
excludeFieldsElement.value = (history.query_config.exclude_fields || []).join(',');
|
||||||
|
excludeFieldsElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn('loadHistoryRecord - 查询配置为空或未定义');
|
||||||
|
document.getElementById('keys').value = '';
|
||||||
|
document.getElementById('fields_to_compare').value = '';
|
||||||
|
document.getElementById('exclude_fields').value = '';
|
||||||
|
}
|
||||||
|
|
||||||
// 填充查询Key值
|
// 填充查询Key值
|
||||||
document.getElementById('query_values').value = (history.query_keys || []).join('\n');
|
document.getElementById('query_values').value = (history.query_keys || []).join('\n');
|
||||||
@@ -3239,8 +3287,8 @@ function formatLogMessage(message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function filterLogsByLevel() {
|
function filterLogsByLevel() {
|
||||||
// 刷新分组日志显示,应用过滤器
|
// 这个函数已弃用,因为查询日志现在使用独立模态框显示
|
||||||
refreshQueryLogs();
|
console.warn('filterLogsByLevel() 已弃用,请使用 filterModalLogsByLevel()');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function clearQueryLogs() {
|
async function clearQueryLogs() {
|
||||||
@@ -3255,7 +3303,11 @@ async function clearQueryLogs() {
|
|||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
document.getElementById('query-logs').innerHTML = '<div class="alert alert-info">查询日志已清空</div>';
|
// 如果查询日志模态框是打开的,清空显示内容
|
||||||
|
const modalLogsContainer = document.getElementById('modal-query-logs');
|
||||||
|
if (modalLogsContainer) {
|
||||||
|
modalLogsContainer.innerHTML = '<div class="alert alert-info">查询日志已清空</div>';
|
||||||
|
}
|
||||||
showAlert('success', result.message);
|
showAlert('success', result.message);
|
||||||
} else {
|
} else {
|
||||||
showAlert('danger', '清空查询日志失败: ' + result.error);
|
showAlert('danger', '清空查询日志失败: ' + result.error);
|
||||||
@@ -3296,8 +3348,8 @@ async function cleanupOldLogs() {
|
|||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
showAlert('success', result.message);
|
showAlert('success', result.message);
|
||||||
// 刷新日志显示
|
// 刷新模态框中的日志显示
|
||||||
refreshQueryLogs();
|
refreshModalQueryLogs();
|
||||||
} else {
|
} else {
|
||||||
showAlert('danger', '清理旧日志失败: ' + result.error);
|
showAlert('danger', '清理旧日志失败: ' + result.error);
|
||||||
}
|
}
|
||||||
@@ -3715,7 +3767,11 @@ function displayHistoryRelatedLogs(groupedLogs, historyId) {
|
|||||||
function autoRefreshLogsAfterQuery() {
|
function autoRefreshLogsAfterQuery() {
|
||||||
// 延迟一下确保后端日志已经记录
|
// 延迟一下确保后端日志已经记录
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
refreshQueryLogs();
|
// 只有当查询日志模态框打开时才刷新
|
||||||
|
const queryLogsModal = document.getElementById('queryLogsModal');
|
||||||
|
if (queryLogsModal && queryLogsModal.classList.contains('show')) {
|
||||||
|
refreshModalQueryLogs();
|
||||||
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user