From 4ba35c33eef9c5468b4c2ab9fdbb8d24483171e8 Mon Sep 17 00:00:00 2001 From: hasura-bot Date: Fri, 22 Dec 2023 16:14:31 +0530 Subject: [PATCH] console: sort filter and sort column options alphabetically, close #9966 GITHUB_PR_NUMBER: 9967 GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/9967 PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10453 Co-authored-by: Bert Verhelst <1710840+bertyhell@users.noreply.github.com> GitOrigin-RevId: 21c8429e32ac9e7e2cf70bc3b8dd3c93ca6ce5cb --- .../components/RunQuery/Filter/FilterRows.tsx | 14 ++++++++------ .../components/RunQuery/Sort/SortRows.tsx | 14 ++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/frontend/libs/console/legacy-ce/src/lib/features/BrowseRows/components/RunQuery/Filter/FilterRows.tsx b/frontend/libs/console/legacy-ce/src/lib/features/BrowseRows/components/RunQuery/Filter/FilterRows.tsx index 519d88aadb8..54534bd6ff7 100644 --- a/frontend/libs/console/legacy-ce/src/lib/features/BrowseRows/components/RunQuery/Filter/FilterRows.tsx +++ b/frontend/libs/console/legacy-ce/src/lib/features/BrowseRows/components/RunQuery/Filter/FilterRows.tsx @@ -52,12 +52,14 @@ export const FilterRows = ({ onRemove?.(); }; - const columnOptions: SelectItem[] = columns.map(column => { - return { - label: column.name, - value: column.name, - }; - }); + const columnOptions: SelectItem[] = columns + .sort((a, b) => (a.name > b.name ? 1 : -1)) + .map(column => { + return { + label: column.name, + value: column.name, + }; + }); const operatorOptions: SelectItem[] = operators.map(operator => ({ label: `[${operator.value}] ${operator.name}`, diff --git a/frontend/libs/console/legacy-ce/src/lib/features/BrowseRows/components/RunQuery/Sort/SortRows.tsx b/frontend/libs/console/legacy-ce/src/lib/features/BrowseRows/components/RunQuery/Sort/SortRows.tsx index 33d69ebfb31..4f4ad08b1ee 100644 --- a/frontend/libs/console/legacy-ce/src/lib/features/BrowseRows/components/RunQuery/Sort/SortRows.tsx +++ b/frontend/libs/console/legacy-ce/src/lib/features/BrowseRows/components/RunQuery/Sort/SortRows.tsx @@ -32,12 +32,14 @@ export const SortRows = ({ } }, [initialSorts?.length]); - const columnOptions: SelectItem[] = columns.map(column => { - return { - label: column.name, - value: column.name, - }; - }); + const columnOptions: SelectItem[] = columns + .sort((a, b) => (a.name > b.name ? 1 : -1)) + .map(column => { + return { + label: column.name, + value: column.name, + }; + }); const orderByOptions = [ {