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: useAdvisories and not Vulnerabilities on the right summary data #284

Merged
Merged
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
26 changes: 12 additions & 14 deletions client/src/app/pages/home/components/MonitoringSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import { severityList } from "@app/api/model-utils";
import { SbomHead, Severity } from "@app/client";
import { LoadingWrapper } from "@app/components/LoadingWrapper";
import { useVulnerabilitiesOfSboms } from "@app/hooks/domain-controls/useVulnerabilitiesOfSbom";
import { useFetchAdvisories } from "@app/queries/advisories";
import { useFetchSBOMs } from "@app/queries/sboms";
import { useFetchVulnerabilities } from "@app/queries/vulnerabilities";
import { formatDate } from "@app/utils/utils";

interface Legend {
Expand Down Expand Up @@ -84,10 +84,10 @@ export const MonitoringSection: React.FC = () => {
//

const {
result: { data: vulnerabilities, total: totalVulnerabilities },
isFetching: isFetchingVulnerabilities,
fetchError: fetchErrorVulnerabilities,
} = useFetchVulnerabilities(
result: { data: advisories, total: totalAdvisories },
isFetching: isFetchingAdvisories,
fetchError: fetchErrorAdvisories,
} = useFetchAdvisories(
{
page: { pageNumber: 1, itemsPerPage: 10 },
sort: { field: "published", direction: "desc" },
Expand Down Expand Up @@ -251,8 +251,8 @@ export const MonitoringSection: React.FC = () => {
</GridItem>
<GridItem md={6}>
<LoadingWrapper
isFetching={isFetchingVulnerabilities}
fetchError={fetchErrorVulnerabilities}
isFetching={isFetchingAdvisories || isFetchingBarchartSboms}
fetchError={fetchErrorAdvisories || fetchErrorBarchartSboms}
>
<Grid hasGutter>
<GridItem md={6}>
Expand Down Expand Up @@ -290,16 +290,14 @@ export const MonitoringSection: React.FC = () => {
<DescriptionList>
<DescriptionListGroup>
<DescriptionListTerm>
Last Vulnerability ingested
Last Advisory ingested
</DescriptionListTerm>
<DescriptionListDescription>
<Stack>
<StackItem>
{formatDate(vulnerabilities?.[0]?.published)}
</StackItem>
<StackItem>
{vulnerabilities?.[0]?.identifier}
{formatDate(advisories?.[0]?.published)}
</StackItem>
<StackItem>{advisories?.[0]?.identifier}</StackItem>
</Stack>
</DescriptionListDescription>
</DescriptionListGroup>
Expand All @@ -309,10 +307,10 @@ export const MonitoringSection: React.FC = () => {
<DescriptionList>
<DescriptionListGroup>
<DescriptionListTerm>
Total Vulnerabilities
Total Advisories
</DescriptionListTerm>
<DescriptionListDescription>
{totalVulnerabilities}
{totalAdvisories}
</DescriptionListDescription>
</DescriptionListGroup>
</DescriptionList>
Expand Down
Loading