修复redis识别
This commit is contained in:
@@ -399,16 +399,19 @@ function displayDifferenceResults(differences) {
|
||||
|
||||
let html = '';
|
||||
differences.forEach((diff, index) => {
|
||||
const cluster1Type = diff.cluster1_type ? ` (${diff.cluster1_type})` : '';
|
||||
const cluster2Type = diff.cluster2_type ? ` (${diff.cluster2_type})` : '';
|
||||
|
||||
html += `
|
||||
<div class="difference-item">
|
||||
<h6><i class="fas fa-key me-2"></i>Key: <code>${diff.key}</code></h6>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<strong>${currentResults.clusters.cluster1_name || '集群1'}:</strong>
|
||||
<strong>${currentResults.clusters.cluster1_name || '集群1'}${cluster1Type}:</strong>
|
||||
<pre class="redis-value mt-2">${formatRedisValue(diff.cluster1_value)}</pre>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<strong>${currentResults.clusters.cluster2_name || '集群2'}:</strong>
|
||||
<strong>${currentResults.clusters.cluster2_name || '集群2'}${cluster2Type}:</strong>
|
||||
<pre class="redis-value mt-2">${formatRedisValue(diff.cluster2_value)}</pre>
|
||||
</div>
|
||||
</div>
|
||||
@@ -439,11 +442,13 @@ function displayIdenticalResults(identical) {
|
||||
|
||||
let html = '';
|
||||
identical.forEach((item, index) => {
|
||||
const typeInfo = item.type ? ` (${item.type})` : '';
|
||||
|
||||
html += `
|
||||
<div class="identical-item">
|
||||
<h6><i class="fas fa-key me-2"></i>Key: <code>${item.key}</code></h6>
|
||||
<div class="mt-2">
|
||||
<strong>值:</strong>
|
||||
<strong>值${typeInfo}:</strong>
|
||||
<pre class="redis-value mt-2">${formatRedisValue(item.value)}</pre>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
@@ -479,15 +484,15 @@ function displayMissingResults(missing) {
|
||||
<div class="mt-2">
|
||||
<span class="badge bg-warning">${item.message}</span>
|
||||
</div>
|
||||
${item.cluster1_value !== undefined ? `
|
||||
${item.cluster1_value !== undefined && item.cluster1_value !== null ? `
|
||||
<div class="mt-2">
|
||||
<strong>${currentResults.clusters.cluster1_name || '集群1'}:</strong>
|
||||
<strong>${currentResults.clusters.cluster1_name || '集群1'}${item.cluster1_type ? ` (${item.cluster1_type})` : ''}:</strong>
|
||||
<pre class="redis-value mt-1">${formatRedisValue(item.cluster1_value)}</pre>
|
||||
</div>
|
||||
` : ''}
|
||||
${item.cluster2_value !== undefined ? `
|
||||
${item.cluster2_value !== undefined && item.cluster2_value !== null ? `
|
||||
<div class="mt-2">
|
||||
<strong>${currentResults.clusters.cluster2_name || '集群2'}:</strong>
|
||||
<strong>${currentResults.clusters.cluster2_name || '集群2'}${item.cluster2_type ? ` (${item.cluster2_type})` : ''}:</strong>
|
||||
<pre class="redis-value mt-1">${formatRedisValue(item.cluster2_value)}</pre>
|
||||
</div>
|
||||
` : ''}
|
||||
@@ -1674,6 +1679,7 @@ function displayRawData(results) {
|
||||
function collectClusterData(results, clusterType) {
|
||||
const data = [];
|
||||
const clusterField = clusterType === 'cluster1' ? 'cluster1_value' : 'cluster2_value';
|
||||
const clusterTypeField = clusterType === 'cluster1' ? 'cluster1_type' : 'cluster2_type';
|
||||
|
||||
// 从相同结果中收集数据
|
||||
if (results.identical_results) {
|
||||
@@ -1682,7 +1688,8 @@ function collectClusterData(results, clusterType) {
|
||||
data.push({
|
||||
key: item.key,
|
||||
value: item.value,
|
||||
type: 'identical'
|
||||
type: 'identical',
|
||||
redis_type: item.type || 'unknown'
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1695,7 +1702,8 @@ function collectClusterData(results, clusterType) {
|
||||
data.push({
|
||||
key: item.key,
|
||||
value: item[clusterField],
|
||||
type: 'different'
|
||||
type: 'different',
|
||||
redis_type: item[clusterTypeField] || 'unknown'
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1704,11 +1712,12 @@ function collectClusterData(results, clusterType) {
|
||||
// 从缺失结果中收集数据
|
||||
if (results.missing_results) {
|
||||
results.missing_results.forEach(item => {
|
||||
if (item.key && item[clusterField] !== undefined) {
|
||||
if (item.key && item[clusterField] !== undefined && item[clusterField] !== null) {
|
||||
data.push({
|
||||
key: item.key,
|
||||
value: item[clusterField],
|
||||
type: 'missing'
|
||||
type: 'missing',
|
||||
redis_type: item[clusterTypeField] || 'unknown'
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -1740,11 +1749,12 @@ function renderRawData(clusterId, data, viewType) {
|
||||
data.forEach((item, index) => {
|
||||
const typeClass = getTypeClass(item.type);
|
||||
const formattedValue = formatRedisValue(item.value);
|
||||
const redisTypeInfo = item.redis_type ? ` [${item.redis_type}]` : '';
|
||||
|
||||
html += `
|
||||
<div class="raw-data-item mb-3 p-3 border rounded ${typeClass}">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<strong class="text-primary">Key: ${escapeHtml(item.key)}</strong>
|
||||
<strong class="text-primary">Key: ${escapeHtml(item.key)}${redisTypeInfo}</strong>
|
||||
<span class="badge bg-secondary">${item.type}</span>
|
||||
</div>
|
||||
<div class="raw-data-value">
|
||||
@@ -1760,7 +1770,8 @@ function renderRawData(clusterId, data, viewType) {
|
||||
html += '<pre class="redis-value">';
|
||||
data.forEach((item, index) => {
|
||||
html += `Key: ${escapeHtml(item.key)}\n`;
|
||||
html += `Type: ${item.type}\n`;
|
||||
html += `Redis Type: ${item.redis_type || 'unknown'}\n`;
|
||||
html += `Comparison Type: ${item.type}\n`;
|
||||
html += `Value: ${escapeHtml(String(item.value))}\n`;
|
||||
if (index < data.length - 1) {
|
||||
html += '\n' + '='.repeat(50) + '\n\n';
|
||||
|
Reference in New Issue
Block a user