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

[Secuity Solution][DQD] add historical results (Phase 1) #191898

Merged
merged 21 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
890e8ed
feat: restore original flyout tabs with disabled history
kapral18 Sep 2, 2024
037d83c
feat: historical results part1
kapral18 Sep 10, 2024
31837fd
refactor: lift shared markdown utils + translations
kapral18 Sep 13, 2024
76248dd
refactor: flatten index check flyout
kapral18 Sep 16, 2024
32498f6
refactor: introduce IncompatibleFieldMetadata and other more granual
kapral18 Sep 19, 2024
1ad6e80
feat: historical results part2
kapral18 Sep 24, 2024
a3f9812
chore: add tests for basic historical results
kapral18 Sep 26, 2024
b03d91e
chore: add remaining tests for basic historical results
kapral18 Sep 30, 2024
e6ee997
feat: update default historical results date range to 30 days
kapral18 Sep 30, 2024
19053b7
feat: add legacy check fields view + tests
kapral18 Oct 1, 2024
3bfb8e7
feat: add history and latest check tabs to data quality panel
kapral18 Oct 1, 2024
05e4a62
feat: add final redesign of legacy view
kapral18 Oct 3, 2024
0eadff1
fix(serverless): incorrect pass badge + disabled datepicker
kapral18 Oct 4, 2024
ce40a92
feat(translations):simplify view check history to just view history
kapral18 Oct 7, 2024
d8dc1d7
test: add tests and minor refactorings
kapral18 Oct 8, 2024
1770462
chore(types): fix outcome filter type issue from ci report
kapral18 Oct 8, 2024
c9f8506
chore(tests): fix timezone issue in tests reported by CI
kapral18 Oct 8, 2024
d2f71bf
improve(context): useMemo provider values
kapral18 Oct 8, 2024
b89a390
chore(translations): add changes following ui copy review
kapral18 Oct 9, 2024
6d898c5
chore(fix): remove left-behind checkState reference from both source …
kapral18 Oct 9, 2024
e282dde
chore(tests): add timeout to ci failing test
kapral18 Oct 11, 2024
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
feat: historical results part1
- add historical results fetching logic with hooks/utils/contexts
- add filtering by outcome
- add filtering by date
- add pagination
- add error handling
- add loading state
- rename index properties into latest results
- add total checks
- add accordion component titles (result badge + check time +
  incompatible count)
- refactor affected parts
  • Loading branch information
kapral18 committed Oct 11, 2024
commit 037d83cbe2cb373b6b7fd7eb73e59807837ecdca
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export const DEFAULT_HISTORICAL_RESULTS_START_DATE = 'now-7d';
export const DEFAULT_HISTORICAL_RESULTS_END_DATE = 'now';
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { createContext, useContext } from 'react';
import { HistoricalResultsValue } from './types';

export const HistoricalResultsContext = createContext<HistoricalResultsValue | null>(null);

export const useHistoricalResultsContext = () => {
const context = useContext(HistoricalResultsContext);
if (context == null) {
throw new Error(
'useHistoricalResultsContext must be used inside the HistoricalResultsContextProvider.'
);
}
return context;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { StorageResult } from '../../../../../../types';
import { FetchHistoricalResultsOpts } from '../../types';

export interface HistoricalResultsValue {
historicalResultsState: {
results: StorageResult[];
total: number;
isLoading: boolean;
error: Error | null;
};
fetchHistoricalResults: (opts: Omit<FetchHistoricalResultsOpts, 'httpFetch'>) => Promise<void>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { useEffect, useRef } from 'react';

export const useFetchHistoricalResultsAbortControllers = () => {
const fetchHistoricalResultsFromDateAbortControllerRef = useRef(new AbortController());
const fetchHistoricalResultsFromOutcomeAbortControllerRef = useRef(new AbortController());
const fetchHistoricalResultsFromSetPageAbortControllerRef = useRef(new AbortController());
const fetchHistoricalResultsFromSetSizeAbortControllerRef = useRef(new AbortController());

useEffect(() => {
const fetchHistoricalResultsAbortController =
fetchHistoricalResultsFromDateAbortControllerRef.current;
const fetchHistoricalResultsFromOutcomeAbortController =
fetchHistoricalResultsFromOutcomeAbortControllerRef.current;
const fetchHistoricalResultsFromSetPageAbortController =
fetchHistoricalResultsFromSetPageAbortControllerRef.current;
const fetchHistoricalResultsFromSetSizeAbortController =
fetchHistoricalResultsFromSetSizeAbortControllerRef.current;

return () => {
fetchHistoricalResultsAbortController.abort();
fetchHistoricalResultsFromOutcomeAbortController.abort();
fetchHistoricalResultsFromSetPageAbortController.abort();
fetchHistoricalResultsFromSetSizeAbortController.abort();
};
}, []);

return {
fetchHistoricalResultsFromDateAbortControllerRef,
fetchHistoricalResultsFromOutcomeAbortControllerRef,
fetchHistoricalResultsFromSetPageAbortControllerRef,
fetchHistoricalResultsFromSetSizeAbortControllerRef,
};
};
Loading