UI – sort case-insensitively and update default sort (#15808)

## Addresses #15253 

- sort case-insensitively in the query results (live), query report, and
host query report tables
- default to sorting by the host display name in the query results and
by `last_fetched` for the query report tables
- (unchanged) host query reports sort by the first column of the
results, since all `last_fetched` are the same

<img width="383" alt="Screenshot 2023-12-21 at 9 49 31 AM"
src="https://github.com/fleetdm/fleet/assets/61553566/2bb5ede1-c40e-4974-9079-4851650163cb">


## 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-04 11:26:01 -08:00 committed by GitHub
parent 2f937ce9a2
commit 87196f43c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 0 deletions

View file

@ -0,0 +1,2 @@
* Sort query results and reports case insensitively, and default to sorting by the host display name
column

View file

@ -59,6 +59,7 @@ const generateColumnConfigs = (rows: Record<string, string>[]) =>
Filter: DefaultColumnFilter, // Component hides filter for last_fetched
filterType: "text",
disableSortBy: false,
sortType: "caseInsensitive",
};
});

View file

@ -154,6 +154,7 @@ const QueryReport = ({
/>
);
}}
defaultSortHeader="last_fetched"
isLoading={false}
isClientSidePagination
isClientSideFilter

View file

@ -88,6 +88,7 @@ const generateReportColumnConfigsFromResults = (results: any[]): Column[] => {
Filter: DefaultColumnFilter, // Component hides filter for last_fetched
filterType: "text",
disableSortBy: false,
sortType: "caseInsensitive",
};
});
return _unshiftHostname(columnConfigs);

View file

@ -198,6 +198,7 @@ const QueryResults = ({
return (
<div className={`${baseClass}__results-table-container`}>
<TableContainer
defaultSortHeader="host_display_name"
columnConfigs={
tableType === "results" ? resultsColumnConfigs : errorColumnConfigs
}

View file

@ -75,6 +75,7 @@ const generateColumnConfigsFromRows = (
},
Filter: DefaultColumnFilter,
disableSortBy: false,
sortType: "caseInsensitive",
};
});
return _unshiftHostname(columnsConfigs);