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] Adding group selector to jobs management #21780

Merged
merged 8 commits into from
Aug 8, 2018

Conversation

jgowdyelastic
Copy link
Member

@jgowdyelastic jgowdyelastic commented Aug 8, 2018

Adding a group selection menu to the jobs management page.
When selecting jobs which do not contain the same groups, the partially matched groups are marked with a -.
The user can then click to select to apply to all jobs, or unselect to remove from current jobs.

2018-08-08 12_22_48

When adding a new group, the name is validated.
image

Missing up and down key navigation of groups. This will be added in a follow up accessibility PR.
Missing jest tests. These will be added in a follow up PR.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui

@jgowdyelastic jgowdyelastic changed the title [ML] [WIP] Adding group selector to jobs management [ML] Adding group selector to jobs management Aug 8, 2018
Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just some minor comments.




export const KEY_CODES = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use eui/src/services/key_codes.js from eui instead? It has all the key codes you need I think.

if (c.jobIds.some(j => jobIds.includes(j))) {
p[c.id] = {
partial: (groupCounts[c.id] !== jobIds.length),
// jobsIds: c.jobIds,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this commented out line needed?

closePopover={() => this.closePopover()}
>
<div className="group-selector">
<EuiPopoverTitle>Apply groups to jobs</EuiPopoverTitle>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - is it worth labelling as job if only one job is selected?


import './styles/main.less';
import { validateGroupNames } from '../../../validate_job';
import { KEY_CODES } from 'plugins/ml/../common/constants/key_codes';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would need to use a relative path when creating Jest tests, or use the eui keyCodes import instead

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

return (
<div className="check" />
);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK it's best practice to add return null if a component should conditionally not render at all https://reactjs.org/docs/conditional-rendering.html#preventing-component-from-rendering

Copy link
Member Author

@jgowdyelastic jgowdyelastic Aug 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with that practice, however this is not just an empty div, it has a class which supplies necessary styling.
Without it the unselected groups are shifted over to the left:
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, sorry I misread the code and thought there might be cases where nothing would be returned ...

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@jgowdyelastic jgowdyelastic merged commit 1de4523 into elastic:master Aug 8, 2018
jgowdyelastic added a commit to jgowdyelastic/kibana that referenced this pull request Aug 8, 2018
* [ML] [WIP] Adding group selector to jobs management

* adding group name validation

* removing comment

* adding keyboard events

* moving new group input to its own component

* changes based on review

* adding tooltip

* adding better error reporting
jgowdyelastic added a commit that referenced this pull request Aug 9, 2018
* [ML] [WIP] Adding group selector to jobs management

* adding group name validation

* removing comment

* adding keyboard events

* moving new group input to its own component

* changes based on review

* adding tooltip

* adding better error reporting
@lcawl lcawl added the enhancement New value added to drive a business result label Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Anomaly Detection ML anomaly detection :ml review v6.5.0 v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants