[SecuritySolution] update sourcer messages (#129329)

* update wording for temporary sourcerer

* update sourcer messages

* add message utils

* fix FormattedMessage

* remove unused i18n keys

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Angela Chuang 2022-04-12 09:41:45 +01:00 committed by GitHub
parent d638fa419f
commit 6366f3738d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 258 additions and 56 deletions

View file

@ -1000,6 +1000,14 @@ describe('Update available', () => {
expect(wrapper.find(`[data-test-subj="sourcerer-deprecated-callout"]`).first().text()).toEqual(
'This timeline uses a legacy data view selector'
);
expect(
wrapper.find(`[data-test-subj="sourcerer-current-patterns-message"]`).first().text()
).toEqual('The active index patterns in this timeline are: myFakebeat-*');
expect(wrapper.find(`[data-test-subj="sourcerer-deprecated-message"]`).first().text()).toEqual(
"We have preserved your timeline by creating a temporary data view. If you'd like to modify your data, we can recreate your temporary data view with the new data view selector. You can also manually select a data view here."
);
});
test('Show Add index pattern in UpdateDefaultDataViewModal', () => {
@ -1103,6 +1111,10 @@ describe('Update available for timeline template', () => {
expect(wrapper.find(`[data-test-subj="sourcerer-deprecated-callout"]`).first().text()).toEqual(
'This timeline template uses a legacy data view selector'
);
expect(wrapper.find(`[data-test-subj="sourcerer-deprecated-message"]`).first().text()).toEqual(
"We have preserved your timeline template by creating a temporary data view. If you'd like to modify your data, we can recreate your temporary data view with the new data view selector. You can also manually select a data view here."
);
});
});
@ -1179,6 +1191,20 @@ describe('Missing index patterns', () => {
expect(wrapper.find(`[data-test-subj="sourcerer-deprecated-callout"]`).first().text()).toEqual(
'This timeline is out of date with the Security Data View'
);
expect(
wrapper.find(`[data-test-subj="sourcerer-current-patterns-message"]`).first().text()
).toEqual('The active index patterns in this timeline are: myFakebeat-*');
expect(
wrapper.find(`[data-test-subj="sourcerer-missing-patterns-callout"]`).first().text()
).toEqual('Security Data View is missing the following index patterns: myFakebeat-*');
expect(
wrapper.find(`[data-test-subj="sourcerer-missing-patterns-message"]`).first().text()
).toEqual(
"We have preserved your timeline by creating a temporary data view. If you'd like to modify your data, we can add the missing index patterns to the Security Data View. You can also manually select a data view here."
);
});
test('Show UpdateDefaultDataViewModal CallOut for timeline template', () => {
@ -1201,5 +1227,19 @@ describe('Missing index patterns', () => {
expect(wrapper.find(`[data-test-subj="sourcerer-deprecated-callout"]`).first().text()).toEqual(
'This timeline template is out of date with the Security Data View'
);
expect(
wrapper.find(`[data-test-subj="sourcerer-current-patterns-message"]`).first().text()
).toEqual('The active index patterns in this timeline template are: myFakebeat-*');
expect(
wrapper.find(`[data-test-subj="sourcerer-missing-patterns-callout"]`).first().text()
).toEqual('Security Data View is missing the following index patterns: myFakebeat-*');
expect(
wrapper.find(`[data-test-subj="sourcerer-missing-patterns-message"]`).first().text()
).toEqual(
"We have preserved your timeline template by creating a temporary data view. If you'd like to modify your data, we can add the missing index patterns to the Security Data View. You can also manually select a data view here."
);
});
});

View file

@ -8,7 +8,6 @@
import { FormattedMessage } from '@kbn/i18n-react';
import {
EuiCallOut,
EuiLink,
EuiText,
EuiTextColor,
EuiSpacer,
@ -16,7 +15,6 @@ import {
EuiFlexItem,
EuiButton,
EuiToolTip,
EuiIcon,
} from '@elastic/eui';
import React, { useMemo } from 'react';
import * as i18n from './translations';
@ -26,6 +24,12 @@ import { TimelineId, TimelineType } from '../../../../common/types';
import { timelineSelectors } from '../../../timelines/store/timeline';
import { useDeepEqualSelector } from '../../hooks/use_selector';
import { timelineDefaults } from '../../../timelines/store/timeline/defaults';
import {
BadCurrentPatternsMessage,
CurrentPatternsMessage,
DeprecatedMessage,
MissingPatternsMessage,
} from './utils';
interface Props {
activePatterns?: string[];
@ -116,66 +120,33 @@ export const TemporarySourcererComp = React.memo<Props>(
<EuiTextColor color="subdued">
<p>
{activePatterns && activePatterns.length > 0 ? (
<FormattedMessage
id="xpack.securitySolution.indexPatterns.currentPatterns"
defaultMessage="The active index patterns in this timeline are{tooltip}: {callout}"
values={{
tooltip:
deadPatterns.length > 0 ? (
<EuiToolTip
content={
<FormattedMessage
id="xpack.securitySolution.indexPatterns.noMatchData"
defaultMessage="The following index patterns are saved to this timeline but do not match any data streams, indices, or index aliases: {aliases}"
values={{
aliases: selectedPatterns
.filter((p) => !activePatterns.includes(p))
.join(', '),
}}
/>
}
>
<EuiIcon type="questionInCircle" title={i18n.INACTIVE_PATTERNS} />
</EuiToolTip>
) : null,
callout: <Blockquote>{activePatterns.join(', ')}</Blockquote>,
}}
<CurrentPatternsMessage
timelineType={timelineType}
activePatterns={activePatterns}
deadPatterns={deadPatterns}
selectedPatterns={selectedPatterns}
/>
) : (
<FormattedMessage
id="xpack.securitySolution.indexPatterns.currentPatternsBad"
defaultMessage="The current index patterns in this timeline are: {callout}"
values={{
callout: <Blockquote>{selectedPatterns.join(', ')}</Blockquote>,
}}
<BadCurrentPatternsMessage
timelineType={timelineType}
selectedPatterns={selectedPatterns}
/>
)}
{isModified === 'deprecated' && (
<FormattedMessage
id="xpack.securitySolution.indexPatterns.toggleToNewSourcerer"
defaultMessage="We have preserved your timeline by creating a temporary data view. If you'd like to modify your data, we can recreate your temporary data view with the new data view selector. You can also manually select a data view {link}."
values={{
link: <EuiLink onClick={onReset}>{i18n.TOGGLE_TO_NEW_SOURCERER}</EuiLink>,
}}
/>
<DeprecatedMessage timelineType={timelineType} onReset={onReset} />
)}
{isModified === 'missingPatterns' && (
<>
<FormattedMessage
data-test-subj="sourcerer-missing-patterns-callout"
id="xpack.securitySolution.indexPatterns.missingPatterns.callout"
defaultMessage="Security Data View is missing the following index patterns: {callout}"
values={{
callout: <Blockquote>{missingPatterns.join(', ')}</Blockquote>,
}}
/>
<FormattedMessage
id="xpack.securitySolution.indexPatterns.missingPatterns.description"
defaultMessage="We have preserved your timeline by creating a temporary data view. If you'd like to modify your data, we can add the missing index patterns to the Security Data View. You can also manually select a data view {link}."
values={{
link: <EuiLink onClick={onReset}>{i18n.TOGGLE_TO_NEW_SOURCERER}</EuiLink>,
}}
/>
<MissingPatternsMessage timelineType={timelineType} onReset={onReset} />
</>
)}
</p>

View file

@ -0,0 +1,201 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { EuiIcon, EuiLink, EuiToolTip } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import React, { useMemo } from 'react';
import { TimelineType } from '../../../../common/types';
import { Blockquote } from './helpers';
import * as i18n from './translations';
export const CurrentPatternsMessage = ({
activePatterns,
deadPatterns,
selectedPatterns,
timelineType,
}: {
activePatterns: string[];
deadPatterns: string[];
selectedPatterns: string[];
timelineType: TimelineType;
}) => {
const tooltip = useMemo(
() =>
deadPatterns.length > 0 ? (
<EuiToolTip
content={
<NoMatchDataMessage
activePatterns={activePatterns}
selectedPatterns={selectedPatterns}
timelineType={timelineType}
/>
}
>
<EuiIcon type="questionInCircle" title={i18n.INACTIVE_PATTERNS} />
</EuiToolTip>
) : null,
[activePatterns, deadPatterns.length, selectedPatterns, timelineType]
);
if (timelineType === TimelineType.template) {
return (
<FormattedMessage
data-test-subj="sourcerer-current-patterns-message"
id="xpack.securitySolution.indexPatterns.timelineTemplate.currentPatterns"
defaultMessage="The active index patterns in this timeline template are{tooltip}: {callout}"
values={{
tooltip,
callout: <Blockquote>{activePatterns.join(', ')}</Blockquote>,
}}
/>
);
}
return (
<FormattedMessage
data-test-subj="sourcerer-current-patterns-message"
id="xpack.securitySolution.indexPatterns.timeline.currentPatterns"
defaultMessage="The active index patterns in this timeline are{tooltip}: {callout}"
values={{
tooltip,
callout: <Blockquote>{activePatterns.join(', ')}</Blockquote>,
}}
/>
);
};
export const NoMatchDataMessage = ({
activePatterns,
selectedPatterns,
timelineType,
}: {
activePatterns: string[];
selectedPatterns: string[];
timelineType: TimelineType;
}) => {
const aliases = useMemo(
() => selectedPatterns.filter((p) => !activePatterns.includes(p)).join(', '),
[activePatterns, selectedPatterns]
);
if (timelineType === TimelineType.template) {
return (
<FormattedMessage
id="xpack.securitySolution.indexPatterns.timelineTemplate.noMatchData"
defaultMessage="The following index patterns are saved to this timeline template but do not match any data streams, indices, or index aliases: {aliases}"
values={{
aliases,
}}
/>
);
}
return (
<FormattedMessage
id="xpack.securitySolution.indexPatterns.timeline.noMatchData"
defaultMessage="The following index patterns are saved to this timeline but do not match any data streams, indices, or index aliases: {aliases}"
values={{
aliases,
}}
/>
);
};
export const BadCurrentPatternsMessage = ({
timelineType,
selectedPatterns,
}: {
timelineType: TimelineType;
selectedPatterns: string[];
}) => {
const callout = useMemo(
() => <Blockquote>{selectedPatterns.join(', ')}</Blockquote>,
[selectedPatterns]
);
if (timelineType === TimelineType.template) {
return (
<FormattedMessage
id="xpack.securitySolution.indexPatterns.timelineTemplate.currentPatternsBad"
defaultMessage="The current index patterns in this timeline template are: {callout}"
values={{
callout,
}}
/>
);
}
return (
<FormattedMessage
id="xpack.securitySolution.indexPatterns.timeline.currentPatternsBad"
defaultMessage="The current index patterns in this timeline are: {callout}"
values={{
callout,
}}
/>
);
};
export const DeprecatedMessage = ({
onReset,
timelineType,
}: {
onReset: () => void;
timelineType: TimelineType;
}) => {
if (timelineType === TimelineType.template) {
return (
<FormattedMessage
data-test-subj="sourcerer-deprecated-message"
id="xpack.securitySolution.indexPatterns.timelineTemplate.toggleToNewSourcerer"
defaultMessage="We have preserved your timeline template by creating a temporary data view. If you'd like to modify your data, we can recreate your temporary data view with the new data view selector. You can also manually select a data view {link}."
values={{
link: <EuiLink onClick={onReset}>{i18n.TOGGLE_TO_NEW_SOURCERER}</EuiLink>,
}}
/>
);
}
return (
<FormattedMessage
data-test-subj="sourcerer-deprecated-message"
id="xpack.securitySolution.indexPatterns.timeline.toggleToNewSourcerer"
defaultMessage="We have preserved your timeline by creating a temporary data view. If you'd like to modify your data, we can recreate your temporary data view with the new data view selector. You can also manually select a data view {link}."
values={{
link: <EuiLink onClick={onReset}>{i18n.TOGGLE_TO_NEW_SOURCERER}</EuiLink>,
}}
/>
);
};
export const MissingPatternsMessage = ({
onReset,
timelineType,
}: {
timelineType: TimelineType;
onReset: () => void;
}) => {
if (timelineType === TimelineType.template) {
return (
<FormattedMessage
data-test-subj="sourcerer-missing-patterns-message"
id="xpack.securitySolution.indexPatterns.missingPatterns.timelineTemplate.description"
defaultMessage="We have preserved your timeline template by creating a temporary data view. If you'd like to modify your data, we can add the missing index patterns to the Security Data View. You can also manually select a data view {link}."
values={{
link: <EuiLink onClick={onReset}>{i18n.TOGGLE_TO_NEW_SOURCERER}</EuiLink>,
}}
/>
);
}
return (
<FormattedMessage
data-test-subj="sourcerer-missing-patterns-message"
id="xpack.securitySolution.indexPatterns.missingPatterns.timeline.description"
defaultMessage="We have preserved your timeline by creating a temporary data view. If you'd like to modify your data, we can add the missing index patterns to the Security Data View. You can also manually select a data view {link}."
values={{
link: <EuiLink onClick={onReset}>{i18n.TOGGLE_TO_NEW_SOURCERER}</EuiLink>,
}}
/>
);
};

View file

@ -24620,8 +24620,6 @@
"xpack.securitySolution.indexPatterns.chooseDataViewLabel": "データビューを選択",
"xpack.securitySolution.indexPatterns.closeButton": "閉じる",
"xpack.securitySolution.indexPatterns.continue": "追加せずに続行",
"xpack.securitySolution.indexPatterns.currentPatterns": "このタイムラインのアクティブなインデックスパターンは{tooltip}です:{callout}",
"xpack.securitySolution.indexPatterns.currentPatternsBad": "このタイムラインの現在のインデックスパターン:{callout}",
"xpack.securitySolution.indexPatterns.dataViewLabel": "データビュー",
"xpack.securitySolution.indexPatterns.descriptionsLabel": "これらは現在選択されているインデックスパターンです。データビューからインデックスパターンを除外すると、全体的なパフォーマンスを改善できます。",
"xpack.securitySolution.indexPatterns.disabled": "このページでは無効なインデックスパターンが推奨されますが、最初にKibanaインデックスパターン設定で構成する必要があります。",
@ -24631,10 +24629,8 @@
"xpack.securitySolution.indexPatterns.indexPatternsLabel": "インデックスパターン",
"xpack.securitySolution.indexPatterns.missingPatterns": "以前のタイムラインのデータビューを再作成するには、セキュリティデータビューに次のインデックスパターンがありません:{callout}",
"xpack.securitySolution.indexPatterns.missingPatterns.callout": "セキュリティデータビューには次のインデックスパターンがありません:{callout}",
"xpack.securitySolution.indexPatterns.missingPatterns.description": "一時データビューを作成することで、タイムラインを保持しています。データを修正する場合は、見つからないインデックスパターンをセキュリティデータビューに追加できます。手動でデータビュー{link}を選択することもできます。",
"xpack.securitySolution.indexPatterns.modifiedBadgeTitle": "変更済み",
"xpack.securitySolution.indexPatterns.noData": "このタイムラインのインデックスパターンはデータストリーム、インデックス、またはインデックスエイリアスと一致しません。",
"xpack.securitySolution.indexPatterns.noMatchData": "次のインデックスパターンはこのタイムラインに保存されますが、データストリーム、インデックス、またはインデックスエイリアスと一致しません:{aliases}",
"xpack.securitySolution.indexPatterns.onlyDetectionAlertsLabel": "検出アラートのみを表示",
"xpack.securitySolution.indexPatterns.pickIndexPatternsCombo": "インデックスパターンを選択",
"xpack.securitySolution.indexPatterns.reloadPageTitle": "ページを再読み込み",
@ -24644,7 +24640,6 @@
"xpack.securitySolution.indexPatterns.securityDefaultDataViewLabel": "セキュリティデフォルトデータビュー",
"xpack.securitySolution.indexPatterns.selectDataView": "データビュー選択",
"xpack.securitySolution.indexPatterns.successToastTitle": "設定を有効にするためにページの再読み込みが必要です",
"xpack.securitySolution.indexPatterns.toggleToNewSourcerer": "一時データビューを作成することで、タイムラインを保持しています。データを修正する場合は、新しいデータビューセレクターを使用して、一時データビューを再作成できます。手動でデータビュー{link}を選択することもできます。",
"xpack.securitySolution.indexPatterns.toggleToNewSourcerer.link": "こちら",
"xpack.securitySolution.indexPatterns.update": "データビューを更新して再作成",
"xpack.securitySolution.indexPatterns.updateAvailableBadgeTitle": "更新が利用可能です",

View file

@ -24648,8 +24648,6 @@
"xpack.securitySolution.indexPatterns.chooseDataViewLabel": "选择数据视图",
"xpack.securitySolution.indexPatterns.closeButton": "关闭",
"xpack.securitySolution.indexPatterns.continue": "继续,而不添加",
"xpack.securitySolution.indexPatterns.currentPatterns": "此时间线中的活动索引模式为 {tooltip}{callout}",
"xpack.securitySolution.indexPatterns.currentPatternsBad": "此时间线中的当前索引模式为:{callout}",
"xpack.securitySolution.indexPatterns.dataViewLabel": "数据视图",
"xpack.securitySolution.indexPatterns.descriptionsLabel": "这些是当前选择的索引模式。从您的数据视图中筛除索引模式可帮助提高整体性能。",
"xpack.securitySolution.indexPatterns.disabled": "在此页面上建议使用已禁用的索引模式,但是首先需要在 Kibana 索引模式设置中配置这些模式",
@ -24659,10 +24657,8 @@
"xpack.securitySolution.indexPatterns.indexPatternsLabel": "索引模式",
"xpack.securitySolution.indexPatterns.missingPatterns": "要重新创建上一时间线的数据视图,安全数据视图缺少以下索引模式:{callout}",
"xpack.securitySolution.indexPatterns.missingPatterns.callout": "安全数据视图缺少以下索引模式:{callout}",
"xpack.securitySolution.indexPatterns.missingPatterns.description": "我们已通过创建临时数据视图来保留您的时间线。如果您要修改数据,我们可以将缺失的索引模式添加到安全数据视图。您还可以手动选择数据视图 {link}。",
"xpack.securitySolution.indexPatterns.modifiedBadgeTitle": "已修改",
"xpack.securitySolution.indexPatterns.noData": "此时间线上的索引模式不匹配任何数据流、索引或索引别名。",
"xpack.securitySolution.indexPatterns.noMatchData": "以下索引模式已保存到此时间线,但不匹配任何数据流、索引或索引别名:{aliases}",
"xpack.securitySolution.indexPatterns.onlyDetectionAlertsLabel": "仅显示检测告警",
"xpack.securitySolution.indexPatterns.pickIndexPatternsCombo": "选取索引模式",
"xpack.securitySolution.indexPatterns.reloadPageTitle": "重新加载页面",
@ -24672,7 +24668,6 @@
"xpack.securitySolution.indexPatterns.securityDefaultDataViewLabel": "安全默认数据视图",
"xpack.securitySolution.indexPatterns.selectDataView": "数据视图选择",
"xpack.securitySolution.indexPatterns.successToastTitle": "一个或多个设置需要您重新加载页面才能生效",
"xpack.securitySolution.indexPatterns.toggleToNewSourcerer": "我们已通过创建临时数据视图来保留您的时间线。如果您要修改数据,我们可以使用新的数据视图选择器重新创建临时数据视图。您还可以手动选择数据视图 {link}。",
"xpack.securitySolution.indexPatterns.toggleToNewSourcerer.link": "此处",
"xpack.securitySolution.indexPatterns.update": "更新并重新创建数据视图",
"xpack.securitySolution.indexPatterns.updateAvailableBadgeTitle": "有可用更新",