-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Conversation
💔 Build Failed |
Pinging @elastic/kibana-app |
💚 Build Succeeded |
💚 Build Succeeded |
@cchaos the PR updated with proposed changes 👌 |
💚 Build Succeeded |
There was a problem hiding this 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', { |
There was a problem hiding this comment.
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?
There was a problem hiding this 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() }))); |
There was a problem hiding this comment.
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(...));
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM 👍
💚 Build Succeeded |
* 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
* 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
Summary
Part of #30922.
EUIfication of
ranges
control forRange
aggregation.The changes include:
-∞
forFrom
and+∞
forTo
(fix Add warning for infinite values in a range aggregation #36558);The PR also includes updated UI for
IPv4 Range
aggregation:Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers