refs #master Merge branch 'origin/master' into 14007-ts-paths
authorDaniel Kos <daniel.kos@contractors.roche.com>
Mon, 13 Aug 2018 17:48:41 +0000 (19:48 +0200)
committerDaniel Kos <daniel.kos@contractors.roche.com>
Mon, 13 Aug 2018 17:48:41 +0000 (19:48 +0200)
# Conflicts:
# src/components/data-explorer/data-explorer.test.tsx
# src/components/data-explorer/data-explorer.tsx
# src/store/navigation/navigation-action.ts
# src/views-components/context-menu/action-sets/root-project-action-set.ts
# src/views-components/details-panel/empty-details.tsx
# src/views/favorite-panel/favorite-panel.tsx
# src/views/project-panel/project-panel.tsx
# src/views/workbench/workbench.test.tsx
# src/views/workbench/workbench.tsx

Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos@contractors.roche.com>

14 files changed:
src/components/data-explorer/data-explorer.test.tsx
src/components/data-explorer/data-explorer.tsx
src/components/default-view/default-view.tsx [new file with mode: 0644]
src/components/details-attribute/details-attribute.tsx
src/components/side-panel/side-panel.tsx
src/store/navigation/navigation-action.ts
src/store/project/project-action.ts
src/store/side-panel/side-panel-reducer.ts
src/views-components/context-menu/action-sets/root-project-action-set.ts
src/views-components/details-panel/empty-details.tsx
src/views/favorite-panel/favorite-panel.tsx
src/views/project-panel/project-panel.tsx
src/views/workbench/workbench.test.tsx
src/views/workbench/workbench.tsx

index 2be106cc41ca2a54823f89b3ca8f43e81ff597a8..a34ab1c8edfeaf97d4f01fb3a1ee51f8b200aad2 100644 (file)
@@ -11,6 +11,8 @@ import { ColumnSelector } from "../column-selector/column-selector";
 import { DataTable } from "../data-table/data-table";
 import { SearchInput } from "../search-input/search-input";
 import { TablePagination } from "@material-ui/core";
+import { ProjectIcon } from '../icon/icon';
+import { DefaultView } from '../default-view/default-view';
 
 configure({ adapter: new Adapter() });
 
@@ -64,12 +66,13 @@ describe("<DataExplorer />", () => {
         expect(onRowClick).toHaveBeenCalledWith("rowClick");
     });
 
-    it("does not render <TablePagination/> if there is no items", () => {
+    it("does not render <DataTable/> if there is no items", () => {
         const dataExplorer = mount(<DataExplorer
             {...mockDataExplorerProps()}
             items={[]}
         />);
-        expect(dataExplorer.find(TablePagination)).toHaveLength(0);
+        expect(dataExplorer.find(DataTable)).toHaveLength(0);
+        expect(dataExplorer.find(DefaultView)).toHaveLength(1);
     });
 
     it("communicates with <TablePagination/>", () => {
@@ -100,7 +103,7 @@ const mockDataExplorerProps = () => ({
     searchValue: "",
     page: 0,
     rowsPerPage: 0,
-    rowsPerPageOptions: [],
+    rowsPerPageOptions: [0],
     onSearch: jest.fn(),
     onFiltersChange: jest.fn(),
     onSortToggle: jest.fn(),
@@ -109,5 +112,7 @@ const mockDataExplorerProps = () => ({
     onColumnToggle: jest.fn(),
     onChangePage: jest.fn(),
     onChangeRowsPerPage: jest.fn(),
-    onContextMenu: jest.fn()
+    onContextMenu: jest.fn(),
+    defaultIcon: ProjectIcon,
+    defaultMessages: ['testing'],
 });
index eaa3464b57bc77442a05e39d7eb8444f508d6ca2..2811bd4d1f7e7fada857e6677e7f50c1c576fba6 100644 (file)
@@ -11,8 +11,10 @@ import { DataColumn } from "../data-table/data-column";
 import { DataTableFilterItem } from '../data-table-filters/data-table-filters';
 import { SearchInput } from '../search-input/search-input';
 import { ArvadosTheme } from "~/common/custom-theme";
+import { DefaultView } from '../default-view/default-view';
+import { IconType } from '../icon/icon';
 
-type CssRules = "searchBox" | "toolbar";
+type CssRules = 'searchBox' | "toolbar" | 'defaultRoot' | 'defaultMessage' | 'defaultIcon';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     searchBox: {
@@ -20,6 +22,19 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     },
     toolbar: {
         paddingTop: theme.spacing.unit * 2
+    },
+    defaultRoot: {
+        position: 'absolute',
+        width: '80%',
+        left: '50%',
+        top: '50%',
+        transform: 'translate(-50%, -50%)'
+    },
+    defaultMessage: {
+        fontSize: '1.75rem',
+    },
+    defaultIcon: {
+        fontSize: '6rem'
     }
 });
 
@@ -31,6 +46,11 @@ interface DataExplorerDataProps<T> {
     rowsPerPage: number;
     rowsPerPageOptions: number[];
     page: number;
+    defaultIcon: IconType;
+    defaultMessages: string[];
+}
+
+interface DataExplorerActionProps<T> {
     onSearch: (value: string) => void;
     onRowClick: (item: T) => void;
     onRowDoubleClick: (item: T) => void;
@@ -43,48 +63,62 @@ interface DataExplorerDataProps<T> {
     extractKey?: (item: T) => React.Key;
 }
 
-type DataExplorerProps<T> = DataExplorerDataProps<T> & WithStyles<CssRules>;
+type DataExplorerProps<T> = DataExplorerDataProps<T> & DataExplorerActionProps<T> & WithStyles<CssRules>;
 
 export const DataExplorer = withStyles(styles)(
     class DataExplorerGeneric<T> extends React.Component<DataExplorerProps<T>> {
         render() {
-            return <Paper>
-                <Toolbar className={this.props.classes.toolbar}>
-                    <Grid container justify="space-between" wrap="nowrap" alignItems="center">
-                        <div className={this.props.classes.searchBox}>
-                            <SearchInput
-                                value={this.props.searchValue}
-                                onSearch={this.props.onSearch}/>
-                        </div>
-                        <ColumnSelector
-                            columns={this.props.columns}
-                            onColumnToggle={this.props.onColumnToggle}/>
-                    </Grid>
-                </Toolbar>
-                <DataTable
-                    columns={[...this.props.columns, this.contextMenuColumn]}
-                    items={this.props.items}
-                    onRowClick={(_, item: T) => this.props.onRowClick(item)}
-                    onContextMenu={this.props.onContextMenu}
-                    onRowDoubleClick={(_, item: T) => this.props.onRowDoubleClick(item)}
-                    onFiltersChange={this.props.onFiltersChange}
-                    onSortToggle={this.props.onSortToggle}
-                    extractKey={this.props.extractKey}/>
-                <Toolbar>
-                    {this.props.items.length > 0 &&
-                    <Grid container justify="flex-end">
-                        <TablePagination
-                            count={this.props.itemsAvailable}
-                            rowsPerPage={this.props.rowsPerPage}
-                            rowsPerPageOptions={this.props.rowsPerPageOptions}
-                            page={this.props.page}
-                            onChangePage={this.changePage}
-                            onChangeRowsPerPage={this.changeRowsPerPage}
-                            component="div"
-                        />
-                    </Grid>}
-                </Toolbar>
-            </Paper>;
+            const { 
+                columns, onContextMenu, onFiltersChange, onSortToggle, extractKey, 
+                rowsPerPage, rowsPerPageOptions, onColumnToggle, searchValue, onSearch, 
+                items, itemsAvailable, onRowClick, onRowDoubleClick, defaultIcon, defaultMessages, classes 
+            } = this.props;
+            return <div>
+                { items.length > 0 ? (
+                    <Paper>
+                        <Toolbar className={classes.toolbar}>
+                            <Grid container justify="space-between" wrap="nowrap" alignItems="center">
+                                <div className={classes.searchBox}>
+                                    <SearchInput
+                                        value={searchValue}
+                                        onSearch={onSearch}/>
+                                </div>
+                                <ColumnSelector
+                                    columns={columns}
+                                    onColumnToggle={onColumnToggle}/>
+                            </Grid>
+                        </Toolbar>
+                        <DataTable
+                            columns={[...columns, this.contextMenuColumn]}
+                            items={items}
+                            onRowClick={(_, item: T) => onRowClick(item)}
+                            onContextMenu={onContextMenu}
+                            onRowDoubleClick={(_, item: T) => onRowDoubleClick(item)}
+                            onFiltersChange={onFiltersChange}
+                            onSortToggle={onSortToggle}
+                            extractKey={extractKey}/>
+                        <Toolbar>
+                            <Grid container justify="flex-end">
+                                <TablePagination
+                                    count={itemsAvailable}
+                                    rowsPerPage={rowsPerPage}
+                                    rowsPerPageOptions={rowsPerPageOptions}
+                                    page={this.props.page}
+                                    onChangePage={this.changePage}
+                                    onChangeRowsPerPage={this.changeRowsPerPage}
+                                    component="div" />
+                            </Grid>
+                        </Toolbar>
+                    </Paper>
+                ) : (
+                    <DefaultView 
+                        classRoot={classes.defaultRoot}
+                        icon={defaultIcon}
+                        classIcon={classes.defaultIcon}
+                        messages={defaultMessages}
+                        classMessage={classes.defaultMessage} />
+                )}
+            </div>;
         }
 
         changePage = (event: React.MouseEvent<HTMLButtonElement>, page: number) => {
diff --git a/src/components/default-view/default-view.tsx b/src/components/default-view/default-view.tsx
new file mode 100644 (file)
index 0000000..3bc3e52
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
+import { ArvadosTheme } from '../../common/custom-theme';
+import { Typography } from '@material-ui/core';
+import { IconType } from '../icon/icon';
+import * as classnames from "classnames";
+
+type CssRules = 'root' | 'icon' | 'message';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    root: {
+        textAlign: 'center'
+    },
+    icon: {
+        color: theme.palette.grey["500"],
+        fontSize: '4.5rem'
+    },
+    message: {
+        color: theme.palette.grey["500"]
+    }
+});
+
+export interface DefaultViewDataProps {
+    classRoot?: string;
+    messages: string[];
+    classMessage?: string;
+    icon: IconType;
+    classIcon?: string;
+}
+
+type DefaultViewProps = DefaultViewDataProps & WithStyles<CssRules>;
+
+export const DefaultView = withStyles(styles)(
+    ({ classes, classRoot, messages, classMessage, icon: Icon, classIcon }: DefaultViewProps) =>
+        <Typography className={classnames([classes.root, classRoot])} component="div">
+            <Icon className={classnames([classes.icon, classIcon])} />
+            {messages.map((msg: string, index: number) => {
+                return <Typography key={index} variant="body1" 
+                    className={classnames([classes.message, classMessage])}>{msg}</Typography>;
+            })}
+        </Typography>
+);
\ No newline at end of file
index d3a83918ec8681da74aa6ea3b49a5e9a1b305cf8..3888b04b67d596ea84f3e11cbfeba30999adbc03 100644 (file)
@@ -45,14 +45,15 @@ interface DetailsAttributeDataProps {
 
 type DetailsAttributeProps = DetailsAttributeDataProps & WithStyles<CssRules>;
 
-export const DetailsAttribute = withStyles(styles)(({ label, link, value, children, classes, classLabel, classValue }: DetailsAttributeProps) =>
-    <Typography component="div" className={classes.attribute}>
-        <Typography component="span" className={classnames([classes.label, classLabel])}>{label}</Typography>
-        { link
-            ? <a href={link} className={classes.link} target='_blank'>{value}</a>
-            : <Typography component="span" className={classnames([classes.value, classValue])}>
-                {value}
-                {children}
-            </Typography> }
-    </Typography>
+export const DetailsAttribute = withStyles(styles)(
+    ({ label, link, value, children, classes, classLabel, classValue }: DetailsAttributeProps) =>
+        <Typography component="div" className={classes.attribute}>
+            <Typography component="span" className={classnames([classes.label, classLabel])}>{label}</Typography>
+            { link
+                ? <a href={link} className={classes.link} target='_blank'>{value}</a>
+                : <Typography component="span" className={classnames([classes.value, classValue])}>
+                    {value}
+                    {children}
+                </Typography> }
+        </Typography>
 );
index 0a62bf2d40216b5043187576f052f85142fe68e6..206cb6322b84a1d181d451f76d8886328837a969 100644 (file)
@@ -59,7 +59,7 @@ export interface SidePanelItem {
     open?: boolean;
     margin?: boolean;
     openAble?: boolean;
-    activeAction?: (dispatch: Dispatch) => void;
+    activeAction?: (dispatch: Dispatch, uuid?: string) => void;
 }
 
 interface SidePanelDataProps {
index e50bce0a7e9b066761289bf8911e698f5b41f875..79d24471491fcd5e2ced64a8bdcd8edb6b38bd87 100644 (file)
@@ -33,12 +33,11 @@ export enum ItemMode {
 }
 
 export const setProjectItem = (itemId: string, itemMode: ItemMode) =>
-    (dispatch: Dispatch, getState: () => RootState) => {
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const { projects, router } = getState();
         const treeItem = findTreeItem(projects.items, itemId);
 
         if (treeItem) {
-
             const resourceUrl = getResourceUrl(treeItem.data);
 
             if (itemMode === ItemMode.ACTIVE || itemMode === ItemMode.BOTH) {
@@ -60,6 +59,13 @@ export const setProjectItem = (itemId: string, itemMode: ItemMode) =>
                     dispatch(projectPanelActions.RESET_PAGINATION());
                     dispatch(projectPanelActions.REQUEST_ITEMS());
                 }));
+        } else {
+            const uuid = services.authService.getUuid();
+            if (itemId === uuid) {
+                dispatch(projectActions.TOGGLE_PROJECT_TREE_ITEM_ACTIVE(uuid));
+                dispatch(projectPanelActions.RESET_PAGINATION());
+                dispatch(projectPanelActions.REQUEST_ITEMS());
+            }
         }
     };
 
index 20b255ca812e1c1d864378cc08c45349640eb640..bef50d1197f44939f9e547c577bb0e2f797e6647 100644 (file)
@@ -26,18 +26,19 @@ export const projectActions = unionize({
     value: 'payload'
 });
 
-export const getProjectList = (parentUuid: string = '') => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-    dispatch(projectActions.PROJECTS_REQUEST(parentUuid));
-    return services.projectService.list({
-        filters: FilterBuilder
-            .create()
-            .addEqual("ownerUuid", parentUuid)
-    }).then(({ items: projects }) => {
-        dispatch(projectActions.PROJECTS_SUCCESS({ projects, parentItemId: parentUuid }));
-        dispatch<any>(checkPresenceInFavorites(projects.map(project => project.uuid)));
-        return projects;
-    });
-};
+export const getProjectList = (parentUuid: string = '') => 
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(projectActions.PROJECTS_REQUEST(parentUuid));
+        return services.projectService.list({
+            filters: FilterBuilder
+                .create()
+                .addEqual("ownerUuid", parentUuid)
+        }).then(({ items: projects }) => {
+            dispatch(projectActions.PROJECTS_SUCCESS({ projects, parentItemId: parentUuid }));
+            dispatch<any>(checkPresenceInFavorites(projects.map(project => project.uuid)));
+            return projects;
+        });
+    };
 
 export const createProject = (project: Partial<ProjectResource>) =>
     (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
index fe0626340d3740695539dd669e3c3ff47debc9bb..8c73a8f596b6c9a96d0359dd804e7838ce307827 100644 (file)
@@ -9,6 +9,9 @@ import { ProjectsIcon, ShareMeIcon, WorkflowIcon, RecentIcon, FavoriteIcon, Tras
 import { Dispatch } from "redux";
 import { push } from "react-router-redux";
 import { favoritePanelActions } from "../favorite-panel/favorite-panel-action";
+import { projectPanelActions } from "../project-panel/project-panel-action";
+import { projectActions } from "../project/project-action";
+import { getProjectUrl } from "../../models/project";
 
 export type SidePanelState = SidePanelItem[];
 
@@ -56,7 +59,13 @@ export const sidePanelData = [
         open: false,
         active: false,
         margin: true,
-        openAble: true
+        openAble: true,
+        activeAction: (dispatch: Dispatch, uuid: string) => {
+            dispatch(projectActions.TOGGLE_PROJECT_TREE_ITEM_ACTIVE(uuid));
+            dispatch(push(getProjectUrl(uuid)));
+            dispatch(projectPanelActions.RESET_PAGINATION());
+            dispatch(projectPanelActions.REQUEST_ITEMS()); 
+        }
     },
     {
         id: SidePanelIdentifiers.SHARED_WITH_ME,
index 556ba5dbfff32d294aa574020c09c091e44fed67..fb380fc4f006201d324d36fadbea8724b3d16111 100644 (file)
@@ -7,13 +7,26 @@ import { reset } from "redux-form";
 import { ContextMenuActionSet } from "../context-menu-action-set";
 import { projectActions } from "~/store/project/project-action";
 import { NewProjectIcon } from "~/components/icon/icon";
+import { collectionCreateActions } from "../../../store/collections/creator/collection-creator-action";
 import { PROJECT_CREATE_DIALOG } from "../../dialog-create/dialog-project-create";
+import { COLLECTION_CREATE_DIALOG } from "../../dialog-create/dialog-collection-create";
+import { NewProjectIcon, CollectionIcon } from "../../../components/icon/icon";
 
-export const rootProjectActionSet: ContextMenuActionSet =  [[{
-    icon: NewProjectIcon,
-    name: "New project",
-    execute: (dispatch, resource) => {
-        dispatch(reset(PROJECT_CREATE_DIALOG));
-        dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid }));
+export const rootProjectActionSet: ContextMenuActionSet =  [[
+    {
+        icon: NewProjectIcon,
+        name: "New project",
+        execute: (dispatch, resource) => {
+            dispatch(reset(PROJECT_CREATE_DIALOG));
+            dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid }));
+        }
+    }, 
+    {
+        icon: CollectionIcon,
+        name: "New Collection",
+        execute: (dispatch, resource) => {
+            dispatch(reset(COLLECTION_CREATE_DIALOG));
+            dispatch(collectionCreateActions.OPEN_COLLECTION_CREATOR({ ownerUuid: resource.uuid }));
+        }
     }
-}]];
+]];
index ccaa561f9fa19310a25e5c6c775d398e0d633277..76778d72b45583b3c374b1bf3416e3528eef5e87 100644 (file)
@@ -3,44 +3,10 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from 'react';
-import { DefaultIcon, IconType, ProjectsIcon } from '~/components/icon/icon';
+import { DefaultIcon, ProjectsIcon } from '~/components/icon/icon';
 import { EmptyResource } from '~/models/empty';
 import { DetailsData } from "./details-data";
-import Typography from "@material-ui/core/Typography";
-import { StyleRulesCallback, WithStyles, withStyles } from "@material-ui/core/styles";
-import { ArvadosTheme } from "~/common/custom-theme";
-import Icon from "@material-ui/core/Icon/Icon";
-
-type CssRules = 'container' | 'icon';
-
-const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
-    container: {
-        textAlign: 'center'
-    },
-    icon: {
-        color: theme.palette.grey["500"],
-        fontSize: '72px'
-    }
-});
-
-export interface EmptyStateDataProps {
-    message: string;
-    icon: IconType;
-    details?: string;
-    children?: React.ReactNode;
-}
-
-type EmptyStateProps = EmptyStateDataProps & WithStyles<CssRules>;
-
-const EmptyState = withStyles(styles)(
-    ({ classes, details, message, children, icon: Icon }: EmptyStateProps) =>
-        <Typography className={classes.container} component="div">
-            <Icon className={classes.icon}/>
-            <Typography variant="body1" gutterBottom>{message}</Typography>
-            {details && <Typography gutterBottom>{details}</Typography>}
-            {children && <Typography gutterBottom>{children}</Typography>}
-        </Typography>
-);
+import { DefaultView } from '~/components/default-view/default-view';
 
 export class EmptyDetails extends DetailsData<EmptyResource> {
     getIcon(className?: string) {
@@ -48,6 +14,6 @@ export class EmptyDetails extends DetailsData<EmptyResource> {
     }
 
     getDetails() {
-       return <EmptyState icon={DefaultIcon} message='Select a file or folder to view its details.'/>;
+        return <DefaultView icon={DefaultIcon} messages={['Select a file or folder to view its details.']} />;
     }
 }
index 899ef3a06b276399ac8ece773647adff7d7031e1..618f0aba426b1ec6d44c00189437414ef5a2e901 100644 (file)
@@ -18,6 +18,7 @@ import { resourceLabel } from '~/common/labels';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { renderName, renderStatus, renderType, renderOwner, renderFileSize, renderDate } from '~/views-components/data-explorer/renderers';
 import { FAVORITE_PANEL_ID } from "~/store/favorite-panel/favorite-panel-action";
+import { FavoriteIcon } from '~/components/icon/icon';
 
 type CssRules = "toolbar" | "button";
 
@@ -150,7 +151,9 @@ export const FavoritePanel = withStyles(styles)(
                     onRowClick={this.props.onItemClick}
                     onRowDoubleClick={this.props.onItemDoubleClick}
                     onContextMenu={this.props.onContextMenu}
-                    extractKey={(item: FavoritePanelItem) => item.uuid} />
+                    extractKey={(item: FavoritePanelItem) => item.uuid} 
+                    defaultIcon={FavoriteIcon}
+                    defaultMessages={['Your favorites list is empty.']}/>
                 ;
             }
 
index fccd93efd39045b20111b4d9ee0748f2297e6fb0..e9179a118ddc759de11d4fccba3109c6309fc600 100644 (file)
@@ -18,10 +18,16 @@ import { resourceLabel } from '~/common/labels';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { renderName, renderStatus, renderType, renderOwner, renderFileSize, renderDate } from '~/views-components/data-explorer/renderers';
 import { restoreBranch } from '~/store/navigation/navigation-action';
+import { ProjectIcon } from '~/components/icon/icon';
 
-type CssRules = "toolbar" | "button";
+type CssRules = 'root' | "toolbar" | "button";
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    root: {
+        position: 'relative',
+        width: '100%',
+        height: '100%'
+    },
     toolbar: {
         paddingBottom: theme.spacing.unit * 3,
         textAlign: "right"
@@ -148,7 +154,7 @@ export const ProjectPanel = withStyles(styles)(
         class extends React.Component<ProjectPanelProps> {
             render() {
                 const { classes } = this.props;
-                return <div>
+                return <div className={classes.root}>
                     <div className={classes.toolbar}>
                         <Button color="primary" onClick={this.handleNewCollectionClick} variant="raised" className={classes.button}>
                             Create a collection
@@ -166,7 +172,9 @@ export const ProjectPanel = withStyles(styles)(
                         onRowClick={this.props.onItemClick}
                         onRowDoubleClick={this.props.onItemDoubleClick}
                         onContextMenu={this.props.onContextMenu}
-                        extractKey={(item: ProjectPanelItem) => item.uuid} />
+                        extractKey={(item: ProjectPanelItem) => item.uuid}
+                        defaultIcon={ProjectIcon}
+                        defaultMessages={['Your project is empty.', 'Please create a project or create a collection and upload a data.']} />
                 </div>;
             }
 
index 3587283e1159af31e2608dedca0374173c1219ce..d03e1172fb4fc963c99fcaaeb9ea014c9dda6751 100644 (file)
@@ -18,6 +18,7 @@ const history = createBrowserHistory();
 it('renders without crashing', () => {
     const div = document.createElement('div');
     const services = createServices("/arvados/v1");
+       services.authService.getUuid = jest.fn().mockReturnValueOnce('test');
     const store = configureStore(createBrowserHistory(), services);
     ReactDOM.render(
         <MuiThemeProvider theme={CustomTheme}>
index a7f14aad4ed1232e7148cab5290d5d2f3c71093d..a0be3729964eb87a33b33d802cedbc265a4376d1 100644 (file)
@@ -6,7 +6,7 @@ import * as React from 'react';
 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
 import Drawer from '@material-ui/core/Drawer';
 import { connect, DispatchProp } from "react-redux";
-import { Route, RouteComponentProps, Switch } from "react-router";
+import { Route, RouteComponentProps, Switch, Redirect } from "react-router";
 import { login, logout } from "~/store/auth/auth-action";
 import { User } from "~/models/user";
 import { RootState } from "~/store/store";
@@ -86,7 +86,8 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     content: {
         padding: `${theme.spacing.unit}px ${theme.spacing.unit * 3}px`,
         overflowY: "auto",
-        flexGrow: 1
+        flexGrow: 1,
+        position: 'relative'
     },
     toolbar: theme.mixins.toolbar
 });
@@ -227,6 +228,7 @@ export const Workbench = withStyles(styles)(
                         <main className={classes.contentWrapper}>
                             <div className={classes.content}>
                                 <Switch>
+                                    <Route path='/' exact render={() => <Redirect to={`/projects/${this.props.authService.getUuid()}`}  />} />
                                     <Route path="/projects/:id" render={this.renderProjectPanel} />
                                     <Route path="/favorites" render={this.renderFavoritePanel} />
                                     <Route path="/collections/:id" render={this.renderCollectionPanel} />
@@ -361,9 +363,10 @@ export const Workbench = withStyles(styles)(
             toggleSidePanelActive = (itemId: string) => {
                 this.props.dispatch(sidePanelActions.TOGGLE_SIDE_PANEL_ITEM_ACTIVE(itemId));
                 this.props.dispatch(projectActions.RESET_PROJECT_TREE_ACTIVITY(itemId));
+
                 const panelItem = this.props.sidePanelItems.find(it => it.id === itemId);
                 if (panelItem && panelItem.activeAction) {
-                    panelItem.activeAction(this.props.dispatch);
+                    panelItem.activeAction(this.props.dispatch, this.props.authService.getUuid());
                 }
             }