From 998dcb93c94cf8cf2cf752cd842ea54f8eae1a3e Mon Sep 17 00:00:00 2001 From: Ashton G Date: Tue, 29 Oct 2024 13:22:50 -0400 Subject: [PATCH] fix: improve sorting for multi-type columns (#10123) --- webui/react/src/components/MultiSortMenu.tsx | 63 ++++++++++++++++++-- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 34 ++++++++--- 2 files changed, 84 insertions(+), 13 deletions(-) diff --git a/webui/react/src/components/MultiSortMenu.tsx b/webui/react/src/components/MultiSortMenu.tsx index 68916cb3fd6..1b677894876 100644 --- a/webui/react/src/components/MultiSortMenu.tsx +++ b/webui/react/src/components/MultiSortMenu.tsx @@ -1,12 +1,17 @@ +import Badge from 'hew/Badge'; import Button from 'hew/Button'; import { DirectionType, Sort, validSort } from 'hew/DataGrid/DataGrid'; import Dropdown, { MenuItem } from 'hew/Dropdown'; import Icon from 'hew/Icon'; import Select, { Option } from 'hew/Select'; import { Loadable } from 'hew/utils/loadable'; +import { groupBy, mapValues } from 'lodash'; +import { Fragment, useMemo } from 'react'; +import { runColumns } from 'pages/FlatRuns/columns'; import { V1ColumnType } from 'services/api-ts-sdk'; import { ProjectColumn } from 'types'; +import { removeColumnTypePrefix } from 'utils/flatRun'; import css from './MultiSortMenu.module.scss'; @@ -25,6 +30,7 @@ interface MultiSortRowProps { onChange?: (sort: Sort) => void; onRemove?: () => void; bannedSortColumns: Set; + typeMap: Record; } interface DirectionOptionsProps { onChange?: (direction: DirectionType) => void; @@ -36,6 +42,7 @@ interface ColumnOptionsProps { onChange?: (column: string) => void; value?: string; bannedSortColumns: Set; + typeMap: Record; } export const optionsByColumnType = { @@ -153,6 +160,7 @@ const ColumnOptions: React.FC = ({ columns, value, bannedSortColumns, + typeMap, }) => (