1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { default as unionize, ofType, UnionOf } from "unionize";
6 import { SortDirection, DataColumn } from "../../components/data-table/data-column";
7 import { DataTableFilterItem } from "../../components/data-table-filters/data-table-filters";
9 type WithId<T> = T & { id: string };
11 const actions = unionize({
12 SET_COLUMNS: ofType<WithId<{ columns: Array<DataColumn<any>> }>>(),
13 SET_FILTERS: ofType<WithId<{columnName: string, filters: DataTableFilterItem[]}>>(),
14 SET_ITEMS: ofType<WithId<{items: any[]}>>(),
15 SET_PAGE: ofType<WithId<{page: number}>>(),
16 SET_ROWS_PER_PAGE: ofType<WithId<{rowsPerPage: number}>>(),
17 TOGGLE_COLUMN: ofType<WithId<{ columnName: string }>>(),
18 TOGGLE_SORT: ofType<WithId<{ columnName: string }>>(),
19 SET_SEARCH_VALUE: ofType<WithId<{searchValue: string}>>()
20 }, { tag: "type", value: "payload" });
22 export type DataExplorerAction = UnionOf<typeof actions>;
24 export default actions;