-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution][Endpoint] Refresh action and comments on the Case…
… Details view when Isolation actions are created (#103160) * Expose new Prop from `CaseComponent` that exposes data refresh callbacks * Refresh case actions and comments if isolation was created successfully
- Loading branch information
1 parent
6488414
commit 91fc3cc
Showing
13 changed files
with
234 additions
and
52 deletions.
There are no files selected for viewing
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
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
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
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
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
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
36 changes: 36 additions & 0 deletions
36
...ublic/common/components/endpoint/host_isolation/endpoint_host_isolation_cases_context.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,36 @@ | ||
/* | ||
* 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 React, { MutableRefObject, useContext } from 'react'; | ||
import { CaseViewRefreshPropInterface } from '../../../../../../cases/common'; | ||
|
||
/** | ||
* React Context that can hold the `Ref` that is created an passed to `CaseViewProps['refreshRef`]`, enabling | ||
* child components to trigger a refresh of a case. | ||
*/ | ||
export const CaseDetailsRefreshContext = React.createContext<MutableRefObject<CaseViewRefreshPropInterface> | null>( | ||
null | ||
); | ||
|
||
/** | ||
* Returns the closes CaseDetails Refresh interface if any. Used in conjuction with `CaseDetailsRefreshContext` component | ||
* | ||
* @example | ||
* // Higher-order component | ||
* const refreshRef = useRef<CaseViewRefreshPropInterface>(null); | ||
* return <CaseDetailsRefreshContext.Provider value={refreshRef}>....</CaseDetailsRefreshContext.Provider> | ||
* | ||
* // Now, use the hook from a hild component that was rendered inside of `<CaseDetailsRefreshContext.Provider>` | ||
* const caseDetailsRefresh = useWithCaseDetailsRefresh(); | ||
* ... | ||
* if (caseDetailsRefresh) { | ||
* caseDetailsRefresh.refreshUserActionsAndComments(); | ||
* } | ||
*/ | ||
export const useWithCaseDetailsRefresh = (): Readonly<CaseViewRefreshPropInterface> | undefined => { | ||
return useContext(CaseDetailsRefreshContext)?.current; | ||
}; |
Oops, something went wrong.