22202: Move get project panel uuid to separate file to avoid import loop
[arvados.git] / services / workbench2 / src / store / project-panel / project-panel-action.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { Dispatch } from "redux";
6 import { propertiesActions } from "store/properties/properties-actions";
7 import { loadProject } from "store/workbench/workbench-actions";
8 import { projectPanelRunActions, projectPanelDataActions } from "store/project-panel/project-panel-action-bind";
9 import { PROJECT_PANEL_CURRENT_UUID, IS_PROJECT_PANEL_TRASHED } from "./project-panel";
10
11 export const openProjectPanel = (projectUuid: string) => async (dispatch: Dispatch) => {
12     await dispatch<any>(loadProject(projectUuid));
13     dispatch(propertiesActions.SET_PROPERTY({ key: PROJECT_PANEL_CURRENT_UUID, value: projectUuid }));
14
15     dispatch(projectPanelDataActions.RESET_EXPLORER_SEARCH_VALUE());
16     dispatch(projectPanelDataActions.REQUEST_ITEMS());
17
18     dispatch(projectPanelRunActions.RESET_EXPLORER_SEARCH_VALUE());
19     dispatch(projectPanelRunActions.REQUEST_ITEMS());
20 };
21
22 export const setIsProjectPanelTrashed = (isTrashed: boolean) => propertiesActions.SET_PROPERTY({ key: IS_PROJECT_PANEL_TRASHED, value: isTrashed });