X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/60a63bb335bb4008ba53e4f19c0c38399e46984e..8e913832ad289fd28700f4081046b7de48688130:/src/store/project-panel/project-panel-action.ts diff --git a/src/store/project-panel/project-panel-action.ts b/src/store/project-panel/project-panel-action.ts index 3b30f4aa..305799e8 100644 --- a/src/store/project-panel/project-panel-action.ts +++ b/src/store/project-panel/project-panel-action.ts @@ -2,25 +2,24 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { Dispatch } from 'redux'; -import { bindDataExplorerActions } from "store/data-explorer/data-explorer-action"; +import { Dispatch } from "redux"; import { propertiesActions } from "store/properties/properties-actions"; -import { RootState } from 'store/store'; +import { RootState } from "store/store"; import { getProperty } from "store/properties/properties"; +import { loadProject } from "store/workbench/workbench-actions"; +import { projectPanelActions } from "store/project-panel/project-panel-action-bind"; export const PROJECT_PANEL_ID = "projectPanel"; export const PROJECT_PANEL_CURRENT_UUID = "projectPanelCurrentUuid"; -export const IS_PROJECT_PANEL_TRASHED = 'isProjectPanelTrashed'; -export const projectPanelActions = bindDataExplorerActions(PROJECT_PANEL_ID); +export const IS_PROJECT_PANEL_TRASHED = "isProjectPanelTrashed"; -export const openProjectPanel = (projectUuid: string) => - (dispatch: Dispatch) => { - dispatch(propertiesActions.SET_PROPERTY({ key: PROJECT_PANEL_CURRENT_UUID, value: projectUuid })); - dispatch(projectPanelActions.RESET_EXPLORER_SEARCH_VALUE()); - dispatch(projectPanelActions.REQUEST_ITEMS()); - }; +export const openProjectPanel = (projectUuid: string) => async (dispatch: Dispatch) => { + await dispatch(loadProject(projectUuid)); + dispatch(propertiesActions.SET_PROPERTY({ key: PROJECT_PANEL_CURRENT_UUID, value: projectUuid })); + dispatch(projectPanelActions.RESET_EXPLORER_SEARCH_VALUE()); + dispatch(projectPanelActions.REQUEST_ITEMS()); +}; export const getProjectPanelCurrentUuid = (state: RootState) => getProperty(PROJECT_PANEL_CURRENT_UUID)(state.properties); -export const setIsProjectPanelTrashed = (isTrashed: boolean) => - propertiesActions.SET_PROPERTY({ key: IS_PROJECT_PANEL_TRASHED, value: isTrashed }); +export const setIsProjectPanelTrashed = (isTrashed: boolean) => propertiesActions.SET_PROPERTY({ key: IS_PROJECT_PANEL_TRASHED, value: isTrashed });