21128: clicking row now checks box Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa...
[arvados-workbench2.git] / src / store / multiselect / multiselect-actions.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { TCheckedList } from "components/data-table/data-table";
6
7 export const multiselectActionContants = {
8     TOGGLE_VISIBLITY: "TOGGLE_VISIBLITY",
9     SET_CHECKEDLIST: "SET_CHECKEDLIST",
10     SELECT_ONE: 'SELECT_ONE',
11     DESELECT_ONE: "DESELECT_ONE",
12 };
13
14 export const toggleMSToolbar = (isVisible: boolean) => {
15     return dispatch => {
16         dispatch({ type: multiselectActionContants.TOGGLE_VISIBLITY, payload: isVisible });
17     };
18 };
19
20 export const setCheckedListOnStore = (checkedList: TCheckedList) => {
21     return dispatch => {
22         dispatch({ type: multiselectActionContants.SET_CHECKEDLIST, payload: checkedList });
23     };
24 };
25
26 export const selectOne = (uuid: string) => {
27     return dispatch => {
28         dispatch({ type: multiselectActionContants.SELECT_ONE, payload: uuid });
29     };
30 };
31
32 export const deselectOne = (uuid: string) => {
33     return dispatch => {
34         dispatch({ type: multiselectActionContants.DESELECT_ONE, payload: uuid });
35     };
36 };
37
38 export const multiselectActions = {
39     toggleMSToolbar,
40     setCheckedListOnStore,
41     selectOne,
42     deselectOne,
43 };