fix: 前端node.pipes显示bug+自动归类关键词精确化
This commit is contained in:
@@ -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