-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add ThreatDetailsModal component and stories * changelog * Fix type error * Fix child component overflow-x styling * Update scan package changelog * Add util for fixerState and separate subcomponents * Add user connection gate * Add credentials gate * Fix stories * Fix stories * Fix credentials type * Update content flow * Improve organization * Separation and reorg * Improve * Remove redundant code * Adjust modal content * Generalize component name * Updates after renaming * Ensure close button exists for vulns modal * changelog * Updates/fixes * Add detailed action * changelog * Add actionToConfirm flag for rendering conditional content based on action selected * Update approach to single view * Move notices to ThreatActions * Add fixer notices * Fix styling * Additional improvements * Fix gap * Remove actionToConfirm flag, to be readded in integration * Early return on ThreatActions for fixed threats * Make threat status check optional * Use custom button for threat details toggle (#40298) * Use Button and override internal styles * Fix classes * Move fixerState comp to ThreatFixConfirmation * Rely heavily on context provider * Fix styles --------- Co-authored-by: Nate Weller <nate.weller@automattic.com>
- Loading branch information
1 parent
b91118f
commit 0f6c6cf
Showing
16 changed files
with
614 additions
and
313 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
projects/js-packages/components/changelog/update-components-threat-details-modal-flow
This file contains 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,4 @@ | ||
Significance: minor | ||
Type: changed | ||
|
||
Updates ThreatModal flow |
This file contains 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
65 changes: 0 additions & 65 deletions
65
projects/js-packages/components/components/threat-modal/credentials-gate.tsx
This file was deleted.
Oops, something went wrong.
63 changes: 63 additions & 0 deletions
63
projects/js-packages/components/components/threat-modal/fixer-state-notice.tsx
This file contains 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,63 @@ | ||
import { __ } from '@wordpress/i18n'; | ||
import { useMemo } from 'react'; | ||
import styles from './styles.module.scss'; | ||
import ThreatNotice from './threat-notice'; | ||
|
||
/** | ||
* FixerStateNotice component | ||
* | ||
* @param {object} props - The component props. | ||
* @param {object} props.fixerState - The state of the fixer (inProgress, error, stale). | ||
* @param {boolean} props.fixerState.inProgress - Whether the fixer is in progress. | ||
* @param {boolean} props.fixerState.error - Whether the fixer encountered an error. | ||
* @param {boolean} props.fixerState.stale - Whether the fixer is stale. | ||
* | ||
* @return {JSX.Element | null} The rendered fixer notice or null if no notice is available. | ||
*/ | ||
const FixerStateNotice = ( { | ||
fixerState, | ||
}: { | ||
fixerState: { inProgress: boolean; error: boolean; stale: boolean }; | ||
} ) => { | ||
const { status, title, content } = useMemo( () => { | ||
if ( fixerState.error ) { | ||
return { | ||
status: 'error' as const, | ||
title: __( 'An error occurred auto-fixing this threat', 'jetpack' ), | ||
content: __( | ||
'Jetpack encountered a filesystem error while attempting to auto-fix this threat. Please try again later or contact support.', | ||
'jetpack' | ||
), | ||
}; | ||
} | ||
|
||
if ( fixerState.stale ) { | ||
return { | ||
status: 'error' as const, | ||
title: __( 'The auto-fixer is taking longer than expected', 'jetpack' ), | ||
content: __( | ||
'Jetpack has been attempting to auto-fix this threat for too long, and something may have gone wrong. Please try again later or contact support.', | ||
'jetpack' | ||
), | ||
}; | ||
} | ||
|
||
if ( fixerState.inProgress ) { | ||
return { | ||
status: 'success' as const, | ||
title: __( 'An auto-fixer is in progress', 'jetpack' ), | ||
content: __( 'Please wait while Jetpack auto-fixes the threat.', 'jetpack' ), | ||
}; | ||
} | ||
|
||
return {}; | ||
}, [ fixerState ] ); | ||
|
||
return title ? ( | ||
<div className={ styles[ 'fixer-notice' ] }> | ||
<ThreatNotice status={ status } title={ title } content={ content } /> | ||
</div> | ||
) : null; | ||
}; | ||
|
||
export default FixerStateNotice; |
This file contains 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
Oops, something went wrong.