All files / src/redux/actions datatableActions.js

98.41% Statements 62/63
100% Branches 0/0
96.77% Functions 30/31
100% Lines 36/36

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163    22x         22x       22x         22x         22x         22x         22x         22x         22x       22x         22x         22x       22x         22x       22x         22x         22x         22x         22x         22x         22x         22x         22x       22x       22x 3x 3x 3x 3x   2x                 2x     1x                 1x         22x         22x         22x        
import { enqueueSnackbar } from "./notifierActions";
 
export const initializeOptions = payload => ({
  type: "INITIALIZE_OPTIONS",
  payload
});
 
export const updateComponentSize = () => ({
  type: "UPDATE_COMPONENT_SIZE"
});
 
export const sortColumns = payload => ({
  type: "SORT_COLUMNS",
  payload
});
 
export const setRowsPerPage = payload => ({
  type: "SET_ROWS_PER_PAGE",
  payload
});
 
export const setPage = payload => ({
  type: "SET_PAGE",
  payload
});
 
export const setIsScrolling = payload => ({
  type: "SET_IS_SCROLLING",
  payload
});
 
export const addRowEdited = payload => ({
  type: "ADD_ROW_EDITED",
  payload
});
 
export const addNewRow = payload => ({
  type: "ADD_NEW_ROW",
  payload
});
 
export const addAllRowsToEdited = () => ({
  type: "ADD_ALL_ROWS_TO_EDITED"
});
 
export const setRowEdited = payload => ({
  type: "SET_ROW_EDITED",
  payload
});
 
export const saveRowEdited = payload => ({
  type: "SAVE_ROW_EDITED",
  payload
});
 
export const saveAllRowsEdited = () => ({
  type: "SAVE_ALL_ROWS_EDITED"
});
 
export const revertRowEdited = payload => ({
  type: "REVERT_ROW_EDITED",
  payload
});
 
export const revertAllRowsToEdited = () => ({
  type: "REVERT_ALL_ROWS_TO_EDITED"
});
 
export const deleteRow = payload => ({
  type: "DELETE_ROW",
  payload
});
 
export const addToDeleteRow = payload => ({
  type: "ADD_TO_DELETE_ROW",
  payload
});
 
export const selectRow = payload => ({
  type: "SELECT_ROW",
  payload
});
 
export const setRowsSelected = payload => ({
  type: "SET_ROWS_SELECTED",
  payload
});
 
export const search = payload => ({
  type: "SEARCH",
  payload
});
 
export const setColumnVisibilty = payload => ({
  type: "SET_COLUMN_VISIBILITY",
  payload
});
 
export const setUserConfiguration = payload => ({
  type: "SET_USER_CONFIGURATION",
  payload
});
 
export const refreshRowsSuccess = payload => ({
  type: "REFRESH_ROWS_SUCCESS",
  payload
});
 
export const refreshRowsError = () => ({
  type: "REFRESH_ROWS_ERROR"
});
 
export const refreshRowsStarted = () => ({
  type: "REFRESH_ROWS_STARTED"
});
 
export const refreshRows = payload => {
  const key = new Date().getTime() + Math.random();
  return dispatch => {
    dispatch(refreshRowsStarted());
    return Promise.resolve(payload())
      .then(res => {
        dispatch(
          enqueueSnackbar({
            message: "Rows have been refreshed.",
            options: {
              key,
              variant: "success"
            }
          })
        );
        dispatch(refreshRowsSuccess(res));
      })
      .catch(err => {
        dispatch(
          enqueueSnackbar({
            message: "Rows couldn't be refreshed.",
            options: {
              key,
              variant: "error"
            }
          })
        );
        dispatch(refreshRowsError(err));
      });
  };
};
 
export const orderByColumns = payload => ({
  type: "ORDER_BY_COLUMNS",
  payload
});
 
export const updateOptions = payload => ({
  type: "UPDATE",
  payload
});
 
export const duplicateRow = payload => ({
  type: "DUPLICATE_ROW",
  payload
});