From 7ef27f6191f17c8eddbfb2ada65bf545aad0b3be Mon Sep 17 00:00:00 2001 From: putrasattvika2 Date: Fri, 31 Oct 2025 15:06:21 +0900 Subject: [PATCH 1/2] Use case-insensitive substring match for quick filter field selector --- .nvmrc | 2 +- .../QueryEditor/FilterEditor/index.tsx | 2 +- src/hooks/useFields.ts | 17 +++++++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.nvmrc b/.nvmrc index 19c7bdb..2edeafb 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16 \ No newline at end of file +20 \ No newline at end of file diff --git a/src/components/QueryEditor/FilterEditor/index.tsx b/src/components/QueryEditor/FilterEditor/index.tsx index e30bdbc..e4a85f7 100644 --- a/src/components/QueryEditor/FilterEditor/index.tsx +++ b/src/components/QueryEditor/FilterEditor/index.tsx @@ -95,7 +95,7 @@ interface FilterEditorRowProps { export const FilterEditorRow = ({ value, onSubmit }: FilterEditorRowProps) => { const dispatch = useDispatch(); - const getFields = useFields('filters', 'startsWith'); + const getFields = useFields('filters', 'containsCaseInsensitive'); const valueInputRef = useRef(null); return ( diff --git a/src/hooks/useFields.ts b/src/hooks/useFields.ts index b4f2192..48e682e 100644 --- a/src/hooks/useFields.ts +++ b/src/hooks/useFields.ts @@ -46,7 +46,7 @@ const toSelectableValue = ({ text }: MetricFindValue): SelectableValue = value: text, }); -type MatchType = 'contains' | 'startsWith' +type MatchType = 'contains' | 'containsCaseInsensitive' | 'startsWith' /** * Returns a function to query the configured datasource for autocomplete values for the specified aggregation type or data types. @@ -73,7 +73,20 @@ export const useFields = (type: AggregationType | string[], matchType: MatchType if (q === undefined) { return true; } - return matchType === 'contains' ? text.includes(q) : text.startsWith(q) + + switch (matchType) { + case 'contains': + return text.includes(q); + + case 'containsCaseInsensitive': + return text.toLowerCase().includes(q.toLowerCase()); + + case 'startsWith': + return text.startsWith(q); + + default: + return true; + } }) .map(toSelectableValue); }; From e3ffed324ec7d2d7afe12e521fef519adb3279c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tommi=20L=C3=A4tti?= Date: Wed, 5 Nov 2025 11:41:30 +0900 Subject: [PATCH 2/2] Update .nvmrc --- .nvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nvmrc b/.nvmrc index 2edeafb..209e3ef 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -20 \ No newline at end of file +20