分割仓库标识获取版本号信息

This commit is contained in:
谢思 2026-03-10 09:20:36 +08:00
parent b2e048bfdb
commit 33ba70459f
1 changed files with 12 additions and 1 deletions

View File

@ -131,9 +131,11 @@ function ProjectHomePage(props) {
// projects
const projectsWithTrustLevel = result.data.projects.map(async project => {
try {
const [part1, part2] = splitLastUnderscore(project.identifier);
const response = await axios.post(`${governance}/detect/software/trustPage`,
{
softwareName: project.identifier,
softwareName: part1,
softwareVersion: part2,
size: 1,
current: 1
}
@ -172,6 +174,15 @@ function ProjectHomePage(props) {
}).catch(error => { })
}
function splitLastUnderscore(str) {
const parts = str.split('_');
const lastPart = parts.length > 1 ? parts.pop() : '';
const firstPart = parts.join('_');
return [firstPart, lastPart];
}
//
return <div className="homepage-box">
{/* banner区域内容 */}
<div className="width1600 mb40">