From 2049dfcdec587fa2cb6b260531f723fe54bea0b1 Mon Sep 17 00:00:00 2001 From: sudhir verma Date: Fri, 30 Aug 2024 16:33:07 +0530 Subject: [PATCH] Added Lab Name and OSAR download and check mark --- src/apiDetailsConfig.json | 3 +- .../Navbars/DefaultNavbar/index.tsx | 9 +- src/pages/BesVersionHistory/index.tsx | 101 ++++++++++++------ .../AdversarialAttackSummary.tsx | 2 +- 4 files changed, 75 insertions(+), 40 deletions(-) diff --git a/src/apiDetailsConfig.json b/src/apiDetailsConfig.json index 2dde9798..4c037bdc 100644 --- a/src/apiDetailsConfig.json +++ b/src/apiDetailsConfig.json @@ -13,5 +13,6 @@ "token": "" }, "activeTool": "github", - "version": "0.19.0" + "version": "0.19.1", + "labName": "Be-Secure Community Lab" } \ No newline at end of file diff --git a/src/components/Navbars/DefaultNavbar/index.tsx b/src/components/Navbars/DefaultNavbar/index.tsx index 8606690f..e44300d8 100644 --- a/src/components/Navbars/DefaultNavbar/index.tsx +++ b/src/components/Navbars/DefaultNavbar/index.tsx @@ -510,9 +510,12 @@ function DefaultNavbar({ - Version: { jsonData.version } + + Powered By   + + BeSLighthouse { jsonData.version } { @@ -165,7 +175,29 @@ function BesVersionHistory() { // eslint-disable-next-line react-hooks/exhaustive-deps }, []); - const [selectedOption, setSelectedOption] = React.useState(""); + React.useEffect(() => { + // Call osspoiMasterAndSummary only when selectedOption changes + if (selectedOption) { + + const osarReportLink = `${assessmentDatastoreURL}/${besName}/${selectedOption}/${besName}-osar.json`; + const cosignLink = `${assessmentDatastoreURL}/${besName}/${selectedOption}/cosign.pub`; + + verifyLink(osarReportLink, setOsarReportData); + checkFileExists(cosignLink, setCosignLink); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [selectedOption]); + + const downloadJson = () => { + const jsonContent = JSON.stringify(getOsarReport); + const blob = new Blob([jsonContent], { type: 'application/json' }); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.setAttribute('download', `${besName}-${selectedOption}-osar.json`); + document.body.appendChild(link); + link.click(); + }; try { if (!selectedOption && versionSummary) { @@ -344,50 +376,49 @@ function BesVersionHistory() { { item.id } - { /* For Open Source Assurance Provider */ } - - OASP:   - - { /* Tooltip is used to provide the title for the icon */ } - - - - - { item.owner.login } - + + + +   repository + + - } - disabled + - OSAR - + OSAR:   + +
+ { Object.keys(getOsarReport).length === 0 ? + Not Available + : } + { getCosignLink ? Checked Icon : <> } +