1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { Dispatch } from 'redux';
6 import { bindDataExplorerActions } from "store/data-explorer/data-explorer-action";
7 import { propertiesActions } from "store/properties/properties-actions";
8 import { RootState } from 'store/store';
9 import { getProperty } from "store/properties/properties";
10 import { loadProject } from "store/workbench/workbench-actions";
12 export const PROJECT_PANEL_ID = "projectPanel";
13 export const PROJECT_PANEL_CURRENT_UUID = "projectPanelCurrentUuid";
14 export const IS_PROJECT_PANEL_TRASHED = 'isProjectPanelTrashed';
15 export const projectPanelActions = bindDataExplorerActions(PROJECT_PANEL_ID);
17 export const openProjectPanel = (projectUuid: string) =>
18 async (dispatch: Dispatch) => {
19 await dispatch<any>(loadProject(projectUuid));
20 dispatch(propertiesActions.SET_PROPERTY({ key: PROJECT_PANEL_CURRENT_UUID, value: projectUuid }));
21 dispatch(projectPanelActions.RESET_EXPLORER_SEARCH_VALUE());
22 dispatch(projectPanelActions.REQUEST_ITEMS());
25 export const getProjectPanelCurrentUuid = (state: RootState) => getProperty<string>(PROJECT_PANEL_CURRENT_UUID)(state.properties);
27 export const setIsProjectPanelTrashed = (isTrashed: boolean) =>
28 propertiesActions.SET_PROPERTY({ key: IS_PROJECT_PANEL_TRASHED, value: isTrashed });