From d42292e596bd6fa2185e15a09790521a93e26a64 Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Sat, 30 Jun 2018 15:54:24 +0200 Subject: [PATCH] Fix incorrect projets item toggling Feature #13678 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- src/store/navigation/navigation-action.ts | 7 ++++++- src/views/workbench/workbench.tsx | 8 +------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/store/navigation/navigation-action.ts b/src/store/navigation/navigation-action.ts index a4b9a8f6..daeb26fd 100644 --- a/src/store/navigation/navigation-action.ts +++ b/src/store/navigation/navigation-action.ts @@ -14,6 +14,7 @@ import dataExplorerActions from "../data-explorer/data-explorer-action"; import { PROJECT_PANEL_ID } from "../../views/project-panel/project-panel"; import { projectPanelItems } from "../../views/project-panel/project-panel-selectors"; import { RootState } from "../store"; +import { sidePanelData } from "../side-panel/side-panel-reducer"; export const getResourceUrl = (resource: Resource): string => { switch (resource.kind) { @@ -31,12 +32,16 @@ export enum ItemMode { export const setProjectItem = (itemId: string, itemMode: ItemMode) => (dispatch: Dispatch, getState: () => RootState) => { - const { projects, router } = getState(); + const { projects, router, sidePanel } = getState(); const treeItem = findTreeItem(projects.items, itemId); if (treeItem) { dispatch(sidePanelActions.RESET_SIDE_PANEL_ACTIVITY()); + const projectsItem = sidePanelData[0]; + if(sidePanel.some(item => item.id === projectsItem.id && !item.open)){ + dispatch(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_OPEN(projectsItem.id)); + } if (itemMode === ItemMode.OPEN || itemMode === ItemMode.BOTH) { dispatch(projectActions.TOGGLE_PROJECT_TREE_ITEM_OPEN(treeItem.data.uuid)); diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index 85ed90c9..b8baeadc 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -202,16 +202,10 @@ class Workbench extends React.Component { } renderProjectPanel = (props: RouteComponentProps<{ id: string }>) => this.props.dispatch(setProjectItem(itemId, ItemMode.ACTIVE))} onItemClick={item => this.props.dispatch(setProjectItem(item.uuid, ItemMode.ACTIVE))} {...props} /> - handleItemRouteChange = (itemId: string) => { - this.props.dispatch(sidePanelActions.RESET_SIDE_PANEL_ACTIVITY()); - this.props.dispatch(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_OPEN(sidePanelData[0].id)); - this.props.dispatch(setProjectItem(itemId, ItemMode.ACTIVE)); - } - } export default connect( -- 2.30.2