[ARVADOS-WORKBENCH2] updated: 1.1.4-244-ge8d0331

Git user git at public.curoverse.com
Mon Jul 9 09:52:29 EDT 2018


Summary of changes:
 .env                                               |  5 +++
 README.md                                          |  8 ++++
 src/common/api/common-resource-service.test.ts     | 27 ++++++++++---
 src/common/api/common-resource-service.ts          |  2 +-
 src/common/api/server-api.ts                       |  2 +-
 src/components/context-menu/context-menu.tsx       |  9 ++++-
 src/components/side-panel/side-panel.tsx           | 10 +++--
 src/components/tree/tree.tsx                       | 28 ++++++++------
 src/index.tsx                                      |  9 ++---
 src/models/group.ts                                |  6 ++-
 src/models/project.ts                              |  4 +-
 src/services/groups-service/groups-service.ts      |  6 +--
 .../project-service/project-service.test.ts        | 39 +++++++++++++++++++
 src/services/project-service/project-service.ts    | 36 +++++++++++++++++
 src/services/services.ts                           |  2 +
 src/store/project/project-action.ts                | 29 ++++++++------
 src/views-components/project-tree/project-tree.tsx |  6 +--
 src/views/project-panel/project-panel.tsx          | 45 ++--------------------
 src/views/workbench/workbench.tsx                  | 35 ++++++++---------
 19 files changed, 199 insertions(+), 109 deletions(-)
 create mode 100644 .env
 create mode 100644 src/services/project-service/project-service.test.ts
 create mode 100644 src/services/project-service/project-service.ts

       via  e8d0331277033fea37a9fd73ffc781ffca8759f0 (commit)
       via  e6d69724ebd2256128e983d4a95bd1d46dd71592 (commit)
       via  a174a1b150360f57be704afcdc2a36ec8fdab98a (commit)
       via  fa73e280e87385b37c9aa9bc3cfee45ff66293d6 (commit)
       via  1fd9a76aa32b299073a01d70b55cd49720ecac7f (commit)
       via  4187ee4067e67370f6708ba1a0121ecf0a1ac756 (commit)
       via  fe979f4143a71d7951dcfa35c9fdf68841742c74 (commit)
       via  7cac459611f4e4d089cedbe13120553f97152509 (commit)
       via  6ee23f0a48cce527596ef1f260b40a71618326a5 (commit)
       via  2851aa591c073750ad9826bb28cba36f1a8cc15a (commit)
       via  447c26c2467f32ac67dbbc9bcb7cbbd0a6471917 (commit)
       via  8c8a3d8d646f99dce6a1cdbf515745d6f84bb814 (commit)
       via  b2fd743a3acb8d301adab2d1bf2cb0eca573f31a (commit)
      from  4b4ef8d9e7c3d65e4d65b8aafb68b294c30e2e28 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit e8d0331277033fea37a9fd73ffc781ffca8759f0
Merge: e6d6972 a174a1b
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Mon Jul 9 15:52:10 2018 +0200

    Merge remote-tracking branch 'origin' into 13694-Data-operations-Project-creation
    
    refs #13694
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>


commit e6d69724ebd2256128e983d4a95bd1d46dd71592
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Mon Jul 9 15:49:36 2018 +0200

    action-on-new-project-click
    
    Feature #13694
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/components/context-menu/context-menu.tsx b/src/components/context-menu/context-menu.tsx
index 7751be4..48e63ba 100644
--- a/src/components/context-menu/context-menu.tsx
+++ b/src/components/context-menu/context-menu.tsx
@@ -8,6 +8,7 @@ import { DefaultTransformOrigin } from "../popover/helpers";
 export interface ContextMenuAction {
     name: string;
     icon: string;
+    openCreateDialog?: boolean;
 }
 
 export type ContextMenuActionGroup = ContextMenuAction[];
diff --git a/src/views/project-panel/project-panel.tsx b/src/views/project-panel/project-panel.tsx
index 2cdb671..f1b8235 100644
--- a/src/views/project-panel/project-panel.tsx
+++ b/src/views/project-panel/project-panel.tsx
@@ -7,7 +7,6 @@ import { ProjectPanelItem } from './project-panel-item';
 import { Grid, Typography, Button, Toolbar, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
 import { formatDate, formatFileSize } from '../../common/formatters';
 import DataExplorer from "../../views-components/data-explorer/data-explorer";
-import { ContextMenuAction } from '../../components/context-menu/context-menu';
 import { DispatchProp, connect } from 'react-redux';
 import { DataColumns } from '../../components/data-table/data-table';
 import { RouteComponentProps } from 'react-router';
@@ -16,8 +15,6 @@ import { ResourceKind } from '../../models/kinds';
 import { DataTableFilterItem } from '../../components/data-table-filters/data-table-filters';
 import { ContainerRequestState } from '../../models/container-request';
 import { SortDirection } from '../../components/data-table/data-column';
-import DialogProjectCreate from '../../components/dialog-create/dialog-project-create';
-import { mockAnchorFromMouseEvent } from "../../components/popover/helpers";
 
 export const PROJECT_PANEL_ID = "projectPanel";
 
@@ -25,33 +22,18 @@ export interface ProjectPanelFilter extends DataTableFilterItem {
     type: ResourceKind | ContainerRequestState;
 }
 
-interface DataExplorerState<T> {
-    contextMenu: {
-        anchorEl?: HTMLElement;
-        item?: T;
-    };
-    open?: boolean;
-}
-
 type ProjectPanelProps = {
     currentItemId: string,
     onItemClick: (item: ProjectPanelItem) => void,
     onItemRouteChange: (itemId: string) => void,
     onContextMenu: (event: React.MouseEvent<HTMLElement>, item: ProjectPanelItem) => void;
-    handleCreationDialogOpen: () => void;
-    handleCreationDialogClose: () => void;
-    isCreationDialogOpen: boolean;
+    onDialogOpen: () => void;
 }
     & DispatchProp
     & WithStyles<CssRules>
     & RouteComponentProps<{ id: string }>;
 
-class ProjectPanel extends React.Component<ProjectPanelProps, DataExplorerState<any>> {
-    state: DataExplorerState<any> = {
-        contextMenu: {},
-        open: false,
-    };
-    
+class ProjectPanel extends React.Component<ProjectPanelProps> {    
     render() {
         return <div>
             <div className={this.props.classes.toolbar}>
@@ -61,10 +43,9 @@ class ProjectPanel extends React.Component<ProjectPanelProps, DataExplorerState<
                 <Button color="primary" variant="raised" className={this.props.classes.button}>
                     Run a process
                 </Button>
-                <Button color="primary" onClick={this.props.handleCreationDialogOpen} variant="raised" className={this.props.classes.button}>
+                <Button color="primary" onClick={this.props.onDialogOpen} variant="raised" className={this.props.classes.button}>
                     New project
                 </Button>
-                <DialogProjectCreate open={this.props.isCreationDialogOpen} handleClose={this.props.handleCreationDialogClose}/>
             </div>
             <DataExplorer
                 id={PROJECT_PANEL_ID}
@@ -78,26 +59,6 @@ class ProjectPanel extends React.Component<ProjectPanelProps, DataExplorerState<
             this.props.onItemRouteChange(match.params.id);
         }
     }
-
-    executeAction = (action: ContextMenuAction, item: ProjectPanelItem) => {
-        alert(`Executing ${action.name} on ${item.name}`);
-    }
-
-    openContextMenu = (event: React.MouseEvent<HTMLElement>, item: any) => {
-        event.preventDefault();
-        event.stopPropagation();
-        this.setState({
-            contextMenu: {
-                anchorEl: mockAnchorFromMouseEvent(event),
-                item
-            }
-        });
-    }
-
-    closeContextMenu = () => {
-        this.setState({ contextMenu: {} });
-    }
-
 }
 
 type CssRules = "toolbar" | "button";
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 78211af..9c1336c 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -6,9 +6,8 @@ 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, Switch, RouteComponentProps, withRouter } from "react-router";
+import { Route, Switch, RouteComponentProps } from "react-router";
 import authActions from "../../store/auth/auth-action";
-import dataExplorerActions from "../../store/data-explorer/data-explorer-action";
 import { User } from "../../models/user";
 import { RootState } from "../../store/store";
 import MainAppBar, {
@@ -20,18 +19,17 @@ import { push } from 'react-router-redux';
 import ProjectTree from '../../views-components/project-tree/project-tree';
 import { TreeItem } from "../../components/tree/tree";
 import { Project } from "../../models/project";
-import { getTreePath, findTreeItem } from '../../store/project/project-reducer';
+import { getTreePath } from '../../store/project/project-reducer';
 import sidePanelActions from '../../store/side-panel/side-panel-action';
 import SidePanel, { SidePanelItem } from '../../components/side-panel/side-panel';
-import { ResourceKind } from "../../models/resource";
 import { ItemMode, setProjectItem } from "../../store/navigation/navigation-action";
 import projectActions from "../../store/project/project-action";
 import ProjectPanel from "../project-panel/project-panel";
-import { sidePanelData } from '../../store/side-panel/side-panel-reducer';
 import DetailsPanel from '../../views-components/details-panel/details-panel';
 import { ArvadosTheme } from '../../common/custom-theme';
-import ContextMenu from '../../components/context-menu/context-menu';
+import ContextMenu, { ContextMenuAction } from '../../components/context-menu/context-menu';
 import { mockAnchorFromMouseEvent } from '../../components/popover/helpers';
+import DialogProjectCreate from '../../components/dialog-create/dialog-project-create';
 
 const drawerWidth = 240;
 const appBarHeight = 100;
@@ -172,6 +170,7 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
     }
 
     handleCreationDialogOpen = () => {
+        this.closeContextMenu();
         this.setState({ isCreationDialogOpen: true });
     }
 
@@ -189,6 +188,9 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
         this.setState({ contextMenu: {} });
     }
 
+    openCreateDialog = (item: ContextMenuAction) =>
+        item.openCreateDialog ? this.handleCreationDialogOpen() : void 0
+
     render() {
         const path = getTreePath(this.props.projects, this.props.currentProjectId);
         const breadcrumbs = path.map(item => ({
@@ -206,8 +208,7 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
                         searchText={this.state.searchText}
                         user={this.props.user}
                         menuItems={this.state.menuItems}
-                        {...this.mainAppBarActions}
-                    />
+                        {...this.mainAppBarActions} />
                 </div>
                 {user &&
                     <Drawer
@@ -241,8 +242,9 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
                 <ContextMenu
                     anchorEl={this.state.contextMenu.anchorEl}
                     actions={contextMenuActions}
-                    onActionClick={console.log}
+                    onActionClick={this.openCreateDialog}
                     onClose={this.closeContextMenu} />
+                <DialogProjectCreate open={this.state.isCreationDialogOpen} handleClose={this.handleCreationDialogClose} />
             </div>
         );
     }
@@ -251,16 +253,14 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
         onItemRouteChange={itemId => this.props.dispatch<any>(setProjectItem(itemId, ItemMode.ACTIVE))}
         onItemClick={item => this.props.dispatch<any>(setProjectItem(item.uuid, ItemMode.ACTIVE))}
         onContextMenu={this.openContextMenu}
-        handleCreationDialogOpen={this.handleCreationDialogOpen}
-        handleCreationDialogClose={this.handleCreationDialogClose}
-        isCreationDialogOpen={this.state.isCreationDialogOpen}
+        onDialogOpen={this.handleCreationDialogOpen}
         {...props} />
-
 }
 
 const contextMenuActions = [[{
     icon: "fas fa-plus fa-fw",
-    name: "New project"
+    name: "New project",
+    openCreateDialog: true
 }, {
     icon: "fas fa-users fa-fw",
     name: "Share"

commit fe979f4143a71d7951dcfa35c9fdf68841742c74
Merge: 7cac459 4b4ef8d
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Mon Jul 9 13:16:20 2018 +0200

    Merge branch '13694-Data-operations-Project-creation' of git.curoverse.com:arvados-workbench2 into 13694-Data-operations-Project-creation
    
    refs #13694
    2
    13694
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>


commit 7cac459611f4e4d089cedbe13120553f97152509
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Mon Jul 9 13:16:05 2018 +0200

    context-menu-in-side-panel-and-project-panel
    
    Feature #13694
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/components/side-panel/side-panel.tsx b/src/components/side-panel/side-panel.tsx
index f78d2a0..a7783fb 100644
--- a/src/components/side-panel/side-panel.tsx
+++ b/src/components/side-panel/side-panel.tsx
@@ -27,8 +27,7 @@ interface SidePanelProps {
     toggleOpen: (id: string) => void;
     toggleActive: (id: string) => void;
     sidePanelItems: SidePanelItem[];
-    handleCreationDialogOpen: () => void;
-    handleCreationDialogClose: () => void;
+    onContextMenu: (event: React.MouseEvent<HTMLElement>, item: SidePanelItem) => void;
 }
 
 class SidePanel extends React.Component<SidePanelProps & WithStyles<CssRules>> {
@@ -40,7 +39,7 @@ class SidePanel extends React.Component<SidePanelProps & WithStyles<CssRules>> {
                 <List>
                     {sidePanelItems.map(it => (
                         <span key={it.name}>
-                            <ListItem button className={list} onClick={() => toggleActive(it.id)}>
+                            <ListItem button className={list} onClick={() => toggleActive(it.id)} onContextMenu={this.handleRowContextMenu(it)}>
                                 <span className={row}>
                                     {it.openAble ? <i onClick={() => toggleOpen(it.id)} className={`${it.active ? activeArrow : inactiveArrow} 
                                         ${it.open ? `fas fa-caret-down ${arrowTransition}` : `fas fa-caret-down ${arrowRotate}`}`} /> : null}
@@ -60,6 +59,11 @@ class SidePanel extends React.Component<SidePanelProps & WithStyles<CssRules>> {
             </div>
         );
     }
+
+    handleRowContextMenu = (item: SidePanelItem) =>
+        (event: React.MouseEvent<HTMLElement>) =>
+            item.openAble ? this.props.onContextMenu(event, item) : null
+
 }
 
 type CssRules = 'active' | 'listItemText' | 'row' | 'leftSidePanelContainer' | 'list' | 'icon' | 'projectIconMargin' |
diff --git a/src/components/tree/tree.tsx b/src/components/tree/tree.tsx
index 2c19a83..8de9bda 100644
--- a/src/components/tree/tree.tsx
+++ b/src/components/tree/tree.tsx
@@ -32,25 +32,18 @@ interface TreeProps<T> {
     toggleItemOpen: (id: string, status: TreeItemStatus) => void;
     toggleItemActive: (id: string, status: TreeItemStatus) => void;
     level?: number;
+    onContextMenu: (event: React.MouseEvent<HTMLElement>, item: TreeItem<T>) => void;
 }
 
 class Tree<T> extends React.Component<TreeProps<T> & WithStyles<CssRules>, {}> {
-    renderArrow(status: TreeItemStatus, arrowClass: string, open: boolean, id: string) {
-        const { arrowTransition, arrowVisibility, arrowRotate } = this.props.classes;
-        return <i onClick={() => this.props.toggleItemOpen(id, status)}
-            className={`
-                    ${arrowClass} 
-                    ${status === TreeItemStatus.Pending ? arrowVisibility : ''} 
-                    ${open ? `fas fa-caret-down ${arrowTransition}` : `fas fa-caret-down ${arrowRotate}`}`} />;
-    }
     render(): ReactElement<any> {
         const level = this.props.level ? this.props.level : 0;
-        const { classes, render, toggleItemOpen, items, toggleItemActive } = this.props;
+        const { classes, render, toggleItemOpen, items, toggleItemActive, onContextMenu } = this.props;
         const { list, inactiveArrow, activeArrow, loader } = classes;
         return <List component="div" className={list}>
             {items && items.map((it: TreeItem<T>, idx: number) =>
                 <div key={`item/${level}/${idx}`}>
-                    <ListItem button className={list} style={{ paddingLeft: (level + 1) * 20 }} onClick={() => toggleItemActive(it.id, it.status)}>
+                    <ListItem button className={list} style={{ paddingLeft: (level + 1) * 20 }} onClick={() => toggleItemActive(it.id, it.status)} onContextMenu={this.handleRowContextMenu(it)}>
                         {it.status === TreeItemStatus.Pending ? <CircularProgress size={10} className={loader} /> : null}
                         {it.toggled && it.items && it.items.length === 0 ? null : this.renderArrow(it.status, it.active ? activeArrow : inactiveArrow, it.open, it.id)}
                         {render(it, level)}
@@ -62,11 +55,24 @@ class Tree<T> extends React.Component<TreeProps<T> & WithStyles<CssRules>, {}> {
                                 render={render}
                                 toggleItemOpen={toggleItemOpen}
                                 toggleItemActive={toggleItemActive}
-                                level={level + 1} />
+                                level={level + 1}
+                                onContextMenu={onContextMenu} />
                         </Collapse>}
                 </div>)}
         </List>;
     }
+    renderArrow(status: TreeItemStatus, arrowClass: string, open: boolean, id: string) {
+        const { arrowTransition, arrowVisibility, arrowRotate } = this.props.classes;
+        return <i onClick={() => this.props.toggleItemOpen(id, status)}
+            className={`
+                    ${arrowClass} 
+                    ${status === TreeItemStatus.Pending ? arrowVisibility : ''} 
+                    ${open ? `fas fa-caret-down ${arrowTransition}` : `fas fa-caret-down ${arrowRotate}`}`} />;
+    }
+
+    handleRowContextMenu = (item: TreeItem<T>) =>
+        (event: React.MouseEvent<HTMLElement>) =>
+            this.props.onContextMenu(event, item)
 }
 
 type CssRules = 'list' | 'activeArrow' | 'inactiveArrow' | 'arrowRotate' | 'arrowTransition' | 'loader' | 'arrowVisibility';
diff --git a/src/views-components/project-tree/project-tree.tsx b/src/views-components/project-tree/project-tree.tsx
index d94d3bf..511cbbb 100644
--- a/src/views-components/project-tree/project-tree.tsx
+++ b/src/views-components/project-tree/project-tree.tsx
@@ -16,17 +16,17 @@ export interface ProjectTreeProps {
     projects: Array<TreeItem<Project>>;
     toggleOpen: (id: string, status: TreeItemStatus) => void;
     toggleActive: (id: string, status: TreeItemStatus) => void;
-    handleCreationDialogOpen: () => void;
-    handleCreationDialogClose: () => void;
+    onContextMenu: (event: React.MouseEvent<HTMLElement>, item: TreeItem<Project>) => void;
 }
 
 class ProjectTree<T> extends React.Component<ProjectTreeProps & WithStyles<CssRules>> {
     render(): ReactElement<any> {
-        const { classes, projects, toggleOpen, toggleActive } = this.props;
+        const { classes, projects, toggleOpen, toggleActive, onContextMenu } = this.props;
         const { active, listItemText, row, treeContainer } = classes;
         return (
             <div className={treeContainer}>
                 <Tree items={projects}
+                    onContextMenu={onContextMenu}
                     toggleItemOpen={toggleOpen}
                     toggleItemActive={toggleActive}
                     render={(project: TreeItem<Project>) =>
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 57f0898..257c7c4 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -217,15 +217,12 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
                             toggleOpen={this.toggleSidePanelOpen}
                             toggleActive={this.toggleSidePanelActive}
                             sidePanelItems={this.props.sidePanelItems}
-                            handleCreationDialogOpen={this.handleCreationDialogOpen}
-                            handleCreationDialogClose={this.handleCreationDialogClose}>
+                            onContextMenu={this.openContextMenu}>
                             <ProjectTree
                                 projects={this.props.projects}
                                 toggleOpen={itemId => this.props.dispatch<any>(setProjectItem(itemId, ItemMode.OPEN))}
                                 toggleActive={itemId => this.props.dispatch<any>(setProjectItem(itemId, ItemMode.ACTIVE))}
-                                handleCreationDialogOpen={this.handleCreationDialogOpen}
-                                handleCreationDialogClose={this.handleCreationDialogClose}
-                            />
+                                onContextMenu={this.openContextMenu} />
                         </SidePanel>
                     </Drawer>}
                 <main className={classes.contentWrapper}>

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list