Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Add query bar to Anomaly Explorer for filtering of anomaly results for one or more influencers #31763

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f63dfde
wip: add autocomplete kueryFilterBar.update endpoints with query.
alvarezmelissa87 Jan 31, 2019
e61b235
Create indexPattern on job change. Value is autocompleted
alvarezmelissa87 Feb 4, 2019
b2af849
Mask unrelated swimlanes on filter apply
alvarezmelissa87 Feb 4, 2019
7130bdb
Only show relevant viewBy swimlane
alvarezmelissa87 Feb 5, 2019
9cafb47
reload viewBy swimlane when view By change is relevant to filter
alvarezmelissa87 Feb 5, 2019
d53411d
handle various query types when building filteredFields list
alvarezmelissa87 Feb 5, 2019
d344e9f
remove deprecated code from old filter bar
alvarezmelissa87 Feb 5, 2019
65669a8
Show error callout when invalid filter syntax
alvarezmelissa87 Feb 6, 2019
e39a56d
remove dependency on deprecated import var
alvarezmelissa87 Feb 6, 2019
963823a
remove all left over apm dependencies
alvarezmelissa87 Feb 6, 2019
2f6b475
persist filter on refresh
alvarezmelissa87 Feb 7, 2019
19c2b35
Create initial filter bar placeholder dynamically
alvarezmelissa87 Feb 7, 2019
80a6250
add description text when filter active
alvarezmelissa87 Feb 20, 2019
daba463
switch to relevant viewBy fieldname on filter
alvarezmelissa87 Feb 21, 2019
2a804a6
recalculate placeholder on job change
alvarezmelissa87 Feb 22, 2019
7c57a51
Create tests for all components
alvarezmelissa87 Feb 23, 2019
2b0ad89
View by dropdown only contains relevant fields for filter
alvarezmelissa87 Feb 26, 2019
41c28c2
fix localization message noInfluencers component
alvarezmelissa87 Feb 26, 2019
d2dee17
Move indexPattern to state and viewBy option filtering to utils
alvarezmelissa87 Feb 27, 2019
bb11a34
remove unnecessary setState when setting viewBy for filter
alvarezmelissa87 Feb 27, 2019
6c3c8c9
Use preloaded jobs from mlJobService to get influencers
alvarezmelissa87 Feb 28, 2019
80cf018
Only filter viewByOptions if valid field
alvarezmelissa87 Mar 1, 2019
a83bfc8
use kql and move to components dir
alvarezmelissa87 Mar 2, 2019
d917054
move filter bar to public/components/
alvarezmelissa87 Mar 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions x-pack/plugins/ml/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import 'plugins/ml/components/nav_menu';
import 'plugins/ml/components/loading_indicator';
import 'plugins/ml/settings';
import 'plugins/ml/file_datavisualizer';
import 'uiExports/autocompleteProviders';

import uiRoutes from 'ui/routes';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`KqlFilterBar snapshot 1`] = `
<Fragment>
<FilterBar
disabled={false}
initialValue=""
isLoading={false}
onChange={[Function]}
onSubmit={[Function]}
placeholder="tag : engineering OR tag : marketing"
suggestions={Array []}
/>
</Fragment>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ClickOutside snapshot 1`] = `
<div
onClickOutside={[Function]}
/>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import React, { Component } from 'react';
import PropTypes from 'prop-types';

export class ClickOutside extends Component {
componentDidMount() {
document.addEventListener('mousedown', this.onClick);
}

componentWillUnmount() {
document.removeEventListener('mousedown', this.onClick);
}

setNodeRef = node => {
this.nodeRef = node;
};

onClick = event => {
if (this.nodeRef && !this.nodeRef.contains(event.target)) {
this.props.onClickOutside();
}
};

render() {
const { ...restProps } = this.props;
return (
<div ref={this.setNodeRef} {...restProps}>
{this.props.children}
</div>
);
}
}

ClickOutside.propTypes = {
onClickOutside: PropTypes.func.isRequired
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import React from 'react';
import { shallow } from 'enzyme';
import { ClickOutside } from './click_outside';


describe('ClickOutside', () => {

test('snapshot', () => {
const wrapper = shallow(<ClickOutside onClickOutside={() => {}} />);
expect(wrapper).toMatchSnapshot();
});

});
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export { ClickOutside } from './click_outside';
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`FilterBar snapshot suggestions not shown 1`] = `
<ClickOutside
onClickOutside={[Function]}
style={
Object {
"position": "relative",
}
}
>
<div
style={
Object {
"position": "relative",
}
}
>
<EuiFieldSearch
autoComplete="off"
compressed={false}
disabled={false}
fullWidth={true}
incremental={false}
inputRef={[Function]}
isLoading={false}
onChange={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
onKeyUp={[Function]}
placeholder="Filter by influencer fields… (E.g. Test placeholder)"
spellCheck={false}
style={
Object {
"backgroundImage": "none",
}
}
value=""
/>
</div>
<Suggestions
index={null}
onClick={[Function]}
onMouseEnter={[Function]}
show={false}
suggestions={
Array [
Object {
"description": "<p>Test description for fieldValueOne</p>",
"end": 1,
"start": 0,
"text": "fieldValueOne",
"type": "field",
},
Object {
"description": "<p>Test description for fieldValueTwo</p>",
"end": 1,
"start": 0,
"text": "fieldValueTwo",
"type": "field",
},
]
}
/>
</ClickOutside>
`;

exports[`FilterBar snapshot suggestions shown 1`] = `
<ClickOutside
onClickOutside={[Function]}
style={
Object {
"position": "relative",
}
}
>
<div
style={
Object {
"position": "relative",
}
}
>
<EuiFieldSearch
autoComplete="off"
compressed={false}
disabled={false}
fullWidth={true}
incremental={false}
inputRef={[Function]}
isLoading={false}
onChange={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
onKeyUp={[Function]}
placeholder="Filter by influencer fields… (E.g. Test placeholder)"
spellCheck={false}
style={
Object {
"backgroundImage": "none",
}
}
value=""
/>
</div>
<Suggestions
index={null}
onClick={[Function]}
onMouseEnter={[Function]}
show={true}
suggestions={
Array [
Object {
"description": "<p>Test description for fieldValueOne</p>",
"end": 1,
"start": 0,
"text": "fieldValueOne",
"type": "field",
},
Object {
"description": "<p>Test description for fieldValueTwo</p>",
"end": 1,
"start": 0,
"text": "fieldValueTwo",
"type": "field",
},
]
}
/>
</ClickOutside>
`;
Loading