From a53ea967e726db1ae67d2af30d6e1e4e3c005adb Mon Sep 17 00:00:00 2001 From: Emily Bonar Date: Wed, 23 Oct 2024 15:34:50 -0400 Subject: [PATCH] PR feedback --- webui/react/src/components/TableActionBar.tsx | 7 ++----- webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx | 10 +++------- webui/react/src/pages/FlatRuns/FlatRuns.tsx | 5 +++-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/webui/react/src/components/TableActionBar.tsx b/webui/react/src/components/TableActionBar.tsx index f4bc1bad956c..fe4de7631ce5 100644 --- a/webui/react/src/components/TableActionBar.tsx +++ b/webui/react/src/components/TableActionBar.tsx @@ -16,7 +16,7 @@ import ColumnPickerMenu from 'components/ColumnPickerMenu'; import ExperimentMoveModalComponent from 'components/ExperimentMoveModal'; import ExperimentRetainLogsModalComponent from 'components/ExperimentRetainLogsModal'; import ExperimentTensorBoardModal from 'components/ExperimentTensorBoardModal'; -import { FilterFormStore, INIT_FORMSET } from 'components/FilterForm/components/FilterFormStore'; +import { FilterFormStore } from 'components/FilterForm/components/FilterFormStore'; import TableFilter from 'components/FilterForm/TableFilter'; import MultiSortMenu from 'components/MultiSortMenu'; import { OptionsMenu, RowHeight } from 'components/OptionsMenu'; @@ -242,10 +242,7 @@ const TableActionBar: React.FC = ({ break; } case 'ALL_EXCEPT': { - const filterFormSet = - selection.type === 'ALL_EXCEPT' - ? (JSON.parse(tableFilterString) as FilterFormSet) - : INIT_FORMSET; + const filterFormSet = JSON.parse(tableFilterString) as FilterFormSet; params.filter = JSON.stringify(getIdsFilter(filterFormSet, selection)); break; } diff --git a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx index ecf8ed42030d..95d917724663 100644 --- a/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRunActionButton.tsx @@ -9,8 +9,7 @@ import { useObservable } from 'micro-observables'; import { useCallback, useMemo, useState } from 'react'; import BatchActionConfirmModalComponent from 'components/BatchActionConfirmModal'; -import { INIT_FORMSET } from 'components/FilterForm/components/FilterFormStore'; -import { FilterFormSet, Operator } from 'components/FilterForm/components/type'; +import { FilterFormSetWithoutId, Operator } from 'components/FilterForm/components/type'; import Link from 'components/Link'; import usePermissions from 'hooks/usePermissions'; import FlatRunMoveModalComponent from 'pages/FlatRuns/FlatRunMoveModal'; @@ -103,10 +102,7 @@ const FlatRunActionButton = ({ break; } case 'ALL_EXCEPT': { - const filterFormSet = - selection.type === 'ALL_EXCEPT' - ? (JSON.parse(tableFilterString) as FilterFormSet) - : INIT_FORMSET; + const filterFormSet = JSON.parse(tableFilterString) as FilterFormSetWithoutId; if (searchId) { // only display trials for search const searchFilter = { @@ -117,7 +113,7 @@ const FlatRunActionButton = ({ type: V1ColumnType.NUMBER, value: searchId, }; - combine(filterFormSet.filterGroup, 'and', searchFilter); + filterFormSet.filterGroup = combine(filterFormSet.filterGroup, 'and', searchFilter); } params.filter = JSON.stringify(getIdsFilter(filterFormSet, selection)); break; diff --git a/webui/react/src/pages/FlatRuns/FlatRuns.tsx b/webui/react/src/pages/FlatRuns/FlatRuns.tsx index b0fa0760e9d6..f005e454ed21 100644 --- a/webui/react/src/pages/FlatRuns/FlatRuns.tsx +++ b/webui/react/src/pages/FlatRuns/FlatRuns.tsx @@ -33,6 +33,7 @@ import { FilterFormStore, ROOT_ID } from 'components/FilterForm/components/Filte import { AvailableOperators, FilterFormSet, + FilterFormSetWithoutId, FormField, FormGroup, FormKind, @@ -516,7 +517,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { if (isLoadingSettings || Loadable.isNotLoaded(loadableFormset)) return; try { const filters = JSON.parse(filtersString); - const filterFormSet = JSON.parse(filtersString); + const filterFormSet = JSON.parse(filtersString) as FilterFormSetWithoutId; if (searchId) { // only display trials for search const searchFilter = { @@ -527,7 +528,7 @@ const FlatRuns: React.FC = ({ projectId, workspaceId, searchId }) => { type: V1ColumnType.NUMBER, value: searchId, }; - combine(filterFormSet.filterGroup, 'and', searchFilter); + filterFormSet.filterGroup = combine(filterFormSet.filterGroup, 'and', searchFilter); } const offset = page * settings.pageLimit; const response = await searchRuns(