Skip to content

Commit

Permalink
fix(CVSS popover): Fix misalignment of CVSS popover
Browse files Browse the repository at this point in the history
  • Loading branch information
leSamo committed Dec 20, 2024
1 parent 2608a54 commit 6997761
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ exports[`CVEDetailsPageSidebar component should render correctly 1`] = `
<div
class="pf-v5-c-content"
>
<div
style="display: contents;"
<span
class="vuln-label "
style="font-size: medium; display: block;"
>
<span
class="vuln-label pf-v5-u-mb-xs pointer"
style="font-size: medium; display: block;"
CVSS 3.0 base score
<div
style="display: contents;"
>
CVSS 3.0 base score
<span
class="pf-v5-c-icon"
>
Expand All @@ -163,11 +163,12 @@ exports[`CVEDetailsPageSidebar component should render correctly 1`] = `
>
<svg
aria-hidden="true"
class="pf-v5-svg pf-v5-u-ml-xs"
class="pf-v5-svg pf-v5-u-ml-xs pointer"
color="var(--pf-v5-global--secondary-color--100)"
fill="currentColor"
height="1em"
role="img"
style="vertical-align: -2px;"
viewBox="0 0 512 512"
width="1em"
>
Expand All @@ -177,8 +178,8 @@ exports[`CVEDetailsPageSidebar component should render correctly 1`] = `
</svg>
</span>
</span>
</span>
</div>
</div>
</span>
<span
class="pf-v5-u-mr-md"
>
Expand Down
70 changes: 39 additions & 31 deletions src/Components/PresentationalComponents/CvssVector/CvssVector.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,42 +43,50 @@ const CvssVector = ({ cvss2_metrics: CVSS2Vector, cvss3_metrics: CVSS3Vector, sc
<CVEPageContext.Consumer>
{context => (
<TextContent>
<Popover
id="popover-cvss"
position="bottom"
maxWidth="100%"
enableFlip
headerContent={`${cvssVer} ${intl.formatMessage(messages.cvssVectorPopoverTitle)}`}
bodyContent={
<WithLoader isLoading={context.isLoading} colSize={2} rowSize={8} variant={LoaderType.compactTable}>
{cvssVector ?
(<Table
aria-label="Metric breakdown"
variant={TableVariant.compact}
gridBreakPoint=""
cells={
[intl.formatMessage(messages.cvssVectorMetric),
intl.formatMessage(messages.cvssVectorValue)]
}
rows={Object.entries(parsedVector)}
>
<TableHeader />
<TableBody />
</Table>
) : (notAvailable)}
</WithLoader>
}
>
<Label isLarge className="pf-v5-u-mb-xs pointer">
{cvssVer} {intl.formatMessage(messages.cvssVectorVectorString)}
<Label isLarge>
{cvssVer} {intl.formatMessage(messages.cvssVectorVectorString)}
<Popover
id="popover-cvss"
position="bottom"
maxWidth="100%"
enableFlip
headerContent={`${cvssVer} ${intl.formatMessage(messages.cvssVectorPopoverTitle)}`}
bodyContent={
<WithLoader
isLoading={context.isLoading}
colSize={2}
rowSize={8}
variant={LoaderType.compactTable}
>
{cvssVector ?
(<Table
aria-label="Metric breakdown"
variant={TableVariant.compact}
gridBreakPoint=""
cells={
[
intl.formatMessage(messages.cvssVectorMetric),
intl.formatMessage(messages.cvssVectorValue)
]
}
rows={Object.entries(parsedVector)}
>
<TableHeader />
<TableBody />
</Table>
) : (notAvailable)}
</WithLoader>
}
>
<Icon>
<OutlinedQuestionCircleIcon
color="var(--pf-v5-global--secondary-color--100)"
className="pf-v5-u-ml-xs"
className="pf-v5-u-ml-xs pointer"
style={{ verticalAlign: -2 }}
/>
</Icon>
</Label>
</Popover>
</Popover>
</Label>

<WithLoader isLoading={context.isLoading} style={{ width: '320px' }}>
<span className="pf-v5-u-mr-md">{score}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,14 @@ exports[`CVE details: Should render match snapshot 1`] = `
<div
class="pf-v5-c-content"
>
<div
style="display: contents;"
<span
class="vuln-label "
style="font-size: medium; display: block;"
>
<span
class="vuln-label pf-v5-u-mb-xs pointer"
style="font-size: medium; display: block;"
CVSS 3.0 base score
<div
style="display: contents;"
>
CVSS 3.0 base score
<span
class="pf-v5-c-icon"
>
Expand All @@ -358,11 +358,12 @@ exports[`CVE details: Should render match snapshot 1`] = `
>
<svg
aria-hidden="true"
class="pf-v5-svg pf-v5-u-ml-xs"
class="pf-v5-svg pf-v5-u-ml-xs pointer"
color="var(--pf-v5-global--secondary-color--100)"
fill="currentColor"
height="1em"
role="img"
style="vertical-align: -2px;"
viewBox="0 0 512 512"
width="1em"
>
Expand All @@ -372,8 +373,8 @@ exports[`CVE details: Should render match snapshot 1`] = `
</svg>
</span>
</span>
</span>
</div>
</div>
</span>
<span
class="pf-v5-u-mr-md"
>
Expand Down

0 comments on commit 6997761

Please sign in to comment.