Untitled
unknown
plain_text
2 years ago
2.7 kB
23
Indexable
tooltip: {
formatter: (params: any) => {
const source = params.data.source.replace(/userstory\/(\d+)\+\d+/g, 'US/$1');
const target = params.data.target.replace(/userstory\/(\d+)\+\d+/g, 'US/$1');
const regex = /(userstory|testcase|defect|task|feature|files)\/(\d+)\+\d+/g;
const sourceResult = source.replace(regex, (match: string, type: string, id: string) => {
let acronym = '';
switch (type) {
case 'userstory':
acronym = 'US';
break;
case 'testcase':
acronym = 'TC';
break;
case 'defect':
acronym = 'DF';
break;
case 'feature':
acronym = 'FT';
break;
case 'files':
acronym = 'CF';
break;
default:
acronym = type.toUpperCase();
}
return `${acronym}/${id}`;
});
const targetResult = target.replace(regex, (match: string, type: string, id: string) => {
let acronym = '';
switch (type) {
case 'userstory':
acronym = 'US';
break;
case 'testcase':
acronym = 'TC';
break;
case 'defect':
acronym = 'DF';
break;
case 'feature':
acronym = 'FT';
break;
case 'files':
acronym = 'CF';
break;
default:
acronym = type.toUpperCase();
}
return `${acronym}/${id}`;
});
if (edges?.level === 'ml') {
//return `${sourceResult} --> ${targetResult} : <b> ML Score: ${Math.round(params.data.score)}%</b>`;
const formattedTooltip = `${sourceResult} --> ${targetResult} : ML Score: ${Math.round(params.data.score)}%`;
console.log('Formatted Tooltip (ML):', formattedTooltip);
return formattedTooltip;
} else {
//return `${sourceResult} --> ${targetResult}`;
const formattedTooltip = `${sourceResult} --> ${targetResult}`;
console.log('Formatted Tooltip:', formattedTooltip);
return formattedTooltip;
}
},
},Editor is loading...
Leave a Comment