-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Security Solution] [Cases] Deleting files from security solution and removing feature flag #95176
Changes from all commits
f77325a
3ab61d4
57dfd51
62fd9a3
d3ba0c3
5e2bb04
519c857
bb74caf
eaccd14
346df21
39a82ab
2625db5
0fd813e
7a743b0
71aa9f6
e65e4b3
0876baa
5c3c628
721b1e4
31219e0
5f996ad
3823f5d
9b39f08
5bb1919
79b560a
15dc4fe
86ec77f
5bb1370
d8f0704
87ecb08
74f0e7e
09e780e
3e5b17e
5996398
b653e1b
2f9fddd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ Case management in Kibana | |
|
||
- [Cases API](#cases-api) | ||
- [Cases UI](#cases-ui) | ||
- [Case Action Type](#case-action-type) | ||
- [Case Action Type](#case-action-type) _feature in development, disabled by default_ | ||
|
||
|
||
## Cases API | ||
|
@@ -52,14 +52,39 @@ Arguments: | |
|disabledStatuses?|`CaseStatuses[];` array of disabled statuses | ||
|getCaseDetailsHref|`(caseDetails: CaseDetailsHrefSchema) => string;` callback to generate the case details url from the case id | ||
|isModal?|`boolean;` is All Cases table a modal | ||
|onCaseDetailsNavClick|`(caseDetails: CaseDetailsHrefSchema) => void;` callback for nav click | ||
|onConfigureCasesNavClick?|`(ev: React.MouseEvent) => void;` callback for nav click | ||
|onCreateCaseNavClick?|`(ev: React.MouseEvent) => void;` callback for nav click | ||
|onCaseDetailsNavClick|`(caseDetails: CaseDetailsHrefSchema) => void;` callback for case details nav click | ||
|onConfigureCasesNavClick?|`(ev: React.MouseEvent) => void;` callback for configure case nav click | ||
|onCreateCaseNavClick?|`(ev: React.MouseEvent) => void;` callback for create case nav click | ||
|onRowClick?|`(theCase?: Case ! SubCase) => void;` callback for row click, passing case in row | ||
|userCanCrud|boolean; user permissions to crud | ||
|userCanCrud|`boolean;` user permissions to crud | ||
|
||
UI component: | ||
![All Cases Component][all-cases-img] | ||
|
||
### `getCaseView` | ||
Arguments: | ||
|
||
|Property|Description| | ||
|---|---| | ||
|allCasesHref|`string;` route for all cases page | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for adding these :) I'm gonna try and clean up this API once everything is deleted to make it easier to consume now that we know what most of them are (apart from the timeline ones left) |
||
|backToAllCasesOnClick|`(ev: MouseEvent) => void;` handler for back to all cases click | ||
|caseDetailsHref|`string;` route for configure cases page | ||
|caseId|`string;` ID of the case | ||
|configureCasesHref|`string;` route for configure cases page | ||
|getCaseDetailHrefWithCommentId|`(commentId: string) => string;` callback to generate the case details url with a comment id reference from the case id and comment id | ||
|getRuleDetailsHref|`(ruleId: string, null, undefined) => string;` callback to generate the rule details url from the rule id | ||
|onComponentInitialized?|`() => void;` callback when component has initialized | ||
|onConfigureCasesNavClick|`(ev: React.MouseEvent) => void;` callback for configure case nav click | ||
|onRuleDetailsClick|`(ruleId: string, null, undefined) => void;` callback for rule details nav click | ||
|renderInvestigateInTimelineActionComponent?|: `(alertIds: string[]) => JSX.Element;` space to render `InvestigateInTimelineActionComponent` | ||
|renderTimelineDetailsPanel?|: `() => JSX.Element;` space to render `TimelineDetailsPanel` | ||
|showAlertDetails|: `(alertId: string, index: string) => void;` callback to show alert details | ||
|subCaseId?|: `string;` subcase id | ||
|useFetchAlertData|: `(alertIds: string[]) => [boolean, Record<string, Ecs>];` fetch alerts | ||
|userCanCrud|: `boolean;` user permissions to crud | ||
|
||
UI component: | ||
![Case View Component][case-view-img] | ||
|
||
### `getCreateCase` | ||
Arguments: | ||
|
@@ -83,8 +108,25 @@ UI component: | |
UI component: | ||
![Configure Component][configure-img] | ||
|
||
### `getRecentCases` | ||
Arguments: | ||
|
||
|Property|Description| | ||
|---|---| | ||
|allCasesHref|`string;` href of all cases page | ||
|createCaseHref|`string;` | ||
|getCaseDetailsHref|`(caseDetails: CaseDetailsHrefSchema) => string;` | ||
|goToAllCases|`(ev: React.MouseEvent) => void;` callback for all cases link click | ||
|onCaseDetailsNavClick|`(caseDetails: CaseDetailsHrefSchema) => void;` callback for case details nav click | ||
|perPage|`number;` number of cases to show in widget | ||
|
||
UI component: | ||
![Recent Cases Component][recent-cases-img] | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know is out of the scope of this PR but could you add a note that the case action type is disabled by default and the connector is not supported? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
## Case Action Type | ||
|
||
_***Feature in development, disabled by default**_ | ||
|
||
See [Kibana Actions](https://github.com/elastic/kibana/tree/master/x-pack/plugins/actions) for more information. | ||
|
||
|
||
|
@@ -192,4 +234,6 @@ For IBM Resilient connectors: | |
[configure-img]: images/configure.png | ||
[create-img]: images/create.png | ||
[all-cases-img]: images/all_cases.png | ||
[recent-cases-img]: images/recent_cases.png | ||
[case-view-img]: images/case_view.png | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
|
||
export * from './constants'; | ||
export * from './api'; | ||
export * from './ui/types'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why the ui types are being exported? Will they be used by another plugin? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, security solution uses the types on the UI There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see! Thanks! |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
* 2.0. | ||
*/ | ||
|
||
export * from '../../translations'; | ||
export * from './types'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ import styled, { css } from 'styled-components'; | |
import classnames from 'classnames'; | ||
|
||
import * as i18n from './translations'; | ||
import { CaseStatuses, CaseType } from '../../../common'; | ||
import { CaseStatuses, CaseType, CommentRequestAlertType, CommentType } from '../../../common'; | ||
import { getCasesColumns } from './columns'; | ||
import { Case, DeleteCase, FilterOptions, SortFieldCase, SubCase } from '../../containers/types'; | ||
import { useGetCases, UpdateCase } from '../../containers/use_get_cases'; | ||
|
@@ -44,6 +44,7 @@ import { getActions } from './actions'; | |
import { CasesTableFilters } from './table_filters'; | ||
import { useUpdateCases } from '../../containers/use_bulk_update_case'; | ||
import { useGetActionLicense } from '../../containers/use_get_action_license'; | ||
import { usePostComment } from '../../containers/use_post_comment'; | ||
import { getActionLicenseError } from '../use_push_to_service/helpers'; | ||
import { CaseCallOut } from '../callout'; | ||
import { ConfigureCaseButton } from '../configure_cases/button'; | ||
|
@@ -112,9 +113,9 @@ const BasicTable = styled(EuiBasicTable)` | |
BasicTable.displayName = 'BasicTable'; | ||
|
||
export interface AllCasesProps { | ||
alertData?: Omit<CommentRequestAlertType, 'type'>; | ||
configureCasesHref: string; | ||
createCaseHref: string; | ||
disabledCases?: CaseType[]; | ||
disabledStatuses?: CaseStatuses[]; | ||
getCaseDetailsHref: (caseDetails: CaseDetailsHrefSchema) => string; | ||
isModal?: boolean; | ||
|
@@ -123,13 +124,14 @@ export interface AllCasesProps { | |
onCreateCaseNavClick?: (ev: React.MouseEvent) => void; | ||
onRowClick?: (theCase?: Case | SubCase) => void; | ||
userCanCrud: boolean; | ||
updateCase?: (newCase: Case) => void; | ||
} | ||
|
||
export const AllCases = React.memo<AllCasesProps>( | ||
({ | ||
alertData, | ||
configureCasesHref, | ||
createCaseHref, | ||
disabledCases = [], | ||
disabledStatuses, | ||
getCaseDetailsHref, | ||
isModal = false, | ||
|
@@ -138,6 +140,7 @@ export const AllCases = React.memo<AllCasesProps>( | |
onCreateCaseNavClick, | ||
onRowClick, | ||
userCanCrud, | ||
updateCase, | ||
}) => { | ||
const { actionLicense } = useGetActionLicense(); | ||
const { | ||
|
@@ -177,6 +180,10 @@ export const AllCases = React.memo<AllCasesProps>( | |
isUpdated, | ||
updateBulkStatus, | ||
} = useUpdateCases(); | ||
|
||
// Post Comment to Case | ||
const { postComment, isLoading: isCommentsUpdating } = usePostComment(); | ||
|
||
const [deleteThisCase, setDeleteThisCase] = useState<DeleteCase>({ | ||
title: '', | ||
id: '', | ||
|
@@ -371,12 +378,12 @@ export const AllCases = React.memo<AllCasesProps>( | |
onCaseDetailsNavClick, | ||
}), | ||
[ | ||
userCanCrud, | ||
actions, | ||
filterOptions.status, | ||
isModal, | ||
getCaseDetailsHref, | ||
isModal, | ||
onCaseDetailsNavClick, | ||
userCanCrud, | ||
] | ||
); | ||
|
||
|
@@ -422,7 +429,17 @@ export const AllCases = React.memo<AllCasesProps>( | |
|
||
const tableRowProps = useCallback( | ||
(theCase: Case) => { | ||
const onTableRowClick = memoize(() => { | ||
const onTableRowClick = memoize(async () => { | ||
if (alertData != null) { | ||
await postComment({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this was previously in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Imo, this shouldn't be inside the component. It is better to be implemented inside the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i didnt want the ui components to rely on any api methods since actions dont, they should just work There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see what you mean. I talk about it with @XavierM and we think that we should break the Example:
I think is a good opportunity to do it in this PR. It will be much cleaner. The |
||
caseId: theCase.id, | ||
data: { | ||
type: CommentType.alert, | ||
...alertData, | ||
}, | ||
updateCase, | ||
}); | ||
} | ||
if (onRowClick) { | ||
onRowClick(theCase); | ||
} | ||
|
@@ -434,7 +451,7 @@ export const AllCases = React.memo<AllCasesProps>( | |
...(isModal && theCase.type !== CaseType.collection ? { onClick: onTableRowClick } : {}), | ||
}; | ||
}, | ||
[isModal, onRowClick] | ||
[isModal, alertData, onRowClick, postComment, updateCase] | ||
); | ||
|
||
const enableBuckActions = userCanCrud && !isModal; | ||
|
@@ -503,7 +520,7 @@ export const AllCases = React.memo<AllCasesProps>( | |
</EuiFlexGroup> | ||
</CaseHeaderPage> | ||
)} | ||
{(isCasesLoading || isDeleting || isUpdating) && !isDataEmpty && ( | ||
{(isCasesLoading || isDeleting || isUpdating || isCommentsUpdating) && !isDataEmpty && ( | ||
<ProgressLoader size="xs" color="accent" className="essentialAnimation" /> | ||
)} | ||
<TableWrap data-test-subj="table-wrap" loading={!isModal ? isCasesLoading : undefined}> | ||
|
@@ -565,6 +582,7 @@ export const AllCases = React.memo<AllCasesProps>( | |
itemId="id" | ||
items={data.cases} | ||
itemIdToExpandedRowMap={itemIdToExpandedRowMap} | ||
loading={isCommentsUpdating} | ||
noItemsMessage={ | ||
<EuiEmptyPrompt | ||
title={<h3>{i18n.NO_CASES}</h3>} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,7 @@ import { | |
EuiHorizontalRule, | ||
} from '@elastic/eui'; | ||
|
||
import { CaseStatuses, CaseAttributes, CaseType } from '../../../common'; | ||
import { Case, CaseConnector } from '../../containers/types'; | ||
import { CaseStatuses, CaseAttributes, CaseType, Case, CaseConnector } from '../../../common'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍🏾 |
||
import { HeaderPage } from '../header_page'; | ||
import { EditableTitle } from '../header_page/editable_title'; | ||
import { TagList } from '../tag_list'; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,8 +36,6 @@ const CaseParamsFields: React.FunctionComponent<ActionParamsProps<CaseActionPara | |
actionParams, | ||
editAction, | ||
index, | ||
errors, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these were unused |
||
messageVariables, | ||
actionConnector, | ||
}) => { | ||
const { caseId = null, comment = defaultAlertComment } = actionParams.subActionParams ?? {}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉