Skip to content

Commit

Permalink
[8.x] [ES|QL] Makes the clear control button optional (#212848) (#212967
Browse files Browse the repository at this point in the history
)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ES|QL] Makes the clear control button optional
(#212848)](#212848)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Stratoula
Kalafateli","email":"efstratia.kalafateli@elastic.co"},"sourceCommit":{"committedDate":"2025-03-03T18:03:57Z","message":"[ES|QL]
Makes the clear control button optional (#212848)\n\n##
Summary\n\nCloses
https://github.com/elastic/kibana/issues/212605\n\nHere we are removing
the clear button from the ES|QL control as clearing\nwill result in
wrong charts. I also considered the reset but when there\nis no changes
should be hidden or disabled. This seems to me as a\nsmaller change and
taken under consideration that dashboard already\nallows resetting I
think it is ok to remove it.\n\nWe can always reconsider if any user
complains.\n\nAlthough by removing the clearSelections from the control
config removes\nthe button the `DefaultControlApi ` was marking it as
required. So I had\nto tweak a bit the
types.","sha":"f6978eaf7b511791039210dd9643b68ae3b6b242","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Feature:ES|QL","Team:ESQL","backport:version","v9.1.0","v8.19.0"],"title":"[ES|QL]
Makes the clear control button
optional","number":212848,"url":"https://github.com/elastic/kibana/pull/212848","mergeCommit":{"message":"[ES|QL]
Makes the clear control button optional (#212848)\n\n##
Summary\n\nCloses
https://github.com/elastic/kibana/issues/212605\n\nHere we are removing
the clear button from the ES|QL control as clearing\nwill result in
wrong charts. I also considered the reset but when there\nis no changes
should be hidden or disabled. This seems to me as a\nsmaller change and
taken under consideration that dashboard already\nallows resetting I
think it is ok to remove it.\n\nWe can always reconsider if any user
complains.\n\nAlthough by removing the clearSelections from the control
config removes\nthe button the `DefaultControlApi ` was marking it as
required. So I had\nto tweak a bit the
types.","sha":"f6978eaf7b511791039210dd9643b68ae3b6b242"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/212848","number":212848,"mergeCommit":{"message":"[ES|QL]
Makes the clear control button optional (#212848)\n\n##
Summary\n\nCloses
https://github.com/elastic/kibana/issues/212605\n\nHere we are removing
the clear button from the ES|QL control as clearing\nwill result in
wrong charts. I also considered the reset but when there\nis no changes
should be hidden or disabled. This seems to me as a\nsmaller change and
taken under consideration that dashboard already\nallows resetting I
think it is ok to remove it.\n\nWe can always reconsider if any user
complains.\n\nAlthough by removing the clearSelections from the control
config removes\nthe button the `DefaultControlApi ` was marking it as
required. So I had\nto tweak a bit the
types.","sha":"f6978eaf7b511791039210dd9643b68ae3b6b242"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
  • Loading branch information
kibanamachine and stratoula authored Mar 3, 2025
1 parent 9d69b19 commit 2e3c2b9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export const SearchExample = ({ data, dataView, navigation }: Props) => {
onClick={() => {
if (controlGroupAPI) {
Object.values(controlGroupAPI.children$.getValue()).forEach((controlApi) => {
(controlApi as DefaultControlApi)?.clearSelections();
(controlApi as DefaultControlApi)?.clearSelections?.();
});
}
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ export const getESQLControlFactory = (): ControlFactory<ESQLControlState, ESQLCo
references: [],
};
},
clearSelections: () => {
// do nothing, not allowed for now;
},
},
{
...defaultControl.comparators,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export type DefaultControlApi = PublishesDataLoading &
PublishesBlockingError &
PublishesUnsavedChanges &
Partial<PublishesTitle & PublishesDisabledActionIds & HasCustomPrepend> &
CanClearSelections &
Partial<CanClearSelections> &
HasType &
HasUniqueId &
HasSerializableState<DefaultControlState> &
Expand Down

0 comments on commit 2e3c2b9

Please sign in to comment.