同步完整源码至远程:扁平化重构现状 + 未入库源文件

- 补入库:server/internal/db/dump.go、redis 分页/扫描预算测试、opsxdb-mcp main_test、
  packages/opsxdb-mcp package-lock、docs 审计与对比文档等 37 个新文件
- 含结构扁平化进行中的 80 处修改与 155 处旧结构删除(server/ src/ src-tauri/ 为当前有效源)
- 构建产物(bin/target/dist)与签名私钥仍按规则排除
This commit is contained in:
logan committed 2026-10-16 03:47:33 +08:00
1 parent 5c0be49217
commit 2c0bfafd8d
269 files changed
+10372 -16435

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
import { cellText } from "./contextActions";
export const RESULT_BATCH = 500;
export function filterRows(rows: Record<string, unknown>[], columns: string[], query: string) {
const q = query.trim().toLocaleLowerCase();
return q ? rows.filter((row) => columns.some((col) => cellText(row[col]).toLocaleLowerCase().includes(q))) : rows;
}
/** 大整数文本不经 Number 转换,避免精度丢失后排序相等。 */
export function compareCells(a: unknown, b: unknown): number {
if (a == null || b == null) return a == null ? (b == null ? 0 : -1) : 1;
if (typeof a === "number" && typeof b === "number") return a - b;
const sa = cellText(a), sb = cellText(b);
if (/^-?\d+$/.test(sa) && /^-?\d+$/.test(sb)) {
const ia = BigInt(sa), ib = BigInt(sb);
return ia < ib ? -1 : ia > ib ? 1 : 0;
}
const numeric = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
if (numeric.test(sa) && numeric.test(sb) && Number.isFinite(Number(sa)) && Number.isFinite(Number(sb))) return Number(sa) - Number(sb);
return sa.localeCompare(sb, undefined, { numeric: true, sensitivity: "base" });
}
export function cellPreview(value: unknown, max = 120): string {
const text = cellText(value);
return text.length > max ? `${text.slice(0, max)}…` : text;
}
export function suggestedColumnWidth(name: string, rows: Record<string, unknown>[]): number {
// 有界采样;宽字符按两个单位估算,长 JSON 不撑满窗口。
const units = (s: string) => Array.from(s).reduce((n, ch) => n + (ch.charCodeAt(0) > 255 ? 2 : 1), 0);
const count = Math.max(units(name), ...rows.slice(0, 100).map((r) => units(cellPreview(r[name], 60))));
return Math.min(480, Math.max(88, count * 7 + 28));
}