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

Fix title for Vulnerabilities and Risk Posture #648

Merged
merged 2 commits into from
Oct 8, 2024
Merged
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/apiDetailsConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"token": ""
},
"activeTool": "github",
"version": "0.19.1",
"version": "0.19.2",
"labName": "Be-Secure Community Lab"
}
20 changes: 18 additions & 2 deletions src/components/Charts/BarChart/VulHistory/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import ReactApexChart from "react-apexcharts";
import { useTheme } from "@mui/material/styles";
import useChart from "../useChart";
import MKBox from "../../../../components/MKBox";
import MKTypography from "../../../MKTypography";

function VulHistory({ vuldata }: any) {
function VulHistory({ vuldata, title }: any) {
const theme = useTheme();
const chartLabels = vuldata.map((i: { label: any }) => i.label);
const chartData = vuldata.map((i: { value: any }) => i.value);
const chartSeries = [{ name: "series-1", data: chartData }];
const chartSeries = [{ name: `CVEs Reported`, data: chartData }];

const chartOptions = useChart({
xaxis: {
Expand Down Expand Up @@ -82,6 +83,21 @@ function VulHistory({ vuldata }: any) {
<Card style={ { height: "100%" } }>
<MKBox>
<MKBox pt={ 1 } pb={ 1 } px={ 1 }>
{
(title === "Known Vulnerabilities") ? <MKTypography
variant="h6"
fontWeight="bold"
color="text"
textTransform="capitalize"
style={ {
fontSize: "15px",
display: "flex",
placeContent: "center",
} }
>
{ title }
</MKTypography> : <></>
}
<ReactApexChart
type="bar"
series={ chartSeries }
Expand Down
46 changes: 32 additions & 14 deletions src/components/Charts/PieChart/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@


import * as React from "react";

import Card from "@mui/material/Card";
Expand All @@ -10,6 +10,7 @@ import useChart from "./useChart";
import MKBox from "../../MKBox";
import { fNumber } from "../../../utils/formatNumber";
import { Typography } from "@mui/material";
import MKTypography from "../../MKTypography";

function PieChart({ title, chartColors, chartData, height }: any) {
const theme = useTheme();
Expand Down Expand Up @@ -41,23 +42,40 @@ function PieChart({ title, chartColors, chartData, height }: any) {
return (
<Card>
<MKBox pt={ 1 } pb={ 1 } px={ 1 }>
<Typography
display="flex"
justifyContent="left"
alignItems="left"
color="black"
fontSize="20px"
variant="h6"
pl={ 2 }
textTransform="capitalize"
>
{ title }
</Typography>
{
(title === "Risk Posture") ? <MKTypography
variant="h6"
fontWeight="bold"
color="text"
textTransform="capitalize"
style={ {
fontSize: "15px",
display: "flex",
position: "relative",
left: "-44px",
placeContent: "center",
} }
>
{ title }
</MKTypography> : <Typography
display="flex"
justifyContent="left"
alignItems="left"
color="black"
fontSize="20px"
variant="h6"
pl={ 2 }
textTransform="capitalize"
>
{ title }
</Typography>
}

<ReactApexChart
type="pie"
series={ chartSeries }
options={ chartOptions }
height={ height??195 }
height={ height ?? 195 }
/>
</MKBox>
</Card>
Expand Down
16 changes: 5 additions & 11 deletions src/pages/BesVersionHistory/AssessmentAnalytics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ const FetchData = ({
if (report === "Risk Posture") {
if (severityData.length !== 0) {
return (

<PieChart
title={ title }
chartData={ severityData }
Expand All @@ -134,9 +133,8 @@ const FetchData = ({
theme.palette.success.main,
theme.palette.secondary.main
] }
height={ 218 }
height={ 232 }
/>

);
} else {
return (
Expand All @@ -158,12 +156,10 @@ const FetchData = ({
</Card>
);
}
}

else if (report === "Vulnerability History") {
} else if (report === "Known Vulnerabilities") {
if (vulHistoryData.length !== 0) {
return (
<VulHistory vuldata={ vulHistoryData } />
<VulHistory vuldata={ vulHistoryData } title={ report } />
);
} else {
return (
Expand Down Expand Up @@ -198,14 +194,12 @@ function AssessmentAnalytics({
}: any) {
const report: string[] = [
"Risk Posture",
"Vulnerability History"
// "Critical Issues"
"Known Vulnerabilities"
];
return (
<Grid container pt={ 2 } spacing={ 1 } style={ { display: "flex", justifyContent: "space-between" } }>
{ /* <Grid container spacing={1} pt={2} style={{ display: "flex", justifyContent: "space-around" }}> */ }

{ report.map((value, index) => {
{ report.map((value) => {
return (

<Grid item xs={ 12 } md={ 6 }
Expand Down
Loading