const mainAppBar = mount(
<MainAppBar
user={user}
++ onContextMenu={jest.fn()}
onDetailsPanelToggle={jest.fn()}
{...{ searchText: "", breadcrumbs: [], menuItems: { accountMenu: [], helpMenu: [], anonymousMenu: [] }, onSearch: jest.fn(), onBreadcrumbClick: jest.fn(), onMenuItemClick: jest.fn() }}
/>
<MainAppBar
menuItems={menuItems}
onDetailsPanelToggle={jest.fn()}
++ onContextMenu={jest.fn()}
{...{ searchText: "", breadcrumbs: [], onSearch: jest.fn(), onBreadcrumbClick: jest.fn(), onMenuItemClick: jest.fn() }}
/>
);
<MainAppBar
searchText="search text"
searchDebounce={2000}
++ onContextMenu={jest.fn()}
onSearch={onSearch}
onDetailsPanelToggle={jest.fn()}
{...{ user, breadcrumbs: [], menuItems: { accountMenu: [], helpMenu: [], anonymousMenu: [] }, onBreadcrumbClick: jest.fn(), onMenuItemClick: jest.fn() }}
const mainAppBar = mount(
<MainAppBar
breadcrumbs={items}
++ onContextMenu={jest.fn()}
onBreadcrumbClick={onBreadcrumbClick}
onDetailsPanelToggle={jest.fn()}
{...{ user, searchText: "", menuItems: { accountMenu: [], helpMenu: [], anonymousMenu: [] }, onSearch: jest.fn(), onMenuItemClick: jest.fn() }}
const mainAppBar = mount(
<MainAppBar
menuItems={menuItems}
++ onContextMenu={jest.fn()}
onMenuItemClick={onMenuItemClick}
onDetailsPanelToggle={jest.fn()}
{...{ user, searchText: "", breadcrumbs: [], onSearch: jest.fn(), onBreadcrumbClick: jest.fn() }}
+++ /dev/null
--// Copyright (C) The Arvados Authors. All rights reserved.
--//
--// SPDX-License-Identifier: AGPL-3.0
--
--import * as React from 'react';
--import { Theme } from "@material-ui/core";
--import { StyleRulesCallback, WithStyles, withStyles } from "@material-ui/core/styles";
--import Paper from "@material-ui/core/Paper/Paper";
--import Table from "@material-ui/core/Table/Table";
--import TableHead from "@material-ui/core/TableHead/TableHead";
--import TableRow from "@material-ui/core/TableRow/TableRow";
--import TableCell from "@material-ui/core/TableCell/TableCell";
--import TableBody from "@material-ui/core/TableBody/TableBody";
--
--type CssRules = 'root' | 'table';
--
--const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
-- root: {
-- width: '100%',
-- marginTop: theme.spacing.unit * 3,
-- overflowX: 'auto',
-- },
-- table: {
-- minWidth: 700,
-- },
--});
--
--interface ProjectListProps {
--}
--
--class ProjectList extends React.Component<ProjectListProps & WithStyles<CssRules>, {}> {
-- render() {
-- const {classes} = this.props;
-- return <Paper className={classes.root}>
-- <Table className={classes.table}>
-- <TableHead>
-- <TableRow>
-- <TableCell>Name</TableCell>
-- <TableCell>Status</TableCell>
-- <TableCell>Type</TableCell>
-- <TableCell>Shared by</TableCell>
-- <TableCell>File size</TableCell>
-- <TableCell>Last modified</TableCell>
-- </TableRow>
-- </TableHead>
-- <TableBody>
-- <TableRow>
-- <TableCell>Project 1</TableCell>
-- <TableCell>Complete</TableCell>
-- <TableCell>Project</TableCell>
-- <TableCell>John Doe</TableCell>
-- <TableCell>1.5 GB</TableCell>
-- <TableCell>9:22 PM</TableCell>
-- </TableRow>
-- </TableBody>
-- </Table>
-- </Paper>;
-- }
--}
--
--export default withStyles(styles)(ProjectList);
import detailsPanelActions, { loadDetails } from "../../store/details-panel/details-panel-action";
import { ResourceKind } from '../../models/kinds';
+ import { SidePanelIdentifiers } from '../../store/side-panel/side-panel-reducer';
-const drawerWidth = 240;
-const appBarHeight = 100;
-
-type CssRules = 'root' | 'appBar' | 'drawerPaper' | 'content' | 'contentWrapper' | 'toolbar';
-
-const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
- root: {
- flexGrow: 1,
- zIndex: 1,
- overflow: 'hidden',
- position: 'relative',
- display: 'flex',
- width: '100vw',
- height: '100vh'
- },
- appBar: {
- zIndex: theme.zIndex.drawer + 1,
- position: "absolute",
- width: "100%"
- },
- drawerPaper: {
- position: 'relative',
- width: drawerWidth,
- display: 'flex',
- flexDirection: 'column',
- },
- contentWrapper: {
- backgroundColor: theme.palette.background.default,
- display: "flex",
- flexGrow: 1,
- minWidth: 0,
- paddingTop: appBarHeight
- },
- content: {
- padding: `${theme.spacing.unit}px ${theme.spacing.unit * 3}px`,
- overflowY: "auto",
- flexGrow: 1
- },
- toolbar: theme.mixins.toolbar
-});
-
interface WorkbenchDataProps {
projects: Array<TreeItem<Project>>;
currentProjectId: string;
this.props.dispatch<any>(loadDetails(item.uuid, ResourceKind.Project));
}}
{...props} />
- mainAppBarActions: MainAppBarActionProps = {
- onBreadcrumbClick: ({ itemId }: NavBreadcrumb) => {
- this.props.dispatch<any>(setProjectItem(itemId, ItemMode.BOTH));
- this.props.dispatch<any>(loadDetails(itemId, ResourceKind.Project));
- },
- onSearch: searchText => {
- this.setState({ searchText });
- this.props.dispatch(push(`/search?q=${searchText}`));
- },
- onMenuItemClick: (menuItem: NavMenuItem) => menuItem.action(),
- onDetailsPanelToggle: () => {
- this.props.dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL());
- },
- onContextMenu: (event: React.MouseEvent<HTMLElement>, breadcrumb: NavBreadcrumb) => {
- this.openContextMenu(event, breadcrumb.itemId);
- }
- };
-
- toggleSidePanelOpen = (itemId: string) => {
- this.props.dispatch(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_OPEN(itemId));
- }
-
- toggleSidePanelActive = (itemId: string) => {
- this.props.dispatch(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_ACTIVE(itemId));
- this.props.dispatch(projectActions.RESET_PROJECT_TREE_ACTIVITY(itemId));
- }
-
- handleCreationDialogOpen = (itemUuid: string) => {
- this.closeContextMenu();
- this.props.dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: itemUuid }));
- }
-
-
- openContextMenu = (event: React.MouseEvent<HTMLElement>, itemUuid: string) => {
- event.preventDefault();
- this.setState({
- contextMenu: {
- anchorEl: mockAnchorFromMouseEvent(event),
- itemUuid
- }
- });
- }
-
- closeContextMenu = () => {
- this.setState({ contextMenu: {} });
+
-
- openCreateDialog = (item: ContextMenuAction) => {
- const { itemUuid } = this.state.contextMenu;
- if (item.openCreateDialog && itemUuid) {
- this.handleCreationDialogOpen(itemUuid);
++ mainAppBarActions: MainAppBarActionProps = {
++ onBreadcrumbClick: ({ itemId }: NavBreadcrumb) => {
++ this.props.dispatch<any>(setProjectItem(itemId, ItemMode.BOTH));
++ this.props.dispatch<any>(loadDetails(itemId, ResourceKind.Project));
++ },
++ onSearch: searchText => {
++ this.setState({ searchText });
++ this.props.dispatch(push(`/search?q=${searchText}`));
++ },
++ onMenuItemClick: (menuItem: NavMenuItem) => menuItem.action(),
++ onDetailsPanelToggle: () => {
++ this.props.dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL());
++ },
++ onContextMenu: (event: React.MouseEvent<HTMLElement>, breadcrumb: NavBreadcrumb) => {
++ this.openContextMenu(event, breadcrumb.itemId);
+ }
++ };
++
++ toggleSidePanelOpen = (itemId: string) => {
++ this.props.dispatch(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_OPEN(itemId));
++ }
++
++ toggleSidePanelActive = (itemId: string) => {
++ this.props.dispatch(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_ACTIVE(itemId));
++ this.props.dispatch(projectActions.RESET_PROJECT_TREE_ACTIVITY(itemId));
++ this.props.dispatch(push("/"));
++ }
++
++ handleCreationDialogOpen = (itemUuid: string) => {
++ this.closeContextMenu();
++ this.props.dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: itemUuid }));
++ }
++
++
++ openContextMenu = (event: React.MouseEvent<HTMLElement>, itemUuid: string) => {
++ event.preventDefault();
++ this.setState({
++ contextMenu: {
++ anchorEl: mockAnchorFromMouseEvent(event),
++ itemUuid
+ }
++ });
++ }
++
++ closeContextMenu = () => {
++ this.setState({ contextMenu: {} });
++ }
++
++ openCreateDialog = (item: ContextMenuAction) => {
++ const { itemUuid } = this.state.contextMenu;
++ if (item.openCreateDialog && itemUuid) {
++ this.handleCreationDialogOpen(itemUuid);
+ }
++ }
}
const contextMenuActions = [[{