Skip to content

Commit

Permalink
[Security Solution][Endpoint][Trusted Apps] TA delete modal shows # o…
Browse files Browse the repository at this point in the history
…f policies it will impact (#111481) (#112048)

Co-authored-by: Candace Park <[email protected]>
  • Loading branch information
kibanamachine and parkiino authored Sep 14, 2021
1 parent 8e7b880 commit dca10ce
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 45 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
EuiButtonEmpty,
EuiButtonProps,
PropsForButton,
EuiCallOut,
EuiSpacer,
EuiModal,
EuiModalBody,
EuiModalFooter,
Expand All @@ -22,7 +24,13 @@ import {
EuiText,
} from '@elastic/eui';

import { Immutable, TrustedApp } from '../../../../../common/endpoint/types';
import {
Immutable,
ImmutableObject,
PolicyEffectScope,
GlobalEffectScope,
TrustedApp,
} from '../../../../../common/endpoint/types';
import { AppAction } from '../../../../common/store/actions';
import { useTrustedAppsSelector } from './hooks';
import {
Expand All @@ -33,19 +41,36 @@ import {

const CANCEL_SUBJ = 'trustedAppDeletionCancel';
const CONFIRM_SUBJ = 'trustedAppDeletionConfirm';
const isTrustedAppByPolicy = (
trustedApp: ImmutableObject<GlobalEffectScope | PolicyEffectScope>
): trustedApp is ImmutableObject<PolicyEffectScope> => {
return (trustedApp as ImmutableObject<PolicyEffectScope>).policies !== undefined;
};

const getTranslations = (entry: Immutable<TrustedApp> | undefined) => ({
title: (
<FormattedMessage
id="xpack.securitySolution.trustedapps.deletionDialog.title"
defaultMessage="Remove trusted application"
defaultMessage='Delete "{name}"'
values={{ name: <b className="eui-textBreakWord">{entry?.name}</b> }}
/>
),
mainMessage: (
calloutTitle: (
<FormattedMessage
id="xpack.securitySolution.trustedapps.deletionDialog.mainMessage"
defaultMessage='You are removing trusted application "{name}".'
values={{ name: <b className="eui-textBreakWord">{entry?.name}</b> }}
id="xpack.securitySolution.trustedapps.deletionDialog.calloutTitle"
defaultMessage="Warning"
/>
),
calloutMessage: (
<FormattedMessage
id="xpack.securitySolution.trustedapps.deletionDialog.calloutMessage"
defaultMessage="Deleting this entry will remove it from {count} associated {count, plural, one {policy} other {policies}}."
values={{
count:
entry && isTrustedAppByPolicy(entry.effectScope)
? entry.effectScope.policies.length
: 'all',
}}
/>
),
subMessage: (
Expand All @@ -63,7 +88,7 @@ const getTranslations = (entry: Immutable<TrustedApp> | undefined) => ({
confirmButton: (
<FormattedMessage
id="xpack.securitySolution.trustedapps.deletionDialog.confirmButton"
defaultMessage="Remove trusted application"
defaultMessage="Delete"
/>
),
});
Expand Down Expand Up @@ -105,8 +130,11 @@ export const TrustedAppDeletionDialog = memo(() => {
</EuiModalHeader>

<EuiModalBody>
<EuiCallOut title={translations.calloutTitle} color="danger" iconType="alert">
<p>{translations.calloutMessage}</p>
</EuiCallOut>
<EuiSpacer size="m" />
<EuiText>
<p>{translations.mainMessage}</p>
<p>{translations.subMessage}</p>
</EuiText>
</EuiModalBody>
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -23514,9 +23514,7 @@
"xpack.securitySolution.trustedapps.creationSuccess.title": "成功!",
"xpack.securitySolution.trustedapps.deletionDialog.cancelButton": "キャンセル",
"xpack.securitySolution.trustedapps.deletionDialog.confirmButton": "信頼できるアプリケーションを削除",
"xpack.securitySolution.trustedapps.deletionDialog.mainMessage": "信頼できるアプリケーション「{name}」を削除しています。",
"xpack.securitySolution.trustedapps.deletionDialog.subMessage": "この操作は元に戻すことができません。続行していいですか?",
"xpack.securitySolution.trustedapps.deletionDialog.title": "信頼できるアプリケーションを削除",
"xpack.securitySolution.trustedapps.deletionError.text": "信頼できるアプリケーションリストから「{name}」を削除できません。理由:{message}",
"xpack.securitySolution.trustedapps.deletionError.title": "削除失敗",
"xpack.securitySolution.trustedapps.deletionSuccess.text": "「{name}」は信頼できるアプリケーションリストから削除されました。",
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -23896,9 +23896,7 @@
"xpack.securitySolution.trustedapps.creationSuccess.title": "成功!",
"xpack.securitySolution.trustedapps.deletionDialog.cancelButton": "取消",
"xpack.securitySolution.trustedapps.deletionDialog.confirmButton": "移除受信任的应用程序",
"xpack.securitySolution.trustedapps.deletionDialog.mainMessage": "您正在移除受信任的应用程序“{name}”。",
"xpack.securitySolution.trustedapps.deletionDialog.subMessage": "此操作无法撤消。是否确定要继续?",
"xpack.securitySolution.trustedapps.deletionDialog.title": "移除受信任的应用程序",
"xpack.securitySolution.trustedapps.deletionError.text": "无法从受信任的应用程序列表中移除“{name}”。原因:{message}",
"xpack.securitySolution.trustedapps.deletionError.title": "移除失败",
"xpack.securitySolution.trustedapps.deletionSuccess.text": "“{name}”已从受信任的应用程序列表中移除。",
Expand Down

0 comments on commit dca10ce

Please sign in to comment.