Skip to content

Commit d38d756

Browse files
authored
[Security Solution][Endpoint][Trusted Apps] TA delete modal shows # of policies it will impact (#111481)
1 parent fbeefed commit d38d756

File tree

4 files changed

+159
-45
lines changed

4 files changed

+159
-45
lines changed

x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/__snapshots__/trusted_app_deletion_dialog.test.tsx.snap

Lines changed: 123 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/security_solution/public/management/pages/trusted_apps/view/trusted_app_deletion_dialog.tsx

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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';
2634
import { AppAction } from '../../../../common/store/actions';
2735
import { useTrustedAppsSelector } from './hooks';
2836
import {
@@ -33,19 +41,36 @@ import {
3341

3442
const CANCEL_SUBJ = 'trustedAppDeletionCancel';
3543
const 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

3750
const 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>

x-pack/plugins/translations/translations/ja-JP.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23386,9 +23386,7 @@
2338623386
"xpack.securitySolution.trustedapps.creationSuccess.title": "成功!",
2338723387
"xpack.securitySolution.trustedapps.deletionDialog.cancelButton": "キャンセル",
2338823388
"xpack.securitySolution.trustedapps.deletionDialog.confirmButton": "信頼できるアプリケーションを削除",
23389-
"xpack.securitySolution.trustedapps.deletionDialog.mainMessage": "信頼できるアプリケーション「{name}」を削除しています。",
2339023389
"xpack.securitySolution.trustedapps.deletionDialog.subMessage": "この操作は元に戻すことができません。続行していいですか?",
23391-
"xpack.securitySolution.trustedapps.deletionDialog.title": "信頼できるアプリケーションを削除",
2339223390
"xpack.securitySolution.trustedapps.deletionError.text": "信頼できるアプリケーションリストから「{name}」を削除できません。理由:{message}",
2339323391
"xpack.securitySolution.trustedapps.deletionError.title": "削除失敗",
2339423392
"xpack.securitySolution.trustedapps.deletionSuccess.text": "「{name}」は信頼できるアプリケーションリストから削除されました。",

x-pack/plugins/translations/translations/zh-CN.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23767,9 +23767,7 @@
2376723767
"xpack.securitySolution.trustedapps.creationSuccess.title": "成功!",
2376823768
"xpack.securitySolution.trustedapps.deletionDialog.cancelButton": "取消",
2376923769
"xpack.securitySolution.trustedapps.deletionDialog.confirmButton": "移除受信任的应用程序",
23770-
"xpack.securitySolution.trustedapps.deletionDialog.mainMessage": "您正在移除受信任的应用程序“{name}”。",
2377123770
"xpack.securitySolution.trustedapps.deletionDialog.subMessage": "此操作无法撤消。是否确定要继续?",
23772-
"xpack.securitySolution.trustedapps.deletionDialog.title": "移除受信任的应用程序",
2377323771
"xpack.securitySolution.trustedapps.deletionError.text": "无法从受信任的应用程序列表中移除“{name}”。原因:{message}",
2377423772
"xpack.securitySolution.trustedapps.deletionError.title": "移除失败",
2377523773
"xpack.securitySolution.trustedapps.deletionSuccess.text": "“{name}”已从受信任的应用程序列表中移除。",

0 commit comments

Comments
 (0)