Skip to content

Commit

Permalink
Merge branch 'adding-cloud-specific-ml-node-warning' of github.com:jg…
Browse files Browse the repository at this point in the history
…owdyelastic/kibana into adding-cloud-specific-ml-node-warning
  • Loading branch information
jgowdyelastic committed Nov 1, 2019
2 parents 83dcfa3 + 596e946 commit 3382f56
Show file tree
Hide file tree
Showing 227 changed files with 4,987 additions and 2,873 deletions.
4 changes: 4 additions & 0 deletions docs/redirects.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ This page has moved. Please see <<infra-configure-source>>.

This page has moved. Please see <<xpack-logs-configuring>>.

[role="exclude",id="extend"]
== Extend your use case

This page was deleted. See <<xpack-graph>> and <<xpack-ml>>.
15 changes: 0 additions & 15 deletions docs/user/extend.asciidoc

This file was deleted.

6 changes: 3 additions & 3 deletions docs/user/graph/configuring-graph.asciidoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[role="xpack"]
[[graph-configuration]]
=== Configuring Graph
== Configuring Graph

When a user saves a graph workspace in Kibana, it is stored in the `.kibana`
index along with other saved objects like visualizations and dashboards.
Expand Down Expand Up @@ -57,9 +57,9 @@ is displayed. For more information on granting access to Kibana, see
[role="screenshot"]
image::user/graph/images/graph-read-only-badge.png[Example of Graph's read only access indicator in Kibana's header]

[float]
[discrete]
[[disable-drill-down]]
==== Disabling drill down configuration
=== Disabling drill down configuration

By default, users can configure _drill down_ URLs to display additional
information about a selected vertex in a new browser window. For example,
Expand Down
2 changes: 1 addition & 1 deletion docs/user/graph/getting-started.asciidoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[role="xpack"]
[[graph-getting-started]]
=== Using Graph
== Using Graph

Graph is automatically enabled in {es} and {kib}.

Expand Down
9 changes: 6 additions & 3 deletions docs/user/graph/index.asciidoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[role="xpack"]
[[xpack-graph]]
== Graph data connections
= Graph data connections

[partintro]
--
The {graph-features} enable you to discover how items in an
Elasticsearch index are related. You can explore the connections between
indexed terms and see which connections are the most meaningful. This can be
Expand All @@ -17,9 +19,9 @@ and an interactive graph visualization tool for Kibana. Both work out of the
box with existing Elasticsearch indices--you don't need to store any
additional data to use these features.

[discrete]
[[how-graph-works]]
[float]
=== How Graph works
== How Graph works
The graph API provides an alternative way to extract and summarize information
about the documents and terms in your Elasticsearch index. A _graph_ is really
just a network of related items. In our case, this means a network of related
Expand Down Expand Up @@ -62,6 +64,7 @@ multi-node clusters and scales with your Elasticsearch deployment.
Advanced options let you control how your data is sampled and summarized.
You can also set timeouts to prevent graph queries from adversely
affecting the cluster.
--

include::getting-started.asciidoc[]

Expand Down
6 changes: 3 additions & 3 deletions docs/user/graph/limitations.asciidoc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[role="xpack"]
[[graph-limitations]]
=== Graph limitations
== Graph limitations
++++
<titleabbrev>Limitations</titleabbrev>
++++

[float]
==== Limited support for multiple indices
[discrete]
=== Limited support for multiple indices
The graph API can explore multiple indices, types, or aliases in a
single API request, but the assumption is that each "hop" it performs
is querying the same set of indices. Currently, it is not possible to
Expand Down
10 changes: 5 additions & 5 deletions docs/user/graph/troubleshooting.asciidoc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[role="xpack"]
[[graph-troubleshooting]]
=== Graph Troubleshooting
== Graph Troubleshooting
++++
<titleabbrev>Troubleshooting</titleabbrev>
++++

[float]
==== Why are results missing?
[discrete]
=== Why are results missing?

The default settings in Graph API requests are configured to tune out noisy
results by using the following strategies:
Expand All @@ -29,8 +29,8 @@ of any statistical correlation with the sample.
* Set the `min_doc_count` for your vertices to 1 to ensure only one document is
required to assert a relationship.

[float]
==== What can I do to to improve performance?
[discrete]
=== What can I do to to improve performance?

With the default setting of `use_significance` set to `true`, the Graph API
performs a background frequency check of the terms it discovers as part of
Expand Down
4 changes: 3 additions & 1 deletion docs/user/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ include::dashboard.asciidoc[]

include::canvas.asciidoc[]

include::extend.asciidoc[]
include::graph/index.asciidoc[]

include::ml/index.asciidoc[]

include::{kib-repo-dir}/maps/index.asciidoc[]

Expand Down
13 changes: 7 additions & 6 deletions docs/user/ml/index.asciidoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[role="xpack"]
[[xpack-ml]]
== {ml-cap}
= {ml-cap}

[partintro]
--
As datasets increase in size and complexity, the human effort required to
inspect dashboards or maintain rules for spotting infrastructure problems,
cyber attacks, or business issues becomes impractical. Elastic {ml-features}
Expand All @@ -28,10 +30,10 @@ You need the following permissions to use the Data Visualizer with file upload:
For more information, see {ref}/security-privileges.html[Security privileges]
and {ref}/built-in-roles.html[Built-in roles].

--

[float]
[[xpack-ml-anomalies]]
=== {anomaly-detect-cap}
== {anomaly-detect-cap}

The Elastic {ml} {anomaly-detect} feature automatically models the normal
behavior of your time series data — learning trends, periodicity, and more — in
Expand Down Expand Up @@ -82,9 +84,8 @@ For more information about the {anomaly-detect} feature, see
https://www.elastic.co/what-is/elastic-stack-machine-learning[{ml-cap} in the {stack}]
and {stack-ov}/xpack-ml.html[{ml-cap} {anomaly-detect}].

[float]
[[xpack-ml-dfanalytics]]
=== {dfanalytics-cap}
== {dfanalytics-cap}

The Elastic {ml} {dfanalytics} feature enables you to analyze your data using
{oldetection} and {regression} algorithms and generate new indices that contain
Expand All @@ -98,4 +99,4 @@ in {kib}. For example:
image::user/ml/images/outliers.jpg[{oldetection-cap} results in {kib}]

For more information about the {dfanalytics} feature, see
{stack-ov}/ml-dfanalytics.html[{ml-cap} {dfanalytics}].
{stack-ov}/ml-dfanalytics.html[{ml-cap} {dfanalytics}].
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@
"d3": "3.5.17",
"d3-cloud": "1.2.5",
"del": "^5.1.0",
"elasticsearch": "^16.4.0",
"elasticsearch-browser": "^16.4.0",
"elasticsearch": "^16.5.0",
"elasticsearch-browser": "^16.5.0",
"encode-uri-query": "1.0.1",
"execa": "^3.2.0",
"expiry-js": "0.1.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@
padding-left: $euiSizeXS;
margin-left: $euiSizeXS;
}

.dscFieldSearch__filterWrapper {
flex-grow: 0;
}

.dscFieldSearch__formWrapper {
padding: $euiSizeM;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,54 +17,123 @@
* under the License.
*/
import React from 'react';
import { act } from 'react-dom/test-utils';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
// @ts-ignore
import { findTestSubject } from '@elastic/eui/lib/test';
import { DiscoverFieldSearch } from './discover_field_search';
import { DiscoverFieldSearch, Props } from './discover_field_search';
import { EuiButtonGroupProps } from '@elastic/eui';
import { ReactWrapper } from 'enzyme';

describe('DiscoverFieldSearch', () => {
function mountComponent() {
const props = {
onChange: jest.fn(),
onShowFilter: jest.fn(),
showFilter: false,
filtersActive: 0,
value: 'test',
};
const comp = mountWithIntl(<DiscoverFieldSearch {...props} />);
const input = findTestSubject(comp, 'fieldFilterSearchInput');
const btn = findTestSubject(comp, 'toggleFieldFilterButton');
return { comp, input, btn, props };
const defaultProps = {
onChange: jest.fn(),
value: 'test',
types: ['any', 'string', '_source'],
};

function mountComponent(props?: Props) {
const compProps = props || defaultProps;
const comp = mountWithIntl(<DiscoverFieldSearch {...compProps} />);
return comp;
}

function findButtonGroup(component: ReactWrapper, id: string) {
return component.find(`[data-test-subj="${id}ButtonGroup"]`).first();
}

test('enter value', () => {
const { input, props } = mountComponent();
const component = mountComponent();
const input = findTestSubject(component, 'fieldFilterSearchInput');
input.simulate('change', { target: { value: 'new filter' } });
expect(props.onChange).toBeCalledTimes(1);
expect(defaultProps.onChange).toBeCalledTimes(1);
});

// this should work, but doesn't, have to do some research
test('click toggle filter button', () => {
const { btn, props } = mountComponent();
test('change in active filters should change facet selection and call onChange', () => {
const onChange = jest.fn();
const component = mountComponent({ ...defaultProps, ...{ onChange } });
let btn = findTestSubject(component, 'toggleFieldFilterButton');
expect(btn.hasClass('euiFacetButton--isSelected')).toBeFalsy();
btn.simulate('click');
expect(props.onShowFilter).toBeCalledTimes(1);
const aggregatableButtonGroup = findButtonGroup(component, 'aggregatable');
act(() => {
// @ts-ignore
(aggregatableButtonGroup.props() as EuiButtonGroupProps).onChange('aggregatable-true', null);
});
component.update();
btn = findTestSubject(component, 'toggleFieldFilterButton');
expect(btn.hasClass('euiFacetButton--isSelected')).toBe(true);
expect(onChange).toBeCalledWith('aggregatable', true);
});

test('change showFilter value should change aria label', () => {
const { comp } = mountComponent();
let btn = findTestSubject(comp, 'toggleFieldFilterButton');
expect(btn.prop('aria-label')).toEqual('Show field filter settings');
comp.setProps({ showFilter: true });
btn = findTestSubject(comp, 'toggleFieldFilterButton');
expect(btn.prop('aria-label')).toEqual('Hide field filter settings');
test('change in active filters should change filters count', () => {
const component = mountComponent();
let btn = findTestSubject(component, 'toggleFieldFilterButton');
btn.simulate('click');
btn = findTestSubject(component, 'toggleFieldFilterButton');
const badge = btn.find('.euiNotificationBadge');
// no active filters
expect(badge.text()).toEqual('0');
// change value of aggregatable select
const aggregatableButtonGroup = findButtonGroup(component, 'aggregatable');
act(() => {
// @ts-ignore
(aggregatableButtonGroup.props() as EuiButtonGroupProps).onChange('aggregatable-true', null);
});
component.update();
expect(badge.text()).toEqual('1');
// change value of searchable select
const searchableButtonGroup = findButtonGroup(component, 'searchable');
act(() => {
// @ts-ignore
(searchableButtonGroup.props() as EuiButtonGroupProps).onChange('searchable-true', null);
});
component.update();
expect(badge.text()).toEqual('2');
// change value of searchable select
act(() => {
// @ts-ignore
(searchableButtonGroup.props() as EuiButtonGroupProps).onChange('searchable-any', null);
});
component.update();
expect(badge.text()).toEqual('1');
});

test('change filtersActive should change facet selection', () => {
const { comp } = mountComponent();
let btn = findTestSubject(comp, 'toggleFieldFilterButton');
expect(btn.hasClass('euiFacetButton--isSelected')).toBeFalsy();
comp.setProps({ filtersActive: 3 });
btn = findTestSubject(comp, 'toggleFieldFilterButton');
expect(btn.hasClass('euiFacetButton--isSelected')).toBe(true);
test('change in missing fields switch should not change filter count', () => {
const component = mountComponent();
const btn = findTestSubject(component, 'toggleFieldFilterButton');
btn.simulate('click');
const badge = btn.find('.euiNotificationBadge');
expect(badge.text()).toEqual('0');
const missingSwitch = findTestSubject(component, 'missingSwitch');
missingSwitch.simulate('change', { target: { value: false } });
expect(badge.text()).toEqual('0');
});

test('change in filters triggers onChange', () => {
const onChange = jest.fn();
const component = mountComponent({ ...defaultProps, ...{ onChange } });
const btn = findTestSubject(component, 'toggleFieldFilterButton');
btn.simulate('click');
const aggregtableButtonGroup = findButtonGroup(component, 'aggregatable');
const missingSwitch = findTestSubject(component, 'missingSwitch');
act(() => {
// @ts-ignore
(aggregtableButtonGroup.props() as EuiButtonGroupProps).onChange('aggregatable-true', null);
});
missingSwitch.simulate('change', { target: { value: false } });
expect(onChange).toBeCalledTimes(2);
});

test('change in type filters triggers onChange with appropriate value', () => {
const onChange = jest.fn();
const component = mountComponent({ ...defaultProps, ...{ onChange } });
const btn = findTestSubject(component, 'toggleFieldFilterButton');
btn.simulate('click');
const typeSelector = findTestSubject(component, 'typeSelect');
typeSelector.simulate('change', { target: { value: 'string' } });
expect(onChange).toBeCalledWith('type', 'string');
typeSelector.simulate('change', { target: { value: 'any' } });
expect(onChange).toBeCalledWith('type', 'any');
});
});
Loading

0 comments on commit 3382f56

Please sign in to comment.