Skip to content

Commit 00a687f

Browse files
committed
update property actions incident
1 parent e63e934 commit 00a687f

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

x-pack/plugins/siem/public/containers/case/use_get_case_user_actions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { CaseExternalService, CaseUserActions, ElasticUser } from './types';
1414
import { convertToCamelCase, parseString } from './utils';
1515
import { CaseFullExternalService } from '../../../../case/common/api/cases';
1616

17-
interface CaseService extends CaseExternalService {
17+
export interface CaseService extends CaseExternalService {
1818
firstPushIndex: number;
1919
lastPushIndex: number;
2020
commentsToUpdate: string[];

x-pack/plugins/siem/public/pages/case/components/case_status/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import * as i18n from '../case_view/translations';
2020
import { FormattedRelativePreferenceDate } from '../../../../components/formatted_date';
2121
import { CaseViewActions } from '../case_view/actions';
2222
import { Case } from '../../../../containers/case/types';
23+
import { CaseService } from '../../../../containers/case/use_get_case_user_actions';
2324

2425
const MyDescriptionList = styled(EuiDescriptionList)`
2526
${({ theme }) => css`
@@ -35,6 +36,7 @@ interface CaseStatusProps {
3536
badgeColor: string;
3637
buttonLabel: string;
3738
caseData: Case;
39+
currentExternalIncident: CaseService | null;
3840
disabled?: boolean;
3941
icon: string;
4042
isLoading: boolean;
@@ -50,6 +52,7 @@ const CaseStatusComp: React.FC<CaseStatusProps> = ({
5052
badgeColor,
5153
buttonLabel,
5254
caseData,
55+
currentExternalIncident,
5356
disabled = false,
5457
icon,
5558
isLoading,
@@ -100,7 +103,11 @@ const CaseStatusComp: React.FC<CaseStatusProps> = ({
100103
/>
101104
</EuiFlexItem>
102105
<EuiFlexItem grow={false}>
103-
<CaseViewActions caseData={caseData} disabled={disabled} />
106+
<CaseViewActions
107+
caseData={caseData}
108+
currentExternalIncident={currentExternalIncident}
109+
disabled={disabled}
110+
/>
104111
</EuiFlexItem>
105112
</EuiFlexGroup>
106113
</EuiFlexItem>

x-pack/plugins/siem/public/pages/case/components/case_view/actions.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,19 @@ import { ConfirmDeleteCaseModal } from '../confirm_delete_case';
1313
import { SiemPageName } from '../../../home/types';
1414
import { PropertyActions } from '../property_actions';
1515
import { Case } from '../../../../containers/case/types';
16+
import { CaseService } from '../../../../containers/case/use_get_case_user_actions';
1617

1718
interface CaseViewActions {
1819
caseData: Case;
20+
currentExternalIncident: CaseService | null;
1921
disabled?: boolean;
2022
}
2123

22-
const CaseViewActionsComponent: React.FC<CaseViewActions> = ({ caseData, disabled = false }) => {
24+
const CaseViewActionsComponent: React.FC<CaseViewActions> = ({
25+
caseData,
26+
currentExternalIncident,
27+
disabled = false,
28+
}) => {
2329
// Delete case
2430
const {
2531
handleToggleModal,
@@ -48,17 +54,17 @@ const CaseViewActionsComponent: React.FC<CaseViewActions> = ({ caseData, disable
4854
label: i18n.DELETE_CASE,
4955
onClick: handleToggleModal,
5056
},
51-
...(caseData.externalService != null && !isEmpty(caseData.externalService?.externalUrl)
57+
...(currentExternalIncident != null && !isEmpty(currentExternalIncident?.externalUrl)
5258
? [
5359
{
5460
iconType: 'popout',
55-
label: i18n.VIEW_INCIDENT(caseData.externalService?.externalTitle ?? ''),
56-
onClick: () => window.open(caseData.externalService?.externalUrl, '_blank'),
61+
label: i18n.VIEW_INCIDENT(currentExternalIncident?.externalTitle ?? ''),
62+
onClick: () => window.open(currentExternalIncident?.externalUrl, '_blank'),
5763
},
5864
]
5965
: []),
6066
],
61-
[disabled, handleToggleModal, caseData]
67+
[disabled, handleToggleModal, currentExternalIncident]
6268
);
6369

6470
if (isDeleted) {

x-pack/plugins/siem/public/pages/case/components/case_view/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ export const CaseComponent = React.memo<CaseProps>(
164164
() => connectors.find(c => c.id === caseData.connectorId)?.name ?? 'none',
165165
[connectors, caseData.connectorId]
166166
);
167+
168+
const currentExternalIncident = useMemo(() => {
169+
return caseServices[caseData.connectorId];
170+
}, [caseServices, caseData.connectorId]);
171+
167172
const { pushButton, pushCallouts } = usePushToService({
168173
caseConnectorId: caseData.connectorId,
169174
caseConnectorName,
@@ -254,6 +259,7 @@ export const CaseComponent = React.memo<CaseProps>(
254259
title={caseData.title}
255260
>
256261
<CaseStatus
262+
currentExternalIncident={currentExternalIncident}
257263
caseData={caseData}
258264
disabled={!userCanCrud}
259265
isLoading={isLoading && updateKey === 'status'}

0 commit comments

Comments
 (0)