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

Protect: Separate scan results and history DataViews #40845

Merged
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4c95bfe
Init project branch
nateweller Nov 14, 2024
91ce2ed
Protect: Refactor AdminSectionHero (#40516)
nateweller Dec 9, 2024
35cd0cf
Restore history header
dkmyta Dec 10, 2024
5ad53b7
Pass status filter presets to consumer
dkmyta Dec 10, 2024
e21bb59
Restore early return
dkmyta Dec 10, 2024
50a5849
Add plan level restrictions
dkmyta Dec 10, 2024
d738a65
Init project branch
nateweller Nov 14, 2024
b93cfa2
Protect: Integrate ThreatsDataViews Component (#40076)
nateweller Dec 5, 2024
19bc943
Separate scan and history DataViews
dkmyta Jan 3, 2025
561ab57
Reapply history routes
dkmyta Jan 3, 2025
13ec8a0
Add filters
dkmyta Jan 3, 2025
996649a
Add toggle group control
dkmyta Jan 3, 2025
5a0871e
Add historic flag
dkmyta Jan 3, 2025
939263c
Update stories
dkmyta Jan 3, 2025
a34d4bd
Remove unneeded filter handling
dkmyta Jan 3, 2025
84a2ebc
Revert unnecessary threats data views updates
dkmyta Jan 3, 2025
1d3733f
Fix import
dkmyta Jan 3, 2025
61ee84d
Include fixer action as label in list view action dropdown
dkmyta Jan 3, 2025
a847325
Add field constants
dkmyta Jan 3, 2025
23b791f
Reorg
dkmyta Jan 3, 2025
9cd5469
Add initialFields prop, update active to current where applicable
dkmyta Jan 6, 2025
ad201c2
Init project branch
nateweller Nov 14, 2024
8960ec6
Fix exports and imports
dkmyta Jan 7, 2025
ec33096
Move default values to function params
nateweller Jan 12, 2025
5ccae12
Fix ts warning
nateweller Jan 12, 2025
dcb2887
minor adjustment to definition of initial filters
nateweller Jan 12, 2025
c8cd20e
Add tsc-expect-error to dummy arg for minification cases
nateweller Jan 12, 2025
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
Prev Previous commit
Next Next commit
Add filters
  • Loading branch information
dkmyta authored and nateweller committed Jan 12, 2025
commit 13ec8a0bd2f65f83a63df85118aa287b30f42881
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ThreatsDataViews } from '@automattic/jetpack-components';
import { type Threat } from '@automattic/jetpack-scan';
import { useCallback } from 'react';
import { useCallback, useMemo } from 'react';
import { useParams } from 'react-router-dom';
import useHistoryQuery from '../../../data/scan/use-history-query';
import useModal from '../../../hooks/use-modal';

Expand All @@ -13,10 +14,22 @@ import useModal from '../../../hooks/use-modal';
* @return {JSX.Element} ScanResultDataView component.
*/
export default function HistoryDataViews( { header }: { header?: JSX.Element } ) {
const { filter } = useParams();
const { data: history } = useHistoryQuery();

const { setModal } = useModal();

const filters = useMemo( () => {
if ( filter ) {
return [
{
field: 'status',
value: filter,
operator: 'isAny',
},
];
}
}, [ filter ] );

const onUnignoreThreats = useCallback(
( threats: Threat[] ) => {
setModal( { type: 'UNIGNORE_THREAT', props: { threat: threats[ 0 ] } } );
Expand All @@ -27,6 +40,7 @@ export default function HistoryDataViews( { header }: { header?: JSX.Element } )
return (
<ThreatsDataViews
data={ history ? history.threats : [] }
filters={ filters }
onUnignoreThreats={ onUnignoreThreats }
header={ header }
/>
Expand Down