mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Updates security data example to external documentation (#114973)
* initial commit. * Remove reverse dependency on security solution presence. * Update translations. * remove unneeded interface. * Remove stray type. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
72dcc4638b
commit
7daf707cb9
18 changed files with 32 additions and 612 deletions
|
@ -1,110 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`example security payload renders as expected 1`] = `
|
||||
<EuiCodeBlock
|
||||
language="js"
|
||||
>
|
||||
{
|
||||
"@timestamp": "2020-09-22T14:34:56.82202300Z",
|
||||
"agent": {
|
||||
"build": {
|
||||
"original": "version: 7.9.1, compiled: Thu Aug 27 14:50:21 2020, branch: 7.9, commit: b594beb958817dee9b9d908191ed766d483df3ea"
|
||||
},
|
||||
"id": "22dd8544-bcac-46cb-b970-5e681bb99e0b",
|
||||
"type": "endpoint",
|
||||
"version": "7.9.1"
|
||||
},
|
||||
"Endpoint": {
|
||||
"policy": {
|
||||
"applied": {
|
||||
"artifacts": {
|
||||
"global": {
|
||||
"identifiers": [
|
||||
{
|
||||
"sha256": "6a546aade5563d3e8dffc1fe2d93d33edda8f9ca3e17ac3cc9ac707620cb9ecd",
|
||||
"name": "endpointpe-v4-blocklist"
|
||||
},
|
||||
{
|
||||
"sha256": "04f9f87accc5d5aea433427bd1bd4ec6908f8528c78ceed26f70df7875a99385",
|
||||
"name": "endpointpe-v4-exceptionlist"
|
||||
},
|
||||
{
|
||||
"sha256": "1471838597fcd79a54ea4a3ec9a9beee1a86feaedab6c98e61102559ced822a8",
|
||||
"name": "endpointpe-v4-model"
|
||||
},
|
||||
{
|
||||
"sha256": "824859b0c6749cc31951d92a73bbdddfcfe9f38abfe432087934d4dab9766ce8",
|
||||
"name": "global-exceptionlist-windows"
|
||||
}
|
||||
],
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"user": {
|
||||
"identifiers": [
|
||||
{
|
||||
"sha256": "d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658",
|
||||
"name": "endpoint-exceptionlist-windows-v1"
|
||||
}
|
||||
],
|
||||
"version": "1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ecs": {
|
||||
"version": "1.5.0"
|
||||
},
|
||||
"elastic": {
|
||||
"agent": {
|
||||
"id": "b2e88aea-2671-402a-828a-957526bac315"
|
||||
}
|
||||
},
|
||||
"file": {
|
||||
"path": "C:\\\\Windows\\\\Temp\\\\mimikatz.exe",
|
||||
"size": 1263880,
|
||||
"created": "2020-05-19T07:50:06.0Z",
|
||||
"accessed": "2020-09-22T14:29:19.93531400Z",
|
||||
"mtime": "2020-09-22T14:29:03.6040000Z",
|
||||
"directory": "C:\\\\Windows\\\\Temp",
|
||||
"hash": {
|
||||
"sha1": "c9fb7f8a4c6b7b12b493a99a8dc6901d17867388",
|
||||
"sha256": "cb1553a3c88817e4cc774a5a93f9158f6785bd3815447d04b6c3f4c2c4b21ed7",
|
||||
"md5": "465d5d850f54d9cde767bda90743df30"
|
||||
},
|
||||
"Ext": {
|
||||
"code_signature": {
|
||||
"trusted": true,
|
||||
"subject_name": "Open Source Developer, Benjamin Delpy",
|
||||
"exists": true,
|
||||
"status": "trusted"
|
||||
},
|
||||
"malware_classification": {
|
||||
"identifier": "endpointpe-v4-model",
|
||||
"score": 0.99956864118576,
|
||||
"threshold": 0.71,
|
||||
"version": "0.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"host": {
|
||||
"os": {
|
||||
"Ext": {
|
||||
"variant": "Windows 10 Enterprise Evaluation"
|
||||
},
|
||||
"kernel": "2004 (10.0.19041.388)",
|
||||
"name": "Windows",
|
||||
"family": "windows",
|
||||
"version": "2004 (10.0.19041.388)",
|
||||
"platform": "windows",
|
||||
"full": "Windows 10 Enterprise Evaluation 2004 (10.0.19041.388)"
|
||||
}
|
||||
},
|
||||
"event": {
|
||||
"kind": "alert"
|
||||
},
|
||||
"cluster_uuid": "kLbKvSMcRiiFAR0t8LebDA",
|
||||
"cluster_name": "elasticsearch"
|
||||
}
|
||||
</EuiCodeBlock>
|
||||
`;
|
|
@ -1,45 +0,0 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`security flyout renders as expected renders as expected 1`] = `
|
||||
<EuiPortal>
|
||||
<EuiFlyout
|
||||
maxWidth={true}
|
||||
onClose={[MockFunction]}
|
||||
ownFocus={true}
|
||||
>
|
||||
<EuiFlyoutHeader>
|
||||
<EuiTitle>
|
||||
<h2>
|
||||
Endpoint security data
|
||||
</h2>
|
||||
</EuiTitle>
|
||||
<EuiTextColor
|
||||
color="subdued"
|
||||
>
|
||||
<EuiText>
|
||||
This is a representative sample of the endpoint security alert event that we collect. Endpoint security data is collected only when the Elastic Endpoint is enabled. It includes information about the endpoint configuration and detection events.
|
||||
</EuiText>
|
||||
</EuiTextColor>
|
||||
</EuiFlyoutHeader>
|
||||
<EuiFlyoutBody>
|
||||
<Suspense
|
||||
fallback={
|
||||
<EuiFlexGroup
|
||||
justifyContent="spaceAround"
|
||||
>
|
||||
<EuiFlexItem
|
||||
grow={false}
|
||||
>
|
||||
<EuiLoadingSpinner
|
||||
size="xl"
|
||||
/>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
}
|
||||
>
|
||||
<lazy />
|
||||
</Suspense>
|
||||
</EuiFlyoutBody>
|
||||
</EuiFlyout>
|
||||
</EuiPortal>
|
||||
`;
|
|
@ -1,50 +1,5 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`TelemetryManagementSectionComponent does not show the endpoint link when isSecurityExampleEnabled returns false 1`] = `
|
||||
<React.Fragment>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
defaultMessage="Enabling data usage collection helps us manage and improve our products and services. See our {privacyStatementLink} for more details."
|
||||
id="telemetry.telemetryConfigAndLinkDescription"
|
||||
values={
|
||||
Object {
|
||||
"privacyStatementLink": <EuiLink
|
||||
href="https://www.elastic.co/legal/privacy-statement"
|
||||
target="_blank"
|
||||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="Privacy Statement"
|
||||
id="telemetry.readOurUsageDataPrivacyStatementLinkText"
|
||||
values={Object {}}
|
||||
/>
|
||||
</EuiLink>,
|
||||
}
|
||||
}
|
||||
/>
|
||||
</p>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
defaultMessage="See an example of the {clusterData} that we collect."
|
||||
id="telemetry.seeExampleOfClusterData"
|
||||
values={
|
||||
Object {
|
||||
"clusterData": <EuiLink
|
||||
data-test-id="cluster_data_example"
|
||||
onClick={[Function]}
|
||||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="cluster data"
|
||||
id="telemetry.clusterData"
|
||||
values={Object {}}
|
||||
/>
|
||||
</EuiLink>,
|
||||
}
|
||||
}
|
||||
/>
|
||||
</p>
|
||||
</React.Fragment>
|
||||
`;
|
||||
|
||||
exports[`TelemetryManagementSectionComponent renders as expected 1`] = `
|
||||
<Fragment>
|
||||
<_EuiSplitPanelOuter
|
||||
|
@ -124,7 +79,7 @@ exports[`TelemetryManagementSectionComponent renders as expected 1`] = `
|
|||
</p>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
defaultMessage="See examples of the {clusterData} and {endpointSecurityData} that we collect."
|
||||
defaultMessage="See examples of the {clusterData} and {securityData} that we collect."
|
||||
id="telemetry.seeExampleOfClusterDataAndEndpointSecuity"
|
||||
values={
|
||||
Object {
|
||||
|
@ -138,12 +93,13 @@ exports[`TelemetryManagementSectionComponent renders as expected 1`] = `
|
|||
values={Object {}}
|
||||
/>
|
||||
</EuiLink>,
|
||||
"endpointSecurityData": <EuiLink
|
||||
"securityData": <EuiLink
|
||||
data-test-id="endpoint_security_example"
|
||||
onClick={[Function]}
|
||||
href="https://www.elastic.co/guide/en/security/current/advanced-settings.html#telemetry-settings"
|
||||
target="_blank"
|
||||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="endpoint security data"
|
||||
defaultMessage="security data"
|
||||
id="telemetry.securityData"
|
||||
values={Object {}}
|
||||
/>
|
||||
|
@ -287,19 +243,6 @@ exports[`TelemetryManagementSectionComponent renders null because allowChangingO
|
|||
"timeZone": null,
|
||||
}
|
||||
}
|
||||
isSecurityExampleEnabled={
|
||||
[MockFunction] {
|
||||
"calls": Array [
|
||||
Array [],
|
||||
],
|
||||
"results": Array [
|
||||
Object {
|
||||
"type": "return",
|
||||
"value": true,
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
onQueryMatchChange={[MockFunction]}
|
||||
showAppliesSettingMessage={true}
|
||||
telemetryService={
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* 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 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { shallowWithIntl } from '@kbn/test/jest';
|
||||
import ExampleSecurityPayload from './example_security_payload';
|
||||
|
||||
describe('example security payload', () => {
|
||||
it('renders as expected', () => {
|
||||
expect(shallowWithIntl(<ExampleSecurityPayload />)).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -1,124 +0,0 @@
|
|||
/*
|
||||
* 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 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { EuiCodeBlock } from '@elastic/eui';
|
||||
import * as React from 'react';
|
||||
|
||||
const exampleSecurityPayload = {
|
||||
'@timestamp': '2020-09-22T14:34:56.82202300Z',
|
||||
agent: {
|
||||
build: {
|
||||
original:
|
||||
'version: 7.9.1, compiled: Thu Aug 27 14:50:21 2020, branch: 7.9, commit: b594beb958817dee9b9d908191ed766d483df3ea',
|
||||
},
|
||||
id: '22dd8544-bcac-46cb-b970-5e681bb99e0b',
|
||||
type: 'endpoint',
|
||||
version: '7.9.1',
|
||||
},
|
||||
Endpoint: {
|
||||
policy: {
|
||||
applied: {
|
||||
artifacts: {
|
||||
global: {
|
||||
identifiers: [
|
||||
{
|
||||
sha256: '6a546aade5563d3e8dffc1fe2d93d33edda8f9ca3e17ac3cc9ac707620cb9ecd',
|
||||
name: 'endpointpe-v4-blocklist',
|
||||
},
|
||||
{
|
||||
sha256: '04f9f87accc5d5aea433427bd1bd4ec6908f8528c78ceed26f70df7875a99385',
|
||||
name: 'endpointpe-v4-exceptionlist',
|
||||
},
|
||||
{
|
||||
sha256: '1471838597fcd79a54ea4a3ec9a9beee1a86feaedab6c98e61102559ced822a8',
|
||||
name: 'endpointpe-v4-model',
|
||||
},
|
||||
{
|
||||
sha256: '824859b0c6749cc31951d92a73bbdddfcfe9f38abfe432087934d4dab9766ce8',
|
||||
name: 'global-exceptionlist-windows',
|
||||
},
|
||||
],
|
||||
version: '1.0.0',
|
||||
},
|
||||
user: {
|
||||
identifiers: [
|
||||
{
|
||||
sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
|
||||
name: 'endpoint-exceptionlist-windows-v1',
|
||||
},
|
||||
],
|
||||
version: '1.0.0',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ecs: {
|
||||
version: '1.5.0',
|
||||
},
|
||||
elastic: {
|
||||
agent: {
|
||||
id: 'b2e88aea-2671-402a-828a-957526bac315',
|
||||
},
|
||||
},
|
||||
file: {
|
||||
path: 'C:\\Windows\\Temp\\mimikatz.exe',
|
||||
size: 1263880,
|
||||
created: '2020-05-19T07:50:06.0Z',
|
||||
accessed: '2020-09-22T14:29:19.93531400Z',
|
||||
mtime: '2020-09-22T14:29:03.6040000Z',
|
||||
directory: 'C:\\Windows\\Temp',
|
||||
hash: {
|
||||
sha1: 'c9fb7f8a4c6b7b12b493a99a8dc6901d17867388',
|
||||
sha256: 'cb1553a3c88817e4cc774a5a93f9158f6785bd3815447d04b6c3f4c2c4b21ed7',
|
||||
md5: '465d5d850f54d9cde767bda90743df30',
|
||||
},
|
||||
Ext: {
|
||||
code_signature: {
|
||||
trusted: true,
|
||||
subject_name: 'Open Source Developer, Benjamin Delpy',
|
||||
exists: true,
|
||||
status: 'trusted',
|
||||
},
|
||||
malware_classification: {
|
||||
identifier: 'endpointpe-v4-model',
|
||||
score: 0.99956864118576,
|
||||
threshold: 0.71,
|
||||
version: '0.0.0',
|
||||
},
|
||||
},
|
||||
},
|
||||
host: {
|
||||
os: {
|
||||
Ext: {
|
||||
variant: 'Windows 10 Enterprise Evaluation',
|
||||
},
|
||||
kernel: '2004 (10.0.19041.388)',
|
||||
name: 'Windows',
|
||||
family: 'windows',
|
||||
version: '2004 (10.0.19041.388)',
|
||||
platform: 'windows',
|
||||
full: 'Windows 10 Enterprise Evaluation 2004 (10.0.19041.388)',
|
||||
},
|
||||
},
|
||||
event: {
|
||||
kind: 'alert',
|
||||
},
|
||||
cluster_uuid: 'kLbKvSMcRiiFAR0t8LebDA',
|
||||
cluster_name: 'elasticsearch',
|
||||
};
|
||||
|
||||
const ExampleSecurityPayload: React.FC = () => {
|
||||
return (
|
||||
<EuiCodeBlock language="js">{JSON.stringify(exampleSecurityPayload, null, 2)}</EuiCodeBlock>
|
||||
);
|
||||
};
|
||||
|
||||
// Used for lazy import
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default ExampleSecurityPayload;
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* 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 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { shallowWithIntl } from '@kbn/test/jest';
|
||||
import { OptInSecurityExampleFlyout } from './opt_in_security_example_flyout';
|
||||
|
||||
describe('security flyout renders as expected', () => {
|
||||
it('renders as expected', () => {
|
||||
expect(shallowWithIntl(<OptInSecurityExampleFlyout onClose={jest.fn()} />)).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* 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 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
import {
|
||||
EuiFlyout,
|
||||
EuiFlyoutHeader,
|
||||
EuiFlyoutBody,
|
||||
EuiPortal, // EuiPortal is a temporary requirement to use EuiFlyout with "ownFocus"
|
||||
EuiText,
|
||||
EuiTextColor,
|
||||
EuiTitle,
|
||||
} from '@elastic/eui';
|
||||
import { loadingSpinner } from './loading_spinner';
|
||||
|
||||
interface Props {
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
const LazyExampleSecurityPayload = React.lazy(() => import('./example_security_payload'));
|
||||
|
||||
/**
|
||||
* React component for displaying the example data associated with the Telemetry opt-in banner.
|
||||
*/
|
||||
export class OptInSecurityExampleFlyout extends React.PureComponent<Props> {
|
||||
render() {
|
||||
return (
|
||||
<EuiPortal>
|
||||
<EuiFlyout ownFocus onClose={this.props.onClose} maxWidth={true}>
|
||||
<EuiFlyoutHeader>
|
||||
<EuiTitle>
|
||||
<h2>Endpoint security data</h2>
|
||||
</EuiTitle>
|
||||
<EuiTextColor color="subdued">
|
||||
<EuiText>
|
||||
This is a representative sample of the endpoint security alert event that we
|
||||
collect. Endpoint security data is collected only when the Elastic Endpoint is
|
||||
enabled. It includes information about the endpoint configuration and detection
|
||||
events.
|
||||
</EuiText>
|
||||
</EuiTextColor>
|
||||
</EuiFlyoutHeader>
|
||||
<EuiFlyoutBody>
|
||||
<React.Suspense fallback={loadingSpinner}>
|
||||
<LazyExampleSecurityPayload />
|
||||
</React.Suspense>
|
||||
</EuiFlyoutBody>
|
||||
</EuiFlyout>
|
||||
</EuiPortal>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -21,7 +21,6 @@ describe('TelemetryManagementSectionComponent', () => {
|
|||
|
||||
it('renders as expected', () => {
|
||||
const onQueryMatchChange = jest.fn();
|
||||
const isSecurityExampleEnabled = jest.fn().mockReturnValue(true);
|
||||
const telemetryService = new TelemetryService({
|
||||
config: {
|
||||
sendUsageTo: 'staging',
|
||||
|
@ -45,7 +44,6 @@ describe('TelemetryManagementSectionComponent', () => {
|
|||
onQueryMatchChange={onQueryMatchChange}
|
||||
showAppliesSettingMessage={true}
|
||||
enableSaving={true}
|
||||
isSecurityExampleEnabled={isSecurityExampleEnabled}
|
||||
toasts={coreStart.notifications.toasts}
|
||||
docLinks={docLinks}
|
||||
/>
|
||||
|
@ -55,7 +53,6 @@ describe('TelemetryManagementSectionComponent', () => {
|
|||
|
||||
it('renders null because query does not match the SEARCH_TERMS', () => {
|
||||
const onQueryMatchChange = jest.fn();
|
||||
const isSecurityExampleEnabled = jest.fn().mockReturnValue(true);
|
||||
const telemetryService = new TelemetryService({
|
||||
config: {
|
||||
enabled: true,
|
||||
|
@ -79,7 +76,6 @@ describe('TelemetryManagementSectionComponent', () => {
|
|||
onQueryMatchChange={onQueryMatchChange}
|
||||
showAppliesSettingMessage={false}
|
||||
enableSaving={true}
|
||||
isSecurityExampleEnabled={isSecurityExampleEnabled}
|
||||
toasts={coreStart.notifications.toasts}
|
||||
docLinks={docLinks}
|
||||
/>
|
||||
|
@ -96,7 +92,6 @@ describe('TelemetryManagementSectionComponent', () => {
|
|||
showAppliesSettingMessage={false}
|
||||
enableSaving={true}
|
||||
toasts={coreStart.notifications.toasts}
|
||||
isSecurityExampleEnabled={isSecurityExampleEnabled}
|
||||
docLinks={docLinks}
|
||||
/>
|
||||
</React.Suspense>
|
||||
|
@ -110,7 +105,6 @@ describe('TelemetryManagementSectionComponent', () => {
|
|||
|
||||
it('renders because query matches the SEARCH_TERMS', () => {
|
||||
const onQueryMatchChange = jest.fn();
|
||||
const isSecurityExampleEnabled = jest.fn().mockReturnValue(true);
|
||||
const telemetryService = new TelemetryService({
|
||||
config: {
|
||||
enabled: true,
|
||||
|
@ -132,7 +126,6 @@ describe('TelemetryManagementSectionComponent', () => {
|
|||
telemetryService={telemetryService}
|
||||
onQueryMatchChange={onQueryMatchChange}
|
||||
showAppliesSettingMessage={false}
|
||||
isSecurityExampleEnabled={isSecurityExampleEnabled}
|
||||
enableSaving={true}
|
||||
toasts={coreStart.notifications.toasts}
|
||||
docLinks={docLinks}
|
||||
|
@ -158,7 +151,6 @@ describe('TelemetryManagementSectionComponent', () => {
|
|||
|
||||
it('renders null because allowChangingOptInStatus is false', () => {
|
||||
const onQueryMatchChange = jest.fn();
|
||||
const isSecurityExampleEnabled = jest.fn().mockReturnValue(true);
|
||||
const telemetryService = new TelemetryService({
|
||||
config: {
|
||||
enabled: true,
|
||||
|
@ -181,7 +173,6 @@ describe('TelemetryManagementSectionComponent', () => {
|
|||
onQueryMatchChange={onQueryMatchChange}
|
||||
showAppliesSettingMessage={true}
|
||||
enableSaving={true}
|
||||
isSecurityExampleEnabled={isSecurityExampleEnabled}
|
||||
toasts={coreStart.notifications.toasts}
|
||||
docLinks={docLinks}
|
||||
/>
|
||||
|
@ -197,7 +188,6 @@ describe('TelemetryManagementSectionComponent', () => {
|
|||
|
||||
it('shows the OptInExampleFlyout', () => {
|
||||
const onQueryMatchChange = jest.fn();
|
||||
const isSecurityExampleEnabled = jest.fn().mockReturnValue(true);
|
||||
const telemetryService = new TelemetryService({
|
||||
config: {
|
||||
enabled: true,
|
||||
|
@ -220,7 +210,6 @@ describe('TelemetryManagementSectionComponent', () => {
|
|||
onQueryMatchChange={onQueryMatchChange}
|
||||
showAppliesSettingMessage={false}
|
||||
enableSaving={true}
|
||||
isSecurityExampleEnabled={isSecurityExampleEnabled}
|
||||
toasts={coreStart.notifications.toasts}
|
||||
docLinks={docLinks}
|
||||
/>
|
||||
|
@ -235,89 +224,8 @@ describe('TelemetryManagementSectionComponent', () => {
|
|||
}
|
||||
});
|
||||
|
||||
it('shows the OptInSecurityExampleFlyout', () => {
|
||||
const onQueryMatchChange = jest.fn();
|
||||
const isSecurityExampleEnabled = jest.fn().mockReturnValue(true);
|
||||
const telemetryService = new TelemetryService({
|
||||
config: {
|
||||
enabled: true,
|
||||
banner: true,
|
||||
allowChangingOptInStatus: true,
|
||||
optIn: false,
|
||||
sendUsageTo: 'staging',
|
||||
sendUsageFrom: 'browser',
|
||||
},
|
||||
isScreenshotMode: false,
|
||||
reportOptInStatusChange: false,
|
||||
notifications: coreStart.notifications,
|
||||
currentKibanaVersion: 'mock_kibana_version',
|
||||
http: coreSetup.http,
|
||||
});
|
||||
|
||||
const component = mountWithIntl(
|
||||
<TelemetryManagementSection
|
||||
telemetryService={telemetryService}
|
||||
onQueryMatchChange={onQueryMatchChange}
|
||||
showAppliesSettingMessage={false}
|
||||
isSecurityExampleEnabled={isSecurityExampleEnabled}
|
||||
enableSaving={true}
|
||||
toasts={coreStart.notifications.toasts}
|
||||
docLinks={docLinks}
|
||||
/>
|
||||
);
|
||||
try {
|
||||
const toggleExampleComponent = component.find('FormattedMessage > EuiLink[onClick]').at(1);
|
||||
const updatedView = toggleExampleComponent.simulate('click');
|
||||
updatedView.find('OptInSecurityExampleFlyout');
|
||||
updatedView.simulate('close');
|
||||
} finally {
|
||||
component.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it('does not show the endpoint link when isSecurityExampleEnabled returns false', () => {
|
||||
const onQueryMatchChange = jest.fn();
|
||||
const isSecurityExampleEnabled = jest.fn().mockReturnValue(false);
|
||||
const telemetryService = new TelemetryService({
|
||||
config: {
|
||||
enabled: true,
|
||||
banner: true,
|
||||
allowChangingOptInStatus: true,
|
||||
optIn: false,
|
||||
sendUsageTo: 'staging',
|
||||
sendUsageFrom: 'browser',
|
||||
},
|
||||
isScreenshotMode: false,
|
||||
reportOptInStatusChange: false,
|
||||
currentKibanaVersion: 'mock_kibana_version',
|
||||
notifications: coreStart.notifications,
|
||||
http: coreSetup.http,
|
||||
});
|
||||
|
||||
const component = mountWithIntl(
|
||||
<TelemetryManagementSection
|
||||
telemetryService={telemetryService}
|
||||
onQueryMatchChange={onQueryMatchChange}
|
||||
showAppliesSettingMessage={false}
|
||||
isSecurityExampleEnabled={isSecurityExampleEnabled}
|
||||
enableSaving={true}
|
||||
toasts={coreStart.notifications.toasts}
|
||||
docLinks={docLinks}
|
||||
/>
|
||||
);
|
||||
|
||||
try {
|
||||
const description = (component.instance() as TelemetryManagementSection).renderDescription();
|
||||
expect(isSecurityExampleEnabled).toBeCalled();
|
||||
expect(description).toMatchSnapshot();
|
||||
} finally {
|
||||
component.unmount();
|
||||
}
|
||||
});
|
||||
|
||||
it('toggles the OptIn button', async () => {
|
||||
const onQueryMatchChange = jest.fn();
|
||||
const isSecurityExampleEnabled = jest.fn().mockReturnValue(true);
|
||||
const telemetryService = new TelemetryService({
|
||||
config: {
|
||||
enabled: true,
|
||||
|
@ -340,7 +248,6 @@ describe('TelemetryManagementSectionComponent', () => {
|
|||
onQueryMatchChange={onQueryMatchChange}
|
||||
showAppliesSettingMessage={false}
|
||||
enableSaving={true}
|
||||
isSecurityExampleEnabled={isSecurityExampleEnabled}
|
||||
toasts={coreStart.notifications.toasts}
|
||||
docLinks={docLinks}
|
||||
/>
|
||||
|
@ -367,7 +274,6 @@ describe('TelemetryManagementSectionComponent', () => {
|
|||
|
||||
it('test the wrapper (for coverage purposes)', () => {
|
||||
const onQueryMatchChange = jest.fn();
|
||||
const isSecurityExampleEnabled = jest.fn().mockReturnValue(true);
|
||||
const telemetryService = new TelemetryService({
|
||||
config: {
|
||||
enabled: true,
|
||||
|
@ -392,7 +298,6 @@ describe('TelemetryManagementSectionComponent', () => {
|
|||
onQueryMatchChange={onQueryMatchChange}
|
||||
enableSaving={true}
|
||||
toasts={coreStart.notifications.toasts}
|
||||
isSecurityExampleEnabled={isSecurityExampleEnabled}
|
||||
docLinks={docLinks}
|
||||
/>
|
||||
).html()
|
||||
|
|
|
@ -15,7 +15,6 @@ import type { TelemetryPluginSetup } from 'src/plugins/telemetry/public';
|
|||
import type { DocLinksStart, ToastsStart } from 'src/core/public';
|
||||
import { PRIVACY_STATEMENT_URL } from '../../../telemetry/common/constants';
|
||||
import { OptInExampleFlyout } from './opt_in_example_flyout';
|
||||
import { OptInSecurityExampleFlyout } from './opt_in_security_example_flyout';
|
||||
import { LazyField } from '../../../advanced_settings/public';
|
||||
import { TrackApplicationView } from '../../../usage_collection/public';
|
||||
|
||||
|
@ -26,7 +25,6 @@ const SEARCH_TERMS = ['telemetry', 'usage', 'data', 'usage data'];
|
|||
interface Props {
|
||||
telemetryService: TelemetryService;
|
||||
onQueryMatchChange: (searchTermMatches: boolean) => void;
|
||||
isSecurityExampleEnabled: () => boolean;
|
||||
showAppliesSettingMessage: boolean;
|
||||
enableSaving: boolean;
|
||||
query?: { text: string };
|
||||
|
@ -80,9 +78,8 @@ export class TelemetryManagementSection extends Component<Props, State> {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { telemetryService, isSecurityExampleEnabled } = this.props;
|
||||
const { showExample, showSecurityExample, queryMatches, enabled, processing } = this.state;
|
||||
const securityExampleEnabled = isSecurityExampleEnabled();
|
||||
const { telemetryService } = this.props;
|
||||
const { showExample, queryMatches, enabled, processing } = this.state;
|
||||
|
||||
if (!telemetryService.getCanChangeOptInStatus()) {
|
||||
return null;
|
||||
|
@ -102,11 +99,6 @@ export class TelemetryManagementSection extends Component<Props, State> {
|
|||
/>
|
||||
</TrackApplicationView>
|
||||
)}
|
||||
{showSecurityExample && securityExampleEnabled && (
|
||||
<TrackApplicationView viewId="optInSecurityExampleFlyout">
|
||||
<OptInSecurityExampleFlyout onClose={this.toggleSecurityExample} />
|
||||
</TrackApplicationView>
|
||||
)}
|
||||
<EuiSplitPanel.Outer hasBorder>
|
||||
<EuiForm>
|
||||
<EuiSplitPanel.Inner color="subdued">
|
||||
|
@ -182,17 +174,19 @@ export class TelemetryManagementSection extends Component<Props, State> {
|
|||
};
|
||||
|
||||
renderDescription = () => {
|
||||
const { isSecurityExampleEnabled } = this.props;
|
||||
const securityExampleEnabled = isSecurityExampleEnabled();
|
||||
const clusterDataLink = (
|
||||
<EuiLink onClick={this.toggleExample} data-test-id="cluster_data_example">
|
||||
<FormattedMessage id="telemetry.clusterData" defaultMessage="cluster data" />
|
||||
</EuiLink>
|
||||
);
|
||||
|
||||
const endpointSecurityDataLink = (
|
||||
<EuiLink onClick={this.toggleSecurityExample} data-test-id="endpoint_security_example">
|
||||
<FormattedMessage id="telemetry.securityData" defaultMessage="endpoint security data" />
|
||||
const securityDataLink = (
|
||||
<EuiLink
|
||||
href="https://www.elastic.co/guide/en/security/current/advanced-settings.html#telemetry-settings"
|
||||
data-test-id="endpoint_security_example"
|
||||
target="_blank"
|
||||
>
|
||||
<FormattedMessage id="telemetry.securityData" defaultMessage="security data" />
|
||||
</EuiLink>
|
||||
);
|
||||
|
||||
|
@ -216,24 +210,14 @@ export class TelemetryManagementSection extends Component<Props, State> {
|
|||
/>
|
||||
</p>
|
||||
<p>
|
||||
{securityExampleEnabled ? (
|
||||
<FormattedMessage
|
||||
id="telemetry.seeExampleOfClusterDataAndEndpointSecuity"
|
||||
defaultMessage="See examples of the {clusterData} and {endpointSecurityData} that we collect."
|
||||
values={{
|
||||
clusterData: clusterDataLink,
|
||||
endpointSecurityData: endpointSecurityDataLink,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<FormattedMessage
|
||||
id="telemetry.seeExampleOfClusterData"
|
||||
defaultMessage="See an example of the {clusterData} that we collect."
|
||||
values={{
|
||||
clusterData: clusterDataLink,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<FormattedMessage
|
||||
id="telemetry.seeExampleOfClusterDataAndEndpointSecuity"
|
||||
defaultMessage="See examples of the {clusterData} and {securityData} that we collect."
|
||||
values={{
|
||||
clusterData: clusterDataLink,
|
||||
securityData: securityDataLink,
|
||||
}}
|
||||
/>
|
||||
</p>
|
||||
</Fragment>
|
||||
);
|
||||
|
@ -277,15 +261,6 @@ export class TelemetryManagementSection extends Component<Props, State> {
|
|||
showExample: !this.state.showExample,
|
||||
});
|
||||
};
|
||||
|
||||
toggleSecurityExample = () => {
|
||||
const { isSecurityExampleEnabled } = this.props;
|
||||
const securityExampleEnabled = isSecurityExampleEnabled();
|
||||
if (!securityExampleEnabled) return;
|
||||
this.setState({
|
||||
showSecurityExample: !this.state.showSecurityExample,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// required for lazy loading
|
||||
|
|
|
@ -12,21 +12,19 @@ import type { TelemetryPluginSetup } from 'src/plugins/telemetry/public';
|
|||
import type TelemetryManagementSection from './telemetry_management_section';
|
||||
export type TelemetryManagementSectionWrapperProps = Omit<
|
||||
TelemetryManagementSection['props'],
|
||||
'telemetryService' | 'showAppliesSettingMessage' | 'isSecurityExampleEnabled'
|
||||
'telemetryService' | 'showAppliesSettingMessage'
|
||||
>;
|
||||
|
||||
const TelemetryManagementSectionComponent = lazy(() => import('./telemetry_management_section'));
|
||||
|
||||
export function telemetryManagementSectionWrapper(
|
||||
telemetryService: TelemetryPluginSetup['telemetryService'],
|
||||
shouldShowSecuritySolutionUsageExample: () => boolean
|
||||
telemetryService: TelemetryPluginSetup['telemetryService']
|
||||
) {
|
||||
const TelemetryManagementSectionWrapper = (props: TelemetryManagementSectionWrapperProps) => (
|
||||
<Suspense fallback={<EuiLoadingSpinner />}>
|
||||
<TelemetryManagementSectionComponent
|
||||
showAppliesSettingMessage={true}
|
||||
telemetryService={telemetryService}
|
||||
isSecurityExampleEnabled={shouldShowSecuritySolutionUsageExample}
|
||||
{...props}
|
||||
/>
|
||||
</Suspense>
|
||||
|
|
|
@ -10,7 +10,6 @@ import { TelemetryManagementSectionPlugin } from './plugin';
|
|||
|
||||
export { OptInExampleFlyout } from './components';
|
||||
|
||||
export type { TelemetryManagementSectionPluginSetup } from './plugin';
|
||||
export function plugin() {
|
||||
return new TelemetryManagementSectionPlugin();
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import React from 'react';
|
|||
import type { AdvancedSettingsSetup } from 'src/plugins/advanced_settings/public';
|
||||
import type { TelemetryPluginSetup } from 'src/plugins/telemetry/public';
|
||||
import type { UsageCollectionSetup } from 'src/plugins/usage_collection/public';
|
||||
import type { Plugin, CoreStart, CoreSetup } from 'src/core/public';
|
||||
import type { CoreStart, CoreSetup } from 'src/core/public';
|
||||
|
||||
import {
|
||||
telemetryManagementSectionWrapper,
|
||||
|
@ -23,18 +23,7 @@ export interface TelemetryManagementSectionPluginDepsSetup {
|
|||
usageCollection?: UsageCollectionSetup;
|
||||
}
|
||||
|
||||
export interface TelemetryManagementSectionPluginSetup {
|
||||
toggleSecuritySolutionExample: (enabled: boolean) => void;
|
||||
}
|
||||
|
||||
export class TelemetryManagementSectionPlugin
|
||||
implements Plugin<TelemetryManagementSectionPluginSetup>
|
||||
{
|
||||
private showSecuritySolutionExample = false;
|
||||
private shouldShowSecuritySolutionExample = () => {
|
||||
return this.showSecuritySolutionExample;
|
||||
};
|
||||
|
||||
export class TelemetryManagementSectionPlugin {
|
||||
public setup(
|
||||
core: CoreSetup,
|
||||
{
|
||||
|
@ -50,21 +39,16 @@ export class TelemetryManagementSectionPlugin
|
|||
(props) => {
|
||||
return (
|
||||
<ApplicationUsageTrackingProvider>
|
||||
{telemetryManagementSectionWrapper(
|
||||
telemetryService,
|
||||
this.shouldShowSecuritySolutionExample
|
||||
)(props as TelemetryManagementSectionWrapperProps)}
|
||||
{telemetryManagementSectionWrapper(telemetryService)(
|
||||
props as TelemetryManagementSectionWrapperProps
|
||||
)}
|
||||
</ApplicationUsageTrackingProvider>
|
||||
);
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
return {
|
||||
toggleSecuritySolutionExample: (enabled: boolean) => {
|
||||
this.showSecuritySolutionExample = enabled;
|
||||
},
|
||||
};
|
||||
return {};
|
||||
}
|
||||
|
||||
public start(core: CoreStart) {}
|
||||
|
|
|
@ -38,8 +38,7 @@
|
|||
"lens",
|
||||
"lists",
|
||||
"home",
|
||||
"telemetry",
|
||||
"telemetryManagementSection"
|
||||
"telemetry"
|
||||
],
|
||||
"server": true,
|
||||
"ui": true,
|
||||
|
|
|
@ -27,14 +27,9 @@ export const track: TrackFn = (type, event, count) => {
|
|||
};
|
||||
|
||||
export const initTelemetry = (
|
||||
{
|
||||
usageCollection,
|
||||
telemetryManagementSection,
|
||||
}: Pick<SetupPlugins, 'usageCollection' | 'telemetryManagementSection'>,
|
||||
{ usageCollection }: Pick<SetupPlugins, 'usageCollection'>,
|
||||
appId: string
|
||||
) => {
|
||||
telemetryManagementSection?.toggleSecuritySolutionExample(true);
|
||||
|
||||
_track = usageCollection?.reportUiCounter?.bind(null, appId) ?? noop;
|
||||
};
|
||||
|
||||
|
|
|
@ -97,7 +97,6 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
|
|||
initTelemetry(
|
||||
{
|
||||
usageCollection: plugins.usageCollection,
|
||||
telemetryManagementSection: plugins.telemetryManagementSection,
|
||||
},
|
||||
APP_ID
|
||||
);
|
||||
|
|
|
@ -15,7 +15,6 @@ import { NewsfeedPublicPluginStart } from '../../../../src/plugins/newsfeed/publ
|
|||
import { Start as InspectorStart } from '../../../../src/plugins/inspector/public';
|
||||
import { UiActionsStart } from '../../../../src/plugins/ui_actions/public';
|
||||
import { UsageCollectionSetup } from '../../../../src/plugins/usage_collection/public';
|
||||
import { TelemetryManagementSectionPluginSetup } from '../../../../src/plugins/telemetry_management_section/public';
|
||||
import { Storage } from '../../../../src/plugins/kibana_utils/public';
|
||||
import { FleetStart } from '../../fleet/public';
|
||||
import { PluginStart as ListsPluginStart } from '../../lists/public';
|
||||
|
@ -49,7 +48,6 @@ export interface SetupPlugins {
|
|||
security: SecurityPluginSetup;
|
||||
triggersActionsUi: TriggersActionsSetup;
|
||||
usageCollection?: UsageCollectionSetup;
|
||||
telemetryManagementSection?: TelemetryManagementSectionPluginSetup;
|
||||
ml?: MlPluginSetup;
|
||||
}
|
||||
|
||||
|
|
|
@ -4524,8 +4524,6 @@
|
|||
"telemetry.provideUsageStatisticsTitle": "使用統計を提供",
|
||||
"telemetry.readOurUsageDataPrivacyStatementLinkText": "プライバシーポリシー",
|
||||
"telemetry.securityData": "Endpoint Security データ",
|
||||
"telemetry.seeExampleOfClusterData": "収集する {clusterData} の例をご覧ください。",
|
||||
"telemetry.seeExampleOfClusterDataAndEndpointSecuity": "当社が収集する{clusterData}および{endpointSecurityData}の例をご覧ください。",
|
||||
"telemetry.telemetryBannerDescription": "Elastic Stackの改善にご協力ください使用状況データの収集は現在無効です。使用状況データの収集を有効にすると、製品とサービスを管理して改善することができます。詳細については、{privacyStatementLink}をご覧ください。",
|
||||
"telemetry.telemetryConfigAndLinkDescription": "使用状況データの収集を有効にすると、製品とサービスを管理して改善することができます。詳細については、{privacyStatementLink}をご覧ください。",
|
||||
"telemetry.telemetryConfigDescription": "基本的な機能の利用状況に関する統計情報を提供して、Elastic Stack の改善にご協力ください。このデータは Elastic 社外と共有されません。",
|
||||
|
|
|
@ -4569,8 +4569,6 @@
|
|||
"telemetry.provideUsageStatisticsTitle": "提供使用情况统计",
|
||||
"telemetry.readOurUsageDataPrivacyStatementLinkText": "隐私声明",
|
||||
"telemetry.securityData": "终端安全数据",
|
||||
"telemetry.seeExampleOfClusterData": "查看我们收集的{clusterData}的示例。",
|
||||
"telemetry.seeExampleOfClusterDataAndEndpointSecuity": "查看我们收集的{clusterData}和 {endpointSecurityData}示例。",
|
||||
"telemetry.telemetryBannerDescription": "想帮助我们改进 Elastic Stack?数据使用情况收集当前已禁用。启用使用情况数据收集可帮助我们管理并改善产品和服务。有关更多详情,请参阅我们的{privacyStatementLink}。",
|
||||
"telemetry.telemetryConfigAndLinkDescription": "启用使用情况数据收集可帮助我们管理并改善产品和服务。有关更多详情,请参阅我们的{privacyStatementLink}。",
|
||||
"telemetry.telemetryConfigDescription": "通过提供基本功能的使用情况统计信息,来帮助我们改进 Elastic Stack。我们不会在 Elastic 之外共享此数据。",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue