-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
removing schemas from agg configs #58462
Conversation
Pinging @elastic/kibana-app-arch (Team:AppArch) |
2dabcc8
to
9ee6762
Compare
b3798fb
to
839edb1
Compare
const payloadAggConfig = action.payload as IAggConfig; | ||
const aggConfig = state.aggs.createAggConfig(payloadAggConfig, { | ||
const { schema } = action.payload; | ||
const defaultConfig = |
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.
handling defaults when adding a new aggregation
@@ -1,33 +0,0 @@ | |||
/* | |||
* Licensed to Elasticsearch B.V. under one or more contributor |
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.
we no longer need this as aggFilter information is no longer present on schema, or anywhere on agg.
this.type.schemas.all | ||
); | ||
let configStates = state.aggs ? state.aggs.aggs || state.aggs : []; | ||
configStates = this.initializeDefaultsFromSchemas(configStates, this.type.schemas.all || []); |
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.
handling defaults
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.
updates LGTM, pending approval from someone who is more familiar with the default vis editor. 😄
# Conflicts: # src/legacy/core_plugins/data/public/search/aggs/agg_types.ts
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.
Please, make sure filtering works correctly!
): ComboBoxGroupedOptions<IAggType> { | ||
const aggTypeOptions = aggTypeFilters.filter((aggTypes as any)[groupName], indexPattern, agg); | ||
const aggTypeOptions = aggTypeFilters |
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.
Since the aggTypeFilters
is used only in rollup
for adding a filter,
makes sense to get rid of it at all.
Please, take a look at this comment https://github.com/elastic/kibana/pull/57695/files/555e19e6ecf08b05e0dc39ebdc92d9f2d5bf32ef#r380614658
Of course, you can skip it for now, but anyway it's worth to do.
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.
yes, lets do that in a followup
name: 'orderAgg', | ||
// This string is never visible to the user so it doesn't need to be translated | ||
title: 'Order Agg', | ||
hideCustomLabel: true, |
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.
const aggTypeOptions = aggTypeFilters | ||
.filter((aggTypes as any)[groupName], indexPattern, agg, aggFilter) | ||
.filter(aggType => { | ||
return filterByName([aggType], allowedAggs).length !== 0; |
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't we just merge both arrays, instead of adding the second filter, which do the same thing?
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.
No, it won't give the same results
get(aggConfig.schema, 'aggSettings.top_hits.allowStrings', false) | ||
? '*' | ||
: KBN_FIELD_TYPES.NUMBER, | ||
filterFieldTypes: () => KBN_FIELD_TYPES.NUMBER, |
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.
get(aggConfig.schema, 'aggSettings.top_hits.allowStrings', false) | ||
? '*' | ||
: KBN_FIELD_TYPES.NUMBER, | ||
filterFieldTypes: (aggConfig: IMetricAggConfig) => '*', |
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.
It's a *
by default
filterFieldTypes: (aggConfig: IMetricAggConfig) => '*', |
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.
oh sorry,
I just see that these are in tests file,
anyway I mean, that filterFieldTypes
as a function became redundant,
so you could even remove it from tests
const idSelected = `visEditorSplitBy__${agg.params.row}`; | ||
function RowsOrColumnsControl({ editorStateParams, setStateParamValue }: AggControlProps) { | ||
if (editorStateParams.row === undefined) { | ||
editorStateParams.row = true; |
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.
We do not prefer using object mutations in React, especially props mutations,
it may lead to issues which are hard to find then.
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
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.
All the comments were fixed, didn’t find anything else. It’s a great step in simplifying agg configs!
LGTM
Summary
removes
schemas
dependency fromaggconfigs
schema: string
still exists on serialized aggconfigsChecklist
Delete any items that are not applicable to this PR.
[ ] Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support[ ] Documentation was added for features that require explanation or tutorials[ ] Unit or functional tests were updated or added to match the most common scenarios[ ] This was checked for keyboard-only and screenreader accessibility[ ] This renders correctly on smaller devices using a responsive layout. (You can test this in your browser[ ] This was checked for cross-browser compatibility, including a check against IE11For maintainers
[ ] This was checked for breaking API changes and was labeled appropriately