Remove lowercasing of display text match when generating label filter options (#16176)

## Addresses #15894 
![Screenshot 2024-01-17 at 12 14
38 PM](https://github.com/fleetdm/fleet/assets/61553566/92c520d4-d1d7-48df-80e8-9c40e2c261f3)

![Screenshot 2024-01-17 at 12 14
58 PM](https://github.com/fleetdm/fleet/assets/61553566/68607bec-48e6-4e4d-abe3-6f7afa0a4f94)
![Screenshot 2024-01-17 at 12 14
54 PM](https://github.com/fleetdm/fleet/assets/61553566/5ffd673b-2924-45c3-a4f0-8a3ee8c167f6)


## Checklist for submitter
- [x] Changes file added for user-visible changes in `changes/`
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
Jacob Shandling
2024-01-18 11:10:50 -05:00
committed by GitHub
co-authored by Jacob Shandling
parent 58487c584a
commit 58043c9d27
3 changed files with 4 additions and 2 deletions
+1
View File
@@ -0,0 +1 @@
- Fix a bug where capital characters would not match labels containing them
+1 -1
View File
@@ -30,7 +30,7 @@ export interface ILabel extends ILabelSummary {
uuid?: string;
query: string;
label_membership_type: LabelMembershipType;
hosts_count: number;
host_count?: number; // returned for built-in labels but not custom labels
display_text: string;
count: number; // seems to be a repeat of hosts_count issue #1618
host_ids: number[] | null;
@@ -34,7 +34,8 @@ const createCustomLabelOptions = (labels: ILabel[], query: string) => {
customLabelGroupOptions = [NO_LABELS_OPTION];
} else {
const matchingLabels = customLabels.filter((label) =>
label.display_text.toLowerCase().includes(query)
// case-insensitive matching
label.display_text.toLowerCase().includes(query.toLowerCase())
);
customLabelGroupOptions =
matchingLabels.length !== 0 ? matchingLabels : [EMPTY_OPTION];