-
Notifications
You must be signed in to change notification settings - Fork 1
feat(heureka): adds vulnerability details panel #1117
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
32b3120
feat(heureka): adds vulnerability details panel with services list only
hodanoori 4b9ffad
Merge main into heureka-vulnerability-panel
hodanoori 3c8f5d4
chore(heureka): fixes eslint
hodanoori 3261803
chore(heureka): adds pagination to services table
hodanoori a3e16a6
chore(heureka): adds support groups
hodanoori 9d82908
chore(heureka): adds vulnerability details panel
hodanoori 9a5e895
Create moody-steaks-lay.md
hodanoori 8d80b3e
chore(heureka): show services as links
hodanoori f85d159
Merge branch 'heureka-vulnerability-panel' of github.com:cloudoperato…
hodanoori f31ac2f
chore(heureka): removes the redundant changeset
hodanoori d661ad9
chore(heureka): improve type handling in utils
hodanoori File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| "@cloudoperators/juno-app-heureka": patch | ||
| "@cloudoperators/juno-app-greenhouse": patch | ||
| --- | ||
|
|
||
| feat(heureka): adds vulnerability details panel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...s/Vulnerabilities/VulnerabilitiesList/VulnerabilityDetailsPanel/VulnerabilityServices.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Juno contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import React, { use, Suspense } from "react" | ||
| import { useNavigate } from "@tanstack/react-router" | ||
| import { Stack, Spinner } from "@cloudoperators/juno-ui-components" | ||
| import { Vulnerability } from "../../utils" | ||
| import { ApolloQueryResult } from "@apollo/client" | ||
| import { GetVulnerabilitiesQuery } from "../../../../generated/graphql" | ||
| import { getNormalizedVulnerabilitiesResponse } from "../../utils" | ||
|
|
||
| type VulnerabilityServicesProps = { | ||
| vulnerabilityName: string | ||
| vulnerabilitiesPromise: Promise<ApolloQueryResult<GetVulnerabilitiesQuery>> | ||
| onServiceClick?: (serviceCcrn: string) => void | ||
| } | ||
|
|
||
| export const VulnerabilityServices = ({ | ||
| vulnerabilityName, | ||
| vulnerabilitiesPromise, | ||
| onServiceClick, | ||
| }: VulnerabilityServicesProps) => { | ||
| const navigate = useNavigate() | ||
|
|
||
| const handleServiceClick = (serviceCcrn: string) => { | ||
| if (onServiceClick) { | ||
| onServiceClick(serviceCcrn) | ||
| } else { | ||
| navigate({ | ||
| to: "/services/$service", | ||
| params: { service: serviceCcrn }, | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| // Use the promise passed from the parent | ||
| const { data } = use(vulnerabilitiesPromise) | ||
|
|
||
| // Get vulnerability data from the response | ||
| const { vulnerabilities } = getNormalizedVulnerabilitiesResponse(data) | ||
| const vulnerabilityData = vulnerabilities.find((vuln: Vulnerability) => vuln.name === vulnerabilityName) | ||
|
|
||
| if (!vulnerabilityData) { | ||
| return <div className="text-sm text-theme-light">Vulnerability not found: {vulnerabilityName}</div> | ||
| } | ||
|
|
||
| const services = vulnerabilityData.services || [] | ||
|
|
||
| if (services.length === 0) { | ||
| return <div className="text-sm text-theme-light">No services affected by this vulnerability.</div> | ||
| } | ||
|
|
||
| return ( | ||
| <div className="mb-4"> | ||
| <Suspense | ||
| fallback={ | ||
| <Stack gap="2" alignment="center"> | ||
| <div>Loading</div> | ||
| <Spinner variant="primary"></Spinner> | ||
| </Stack> | ||
| } | ||
| > | ||
| <Stack gap="4" direction="horizontal" wrap> | ||
| {services.map((service, index) => ( | ||
| <a | ||
| key={index} | ||
| href="#" | ||
| onClick={(e) => { | ||
| e.preventDefault() | ||
| handleServiceClick(service.ccrn) | ||
| }} | ||
| className="link-hover" | ||
| > | ||
| {service.ccrn} | ||
| </a> | ||
| ))} | ||
| </Stack> | ||
| </Suspense> | ||
| </div> | ||
| ) | ||
| } |
27 changes: 27 additions & 0 deletions
27
...ilities/VulnerabilitiesList/VulnerabilityDetailsPanel/VulnerabilityServicesTotalCount.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Juno contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import React, { use } from "react" | ||
| import { Vulnerability } from "../../utils" | ||
| import { ApolloQueryResult } from "@apollo/client" | ||
| import { GetVulnerabilitiesQuery } from "../../../../generated/graphql" | ||
| import { getNormalizedVulnerabilitiesResponse } from "../../utils" | ||
|
|
||
| type VulnerabilityServicesTotalCountProps = { | ||
| vulnerabilitiesPromise: Promise<ApolloQueryResult<GetVulnerabilitiesQuery>> | ||
| vulnerabilityName: string | ||
| } | ||
|
|
||
| export const VulnerabilityServicesTotalCount = ({ | ||
| vulnerabilitiesPromise, | ||
| vulnerabilityName, | ||
| }: VulnerabilityServicesTotalCountProps) => { | ||
| const { data } = use(vulnerabilitiesPromise) | ||
| const { vulnerabilities } = getNormalizedVulnerabilitiesResponse(data) | ||
| const vulnerabilityData = vulnerabilities.find((vuln: Vulnerability) => vuln.name === vulnerabilityName) | ||
| const { servicesCount } = vulnerabilityData || { servicesCount: 0 } | ||
|
|
||
| return servicesCount | ||
| } |
46 changes: 46 additions & 0 deletions
46
...nerabilities/VulnerabilitiesList/VulnerabilityDetailsPanel/VulnerabilitySupportGroups.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Juno contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import React, { Suspense, use } from "react" | ||
| import { Stack, Pill, Spinner } from "@cloudoperators/juno-ui-components" | ||
| import { Vulnerability } from "../../utils" | ||
| import { ApolloQueryResult } from "@apollo/client" | ||
| import { GetVulnerabilitiesQuery } from "../../../../generated/graphql" | ||
| import { getNormalizedVulnerabilitiesResponse } from "../../utils" | ||
|
|
||
| type VulnerabilitySupportGroupsProps = { | ||
| vulnerabilitiesPromise: Promise<ApolloQueryResult<GetVulnerabilitiesQuery>> | ||
| vulnerabilityName: string | ||
| } | ||
|
|
||
| export const VulnerabilitySupportGroups = ({ | ||
| vulnerabilitiesPromise, | ||
| vulnerabilityName, | ||
| }: VulnerabilitySupportGroupsProps) => { | ||
| const { data } = use(vulnerabilitiesPromise) | ||
| const { vulnerabilities } = getNormalizedVulnerabilitiesResponse(data) | ||
| const vulnerabilityData = vulnerabilities.find((vuln: Vulnerability) => vuln.name === vulnerabilityName) | ||
|
|
||
| if (!vulnerabilityData) { | ||
| return null | ||
| } | ||
|
|
||
| return ( | ||
| <Stack gap="1" direction="horizontal" wrap> | ||
| <Suspense | ||
| fallback={ | ||
| <Stack gap="2" alignment="center"> | ||
| <div>Loading</div> | ||
| <Spinner variant="primary"></Spinner> | ||
| </Stack> | ||
| } | ||
| > | ||
| {vulnerabilityData.supportGroups?.map((group: string) => ( | ||
| <Pill key={group} pillValue={group} pillValueLabel={group} /> | ||
| ))} | ||
| </Suspense> | ||
| </Stack> | ||
| ) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.