mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 01:18:42 +00:00
Fleet UI: Queries default to alpha order (#12924)
This commit is contained in:
parent
7bff7447b0
commit
fdf89989c5
3 changed files with 11 additions and 6 deletions
|
|
@ -22,7 +22,7 @@ const TAGGED_TEMPLATES = {
|
|||
};
|
||||
|
||||
const DEFAULT_SORT_DIRECTION = "asc";
|
||||
const DEFAULT_SORT_HEADER = "updated_at";
|
||||
const DEFAULT_SORT_HEADER = "name";
|
||||
|
||||
interface IPoliciesTableProps {
|
||||
policiesList: IPolicyStats[];
|
||||
|
|
|
|||
|
|
@ -66,8 +66,14 @@ const ManageAutomationsModal = ({
|
|||
// TODO: Error handling, if any
|
||||
const [errors, setErrors] = useState<{ [key: string]: string }>({});
|
||||
|
||||
// Client side sort queries alphabetically
|
||||
const sortedAvailableQueries =
|
||||
availableQueries?.sort((a, b) =>
|
||||
a.name.toLowerCase().localeCompare(b.name.toLowerCase())
|
||||
) || [];
|
||||
|
||||
const { queryItems, updateQueryItems } = useCheckboxListStateManagement(
|
||||
availableQueries || [],
|
||||
sortedAvailableQueries,
|
||||
automatedQueryIds || []
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ interface IQueriesTableProps {
|
|||
isInherited?: boolean;
|
||||
}
|
||||
|
||||
const DEFAULT_SORT_DIRECTION = "desc";
|
||||
const DEFAULT_SORT_HEADER = "updated_at";
|
||||
const DEFAULT_SORT_DIRECTION = "asc";
|
||||
const DEFAULT_SORT_HEADER = "name";
|
||||
const DEFAULT_PAGE_SIZE = 20;
|
||||
const DEFAULT_PLATFORM = "all";
|
||||
|
||||
|
|
@ -99,8 +99,7 @@ const QueriesTable = ({
|
|||
// Functions to avoid race conditions
|
||||
const initialSearchQuery = (() => queryParams?.query ?? "")();
|
||||
const initialSortHeader = (() =>
|
||||
(queryParams?.order_key as "updated_at" | "name" | "author") ??
|
||||
"updated_at")();
|
||||
(queryParams?.order_key as "name" | "updated_at" | "author") ?? "name")();
|
||||
const initialSortDirection = (() =>
|
||||
(queryParams?.order_direction as "asc" | "desc") ?? "asc")();
|
||||
const initialPlatform = (() =>
|
||||
|
|
|
|||
Loading…
Reference in a new issue