Skip to content

Commit

Permalink
fix: replace "CVE" wording by "Vulnerability" (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosthe19916 authored Dec 5, 2024
1 parent 53ede26 commit 540e7b0
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 100 deletions.
2 changes: 1 addition & 1 deletion client/src/app/layout/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const SidebarApp: React.FC = () => {
return css(LINK_CLASS, isActive ? ACTIVE_LINK_CLASS : "");
}}
>
CVEs
Vulnerabilities
</NavLink>
</li>
<li className="pf-v5-c-nav__item">
Expand Down
76 changes: 0 additions & 76 deletions client/src/app/pages/advisory-details/overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from "react";

import prettyBytes from "pretty-bytes";

import { ChartDonut } from "@patternfly/react-charts";
import {
Card,
CardBody,
Expand All @@ -15,7 +14,6 @@ import {
GridItem,
} from "@patternfly/react-core";

import { compareBySeverityFn, severityList } from "@app/api/model-utils";
import { AdvisorySummary, Severity } from "@app/client";
import { SeverityShieldAndText } from "@app/components/SeverityShieldAndText";
import { formatDate } from "@app/utils/utils";
Expand Down Expand Up @@ -115,77 +113,3 @@ export const Overview: React.FC<InfoProps> = ({ advisory }) => {
</Grid>
);
};

//

interface ChartData {
severity: Severity;
legend: string;
count: number;
color: string;
}

interface CVEsChartProps {
data: { [key in Severity]: number };
}

export const CVEsChart: React.FC<CVEsChartProps> = ({ data }) => {
const enrichedData = Object.entries(data)
.map(([severity, count]) => {
const severityProps = severityList[severity as Severity];

const result: ChartData = {
severity: severity as Severity,
legend: severityProps.name,
color: severityProps.color.value,
count: count,
};

return result;
})
.sort(compareBySeverityFn((item) => item.severity));

const chartData = enrichedData.map((e) => {
return {
x: e.legend,
y: e.count,
};
});

const chartLegendData = enrichedData.map((e) => ({
name: `${e.count} ${e.legend}`,
}));

const chartColorData = enrichedData.map((e) => e.color);

return (
<>
<div style={{ height: "230px", width: "350px" }}>
<ChartDonut
ariaDesc="CVEs"
ariaTitle="CVEs"
constrainToVisibleArea
data={chartData}
labels={({ datum }) => `${datum.x}: ${datum.y}`}
legendData={chartLegendData}
colorScale={chartColorData}
legendOrientation="vertical"
legendPosition="right"
name="CVEs"
padding={{
bottom: 20,
left: 20,
right: 140, // Adjusted to accommodate legend
top: 20,
}}
subTitle="CVEs"
title={enrichedData
.map((e) => e.count)
.reduce((prev, current) => prev + current, 0)
.toString()}
width={350}
/>
</div>
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const VulnerabilitiesByAdvisory: React.FC<
items: vulnerabilities,
isLoading: isFetching,
columnNames: {
identifier: "CVE ID",
identifier: "ID",
title: "Title",
discovery: "Discovery",
release: "Release",
Expand Down
6 changes: 3 additions & 3 deletions client/src/app/pages/home/components/MonitoringSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ export const MonitoringSection: React.FC = () => {
<Stack hasGutter>
<StackItem>
<TextContent>
Below is a summary of CVE status for your last 10 ingested
SBOMs. You can click on the SBOM name or CVE severity number
below to be taken to their respective details page.
Below is a summary of Vulnerability status for your last 10
ingested SBOMs. You can click on the SBOM name to be taken
to their respective details page.
</TextContent>
</StackItem>
<StackItem>
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/pages/importer-list/importer-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export const ImporterList: React.FC = () => {
</ToolbarContent>
</Toolbar>

<Table {...tableProps} aria-label="CVEs table">
<Table {...tableProps} aria-label="Importer table">
<Thead>
<Tr>
<TableHeaderContentWithControls {...tableControls}>
Expand Down
18 changes: 9 additions & 9 deletions client/src/app/pages/search/components/SearchMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import React from "react";
import { HubRequestParams } from "@app/api/models";
import { FILTER_TEXT_CATEGORY_KEY } from "@app/Constants";
import { useFetchAdvisories } from "@app/queries/advisories";
import { useFetchPackages } from "@app/queries/packages";
import { useFetchSBOMs } from "@app/queries/sboms";
import { useFetchVulnerabilities } from "@app/queries/vulnerabilities";
import {
Label,
Menu,
MenuContent,
MenuItem,
MenuList,
Popper,
SearchInput,
} from "@patternfly/react-core";
import { FILTER_TEXT_CATEGORY_KEY } from "@app/Constants";
import { Label } from "@patternfly/react-core";
import { useFetchAdvisories } from "@app/queries/advisories";
import { HubRequestParams } from "@app/api/models";
import { useFetchPackages } from "@app/queries/packages";
import { useFetchSBOMs } from "@app/queries/sboms";
import { useFetchVulnerabilities } from "@app/queries/vulnerabilities";
import React from "react";
import { Link } from "react-router-dom";

export interface IEntity {
Expand Down Expand Up @@ -137,7 +137,7 @@ function useAllEntities(filterText: string) {
title: item.identifier,
description: item.description?.substring(0, 75),
navLink: `/vulnerabilities/${item.identifier}`,
type: "CVE",
type: "Vulnerability",
typeColor: "orange",
}));

Expand Down
2 changes: 1 addition & 1 deletion client/src/app/pages/search/components/SearchTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const SearchTabs: React.FC<SearchTabsProps> = ({
eventKey={2}
title={
<TabTitleText>
CVEs{" "}
Vulnerabilities{" "}
<Badge screenReaderText="Search Result Count">
{vulnerabilityTotalCount}
</Badge>
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/pages/vulnerability-details/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { CveDetails as default } from "./vulnerability-details";
export { VulnerabilityDetails as default } from "./vulnerability-details";
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import type { Meta, StoryObj } from "@storybook/react";
import React from "react";
import { CveDetails } from "./vulnerability-details";
import { VulnerabilityDetails } from "./vulnerability-details";

const meta = {
title: "Components/VulnerabilityDetails",
component: CveDetails,
component: VulnerabilityDetails,
parameters: {
query: {
vulnerabilityId: "CVE-2023-1664",
},
},
tags: ["autodocs"],
} satisfies Meta<typeof CveDetails>;
} satisfies Meta<typeof VulnerabilityDetails>;

export default meta;
type Story = StoryObj<typeof meta>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { AdvisoriesByVulnerability } from "./advisories-by-vulnerability";
import { Overview } from "./overview";
import { SbomsByVulnerability } from "./sboms-by-vulnerability";

export const CveDetails: React.FC = () => {
export const VulnerabilityDetails: React.FC = () => {
const vulnerabilityId = useRouteParams(PathParam.VULNERABILITY_ID);

const { vulnerability, isFetching, fetchError } =
Expand Down Expand Up @@ -69,15 +69,15 @@ export const CveDetails: React.FC = () => {
mountOnEnter
activeKey={activeTabKey}
onSelect={handleTabClick}
aria-label="CVE detail tabs"
aria-label="Vulnerability detail tabs"
role="region"
>
<Tab
eventKey={0}
title={<TabTitleText>Related SBOMs</TabTitleText>}
tabContentId="refTabSbomsSection"
tabContentRef={sbomsTabRef}
aria-label="Related SBOMs for this CVE"
aria-label="Related SBOMs for this Vulnerability"
/>
<Tab
eventKey={1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const VulnerabilityList: React.FC = () => {
<>
<PageSection variant={PageSectionVariants.light}>
<TextContent>
<Text component="h1">CVEs</Text>
<Text component="h1">Vulnerabilities</Text>
</TextContent>
</PageSection>
<PageSection>
Expand Down

0 comments on commit 540e7b0

Please sign in to comment.