Skip to content

Conversation

@Zacqary
Copy link
Contributor

@Zacqary Zacqary commented Aug 27, 2025

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 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

@Zacqary Zacqary added Feature:Dashboard Dashboard related features Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// release_note:skip Skip the PR/issue when compiling release notes Project:Controls backport:version Backport to applied version labels v9.2.0 labels Aug 27, 2025
@Zacqary Zacqary changed the title [Controls] Add ESQL control types to option types to options list [Controls] Add ESQL control types to options list Aug 27, 2025
totalCardinality,
field,
fieldName,
displayName,
Copy link
Contributor Author

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'>
Copy link
Contributor Author

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.

@Zacqary Zacqary requested a review from nreese August 27, 2025 18:50
setSelectedOptions: (options: OptionsListSelection[] | undefined) => void;
};

export interface OptionsListComponentState
Copy link
Contributor Author

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;
Copy link
Contributor

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.

@Zacqary Zacqary marked this pull request as ready for review August 28, 2025 17:47
@Zacqary Zacqary requested review from a team as code owners August 28, 2025 17:47
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@Zacqary Zacqary requested a review from nreese September 8, 2025 18:57
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
controls 396 397 +1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
controls 101 95 -6

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
controls 485.0KB 485.4KB +328.0B

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
controls 15 17 +2
Unknown metric groups

API count

id before after diff
controls 105 99 -6

History

Copy link
Contributor

@nreese nreese left a 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

@Zacqary Zacqary merged commit 493cd58 into elastic:main Sep 10, 2025
12 checks passed
Zacqary added a commit that referenced this pull request Sep 12, 2025
## 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]>
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Sep 12, 2025
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 233126 locally
cc: @Zacqary

@Zacqary Zacqary added the v9.1.5 label Sep 12, 2025
KodeRad pushed a commit to KodeRad/kibana that referenced this pull request Sep 15, 2025
## 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
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 233126 locally
cc: @Zacqary

3 similar comments
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 233126 locally
cc: @Zacqary

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 233126 locally
cc: @Zacqary

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 233126 locally
cc: @Zacqary

@adcoelho
Copy link
Contributor

Ping @Zacqary , this needs to be backported.

@Zacqary
Copy link
Contributor Author

Zacqary commented Sep 19, 2025

💚 All backports created successfully

Status Branch Result
9.1

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

Zacqary added a commit to Zacqary/kibana that referenced this pull request Sep 19, 2025
## 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
@Zacqary Zacqary removed backport missing Added to PRs automatically when the are determined to be missing a backport. backport:version Backport to applied version labels v9.1.5 labels Sep 19, 2025
@kibanamachine kibanamachine added the backport:skip This PR does not require backporting label Sep 19, 2025
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Sep 24, 2025
## 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
niros1 pushed a commit that referenced this pull request Sep 30, 2025
## 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Dashboard Dashboard related features impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:small Small Level of Effort Project:Controls release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants