fix browse the contents of a Project in Trash and tooltips around button
[arvados-workbench2.git] / 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 { bindDataExplorerActions } from "../data-explorer/data-explorer-action";
6 import { propertiesActions } from "~/store/properties/properties-actions";
7 import { Dispatch } from 'redux';
8 import { ServiceRepository } from "~/services/services";
9 import { RootState } from '~/store/store';
10 import { getProperty } from "~/store/properties/properties";
11 export const PROJECT_PANEL_ID = "projectPanel";
12 export const PROJECT_PANEL_CURRENT_UUID = "projectPanelCurrentUuid";
13 export const IS_PROJECT_PANEL_TRASHED = 'isProjectPanelTrashed';
14 export const projectPanelActions = bindDataExplorerActions(PROJECT_PANEL_ID);
15
16 export const openProjectPanel = (projectUuid: string) =>
17     (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
18         dispatch(propertiesActions.SET_PROPERTY({ key: PROJECT_PANEL_CURRENT_UUID, value: projectUuid }));
19         dispatch(projectPanelActions.REQUEST_ITEMS());
20     };
21
22 export const getProjectPanelCurrentUuid = (state: RootState) => getProperty<string>(PROJECT_PANEL_CURRENT_UUID)(state.properties);
23
24 export const setIsProjectPanelTrashed = (isTrashed: boolean) =>
25     (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
26         dispatch(propertiesActions.SET_PROPERTY({ key: IS_PROJECT_PANEL_TRASHED, value: isTrashed }));
27     };