Add getting items on favorites click
authorDaniel Kos <daniel.kos@contractors.roche.com>
Tue, 24 Jul 2018 06:53:38 +0000 (08:53 +0200)
committerDaniel Kos <daniel.kos@contractors.roche.com>
Tue, 24 Jul 2018 06:53:38 +0000 (08:53 +0200)
Feature #13753

Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos@contractors.roche.com>

src/components/side-panel/side-panel.tsx
src/store/side-panel/side-panel-reducer.ts
src/views/workbench/workbench.tsx

index 0d2758402c984fe846bef39a50066b4c7f0dd6ac..8622b68cc9e68049cbd60dfbf52d97c7266a8963 100644 (file)
@@ -10,6 +10,7 @@ import { List, ListItem, ListItemIcon, Collapse } from "@material-ui/core";
 import { SidePanelRightArrowIcon, IconType } from '../icon/icon';
 import * as classnames from "classnames";
 import { ListItemTextIcon } from '../list-item-text-icon/list-item-text-icon';
+import { Dispatch } from "redux";
 
 type CssRules = 'active' | 'row' | 'root' | 'list' | 'iconClose' | 'iconOpen' | 'toggableIconContainer' | 'toggableIcon';
 
@@ -58,7 +59,7 @@ export interface SidePanelItem {
     open?: boolean;
     margin?: boolean;
     openAble?: boolean;
-    path?: string;
+    activeAction?: (dispatch: Dispatch) => void;
 }
 
 interface SidePanelDataProps {
index 5dd5c012f58861ef95bbeea180f46e2f0a659636..8d170b383b37a83275f920c9e02faba419b9d987 100644 (file)
@@ -6,6 +6,10 @@ import * as _ from "lodash";
 import { sidePanelActions, SidePanelAction } from './side-panel-action';
 import { SidePanelItem } from '../../components/side-panel/side-panel';
 import { ProjectsIcon, ShareMeIcon, WorkflowIcon, RecentIcon, FavoriteIcon, TrashIcon } from "../../components/icon/icon";
+import { dataExplorerActions } from "../data-explorer/data-explorer-action";
+import { Dispatch } from "react-redux";
+import { FAVORITE_PANEL_ID } from "../../views/favorite-panel/favorite-panel";
+import { push } from "react-router-redux";
 
 export type SidePanelState = SidePanelItem[];
 
@@ -78,7 +82,11 @@ export const sidePanelData = [
         name: "Favorites",
         icon: FavoriteIcon,
         active: false,
-        path: '/favorites'
+        activeAction: (dispatch: Dispatch) => {
+            dispatch(push("/favorites"));
+            dispatch(dataExplorerActions.RESET_PAGINATION({id: FAVORITE_PANEL_ID}));
+            dispatch(dataExplorerActions.REQUEST_ITEMS({id: FAVORITE_PANEL_ID}));
+        }
     },
     {
         id: SidePanelIdentifiers.Trash,
index 3fec6d67dd1610d116627938806dda4e9460c138..309b31af1ec9c4096a40a94ee9948707956706ab 100644 (file)
@@ -255,7 +255,9 @@ export const Workbench = withStyles(styles)(
                 this.props.dispatch(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_ACTIVE(itemId));
                 this.props.dispatch(projectActions.RESET_PROJECT_TREE_ACTIVITY(itemId));
                 const panelItem = this.props.sidePanelItems.find(it => it.id === itemId);
-                this.props.dispatch(push(panelItem && panelItem.path ? panelItem.path : "/"));
+                if (panelItem && panelItem.activeAction) {
+                    panelItem.activeAction(this.props.dispatch);
+                }
             }
 
             handleCreationDialogOpen = (itemUuid: string) => {