Improve pagination actions in data explorer
[arvados-workbench2.git] / src / store / data-explorer / data-explorer-action.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { default as unionize, ofType, UnionOf } from "unionize";
6 import { DataTableFilterItem } from "../../components/data-table-filters/data-table-filters";
7 import { DataColumns, DataItem } from "../../components/data-table/data-table";
8
9 const actions = unionize({
10     RESET_PAGINATION: ofType<{ id: string }>(),
11     REQUEST_ITEMS: ofType<{ id: string }>(),
12     SET_COLUMNS: ofType<{ id: string, columns: DataColumns<any> }>(),
13     SET_FILTERS: ofType<{ id: string, columnName: string, filters: DataTableFilterItem[] }>(),
14     SET_ITEMS: ofType<{ id: string, items: DataItem[], page: number, rowsPerPage: number, itemsAvailable: number }>(),
15     SET_PAGE: ofType<{ id: string, page: number }>(),
16     SET_ROWS_PER_PAGE: ofType<{ id: string, rowsPerPage: number }>(),
17     TOGGLE_COLUMN: ofType<{ id: string, columnName: string }>(),
18     TOGGLE_SORT: ofType<{ id: string, columnName: string }>(),
19     SET_SEARCH_VALUE: ofType<{ id: string, searchValue: string }>(),
20 }, { tag: "type", value: "payload" });
21
22 export type DataExplorerAction = UnionOf<typeof actions>;
23
24 export default actions;