分表参数
This commit is contained in:
115
static/js/app.js
115
static/js/app.js
@@ -142,6 +142,10 @@ async function loadSelectedConfigGroup() {
|
||||
if (result.success) {
|
||||
const config = result.data;
|
||||
|
||||
// 调试输出
|
||||
console.log('加载配置组数据:', config);
|
||||
console.log('查询配置数据:', config.query_config);
|
||||
|
||||
// 填充生产环境配置
|
||||
document.getElementById('pro_cluster_name').value = config.pro_config.cluster_name || '';
|
||||
document.getElementById('pro_datacenter').value = config.pro_config.datacenter || '';
|
||||
@@ -162,9 +166,59 @@ async function loadSelectedConfigGroup() {
|
||||
document.getElementById('test_keyspace').value = config.test_config.keyspace || '';
|
||||
document.getElementById('test_table').value = config.test_config.table || '';
|
||||
|
||||
document.getElementById('keys').value = (config.query_config.keys || []).join(',');
|
||||
document.getElementById('fields_to_compare').value = (config.query_config.fields_to_compare || []).join(',');
|
||||
document.getElementById('exclude_fields').value = (config.query_config.exclude_fields || []).join(',');
|
||||
// 填充查询配置 - 增加调试输出和保护性检查
|
||||
if (config.query_config) {
|
||||
console.log('设置keys字段:', config.query_config.keys);
|
||||
const keysElement = document.getElementById('keys');
|
||||
console.log('keys元素:', keysElement);
|
||||
console.log('keys元素当前值:', keysElement ? keysElement.value : 'element not found');
|
||||
|
||||
if (keysElement) {
|
||||
keysElement.value = (config.query_config.keys || []).join(',');
|
||||
console.log('keys字段设置后的值:', keysElement.value);
|
||||
|
||||
// 强制触发多种事件以确保UI更新
|
||||
keysElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
keysElement.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
|
||||
// 添加延迟更新,确保模态框关闭后再次设置
|
||||
setTimeout(() => {
|
||||
keysElement.value = (config.query_config.keys || []).join(',');
|
||||
keysElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
console.log('延迟设置后的值:', keysElement.value);
|
||||
}, 100);
|
||||
} else {
|
||||
console.error('未找到keys输入元素!');
|
||||
}
|
||||
|
||||
const fieldsToCompareElement = document.getElementById('fields_to_compare');
|
||||
const excludeFieldsElement = document.getElementById('exclude_fields');
|
||||
|
||||
if (fieldsToCompareElement) {
|
||||
fieldsToCompareElement.value = (config.query_config.fields_to_compare || []).join(',');
|
||||
fieldsToCompareElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
fieldsToCompareElement.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
setTimeout(() => {
|
||||
fieldsToCompareElement.value = (config.query_config.fields_to_compare || []).join(',');
|
||||
fieldsToCompareElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
}, 100);
|
||||
}
|
||||
|
||||
if (excludeFieldsElement) {
|
||||
excludeFieldsElement.value = (config.query_config.exclude_fields || []).join(',');
|
||||
excludeFieldsElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
excludeFieldsElement.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
setTimeout(() => {
|
||||
excludeFieldsElement.value = (config.query_config.exclude_fields || []).join(',');
|
||||
excludeFieldsElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
}, 100);
|
||||
}
|
||||
} else {
|
||||
console.warn('查询配置为空或未定义');
|
||||
document.getElementById('keys').value = '';
|
||||
document.getElementById('fields_to_compare').value = '';
|
||||
document.getElementById('exclude_fields').value = '';
|
||||
}
|
||||
|
||||
// 加载分表配置
|
||||
if (config.sharding_config) {
|
||||
@@ -401,9 +455,58 @@ async function loadConfigGroupById(groupId) {
|
||||
document.getElementById('test_keyspace').value = config.test_config.keyspace || '';
|
||||
document.getElementById('test_table').value = config.test_config.table || '';
|
||||
|
||||
document.getElementById('keys').value = (config.query_config.keys || []).join(',');
|
||||
document.getElementById('fields_to_compare').value = (config.query_config.fields_to_compare || []).join(',');
|
||||
document.getElementById('exclude_fields').value = (config.query_config.exclude_fields || []).join(',');
|
||||
// 填充查询配置 - 增加调试输出和保护性检查
|
||||
if (config.query_config) {
|
||||
console.log('loadConfigGroupById - 设置keys字段:', config.query_config.keys);
|
||||
const keysElement = document.getElementById('keys');
|
||||
console.log('loadConfigGroupById - keys元素:', keysElement);
|
||||
|
||||
if (keysElement) {
|
||||
keysElement.value = (config.query_config.keys || []).join(',');
|
||||
console.log('loadConfigGroupById - keys字段设置后的值:', keysElement.value);
|
||||
|
||||
// 强制触发多种事件以确保UI更新
|
||||
keysElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
keysElement.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
|
||||
// 添加延迟更新,确保模态框关闭后再次设置
|
||||
setTimeout(() => {
|
||||
keysElement.value = (config.query_config.keys || []).join(',');
|
||||
keysElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
console.log('loadConfigGroupById - 延迟设置后的值:', keysElement.value);
|
||||
}, 100);
|
||||
} else {
|
||||
console.error('loadConfigGroupById - 未找到keys输入元素!');
|
||||
}
|
||||
|
||||
const fieldsToCompareElement = document.getElementById('fields_to_compare');
|
||||
const excludeFieldsElement = document.getElementById('exclude_fields');
|
||||
|
||||
if (fieldsToCompareElement) {
|
||||
fieldsToCompareElement.value = (config.query_config.fields_to_compare || []).join(',');
|
||||
fieldsToCompareElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
fieldsToCompareElement.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
setTimeout(() => {
|
||||
fieldsToCompareElement.value = (config.query_config.fields_to_compare || []).join(',');
|
||||
fieldsToCompareElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
}, 100);
|
||||
}
|
||||
|
||||
if (excludeFieldsElement) {
|
||||
excludeFieldsElement.value = (config.query_config.exclude_fields || []).join(',');
|
||||
excludeFieldsElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
excludeFieldsElement.dispatchEvent(new Event('change', { bubbles: true }));
|
||||
setTimeout(() => {
|
||||
excludeFieldsElement.value = (config.query_config.exclude_fields || []).join(',');
|
||||
excludeFieldsElement.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
}, 100);
|
||||
}
|
||||
} else {
|
||||
console.warn('loadConfigGroupById - 查询配置为空或未定义');
|
||||
document.getElementById('keys').value = '';
|
||||
document.getElementById('fields_to_compare').value = '';
|
||||
document.getElementById('exclude_fields').value = '';
|
||||
}
|
||||
|
||||
// 更新下拉框选中状态
|
||||
document.getElementById('configGroupSelect').value = groupId;
|
||||
|
Reference in New Issue
Block a user