+++ /dev/null
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-export const goToProject = (uuid: string) => {
- return `/projects/${uuid}`;
-};
-
-export const goToCollection = (uuid: string) => {
- return `/collections/${uuid}`;
-};
\ No newline at end of file
deleteAt: string;
isTrashed: boolean;
}
+
+export const getCollectionUrl = (uuid: string) => {
+ return `/collections/${uuid}`;
+};
\ No newline at end of file
export interface ProjectResource extends GroupResource {
groupClass: GroupClass.Project;
}
+
+export const getProjectUrl = (uuid: string) => {
+ return `/projects/${uuid}`;
+};
import { PROJECT_PANEL_ID } from "../../views/project-panel/project-panel";
import { RootState } from "../store";
import { Resource, ResourceKind } from "../../models/resource";
-import { goToProject, goToCollection } from "../../common/actions";
+import { getCollectionUrl } from "../../models/collection";
+import { getProjectUrl } from "../../models/project";
export const getResourceUrl = <T extends Resource>(resource: T): string => {
switch (resource.kind) {
- case ResourceKind.Project: return goToProject(resource.uuid);
- case ResourceKind.Collection: return goToCollection(resource.uuid);
+ case ResourceKind.Project: return getProjectUrl(resource.uuid);
+ case ResourceKind.Collection: return getCollectionUrl(resource.uuid);
default: return resource.href;
}
};
class extends React.Component<CollectionPanelProps> {
state = {
- anchorEl: undefined
+ anchorEl: undefined,
+ open: false
};
showMenu = (event: any) => {
- this.setState({ anchorEl: event.currentTarget });
+ this.setState({ anchorEl: event.currentTarget, open: true });
}
closeMenu = () => {
- this.setState({ anchorEl: undefined });
+ this.setState({ anchorEl: undefined, open: false });
}
displayMenuAction = () => {
}
render() {
- const { anchorEl } = this.state;
+ const { anchorEl, open } = this.state;
const { classes, item } = this.props;
return <div>
<Card className={classes.card}>
<Menu
id="submenu"
anchorEl={anchorEl}
- open={Boolean(anchorEl)}
+ open={open}
onClose={this.closeMenu}>
{MENU_OPTIONS.map((option) => (
<MenuItem key={option.title}>
import { detailsPanelActions, loadDetails } from "../../store/details-panel/details-panel-action";
import { contextMenuActions } from "../../store/context-menu/context-menu-actions";
-import { sidePanelData, SidePanelIdentifiers } from '../../store/side-panel/side-panel-reducer';
+import { SidePanelIdentifiers } from '../../store/side-panel/side-panel-reducer';
import { ProjectResource } from '../../models/project';
import { ResourceKind } from '../../models/resource';
import { ContextMenu, ContextMenuKind } from "../../views-components/context-menu/context-menu";
import { dataExplorerActions } from '../../store/data-explorer/data-explorer-action';
import { Snackbar } from '../../views-components/snackbar/snackbar';
import { CollectionPanel } from '../collection-panel/collection-panel';
-import { goToCollection } from '../../common/actions';
import { loadCollection } from '../../store/collection-panel/collection-panel-action';
+import { getCollectionUrl } from '../../models/collection';
const drawerWidth = 240;
const appBarHeight = 100;
switch (item.kind) {
case ResourceKind.Collection:
this.props.dispatch<any>(loadCollection(item.uuid, item.kind as ResourceKind));
- this.props.dispatch(push(goToCollection(item.uuid)));
+ this.props.dispatch(push(getCollectionUrl(item.uuid)));
default:
this.props.dispatch<any>(setProjectItem(item.uuid, ItemMode.ACTIVE));
this.props.dispatch<any>(loadDetails(item.uuid, item.kind as ResourceKind));