Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue: Incorrectly displaying the parent project name as part of dependencies in POI detail page #559

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pages/BesAssessmentReport/SBOM/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ export default function Sbom({ data }: any) {
const [rowsPerPage, setRowsPerPage] = useState(15);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [filterName, setFilterName] = useState("");

let sonarqubeData: any;
if (data?.packages) sonarqubeData = data?.packages;
else sonarqubeData = [];

const filteredUsers = applySortFilter(
sonarqubeData,
getComparator("desc", "name"),
Expand Down
6 changes: 3 additions & 3 deletions src/pages/BesAssessmentReport/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const spanStyle: any = {
paddingRight: "13px",
};

function displayReport(besReport: any, report: any): any {
function displayReport(BeSName: string, besReport: any, report: any): any {
if (besReport === "Scorecard") {
return <ScorecardTable data={report} />;
}
Expand All @@ -38,7 +38,7 @@ function displayReport(besReport: any, report: any): any {
return <Fossology data={report} />;
}
if (besReport === "SBOM") {
return <Sbom data={report} />;
return <Sbom data={report}/>;
}
}

Expand Down Expand Up @@ -73,7 +73,7 @@ function BesAssessmentReport() {
<Grid container spacing={6}>
<Grid item xs={12}>
<Card sx={{mx: { xs: 2, lg: 3 }}}>
<MKBox >{displayReport(besReport, report)}</MKBox>
<MKBox >{displayReport(besName, besReport, report)}</MKBox>
</Card>
</Grid>
</Grid>
Expand Down
109 changes: 64 additions & 45 deletions src/pages/BesVersionHistory/AssessmentReport/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,6 @@ const FetchLicense = ({ data, uniq_lic, itemData }: any) => {
ld.LicenseConcluded.length === 0))
non_lic_files++;
});
//console.log("item data=" + JSON.stringify(itemData));
if (itemData.license && itemData.license.key) {
project_lcesnse = itemData.license.key;
}
Expand Down Expand Up @@ -652,17 +651,18 @@ const FetchLicense = ({ data, uniq_lic, itemData }: any) => {
}
};

const FetchSBOM = ({ data, masterData }: any) => {

const FetchSBOM = ({data, masterData, name}: any) => {
let tracked: string[] = [];
let dis: any = {};

data.forEach((dp) => {
if(dp.name.toLowerCase() === name.toLowerCase()){
return;
}
masterData.forEach((tp) => {
let duplicate: boolean = false;
if (dp.name === tp.name) {
if (dp.name.toLowerCase() === tp.name.toLowerCase()) {
tracked.forEach((tmptracked) => {
if (tmptracked === dp.name)
if (tmptracked.toLowerCase() === dp.name.toLowerCase())
duplicate = true;
});

Expand All @@ -671,7 +671,6 @@ const FetchSBOM = ({ data, masterData }: any) => {
}
});
});

dis = tracked.map(function (td: string, index: number) {
return (<>
<Grid item
Expand All @@ -692,20 +691,31 @@ const FetchSBOM = ({ data, masterData }: any) => {
</>
);
});

return (<>
<Grid key={`GRIDSBOMMAIN`}
style={{ minWidth: "200px" }}>
<MKTypography key="MKTypoSBOMMain" variant="body1"
{tracked.length !== 0 ? (
<MKTypography key="MKTypoSBOMMain" variant="body1"
color="inherit"
style={{
fontSize: "12px",
justifyContent: "left",
display: "flex",
paddingLeft: "calc(0.1rem + 0.3vw)"
}}>
<b key={`BOLDSBOM1`}>Tracked under BeS :</b>
</MKTypography>
<b key={`BOLDSBOM1`}>Tracked under BeS :</b>
</MKTypography>
) : (
<MKTypography key="MKTypoSBOMMain" variant="body1"
color="inherit"

style={{
fontSize: "12px", display: "flex",
justifyContent: "center", alignItems: "center", position: "relative", top: "55px"
}}>
<b key={`BOLDSBOM1`}>No dependencies tracked under BeS</b>
</MKTypography>
)}
<Grid key={`GRIDSBOMSUBMAIN`}
container>
{dis}
Expand All @@ -723,7 +733,6 @@ const GetAssessmentData = ({ version, name, report, itemData, masterData }: any)
let reportNameMapCodeql = "";
let reportNameMapSonar = "";


if (report === "Criticality Score") {
reportNameMap = "Criticality Score";
} else if (report === "Vulnerabilities") {
Expand Down Expand Up @@ -1044,42 +1053,48 @@ const GetAssessmentData = ({ version, name, report, itemData, masterData }: any)
</>
);
}

let flag = false;
if (report === "Dependencies" && jsonDataLength !== 0) {
return (<>
<Typography variant="h6"
key="TYPOSBOMMAIN1"
color="inherit"
style={{
fontSize: "calc(0.6rem + 0.5vw)"
}}>
<Link to={myObject}
key="LINKSBOMMAIN1"
if (!(jsonData.packages.length === 1 && jsonData.packages[0].name.toLowerCase() === name.toLowerCase())){
return (<>
<Typography variant="h6"
key="TYPOSBOMMAIN1"
color="inherit"
style={{
fontSize: "calc(0.6rem + 0.5vw)",
display: "flex",
justifyContent: "center"
fontSize: "calc(0.6rem + 0.5vw)"
}}>
{jsonData.packages.length}
</Link>
</Typography>
<Grid key="GRIDSBOMMAIN1"
style={{
height: "100px",
borderRadius: "3px"
}}
sx={{ overflowY: "scroll" }}>
<MKBox key="MKBOXSBOMMAIN1">
<FetchSBOM
data={jsonData.packages}
masterData={masterData}
/>
</MKBox>
</Grid>
</>
);
<Link to={myObject}
key="LINKSBOMMAIN1"
style={{
fontSize: "calc(0.6rem + 0.5vw)",
display: "flex",
justifyContent: "center"
}}>
{(jsonData.packages.length)-1}
</Link>
</Typography>
<Grid key="GRIDSBOMMAIN1"
style={{
height: "100px",
borderRadius: "3px"
}}
sx={{ overflowY: "scroll" }}>
<MKBox key="MKBOXSBOMMAIN1">
<FetchSBOM
data={jsonData.packages}
masterData={masterData}
name={name}
/>
</MKBox>
</Grid>
</>
);
} else {
flag = true;
}

}

return (
<MKTypography variant="h6"
key="TYPOSBOMMAINBLANK1"
Expand All @@ -1088,7 +1103,11 @@ const GetAssessmentData = ({ version, name, report, itemData, masterData }: any)
fontSize: "12px", display: "flex",
justifyContent: "center", alignItems: "center", position: "relative", top: "67px"
}}>
Not Available
{flag ? (
"No dependent packages are available"
) : (
"Assessment report not available"
)}
</MKTypography>
);
};
Expand Down
Loading