21128: clicking row now checks box Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa...
authorLisa Knox <lisaknox83@gmail.com>
Thu, 16 Nov 2023 19:46:41 +0000 (14:46 -0500)
committerLisa Knox <lisaknox83@gmail.com>
Thu, 16 Nov 2023 19:46:41 +0000 (14:46 -0500)
src/store/details-panel/details-panel-action.ts
src/store/multiselect/multiselect-actions.tsx
src/store/multiselect/multiselect-reducer.tsx

index b708ad622c8ccfa141a7118c516d8cef33fcc8b7..ef5f6095c07725c29a6a02f49d23c56d3286941c 100644 (file)
@@ -13,6 +13,7 @@ import { FilterBuilder } from 'services/api/filter-builder';
 import { OrderBuilder } from 'services/api/order-builder';
 import { CollectionResource } from 'models/collection';
 import { extractUuidKind, ResourceKind } from 'models/resource';
+import { selectOne } from 'store/multiselect/multiselect-actions';
 
 export const SLIDE_TIMEOUT = 500;
 
@@ -36,6 +37,7 @@ export const loadDetailsPanel = (uuid: string) =>
                     break;
             }
         }
+        dispatch<any>(selectOne(uuid))
         dispatch(detailsPanelActions.LOAD_DETAILS_PANEL(uuid));
     };
 
index 1c329a9e90496bb87b168e55b8302c9808f6c555..c5ad4948b5a2ee569ba6f3ae9ddf555f84a9f8b2 100644 (file)
@@ -7,6 +7,7 @@ import { TCheckedList } from "components/data-table/data-table";
 export const multiselectActionContants = {
     TOGGLE_VISIBLITY: "TOGGLE_VISIBLITY",
     SET_CHECKEDLIST: "SET_CHECKEDLIST",
+    SELECT_ONE: 'SELECT_ONE',
     DESELECT_ONE: "DESELECT_ONE",
 };
 
@@ -22,6 +23,12 @@ export const setCheckedListOnStore = (checkedList: TCheckedList) => {
     };
 };
 
+export const selectOne = (uuid: string) => {
+    return dispatch => {
+        dispatch({ type: multiselectActionContants.SELECT_ONE, payload: uuid });
+    };
+};
+
 export const deselectOne = (uuid: string) => {
     return dispatch => {
         dispatch({ type: multiselectActionContants.DESELECT_ONE, payload: uuid });
@@ -31,5 +38,6 @@ export const deselectOne = (uuid: string) => {
 export const multiselectActions = {
     toggleMSToolbar,
     setCheckedListOnStore,
+    selectOne,
     deselectOne,
 };
index 75c4b1f99388d5567b98cf7955c59db297355fd1..8b70ceccb0788a9cff31bc40909c7bcdbdbcacd2 100644 (file)
@@ -15,7 +15,7 @@ const multiselectToolbarInitialState = {
     checkedList: {},
 };
 
-const { TOGGLE_VISIBLITY, SET_CHECKEDLIST, DESELECT_ONE } = multiselectActionContants;
+const { TOGGLE_VISIBLITY, SET_CHECKEDLIST, SELECT_ONE, DESELECT_ONE } = multiselectActionContants;
 
 export const multiselectReducer = (state: MultiselectToolbarState = multiselectToolbarInitialState, action) => {
     switch (action.type) {
@@ -23,6 +23,8 @@ export const multiselectReducer = (state: MultiselectToolbarState = multiselectT
             return { ...state, isVisible: action.payload };
         case SET_CHECKEDLIST:
             return { ...state, checkedList: action.payload };
+        case SELECT_ONE:
+            return { ...state, checkedList: { ...state.checkedList, [action.payload]: true } };
         case DESELECT_ONE:
             return { ...state, checkedList: { ...state.checkedList, [action.payload]: false } };
         default: