diff --git a/src/__tests__/Explore/Explore.test.js b/src/__tests__/Explore/Explore.test.js
index 0e71f6a1..afe2731d 100644
--- a/src/__tests__/Explore/Explore.test.js
+++ b/src/__tests__/Explore/Explore.test.js
@@ -150,24 +150,24 @@ describe('Explore component', () => {
expect(await screen.findByText(/Looks like/i)).toBeInTheDocument();
});
- it('renders signature chips', async () => {
+ it('renders signature icons', async () => {
// @ts-ignore
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockImageList } });
render();
- expect(await screen.findAllByTestId('unverified-chip')).toHaveLength(1);
- expect(await screen.findAllByTestId('verified-chip')).toHaveLength(5);
+ expect(await screen.findAllByTestId('unverified-icon')).toHaveLength(1);
+ expect(await screen.findAllByTestId('verified-icon')).toHaveLength(5);
});
- it('renders vulnerability chips', async () => {
+ it('renders vulnerability icons', async () => {
// @ts-ignore
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockImageList } });
render();
- expect(await screen.findAllByTestId('low-vulnerability-chip')).toHaveLength(1);
- expect(await screen.findAllByTestId('high-vulnerability-chip')).toHaveLength(1);
- expect(await screen.findAllByTestId('critical-vulnerability-chip')).toHaveLength(1);
- expect(await screen.findAllByTestId('none-vulnerability-chip')).toHaveLength(1);
- expect(await screen.findAllByTestId('medium-vulnerability-chip')).toHaveLength(1);
- expect(await screen.findAllByTestId('unknown-vulnerability-chip')).toHaveLength(1);
+ expect(await screen.findAllByTestId('low-vulnerability-icon')).toHaveLength(1);
+ expect(await screen.findAllByTestId('high-vulnerability-icon')).toHaveLength(1);
+ expect(await screen.findAllByTestId('critical-vulnerability-icon')).toHaveLength(1);
+ expect(await screen.findAllByTestId('none-vulnerability-icon')).toHaveLength(1);
+ expect(await screen.findAllByTestId('medium-vulnerability-icon')).toHaveLength(1);
+ expect(await screen.findAllByTestId('unknown-vulnerability-icon')).toHaveLength(1);
});
it("should log an error when data can't be fetched", async () => {
diff --git a/src/__tests__/HomePage/Home.test.js b/src/__tests__/HomePage/Home.test.js
index b5c70ff3..45be1b6b 100644
--- a/src/__tests__/HomePage/Home.test.js
+++ b/src/__tests__/HomePage/Home.test.js
@@ -137,22 +137,20 @@ describe('Home component', () => {
await waitFor(() => expect(screen.getAllByText(/node/i)).toHaveLength(1));
});
- it('renders signature chips', async () => {
+ it('renders signature icons', async () => {
// @ts-ignore
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockImageList } });
render();
- expect(await screen.findAllByTestId('unverified-icon')).toHaveLength(1);
- expect(await screen.findAllByTestId('verified-icon')).toHaveLength(3);
- expect(await screen.findAllByTestId('unverified-chip')).toHaveLength(1);
- expect(await screen.findAllByTestId('verified-chip')).toHaveLength(1);
+ expect(await screen.findAllByTestId('unverified-icon')).toHaveLength(2);
+ expect(await screen.findAllByTestId('verified-icon')).toHaveLength(4);
});
it('renders vulnerability icons', async () => {
// @ts-ignore
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockImageList } });
render();
- expect(await screen.findAllByTestId('low-vulnerability-icon')).toHaveLength(1);
- expect(await screen.findAllByTestId('high-vulnerability-icon')).toHaveLength(1);
+ expect(await screen.findAllByTestId('low-vulnerability-icon')).toHaveLength(2);
+ expect(await screen.findAllByTestId('high-vulnerability-icon')).toHaveLength(2);
expect(await screen.findAllByTestId('critical-vulnerability-icon')).toHaveLength(1);
expect(await screen.findAllByTestId('none-vulnerability-icon')).toHaveLength(1);
});
diff --git a/src/__tests__/RepoPage/Repo.test.js b/src/__tests__/RepoPage/Repo.test.js
index dd9320ba..c1e45267 100644
--- a/src/__tests__/RepoPage/Repo.test.js
+++ b/src/__tests__/RepoPage/Repo.test.js
@@ -167,31 +167,31 @@ describe('Repo details component', () => {
expect(await screen.findByText('test')).toBeInTheDocument();
});
- it('renders vulnerability chips', async () => {
+ it('renders vulnerability icons', async () => {
// @ts-ignore
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockRepoDetailsData } });
render();
- expect(await screen.findAllByTestId('critical-vulnerability-chip')).toHaveLength(1);
+ expect(await screen.findAllByTestId('critical-vulnerability-icon')).toHaveLength(1);
// @ts-ignore
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockRepoDetailsNone } });
render();
- expect(await screen.findAllByTestId('none-vulnerability-chip')).toHaveLength(1);
+ expect(await screen.findAllByTestId('none-vulnerability-icon')).toHaveLength(1);
// @ts-ignore
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockRepoDetailsUnknown } });
render();
- expect(await screen.findAllByTestId('unknown-vulnerability-chip')).toHaveLength(1);
+ expect(await screen.findAllByTestId('unknown-vulnerability-icon')).toHaveLength(1);
// @ts-ignore
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockRepoDetailsLow } });
render();
- expect(await screen.findAllByTestId('low-vulnerability-chip')).toHaveLength(1);
+ expect(await screen.findAllByTestId('low-vulnerability-icon')).toHaveLength(1);
// @ts-ignore
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockRepoDetailsMedium } });
render();
- expect(await screen.findAllByTestId('medium-vulnerability-chip')).toHaveLength(1);
+ expect(await screen.findAllByTestId('medium-vulnerability-icon')).toHaveLength(1);
// @ts-ignore
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockRepoDetailsHigh } });
render();
- expect(await screen.findAllByTestId('high-vulnerability-chip')).toHaveLength(1);
+ expect(await screen.findAllByTestId('high-vulnerability-icon')).toHaveLength(1);
});
it("should log error if data can't be fetched", async () => {
diff --git a/src/__tests__/TagPage/TagDetails.test.js b/src/__tests__/TagPage/TagDetails.test.js
index e1264515..32bb0763 100644
--- a/src/__tests__/TagPage/TagDetails.test.js
+++ b/src/__tests__/TagPage/TagDetails.test.js
@@ -216,31 +216,31 @@ describe('Tags details', () => {
expect(await screen.findByTestId('tagDetailsMetadata-container')).toBeInTheDocument();
});
- it('renders vulnerability chips', async () => {
+ it('renders vulnerability icons', async () => {
// @ts-ignore
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockImage } });
render();
- expect(await screen.findAllByTestId('critical-vulnerability-chip')).toHaveLength(1);
+ expect(await screen.findAllByTestId('critical-vulnerability-icon')).toHaveLength(1);
// @ts-ignore
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockImageNone } });
render();
- expect(await screen.findAllByTestId('none-vulnerability-chip')).toHaveLength(1);
+ expect(await screen.findAllByTestId('none-vulnerability-icon')).toHaveLength(1);
// @ts-ignore
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockImageUnknown } });
render();
- expect(await screen.findAllByTestId('unknown-vulnerability-chip')).toHaveLength(1);
+ expect(await screen.findAllByTestId('unknown-vulnerability-icon')).toHaveLength(1);
// @ts-ignore
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockImageLow } });
render();
- expect(await screen.findAllByTestId('low-vulnerability-chip')).toHaveLength(1);
+ expect(await screen.findAllByTestId('low-vulnerability-icon')).toHaveLength(1);
// @ts-ignore
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockImageMedium } });
render();
- expect(await screen.findAllByTestId('medium-vulnerability-chip')).toHaveLength(1);
+ expect(await screen.findAllByTestId('medium-vulnerability-icon')).toHaveLength(1);
// @ts-ignore
jest.spyOn(api, 'get').mockResolvedValue({ status: 200, data: { data: mockImageHigh } });
render();
- expect(await screen.findAllByTestId('high-vulnerability-chip')).toHaveLength(1);
+ expect(await screen.findAllByTestId('high-vulnerability-icon')).toHaveLength(1);
});
it('should copy the pull string to clipboard', async () => {
diff --git a/src/components/PreviewCard.jsx b/src/components/PreviewCard.jsx
index 0d51b180..c6edd35f 100644
--- a/src/components/PreviewCard.jsx
+++ b/src/components/PreviewCard.jsx
@@ -9,13 +9,8 @@ import repocube2 from '../assets/repocube-2.png';
import repocube3 from '../assets/repocube-3.png';
import repocube4 from '../assets/repocube-4.png';
-//icons
-import GppBadOutlinedIcon from '@mui/icons-material/GppBadOutlined';
-import GppGoodOutlinedIcon from '@mui/icons-material/GppGoodOutlined';
-import PestControlOutlinedIcon from '@mui/icons-material/PestControlOutlined';
-import PestControlIcon from '@mui/icons-material/PestControl';
import { isEmpty } from 'lodash';
-//import GppMaybeOutlinedIcon from '@mui/icons-material/GppMaybeOutlined';
+import { VulnerabilityIconCheck, SignatureIconCheck } from 'utilities/vulnerabilityAndSignatureCheck';
// temporary utility to get image
const randomIntFromInterval = (min, max) => {
@@ -72,151 +67,12 @@ const useStyles = makeStyles(() => ({
function PreviewCard(props) {
const classes = useStyles();
const navigate = useNavigate();
- const { name, isSigned, vulnerabiltySeverity, vulnerabilityCount, logo } = props;
+ const { name, isSigned, vulnerabiltySeverity, logo } = props;
const goToDetails = () => {
navigate(`/image/${encodeURIComponent(name)}`);
};
- const vulnerabilityCheck = () => {
- const noneVulnerability = (
-
- );
- const unknownVulnerability = (
-
- );
- const lowVulnerability = (
-
- );
- const mediumVulnerability = (
-
- );
- const highVulnerability = (
-
- );
- const criticalVulnerability = (
-
- );
-
- let result;
- switch (vulnerabiltySeverity) {
- case 'NONE':
- result = noneVulnerability;
- break;
- case 'LOW':
- result = lowVulnerability;
- break;
- case 'MEDIUM':
- result = mediumVulnerability;
- break;
- case 'HIGH':
- result = highVulnerability;
- break;
- case 'CRITICAL':
- result = criticalVulnerability;
- break;
- default:
- result = unknownVulnerability;
- }
-
- return result;
- };
-
- const signatureCheck = () => {
- const unverifiedSignature = (
-
- );
- //const untrustedSignature = ;
- const verifiedSignature = (
-
- );
- if (isSigned) {
- return verifiedSignature;
- } else {
- return unverifiedSignature;
- }
- };
-
return (
goToDetails()} className={classes.cardBtn}>
@@ -251,10 +107,8 @@ function PreviewCard(props) {
-
- {vulnerabilityCheck()}
-
- {signatureCheck()}
+
+
diff --git a/src/components/RepoCard.jsx b/src/components/RepoCard.jsx
index 5cb445db..da74c594 100644
--- a/src/components/RepoCard.jsx
+++ b/src/components/RepoCard.jsx
@@ -14,12 +14,8 @@ import repocube2 from '../assets/repocube-2.png';
import repocube3 from '../assets/repocube-3.png';
import repocube4 from '../assets/repocube-4.png';
-//icons
-import GppBadOutlinedIcon from '@mui/icons-material/GppBadOutlined';
-import GppGoodOutlinedIcon from '@mui/icons-material/GppGoodOutlined';
+import { VulnerabilityIconCheck, SignatureIconCheck } from 'utilities/vulnerabilityAndSignatureCheck';
import { Markdown } from 'utilities/MarkdowntojsxWrapper';
-import PestControlOutlinedIcon from '@mui/icons-material/PestControlOutlined';
-import PestControlIcon from '@mui/icons-material/PestControl';
import { isEmpty } from 'lodash';
// temporary utility to get image
@@ -104,144 +100,13 @@ function RepoCard(props) {
lastUpdated,
logo,
version,
- vulnerabiltySeverity,
- vulnerabilityCount
+ vulnerabiltySeverity
} = props;
const goToDetails = () => {
navigate(`/image/${encodeURIComponent(name)}`);
};
- const vulnerabilityCheck = () => {
- const noneVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="none-vulnerability-chip"
- />
- );
- const unknownVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="unknown-vulnerability-chip"
- />
- );
- const lowVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="low-vulnerability-chip"
- />
- );
- const mediumVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="medium-vulnerability-chip"
- />
- );
- const highVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="high-vulnerability-chip"
- />
- );
- const criticalVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="critical-vulnerability-chip"
- />
- );
- let result;
- switch (vulnerabiltySeverity) {
- case 'NONE':
- result = noneVulnerability;
- break;
- case 'LOW':
- result = lowVulnerability;
- break;
- case 'MEDIUM':
- result = mediumVulnerability;
- break;
- case 'HIGH':
- result = highVulnerability;
- break;
- case 'CRITICAL':
- result = criticalVulnerability;
- break;
- default:
- result = unknownVulnerability;
- }
-
- return result;
- };
-
- const signatureCheck = () => {
- const unverifiedSignature = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="unverified-chip"
- />
- );
- //const untrustedSignature = { return; }} deleteIcon={ }/>;
- const verifiedSignature = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="verified-chip"
- />
- );
- if (isSigned) {
- return verifiedSignature;
- } else {
- return unverifiedSignature;
- }
- };
-
const platformChips = () => {
// if platforms not received, mock data
const platformsOsArch = platforms || [];
@@ -301,10 +166,8 @@ function RepoCard(props) {
{name}
-
- {vulnerabilityCheck()}
-
- {signatureCheck()}
+
+
{/* { return }} deleteIcon={vulnerabilityCheck()} /> */}
diff --git a/src/components/RepoDetails.jsx b/src/components/RepoDetails.jsx
index a053ef58..8e1518ba 100644
--- a/src/components/RepoDetails.jsx
+++ b/src/components/RepoDetails.jsx
@@ -7,7 +7,7 @@ import { api, endpoints } from '../api';
// components
import Tags from './Tags.jsx';
-import { Box, Card, CardContent, CardMedia, Chip, Grid, Stack, Tab, Tooltip, Typography } from '@mui/material';
+import { Box, Card, CardContent, CardMedia, Chip, Grid, Stack, Tab, Typography } from '@mui/material';
import makeStyles from '@mui/styles/makeStyles';
import { host } from '../host';
@@ -18,14 +18,10 @@ import repocube3 from '../assets/repocube-3.png';
import repocube4 from '../assets/repocube-4.png';
import { TabContext, TabList, TabPanel } from '@mui/lab';
-//icons
-import GppBadOutlinedIcon from '@mui/icons-material/GppBadOutlined';
-import GppGoodOutlinedIcon from '@mui/icons-material/GppGoodOutlined';
-import PestControlOutlinedIcon from '@mui/icons-material/PestControlOutlined';
-import PestControlIcon from '@mui/icons-material/PestControl';
import RepoDetailsMetadata from './RepoDetailsMetadata';
import Loading from './Loading';
import { isEmpty } from 'lodash';
+import { VulnerabilityIconCheck, SignatureIconCheck } from 'utilities/vulnerabilityAndSignatureCheck';
// @ts-ignore
const useStyles = makeStyles(() => ({
@@ -176,135 +172,6 @@ function RepoDetails() {
};
}, [name]);
- const signatureCheck = () => {
- const unverifiedSignature = (
- {
- return;
- }}
- deleteIcon={}
- />
- );
- const verifiedSignature = (
- {
- return;
- }}
- deleteIcon={}
- />
- );
- // @ts-ignore
- if (repoDetailData.isSigned) {
- return verifiedSignature;
- } else {
- return unverifiedSignature;
- }
- };
-
- const vulnerabilityCheck = () => {
- const noneVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="none-vulnerability-chip"
- />
- );
- const unknownVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="unknown-vulnerability-chip"
- />
- );
- const lowVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="low-vulnerability-chip"
- />
- );
- const mediumVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="medium-vulnerability-chip"
- />
- );
- const highVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="high-vulnerability-chip"
- />
- );
- const criticalVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="critical-vulnerability-chip"
- />
- );
- let result;
- // @ts-ignore
- switch (repoDetailData.vulnerabiltySeverity) {
- case 'NONE':
- result = noneVulnerability;
- break;
- case 'LOW':
- result = lowVulnerability;
- break;
- case 'MEDIUM':
- result = mediumVulnerability;
- break;
- case 'HIGH':
- result = highVulnerability;
- break;
- case 'CRITICAL':
- result = criticalVulnerability;
- break;
- default:
- result = unknownVulnerability;
- }
-
- return result;
- };
-
const platformChips = () => {
// @ts-ignore
const platforms = repoDetailData?.platforms || [];
@@ -382,22 +249,30 @@ function RepoDetails() {
component="img"
// @ts-ignore
// eslint-disable-next-line prettier/prettier
- image={!isEmpty(repoDetailData?.logo) ? `data:image/png;base64, ${repoDetailData?.logo}` : randomImage()}
+ image={
+ // @ts-ignore
+ !isEmpty(repoDetailData?.logo)
+ ? // @ts-ignore
+ `data:image/png;base64, ${repoDetailData?.logo}`
+ : randomImage()
+ }
alt="icon"
/>
{name}
-
- {vulnerabilityCheck()}
-
- {signatureCheck()}
+ />
+
{/* */}
({
@@ -206,135 +199,6 @@ function TagDetails() {
};
}, [name, tag]);
- const signatureCheck = () => {
- const unverifiedSignature = (
- {
- return;
- }}
- deleteIcon={}
- />
- );
- const verifiedSignature = (
- {
- return;
- }}
- deleteIcon={}
- />
- );
- // @ts-ignore
- if (imageDetailData.isSigned) {
- return verifiedSignature;
- } else {
- return unverifiedSignature;
- }
- };
-
- const vulnerabilityCheck = () => {
- const noneVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="none-vulnerability-chip"
- />
- );
- const unknownVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="unknown-vulnerability-chip"
- />
- );
- const lowVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="low-vulnerability-chip"
- />
- );
- const mediumVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="medium-vulnerability-chip"
- />
- );
- const highVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="high-vulnerability-chip"
- />
- );
- const criticalVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- data-testid="critical-vulnerability-chip"
- />
- );
- let result;
- // @ts-ignore
- switch (imageDetailData.vulnerabiltySeverity) {
- case 'NONE':
- result = noneVulnerability;
- break;
- case 'LOW':
- result = lowVulnerability;
- break;
- case 'MEDIUM':
- result = mediumVulnerability;
- break;
- case 'HIGH':
- result = highVulnerability;
- break;
- case 'CRITICAL':
- result = criticalVulnerability;
- break;
- default:
- result = unknownVulnerability;
- }
-
- return result;
- };
-
const getPlatform = () => {
// @ts-ignore
return imageDetailData?.platform ? imageDetailData.platform : '--/--';
@@ -377,23 +241,28 @@ function TagDetails() {
image={
// @ts-ignore
// eslint-disable-next-line prettier/prettier
- !isEmpty(imageDetailData?.logo) ? `data:image/ png;base64, ${imageDetailData?.logo}` : randomImage()
+ !isEmpty(imageDetailData?.logo)
+ ? // @ts-ignore
+ `data:image/ png;base64, ${imageDetailData?.logo}`
+ : randomImage()
}
alt="icon"
/>
{name}:{tag}
-
- {vulnerabilityCheck()}
-
- {signatureCheck()}
+ />
+
{/* */}
({
card: {
@@ -83,98 +82,6 @@ const useStyles = makeStyles(() => ({
}
}));
-const vulnerabilityCheck = (status) => {
- const noneVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- />
- );
- const unknownVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- />
- );
- const lowVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- />
- );
- const mediumVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- />
- );
- const highVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- />
- );
- const criticalVulnerability = (
- {
- return;
- }}
- deleteIcon={}
- />
- );
-
- let result;
- switch (status) {
- case 'NONE':
- result = noneVulnerability;
- break;
- case 'LOW':
- result = lowVulnerability;
- break;
- case 'MEDIUM':
- result = mediumVulnerability;
- break;
- case 'HIGH':
- result = highVulnerability;
- break;
- case 'CRITICAL':
- result = criticalVulnerability;
- break;
- default:
- result = unknownVulnerability;
- }
-
- return result;
-};
-
function VulnerabilitiyCard(props) {
const classes = useStyles();
const { cve, name } = props;
@@ -225,7 +132,7 @@ function VulnerabilitiyCard(props) {
{cve.Id}
- {vulnerabilityCheck(cve.Severity)}
+
{' '}
diff --git a/src/utilities/vulnerabilityAndSignatureCheck.js b/src/utilities/vulnerabilityAndSignatureCheck.js
new file mode 100644
index 00000000..e98f4917
--- /dev/null
+++ b/src/utilities/vulnerabilityAndSignatureCheck.js
@@ -0,0 +1,89 @@
+import React from 'react';
+import {
+ NoneVulnerabilityIcon,
+ UnknownVulnerabilityIcon,
+ LowVulnerabilityIcon,
+ MediumVulnerabilityIcon,
+ HighVulnerabilityIcon,
+ CriticalVulnerabilityIcon,
+ NoneVulnerabilityChip,
+ UnknownVulnerabilityChip,
+ LowVulnerabilityChip,
+ MediumVulnerabilityChip,
+ HighVulnerabilityChip,
+ CriticalVulnerabilityChip,
+ UnverifiedSignatureIcon,
+ VerifiedSignatureIcon,
+ UnverifiedSignatureChip,
+ VerifiedSignatureChip
+} from './vulnerabilityAndSignatureComponents';
+
+const VulnerabilityIconCheck = ({ vulnerabilitySeverity }) => {
+ let result;
+ let vulnerabilityStringTitle = '';
+ if (vulnerabilitySeverity) {
+ vulnerabilityStringTitle = vulnerabilitySeverity.charAt(0) + vulnerabilitySeverity.substring(1).toLowerCase();
+ }
+ switch (vulnerabilitySeverity) {
+ case 'NONE':
+ result = ;
+ break;
+ case 'LOW':
+ result = ;
+ break;
+ case 'MEDIUM':
+ result = ;
+ break;
+ case 'HIGH':
+ result = ;
+ break;
+ case 'CRITICAL':
+ result = ;
+ break;
+ default:
+ result = ;
+ }
+ return result;
+};
+
+const VulnerabilityChipCheck = ({ vulnerabilitySeverity }) => {
+ let result;
+ switch (vulnerabilitySeverity) {
+ case 'NONE':
+ result = ;
+ break;
+ case 'LOW':
+ result = ;
+ break;
+ case 'MEDIUM':
+ result = ;
+ break;
+ case 'HIGH':
+ result = ;
+ break;
+ case 'CRITICAL':
+ result = ;
+ break;
+ default:
+ result = ;
+ }
+ return result;
+};
+
+const SignatureIconCheck = ({ isSigned }) => {
+ if (isSigned) {
+ return ;
+ } else {
+ return ;
+ }
+};
+
+const SignatureChipCheck = ({ isSigned }) => {
+ if (isSigned) {
+ return ;
+ } else {
+ return ;
+ }
+};
+
+export { VulnerabilityIconCheck, VulnerabilityChipCheck, SignatureIconCheck, SignatureChipCheck };
diff --git a/src/utilities/vulnerabilityAndSignatureComponents.jsx b/src/utilities/vulnerabilityAndSignatureComponents.jsx
new file mode 100644
index 00000000..d83eb503
--- /dev/null
+++ b/src/utilities/vulnerabilityAndSignatureComponents.jsx
@@ -0,0 +1,275 @@
+import React from 'react';
+import { Chip, Tooltip } from '@mui/material';
+import PestControlOutlinedIcon from '@mui/icons-material/PestControlOutlined';
+import PestControlIcon from '@mui/icons-material/PestControl';
+import GppBadOutlinedIcon from '@mui/icons-material/GppBadOutlined';
+import GppGoodOutlinedIcon from '@mui/icons-material/GppGoodOutlined';
+
+const NoneVulnerabilityIcon = ({ vulnerabilityStringTitle }) => {
+ return (
+
+
+
+ );
+};
+const UnknownVulnerabilityIcon = ({ vulnerabilityStringTitle }) => {
+ return (
+
+
+
+ );
+};
+const LowVulnerabilityIcon = ({ vulnerabilityStringTitle }) => {
+ return (
+
+
+
+ );
+};
+const MediumVulnerabilityIcon = ({ vulnerabilityStringTitle }) => {
+ return (
+
+
+
+ );
+};
+const HighVulnerabilityIcon = ({ vulnerabilityStringTitle }) => {
+ return (
+
+
+
+ );
+};
+const CriticalVulnerabilityIcon = ({ vulnerabilityStringTitle }) => {
+ return (
+
+
+
+ );
+};
+
+const NoneVulnerabilityChip = () => {
+ return (
+ {
+ return;
+ }}
+ deleteIcon={}
+ data-testid="none-vulnerability-chip"
+ />
+ );
+};
+const UnknownVulnerabilityChip = () => {
+ return (
+ {
+ return;
+ }}
+ deleteIcon={}
+ data-testid="unknown-vulnerability-chip"
+ />
+ );
+};
+const LowVulnerabilityChip = () => {
+ return (
+ {
+ return;
+ }}
+ deleteIcon={}
+ data-testid="low-vulnerability-chip"
+ />
+ );
+};
+const MediumVulnerabilityChip = () => {
+ return (
+ {
+ return;
+ }}
+ deleteIcon={}
+ data-testid="medium-vulnerability-chip"
+ />
+ );
+};
+const HighVulnerabilityChip = () => {
+ return (
+ {
+ return;
+ }}
+ deleteIcon={}
+ data-testid="high-vulnerability-chip"
+ />
+ );
+};
+const CriticalVulnerabilityChip = () => {
+ return (
+ {
+ return;
+ }}
+ deleteIcon={}
+ data-testid="critical-vulnerability-chip"
+ />
+ );
+};
+
+const UnverifiedSignatureIcon = () => {
+ return (
+
+
+
+ );
+};
+const VerifiedSignatureIcon = () => {
+ return (
+
+
+
+ );
+};
+
+const UnverifiedSignatureChip = () => {
+ return (
+ {
+ return;
+ }}
+ deleteIcon={}
+ />
+ );
+};
+const VerifiedSignatureChip = () => {
+ return (
+ {
+ return;
+ }}
+ deleteIcon={}
+ />
+ );
+};
+
+export {
+ NoneVulnerabilityIcon,
+ UnknownVulnerabilityIcon,
+ LowVulnerabilityIcon,
+ MediumVulnerabilityIcon,
+ HighVulnerabilityIcon,
+ CriticalVulnerabilityIcon,
+ NoneVulnerabilityChip,
+ UnknownVulnerabilityChip,
+ LowVulnerabilityChip,
+ MediumVulnerabilityChip,
+ HighVulnerabilityChip,
+ CriticalVulnerabilityChip,
+ UnverifiedSignatureIcon,
+ VerifiedSignatureIcon,
+ UnverifiedSignatureChip,
+ VerifiedSignatureChip
+};