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

[Vis: Default editor] EUIficate ranges param editor #38531

Merged
merged 9 commits into from
Jun 12, 2019

Conversation

sulemanof
Copy link
Contributor

@sulemanof sulemanof commented Jun 10, 2019

Summary

Part of #30922.
EUIfication of ranges control for Range aggregation.

ranges

The changes include:

Capture

The PR also includes updated UI for IPv4 Range aggregation:

ip_ranges

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@elasticmachine
Copy link
Contributor

💔 Build Failed

@sulemanof sulemanof added Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Vis Editor Visualization editor issues v7.3.0 v8.0.0 labels Jun 10, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app

@sulemanof sulemanof added the release_note:skip Skip the PR/issue when compiling release notes label Jun 10, 2019
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@cchaos
Copy link
Contributor

cchaos commented Jun 10, 2019

I like the use of the prepend labels, however, I think it gets too repetitive and I lose track of the actual values. How about we remove the prepend labels and use a subdued sortRight icon in the middle like so:

Screen Shot 2019-06-10 at 10 29 11 AM

I also realize we probably need something for the IP ranges as well:
Screen Shot 2019-06-10 at 10 25 51 AM

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@sulemanof
Copy link
Contributor Author

@cchaos the PR updated with proposed changes 👌

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@cchaos cchaos 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 one suggestion

</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon
aria-label={i18n.translate('common.ui.aggTypes.ranges.removeRangeButtonAriaLabel', {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you duplicate this aria-label as the title attribute as well?

Copy link
Contributor

@wylieconlon wylieconlon left a comment

Choose a reason for hiding this comment

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

Stylistic comments, but this LGTM

}

function RangesParamEditor({ agg, value = [], setValue }: AggParamEditorProps<RangeValues[]>) {
const [ranges, setRanges] = useState(() => value.map(range => ({ ...range, id: generateId() })));
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure you need to use a callback state here, couldn't you write: const [ranges, setRanges] = useState(value.map(...));

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the lazy init is used to prevent an id generation on every render.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@flash1293 you are completely right

import { AggParamEditorProps } from 'ui/vis/editors/default';

const generateId = htmlIdGenerator();
const isEmpty = (value: any) => value === undefined || value === null;
Copy link
Contributor

Choose a reason for hiding this comment

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

As long as you're using lodash helpers, why not use the equivalent helper to this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure which lodash helper you are talking about, but if you mean isNil - it is only available from the version 4.0.0. (currently we are using 3.10.1)

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Code LGTM 👍

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@sulemanof sulemanof merged commit 04e87ee into elastic:master Jun 12, 2019
@sulemanof sulemanof deleted the EUIfication/ranges branch June 12, 2019 14:34
@timroes timroes mentioned this pull request Jun 12, 2019
29 tasks
sulemanof added a commit to sulemanof/kibana that referenced this pull request Jun 12, 2019
* EUIficate ranges control

* Remove unused translations

* Fix screenreader issue

* Add an initial case for safety

* Remove labels, add icon between ranges

* Add title for delete btn

# Conflicts:
#	x-pack/plugins/translations/translations/zh-CN.json
sulemanof added a commit that referenced this pull request Jun 13, 2019
* EUIficate ranges control

* Remove unused translations

* Fix screenreader issue

* Add an initial case for safety

* Remove labels, add icon between ranges

* Add title for delete btn

# Conflicts:
#	x-pack/plugins/translations/translations/zh-CN.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported Feature:Vis Editor Visualization editor issues release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.3.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add warning for infinite values in a range aggregation
5 participants