fix: 前端node.pipes显示bug+自动归类关键词精确化
This commit is contained in:
+26
-8
@@ -190,17 +190,35 @@ def build_feature_tree(cron_jobs, db_stats):
|
||||
"策略质量门禁": ["策略质量门禁"],
|
||||
"自选自动清理": ["自选自动清理"],
|
||||
"建议对账": ["建议对账"],
|
||||
"宏观新闻采集": ["宏观新闻采集"],
|
||||
"数据治理": ["数据治理"],
|
||||
"盘前热点扫描": ["盘前热点扫描"],
|
||||
"数据同步": ["数据同步"],
|
||||
"小果市场筛选": ["小果市场筛选"],
|
||||
"芯碁微装": ["芯碁微装"],
|
||||
"宏观新闻采集-周末": ["宏观新闻采集-周末"],
|
||||
"硬编码扫描": ["硬编码扫描"],
|
||||
"系统体检": ["系统体检"],
|
||||
"盘中自检": ["盘中自检"],
|
||||
"记忆守卫": ["记忆守卫"],
|
||||
"数据治理": ["数据治理"],
|
||||
"自选股自动重评": ["自选股自动重评"],
|
||||
"state.db真空整理": ["真空整理"],
|
||||
"300308": ["300308"],
|
||||
"多周期缓存": ["多周期缓存"],
|
||||
"元自成长": ["元自成长"],
|
||||
}
|
||||
# 自动归类:未被任何规则匹配的cron按名称关键词归入类别
|
||||
# 关键词必须够精确,避免误归类
|
||||
AUTO_CATEGORIES = [
|
||||
("数据采集", ["采集", "数据", "快照", "宏观", "新闻", "监控", "扫描", "价格", "资金", "上下文", "市场"]),
|
||||
("策略分析", ["策略", "评估", "重评", "自选", "买入", "新鲜度", "时效", "分支", "成长", "元"]),
|
||||
("推荐推送", ["简报", "推送", "推荐", "XMPP", "开盘", "收盘", "简报"]),
|
||||
("风险监控", ["风险", "背离", "宏观风险"]),
|
||||
("自检/审计", ["审计", "健康", "管道", "体检", "自检", "记忆", "硬编码", "守卫", "扫描", "治理"]),
|
||||
("执行/修复", ["执行", "门禁", "清理", "对账", "TODO"]),
|
||||
("信号消费", ["信号"]),
|
||||
("其他服务", ["真空", "整理", "模型"]),
|
||||
("数据采集", ["市场数据", "宏观采集", "新闻采集", "价格监控", "资金流采集", "小果独立扫描", "上下文刷新"]),
|
||||
("策略分析", ["策略评估", "策略时效性", "重评", "买入区提醒", "自成长", "策略复盘", "分支"]),
|
||||
("推荐推送", ["简报", "推送", "推荐", "XMPP", "开盘", "收盘"]),
|
||||
("风险监控", ["宏观风险", "背离检测", "信号消费"]),
|
||||
("自检/审计", ["系统全局审计", "健康监控", "管道审计", "系统体检", "盘中自检", "记忆守卫", "硬编码扫描", "治理"]),
|
||||
("执行/修复", ["自愈执行", "门禁", "清理", "对账", "TODO"]),
|
||||
("持仓监控", ["300308", "芯碁微装", "多周期缓存", "自选股自动重评"]),
|
||||
("系统服务", ["真空整理"]),
|
||||
]
|
||||
|
||||
matched_names = set() # 记录已匹配的cron name
|
||||
|
||||
@@ -71,8 +71,7 @@ function renderFeatureTree(tree) {
|
||||
const cls = node.status || 'ok';
|
||||
|
||||
// 尝试匹配cron
|
||||
const pipeKey = (node.label||'').toLowerCase().split('(')[0].trim();
|
||||
const pipes = node._pipes || [];
|
||||
const pipes = node.pipes || [];
|
||||
|
||||
if (pipes.length === 0) {
|
||||
// 无对应cron的功能节点
|
||||
@@ -131,34 +130,6 @@ function loadData() {
|
||||
.then(r=>r.json())
|
||||
.then(d=>{
|
||||
data = d;
|
||||
// 把pipeline关联到feature tree节点
|
||||
const pipeMap = {};
|
||||
d.pipelines.forEach(p => {
|
||||
const key = (p.name||p.script||'').toLowerCase().split('.')[0].trim();
|
||||
const label = (p.name||p.script||'').toLowerCase();
|
||||
pipeMap[key] = pipeMap[key] || [];
|
||||
pipeMap[key].push(p);
|
||||
// 也存label搜索
|
||||
pipeMap[label] = pipeMap[label] || [];
|
||||
pipeMap[label].push(p);
|
||||
});
|
||||
|
||||
// 给feature tree节点挂_pipes
|
||||
function attachPipes(node) {
|
||||
const key = (node.label||'').toLowerCase().split('(')[0].trim();
|
||||
node._pipes = pipeMap[key] || [];
|
||||
// 尝试用脚本名匹配
|
||||
if (!node._pipes.length) {
|
||||
const scriptMatch = (node.label||'').match(/\(([^)]+)\)/);
|
||||
if (scriptMatch) {
|
||||
const s = scriptMatch[1].toLowerCase().split('.')[0];
|
||||
node._pipes = pipeMap[s] || [];
|
||||
}
|
||||
}
|
||||
if (node.children) node.children.forEach(c => attachPipes(c));
|
||||
}
|
||||
attachPipes(d.feature_tree);
|
||||
|
||||
// 统计
|
||||
const cnt = {ok:0,warn:0,fail:0};
|
||||
function countStatus(n) { cnt[n.status]++; if(n.children) n.children.forEach(countStatus); }
|
||||
|
||||
Reference in New Issue
Block a user