Skip to content

Commit

Permalink
Rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
dkmyta committed Jan 3, 2025
2 parents cdac95f + 1c72079 commit 856479c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ export default function ScanReport( { dataSource, data, onChangeSelection } ): J
},
render( { item }: { item: ScanReportExtension } ) {
const scanApi = 'scan_api' === dataSource;
let variant: 'info' | 'warning' | 'success' = 'info';
let variant: 'info' | 'error' | 'success' = 'info';
let text = __(
'This item was added to your site after the most recent scan. We will check for threats during the next scheduled one.',
'jetpack-components'
);

if ( item.checked ) {
if ( item.threats.length > 0 ) {
variant = 'warning';
variant = 'error';
text = _n(
'Vulnerability detected.',
'Vulnerabilities detected.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,28 @@ export default function ThreatsDataViews( {
);
},
},
{
id: THREAT_FIELD_STATUS,
label: __( 'Status', 'jetpack-components' ),
elements: THREAT_STATUSES,
getValue( { item }: { item: Threat } ) {
if ( ! item.status ) {
return 'current';
}
return (
THREAT_STATUSES.find( ( { value } ) => value === item.status )?.value ?? item.status
);
},
render( { item }: { item: Threat } ) {
if ( item.status ) {
const status = THREAT_STATUSES.find( ( { value } ) => value === item.status );
if ( status ) {
return <Badge variant={ status?.variant }>{ status.label }</Badge>;
}
}
return <Badge variant="warning">{ __( 'Active', 'jetpack-components' ) }</Badge>;
},
},
{
id: THREAT_FIELD_TYPE,
label: __( 'Type', 'jetpack-components' ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const HistoryPage = () => {

return (
<AdminPage>
<HistoryAdminSectionHero size={ hasHistory ? 'normal' : 'large' } />
<HistoryAdminSectionHero size={ showResults ? 'normal' : 'large' } />
{ showResults && (
<AdminSection>
<Container
Expand Down
2 changes: 1 addition & 1 deletion projects/plugins/protect/src/js/routes/scan/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const ScanPage = () => {
return (
<OnboardingContext.Provider value={ onboardingSteps }>
<AdminPage>
<ScanAdminSectionHero size={ hasActiveThreats ? 'normal' : 'large' } />
<ScanAdminSectionHero size={ showResults ? 'normal' : 'large' } />
{ showResults && (
<AdminSection>
<Container
Expand Down

0 comments on commit 856479c

Please sign in to comment.