1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { Dispatch } from 'redux';
6 import { isSidePanelTreeCategory, SidePanelTreeCategory } from '~/store/side-panel-tree/side-panel-tree-actions';
7 import { navigateToFavorites, navigateTo } from '../navigation/navigation-action';
8 import { snackbarActions } from '~/store/snackbar/snackbar-actions';
9 import { RootState } from '~/store/store';
10 import { extractUuidKind, ResourceKind } from '~/models/resource';
11 import { openProjectContextMenu } from '~/store/context-menu/context-menu-actions';
12 import { openRootProjectContextMenu } from '../context-menu/context-menu-actions';
14 export const navigateFromSidePanel = (id: string) =>
15 (dispatch: Dispatch) => {
16 if (isSidePanelTreeCategory(id)) {
17 dispatch<any>(getSidePanelTreeCategoryAction(id));
19 dispatch<any>(navigateTo(id));
23 const getSidePanelTreeCategoryAction = (id: string) => {
25 case SidePanelTreeCategory.FAVORITES:
26 return navigateToFavorites;
28 return sidePanelTreeCategoryNotAvailable(id);
32 const sidePanelTreeCategoryNotAvailable = (id: string) =>
33 snackbarActions.OPEN_SNACKBAR({
34 message: `${id} not available`,