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.
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.
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 || []); |
lukeelmers
left a comment
There was a problem hiding this comment.
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
sulemanof
left a comment
There was a problem hiding this comment.
Please, make sure filtering works correctly!
| allowedAggs: string[] | ||
| ): ComboBoxGroupedOptions<IAggType> { | ||
| const aggTypeOptions = aggTypeFilters.filter((aggTypes as any)[groupName], indexPattern, agg); | ||
| const aggTypeOptions = aggTypeFilters |
There was a problem hiding this comment.
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.
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, |
| 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.
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.
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, |
| get(aggConfig.schema, 'aggSettings.top_hits.allowStrings', false) | ||
| ? '*' | ||
| : KBN_FIELD_TYPES.NUMBER, | ||
| filterFieldTypes: (aggConfig: IMetricAggConfig) => '*', |
There was a problem hiding this comment.
It's a * by default
| filterFieldTypes: (aggConfig: IMetricAggConfig) => '*', |
There was a problem hiding this comment.
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.
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: |
sulemanof
left a comment
There was a problem hiding this comment.
All the comments were fixed, didn’t find anything else. It’s a great step in simplifying agg configs!
LGTM


Summary
removes
schemasdependency fromaggconfigsschema: stringstill 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