X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/6a9ed65ed717080ce933718436038b5c4dec2a74..7da8834efcac17c997d6a7f7a557b7865b1c1137:/src/store/data-explorer/data-explorer-reducer.ts diff --git a/src/store/data-explorer/data-explorer-reducer.ts b/src/store/data-explorer/data-explorer-reducer.ts index 141d1a9f20..1657ab70ed 100644 --- a/src/store/data-explorer/data-explorer-reducer.ts +++ b/src/store/data-explorer/data-explorer-reducer.ts @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { DataColumn, toggleSortDirection, resetSortDirection } from "~/components/data-table/data-column"; +import { DataColumn, toggleSortDirection, resetSortDirection, SortDirection } from "~/components/data-table/data-column"; import { dataExplorerActions, DataExplorerAction } from "./data-explorer-action"; import { DataTableFilterItem } from "~/components/data-table-filters/data-table-filters"; import { DataColumns } from "~/components/data-table/data-table"; @@ -65,6 +65,9 @@ export const dataExplorerReducer = (state: DataExplorerState = {}, action: DataE export const getDataExplorer = (state: DataExplorerState, id: string) => state[id] || initialDataExplorer; +export const getSortColumn = (dataExplorer: DataExplorer) => dataExplorer.columns.find((c: any) => + !!c.sortDirection && c.sortDirection !== SortDirection.NONE); + const update = (state: DataExplorerState, id: string, updateFn: (dataExplorer: DataExplorer) => DataExplorer) => ({ ...state, [id]: updateFn(getDataExplorer(state, id)) });