@@ -14,6 +14,8 @@ import {
1414 EuiButtonEmpty ,
1515 EuiButtonProps ,
1616 PropsForButton ,
17+ EuiCallOut ,
18+ EuiSpacer ,
1719 EuiModal ,
1820 EuiModalBody ,
1921 EuiModalFooter ,
@@ -22,7 +24,13 @@ import {
2224 EuiText ,
2325} from '@elastic/eui' ;
2426
25- import { Immutable , TrustedApp } from '../../../../../common/endpoint/types' ;
27+ import {
28+ Immutable ,
29+ ImmutableObject ,
30+ PolicyEffectScope ,
31+ GlobalEffectScope ,
32+ TrustedApp ,
33+ } from '../../../../../common/endpoint/types' ;
2634import { AppAction } from '../../../../common/store/actions' ;
2735import { useTrustedAppsSelector } from './hooks' ;
2836import {
@@ -33,19 +41,36 @@ import {
3341
3442const CANCEL_SUBJ = 'trustedAppDeletionCancel' ;
3543const CONFIRM_SUBJ = 'trustedAppDeletionConfirm' ;
44+ const isTrustedAppByPolicy = (
45+ trustedApp : ImmutableObject < GlobalEffectScope | PolicyEffectScope >
46+ ) : trustedApp is ImmutableObject < PolicyEffectScope > => {
47+ return ( trustedApp as ImmutableObject < PolicyEffectScope > ) . policies !== undefined ;
48+ } ;
3649
3750const getTranslations = ( entry : Immutable < TrustedApp > | undefined ) => ( {
3851 title : (
3952 < FormattedMessage
4053 id = "xpack.securitySolution.trustedapps.deletionDialog.title"
41- defaultMessage = "Remove trusted application"
54+ defaultMessage = 'Delete "{name}"'
55+ values = { { name : < b className = "eui-textBreakWord" > { entry ?. name } </ b > } }
4256 />
4357 ) ,
44- mainMessage : (
58+ calloutTitle : (
4559 < FormattedMessage
46- id = "xpack.securitySolution.trustedapps.deletionDialog.mainMessage"
47- defaultMessage = 'You are removing trusted application "{name}".'
48- values = { { name : < b className = "eui-textBreakWord" > { entry ?. name } </ b > } }
60+ id = "xpack.securitySolution.trustedapps.deletionDialog.calloutTitle"
61+ defaultMessage = "Warning"
62+ />
63+ ) ,
64+ calloutMessage : (
65+ < FormattedMessage
66+ id = "xpack.securitySolution.trustedapps.deletionDialog.calloutMessage"
67+ defaultMessage = "Deleting this entry will remove it from {count} associated {count, plural, one {policy} other {policies}}."
68+ values = { {
69+ count :
70+ entry && isTrustedAppByPolicy ( entry . effectScope )
71+ ? entry . effectScope . policies . length
72+ : 'all' ,
73+ } }
4974 />
5075 ) ,
5176 subMessage : (
@@ -63,7 +88,7 @@ const getTranslations = (entry: Immutable<TrustedApp> | undefined) => ({
6388 confirmButton : (
6489 < FormattedMessage
6590 id = "xpack.securitySolution.trustedapps.deletionDialog.confirmButton"
66- defaultMessage = "Remove trusted application "
91+ defaultMessage = "Delete "
6792 />
6893 ) ,
6994} ) ;
@@ -105,8 +130,11 @@ export const TrustedAppDeletionDialog = memo(() => {
105130 </ EuiModalHeader >
106131
107132 < EuiModalBody >
133+ < EuiCallOut title = { translations . calloutTitle } color = "danger" iconType = "alert" >
134+ < p > { translations . calloutMessage } </ p >
135+ </ EuiCallOut >
136+ < EuiSpacer size = "m" />
108137 < EuiText >
109- < p > { translations . mainMessage } </ p >
110138 < p > { translations . subMessage } </ p >
111139 </ EuiText >
112140 </ EuiModalBody >
0 commit comments