Skip to content

Commit 44c8946

Browse files
[9.2] [Metrics][Discover] Fix dimensions and values search being case sensitive (#239110) (#239197)
# Backport This will backport the following commits from `main` to `9.2`: - [[Metrics][Discover] Fix dimensions and values search being case sensitive (#239110)](#239110) <!--- Backport version: 10.1.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Miriam","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-10-15T13:49:20Z","message":"[Metrics][Discover] Fix dimensions and values search being case sensitive (#239110)\n\nCloses https://github.com/elastic/kibana/issues/238881\n\nBEFORE:\n\n\nhttps://github.com/user-attachments/assets/b27286f8-5515-4ed3-8b1c-f7247c6fca4c\n\nAFTER:\n\n\nhttps://github.com/user-attachments/assets/e13a57d7-a958-48fb-a086-cdd447d45032\n\n---------\n\nCo-authored-by: kibanamachine <[email protected]>","sha":"b2699c7e3c2250c4ca7d347cb00f671f40b3a0de","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:obs-ux-infra_services","backport:version","v9.2.0","v9.3.0"],"title":"[Metrics][Discover] Fix dimensions and values search being case sensitive","number":239110,"url":"https://github.com/elastic/kibana/pull/239110","mergeCommit":{"message":"[Metrics][Discover] Fix dimensions and values search being case sensitive (#239110)\n\nCloses https://github.com/elastic/kibana/issues/238881\n\nBEFORE:\n\n\nhttps://github.com/user-attachments/assets/b27286f8-5515-4ed3-8b1c-f7247c6fca4c\n\nAFTER:\n\n\nhttps://github.com/user-attachments/assets/e13a57d7-a958-48fb-a086-cdd447d45032\n\n---------\n\nCo-authored-by: kibanamachine <[email protected]>","sha":"b2699c7e3c2250c4ca7d347cb00f671f40b3a0de"}},"sourceBranch":"main","suggestedTargetBranches":["9.2"],"targetPullRequestStates":[{"branch":"9.2","label":"v9.2.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/239110","number":239110,"mergeCommit":{"message":"[Metrics][Discover] Fix dimensions and values search being case sensitive (#239110)\n\nCloses https://github.com/elastic/kibana/issues/238881\n\nBEFORE:\n\n\nhttps://github.com/user-attachments/assets/b27286f8-5515-4ed3-8b1c-f7247c6fca4c\n\nAFTER:\n\n\nhttps://github.com/user-attachments/assets/e13a57d7-a958-48fb-a086-cdd447d45032\n\n---------\n\nCo-authored-by: kibanamachine <[email protected]>","sha":"b2699c7e3c2250c4ca7d347cb00f671f40b3a0de"}}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <[email protected]>
1 parent f2e8b83 commit 44c8946

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

src/platform/packages/shared/kbn-unified-metrics-grid/src/components/toolbar/dimensions_selector.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { FormattedMessage } from '@kbn/i18n-react';
1212
import { EuiFlexGroup, EuiFlexItem, EuiNotificationBadge } from '@elastic/eui';
1313
import { i18n } from '@kbn/i18n';
1414
import { ToolbarSelector, type SelectableEntry } from '@kbn/shared-ux-toolbar-selector';
15+
import { comboBoxFieldOptionMatcher } from '@kbn/field-utils';
1516
import { ClearAllSection } from './clear_all_section';
1617
import { MAX_DIMENSIONS_SELECTIONS } from '../../common/constants';
1718

@@ -159,11 +160,7 @@ export const DimensionsSelector = ({
159160
data-selected-value={selectedDimensions}
160161
searchable
161162
buttonLabel={buttonLabel}
162-
optionMatcher={({ option, normalizedSearchValue }) => {
163-
return 'name' in option
164-
? String(option.name ?? '').includes(normalizedSearchValue)
165-
: option.label.includes(normalizedSearchValue);
166-
}}
163+
optionMatcher={comboBoxFieldOptionMatcher}
167164
options={options}
168165
singleSelection={false}
169166
onChange={handleChange}

src/platform/packages/shared/kbn-unified-metrics-grid/src/components/toolbar/values_selector.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
} from '@elastic/eui';
2121
import type { TimeRange } from '@kbn/data-plugin/common';
2222
import { i18n } from '@kbn/i18n';
23+
import { comboBoxFieldOptionMatcher } from '@kbn/field-utils';
2324
import { FIELD_VALUE_SEPARATOR } from '../../common/constants';
2425
import { useDimensionsQuery } from '../../hooks';
2526
import { ClearAllSection } from './clear_all_section';
@@ -175,11 +176,7 @@ export const ValuesSelector = ({
175176
data-selected-value={selectedDimensions}
176177
searchable
177178
buttonLabel={buttonLabel}
178-
optionMatcher={({ option, normalizedSearchValue }) => {
179-
return 'name' in option
180-
? String(option.name ?? '').includes(normalizedSearchValue)
181-
: option.label.includes(normalizedSearchValue);
182-
}}
179+
optionMatcher={comboBoxFieldOptionMatcher}
183180
options={options}
184181
singleSelection={false}
185182
hasArrow={!isLoading}

src/platform/packages/shared/kbn-unified-metrics-grid/tsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,7 @@
3232
"@kbn/es-query",
3333
"@kbn/discover-utils",
3434
"@kbn/fields-metadata-plugin",
35+
"@kbn/esql-utils",
36+
"@kbn/field-utils"
3537
]
3638
}

0 commit comments

Comments
 (0)