-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Controls] Add ESQL control types to options list #233126
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
Conversation
| totalCardinality, | ||
| field, | ||
| fieldName, | ||
| displayName, |
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.
The fieldName subject is only used in the UI component to generate aria labels and such. Because ES|QL controls won't have a fieldName this is being changed to displayName and derived within the factory from whichever descriptive properties are available.
The default is now title if defined, which I think was an oversight in the initial implementation.
| } from '../../../../common/options_list'; | ||
|
|
||
| type ESQLOptionsListInputState = Partial< | ||
| Pick<OptionsListESQLControlState, 'esqlQuery' | 'variableName' | 'variableType' | 'controlType'> |
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 don't pull availableOptions into the state here, the options list already has an availableOptions state and those get derived within fetchAndValidate.
The follow-up PR will apply a static values control's availableOptions instead of fetching data.
| setSelectedOptions: (options: OptionsListSelection[] | undefined) => void; | ||
| }; | ||
|
|
||
| export interface OptionsListComponentState |
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.
This type was unused
| export type OptionsListDataControlState = DefaultDataControlState & OptionsListBaseControlState; | ||
| export type OptionsListESQLControlState = ESQLControlState & OptionsListBaseControlState; | ||
|
|
||
| export type OptionsListControlState = OptionsListDataControlState | OptionsListESQLControlState; |
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.
Lets rename OptionsListDataControlState to 'OptionsListDSLControlState' since data has little meaning and is very ambiguous.
|
Pinging @elastic/kibana-presentation (Team:Presentation) |
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
History
|
nreese
left a comment
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.
kibana-presentation changes LGTM - thanks for breaking these type changes out into its own PR
code review only
## Summary > [!WARNING] > **_This work is being merged into a feature branch, not main!_** > Because of this, we only need a review from @elastic/kibana-presentation for now. > > Type failures are expected because the feature branch is currently in an incomplete state, where the controls that have not yet been converted are dependent on things that no longer exist. Fixes merge conflicts on the Controls Anywhere branch introduced by #233126. DSL/ES|QL type definitions for the options list are now defined as schemas. --------- Co-authored-by: kibanamachine <[email protected]>
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
## Summary Part of elastic#227062 This adds types for ES|QL control properties and API methods to the options list control factory in preparation to unify the factories. It does not actually yet make the control function with ES|QL data sources or variables, but lays the groundwork for adding this functionality in a second PR. - Options list control now optionally accepts all the properties in `ESQLControlState` as a possible input state. The input state must now be either `ESQLControlState` or `DefaultDataControlState`. - The options list control and component APIs now publish `esqlQuery$`, `esqlVariable$`, and `esqlControlType$`. `esqlVariable$` is an `ESQLControlVariable` derived from the ES|QL control's `variableType`/`variableName`, and the other two subjects are simply renamed properties to reduce ambiguity downstream in the control factory. - `esqlVariable$` will publish from the control API and be read by the control group. This is how current ES|QL controls already publish their variables and make them available to the dashboard. In this PR, it will always publish `undefined` and therefore do nothing. - `esqlControlType$` can be used to determine whether to fetch available options list suggestions, or to pull them from the `availableOptions` input state - `esqlQuery$` can be used to fetch available options if the control type is `VALUES_FROM_QUERY` - Options list suggestions data requests to be passed to `fetchAndValidate` now have types for possible ES|QL requests. See [this part of the initial draft unification PR](https://github.com/elastic/kibana/pull/230132/files#diff-338ef52d0d7391e8b3fb6cbd90747d33f3a93b0389a8fa586f4f94e86fbc1916) for an example of what this enables us to do. - An ESQL state manager has been added to the options list factory, even though it's not fully implemented yet. This generates all the needed publishing subjects and allows the component and control APIs to pass the new type checks. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
3 similar comments
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Ping @Zacqary , this needs to be backported. |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
## Summary Part of elastic#227062 This adds types for ES|QL control properties and API methods to the options list control factory in preparation to unify the factories. It does not actually yet make the control function with ES|QL data sources or variables, but lays the groundwork for adding this functionality in a second PR. - Options list control now optionally accepts all the properties in `ESQLControlState` as a possible input state. The input state must now be either `ESQLControlState` or `DefaultDataControlState`. - The options list control and component APIs now publish `esqlQuery$`, `esqlVariable$`, and `esqlControlType$`. `esqlVariable$` is an `ESQLControlVariable` derived from the ES|QL control's `variableType`/`variableName`, and the other two subjects are simply renamed properties to reduce ambiguity downstream in the control factory. - `esqlVariable$` will publish from the control API and be read by the control group. This is how current ES|QL controls already publish their variables and make them available to the dashboard. In this PR, it will always publish `undefined` and therefore do nothing. - `esqlControlType$` can be used to determine whether to fetch available options list suggestions, or to pull them from the `availableOptions` input state - `esqlQuery$` can be used to fetch available options if the control type is `VALUES_FROM_QUERY` - Options list suggestions data requests to be passed to `fetchAndValidate` now have types for possible ES|QL requests. See [this part of the initial draft unification PR](https://github.com/elastic/kibana/pull/230132/files#diff-338ef52d0d7391e8b3fb6cbd90747d33f3a93b0389a8fa586f4f94e86fbc1916) for an example of what this enables us to do. - An ESQL state manager has been added to the options list factory, even though it's not fully implemented yet. This generates all the needed publishing subjects and allows the component and control APIs to pass the new type checks. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios (cherry picked from commit 493cd58) # Conflicts: # src/platform/plugins/shared/controls/common/options_list/types.ts # src/platform/plugins/shared/controls/public/controls/data_controls/options_list_control/get_options_list_control_factory.tsx # src/platform/plugins/shared/controls/public/controls/data_controls/types.ts # src/platform/plugins/shared/controls/public/controls/esql_control/types.ts
## Summary Part of elastic#227062 This adds types for ES|QL control properties and API methods to the options list control factory in preparation to unify the factories. It does not actually yet make the control function with ES|QL data sources or variables, but lays the groundwork for adding this functionality in a second PR. - Options list control now optionally accepts all the properties in `ESQLControlState` as a possible input state. The input state must now be either `ESQLControlState` or `DefaultDataControlState`. - The options list control and component APIs now publish `esqlQuery$`, `esqlVariable$`, and `esqlControlType$`. `esqlVariable$` is an `ESQLControlVariable` derived from the ES|QL control's `variableType`/`variableName`, and the other two subjects are simply renamed properties to reduce ambiguity downstream in the control factory. - `esqlVariable$` will publish from the control API and be read by the control group. This is how current ES|QL controls already publish their variables and make them available to the dashboard. In this PR, it will always publish `undefined` and therefore do nothing. - `esqlControlType$` can be used to determine whether to fetch available options list suggestions, or to pull them from the `availableOptions` input state - `esqlQuery$` can be used to fetch available options if the control type is `VALUES_FROM_QUERY` - Options list suggestions data requests to be passed to `fetchAndValidate` now have types for possible ES|QL requests. See [this part of the initial draft unification PR](https://github.com/elastic/kibana/pull/230132/files#diff-338ef52d0d7391e8b3fb6cbd90747d33f3a93b0389a8fa586f4f94e86fbc1916) for an example of what this enables us to do. - An ESQL state manager has been added to the options list factory, even though it's not fully implemented yet. This generates all the needed publishing subjects and allows the component and control APIs to pass the new type checks. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
## Summary Part of #227062 This adds types for ES|QL control properties and API methods to the options list control factory in preparation to unify the factories. It does not actually yet make the control function with ES|QL data sources or variables, but lays the groundwork for adding this functionality in a second PR. - Options list control now optionally accepts all the properties in `ESQLControlState` as a possible input state. The input state must now be either `ESQLControlState` or `DefaultDataControlState`. - The options list control and component APIs now publish `esqlQuery$`, `esqlVariable$`, and `esqlControlType$`. `esqlVariable$` is an `ESQLControlVariable` derived from the ES|QL control's `variableType`/`variableName`, and the other two subjects are simply renamed properties to reduce ambiguity downstream in the control factory. - `esqlVariable$` will publish from the control API and be read by the control group. This is how current ES|QL controls already publish their variables and make them available to the dashboard. In this PR, it will always publish `undefined` and therefore do nothing. - `esqlControlType$` can be used to determine whether to fetch available options list suggestions, or to pull them from the `availableOptions` input state - `esqlQuery$` can be used to fetch available options if the control type is `VALUES_FROM_QUERY` - Options list suggestions data requests to be passed to `fetchAndValidate` now have types for possible ES|QL requests. See [this part of the initial draft unification PR](https://github.com/elastic/kibana/pull/230132/files#diff-338ef52d0d7391e8b3fb6cbd90747d33f3a93b0389a8fa586f4f94e86fbc1916) for an example of what this enables us to do. - An ESQL state manager has been added to the options list factory, even though it's not fully implemented yet. This generates all the needed publishing subjects and allows the component and control APIs to pass the new type checks. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
Summary
Part of #227062
This adds types for ES|QL control properties and API methods to the options list control factory in preparation to unify the factories. It does not actually yet make the control function with ES|QL data sources or variables, but lays the groundwork for adding this functionality in a second PR.
ESQLControlStateas a possible input state. The input state must now be eitherESQLControlStateorDefaultDataControlState.esqlQuery$,esqlVariable$, andesqlControlType$.esqlVariable$is anESQLControlVariablederived from the ES|QL control'svariableType/variableName, and the other two subjects are simply renamed properties to reduce ambiguity downstream in the control factory.esqlVariable$will publish from the control API and be read by the control group. This is how current ES|QL controls already publish their variables and make them available to the dashboard. In this PR, it will always publishundefinedand therefore do nothing.esqlControlType$can be used to determine whether to fetch available options list suggestions, or to pull them from theavailableOptionsinput stateesqlQuery$can be used to fetch available options if the control type isVALUES_FROM_QUERYfetchAndValidatenow have types for possible ES|QL requests. See this part of the initial draft unification PR for an example of what this enables us to do.Checklist