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: show only the suggested version when a golden version is available #155

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions public/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -390,5 +390,9 @@
"GOLDEN_VERSION": {
"message": "Golden Version",
"description": "Golden Version (IQ 184+)"
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to define this new message in all language files please @maurycupitt

"GOLDEN_VERSION_TOOLTIP": {
"message": "This is a safe-to-use version of the component, including its dependencies, with no resulting breaking changes, that can be used for upgrade to remediate the reported policy violation.",
"description": "Golden Version (IQ 184+) Tooltip from https://help.sonatype.com/en/golden-versions-and-prs.html#golden-versions"
}
}
5 changes: 5 additions & 0 deletions public/css/pagestyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
max-width: unset !important;
}

.sonatype-iq-extension-golden {
padding-right: 15px !important;
vertical-align: bottom !important;;
}

.sonatype-iq-extension-vuln {
padding-right: 15px !important;
padding-left: 10px !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
NxLoadingSpinner,
NxMeter,
NxPolicyViolationIndicator,
NxSmallTag,

Check warning on line 22 in src/components/Popup/IQServer/RemediationPage/AllVersionsPage/AllVersionsDetails/AllVersionsDetails.tsx

View workflow job for this annotation

GitHub Actions / Code Quality

'NxSmallTag' is defined but never used
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defined and unused - tidy up imports please.

NxThreatIndicator,
ThreatLevelNumber,
} from '@sonatype/react-shared-components'
Expand Down Expand Up @@ -220,7 +221,7 @@

<Tooltip title={`Catalog Date: ${formatDate(version.catalogDate)}`}>
<span className='nx-pull-right'>
{catalogDateDifference(version.catalogDate)}
<small>{catalogDateDifference(version.catalogDate)}</small>
</span>
</Tooltip>
</NxGrid.Header>
Expand Down Expand Up @@ -291,7 +292,7 @@

<Tooltip title={`Catalog Date: ${formatDate(version.catalogDate)}`}>
<span className='nx-pull-right'>
{catalogDateDifference(version.catalogDate)}
<small>{catalogDateDifference(version.catalogDate)}</small>
</span>
</Tooltip>
</NxGrid.Header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { ExtensionPopupContext } from "../../../../../context/ExtensionPopupCont
import { getNewSelectedVersionUrl } from "../../../../../utils/Helpers"
import { NxList } from "@sonatype/react-shared-components"
import { REMEDIATION_LABELS } from "../../../../../utils/Constants"
import { Tooltip } from '@material-ui/core'

// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions, @typescript-eslint/no-explicit-any
const _browser: any = chrome || browser
Expand All @@ -36,15 +37,19 @@ function SuggestedVersionLinkItemContent(props: SuggestedVersionChangeProps) {
{props.suggestedVersion.isGolden != null && props.suggestedVersion.isGolden && (
<span>
<img
style={{ paddingBottom: '3px', paddingRight: '7px', verticalAlign:'middle' }}
src='/images/golden-star.svg'
alt={_browser.i18n.getMessage('GOLDEN_VERSION')}
title={_browser.i18n.getMessage('GOLDEN_VERSION')}
/>
</span>
)}
<NxList.Text>
<small>{REMEDIATION_LABELS[props.suggestedVersion.type as string]}</small>
<Tooltip title={_browser.i18n.getMessage('GOLDEN_VERSION_TOOLTIP')}>
<NxList.Text
style={{ paddingRight: '0px' }}>
{REMEDIATION_LABELS[props.suggestedVersion.type as string]}
</NxList.Text>
</Tooltip>
<NxList.Subtext>
<strong>
{props.suggestedVersion.data?.component?.componentIdentifier?.coordinates
Expand Down Expand Up @@ -85,7 +90,9 @@ export default function SuggestedVersionChange(props: SuggestedVersionChangeProp
</NxList.LinkItem>
)}
{clickable !== true && (
<NxList.Item key="suggested-change">
<NxList.Item
style={{ paddingRight: '0px !important' }}
key="suggested-change">
<SuggestedVersionLinkItemContent suggestedVersion={props.suggestedVersion} />
</NxList.Item>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ function IqRemediationPage() {
)}
{versionChanges && versionChanges.length > 0 && <NxH3>
{_browser.i18n.getMessage('RECOMMENDED_VERSIONS')}
<RemediationDetails />
</NxH3>}
<RemediationDetails />

</section>
<section className='nx-grid-col nx-grid-col--67 nx-scrollable'>
<NxH3>
Expand Down
Loading