21364: added reset_items_available method Arvados-DCO-1.1-Signed-off-by: Lisa Knox...
[arvados.git] / services / workbench2 / src / store / data-explorer / data-explorer-reducer.ts
index a0a7eb6400b1160f0702d2e4243b94912c85bfa1..1c32891e52de1cb01fd242d0df6972f8199a868d 100644 (file)
@@ -30,6 +30,7 @@ export interface DataExplorer {
     searchValue: string;
     working?: boolean;
     requestState: DataTableRequestState;
+    isNotFound: boolean;
 }
 
 export const initialDataExplorer: DataExplorer = {
@@ -42,6 +43,7 @@ export const initialDataExplorer: DataExplorer = {
     rowsPerPageOptions: [10, 20, 50, 100, 200, 500],
     searchValue: '',
     requestState: DataTableRequestState.IDLE,
+    isNotFound: false,
 };
 
 export type DataExplorerState = Record<string, DataExplorer>;
@@ -89,6 +91,9 @@ export const dataExplorerReducer = (
             })
         ),
 
+        RESET_ITEMS_AVAILABLE: ({ id }) =>
+            update(state, id, (explorer) => ({ ...explorer, itemsAvailable: 0 })),
+
         APPEND_ITEMS: ({ id, items, itemsAvailable, page, rowsPerPage }) =>
             update(state, id, (explorer) => ({
                 ...explorer,
@@ -119,6 +124,9 @@ export const dataExplorerReducer = (
         TOGGLE_COLUMN: ({ id, columnName }) =>
             update(state, id, mapColumns(toggleColumn(columnName))),
 
+        SET_IS_NOT_FOUND: ({ id, isNotFound }) =>
+            update(state, id, (explorer) => ({ ...explorer, isNotFound })),
+
         default: () => state,
     });
 };