[ARVADOS-WORKBENCH2] created: 1.1.4-243-g9004a33

Git user git at public.curoverse.com
Tue Jul 10 08:34:38 EDT 2018


        at  9004a33fe4598b83a8cce315cc28528b3d224a12 (commit)


commit 9004a33fe4598b83a8cce315cc28528b3d224a12
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Jul 10 14:34:27 2018 +0200

    Add double click handler
    
    Feature #13777
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/components/data-explorer/data-explorer.tsx b/src/components/data-explorer/data-explorer.tsx
index 09a3272..9b099ac 100644
--- a/src/components/data-explorer/data-explorer.tsx
+++ b/src/components/data-explorer/data-explorer.tsx
@@ -24,6 +24,7 @@ interface DataExplorerProps<T> {
     page: number;
     onSearch: (value: string) => void;
     onRowClick: (item: T) => void;
+    onRowDoubleClick: (item: T) => void;
     onColumnToggle: (column: DataColumn<T>) => void;
     onContextAction: (action: ContextMenuAction, item: T) => void;
     onSortToggle: (column: DataColumn<T>) => void;
@@ -67,6 +68,7 @@ class DataExplorer<T extends DataItem> extends React.Component<DataExplorerProps
                 columns={[...this.props.columns, this.contextMenuColumn]}
                 items={this.props.items}
                 onRowClick={(_, item: T) => this.props.onRowClick(item)}
+                onRowDoubleClick={(_, item: T) => this.props.onRowDoubleClick(item)}
                 onRowContextMenu={this.openContextMenu}
                 onFiltersChange={this.props.onFiltersChange}
                 onSortToggle={this.props.onSortToggle} />
diff --git a/src/components/data-table/data-table.tsx b/src/components/data-table/data-table.tsx
index 5372128..c657e11 100644
--- a/src/components/data-table/data-table.tsx
+++ b/src/components/data-table/data-table.tsx
@@ -15,6 +15,7 @@ export interface DataTableProps<T> {
     items: T[];
     columns: DataColumns<T>;
     onRowClick: (event: React.MouseEvent<HTMLTableRowElement>, item: T) => void;
+    onRowDoubleClick: (event: React.MouseEvent<HTMLTableRowElement>, item: T) => void;
     onRowContextMenu: (event: React.MouseEvent<HTMLTableRowElement>, item: T) => void;
     onSortToggle: (column: DataColumn<T>) => void;
     onFiltersChange: (filters: DataTableFilterItem[], column: DataColumn<T>) => void;
@@ -68,11 +69,12 @@ class DataTable<T extends DataItem> extends React.Component<DataTableProps<T> &
     }
 
     renderBodyRow = (item: T, index: number) => {
-        const { onRowClick, onRowContextMenu } = this.props;
+        const { onRowClick, onRowDoubleClick, onRowContextMenu } = this.props;
         return <TableRow
             hover
             key={item.key}
             onClick={event => onRowClick && onRowClick(event, item)}
+            onDoubleClick={event => onRowDoubleClick && onRowDoubleClick(event, item) }
             onContextMenu={event => onRowContextMenu && onRowContextMenu(event, item)}>
             {this.mapVisibleColumns((column, index) => (
                 <TableCell key={column.key || index}>
diff --git a/src/views-components/data-explorer/data-explorer.tsx b/src/views-components/data-explorer/data-explorer.tsx
index f89bc65..5ff8c66 100644
--- a/src/views-components/data-explorer/data-explorer.tsx
+++ b/src/views-components/data-explorer/data-explorer.tsx
@@ -16,13 +16,14 @@ interface Props {
     id: string;
     contextActions: ContextMenuActionGroup[];
     onRowClick: (item: any) => void;
+    onRowDoubleClick: (item: any) => void;
     onContextAction: (action: ContextMenuAction, item: any) => void;
 }
 
 const mapStateToProps = (state: RootState, { id, contextActions }: Props) =>
     getDataExplorer(state.dataExplorer, id);
 
-const mapDispatchToProps = (dispatch: Dispatch, { id, contextActions, onRowClick, onContextAction }: Props) => ({
+const mapDispatchToProps = (dispatch: Dispatch, { id, contextActions, onRowClick, onRowDoubleClick, onContextAction }: Props) => ({
     onSearch: (searchValue: string) => {
         dispatch(actions.SET_SEARCH_VALUE({ id, searchValue }));
     },
@@ -51,6 +52,8 @@ const mapDispatchToProps = (dispatch: Dispatch, { id, contextActions, onRowClick
 
     onRowClick,
 
+    onRowDoubleClick,
+
     onContextAction
 });
 
diff --git a/src/views/project-panel/project-panel.tsx b/src/views/project-panel/project-panel.tsx
index c1d6660..0708b16 100644
--- a/src/views/project-panel/project-panel.tsx
+++ b/src/views/project-panel/project-panel.tsx
@@ -26,6 +26,7 @@ export interface ProjectPanelFilter extends DataTableFilterItem {
 type ProjectPanelProps = {
     currentItemId: string,
     onItemClick: (item: ProjectPanelItem) => void,
+    onItemDoubleClick: (item: ProjectPanelItem) => void,
     onItemRouteChange: (itemId: string) => void
 }
     & DispatchProp
@@ -49,6 +50,7 @@ class ProjectPanel extends React.Component<ProjectPanelProps> {
                 id={PROJECT_PANEL_ID}
                 contextActions={contextMenuActions}
                 onRowClick={this.props.onItemClick}
+                onRowDoubleClick={this.props.onItemDoubleClick}
                 onContextAction={this.executeAction} />;
         </div>;
     }
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 11f3694..fac9626 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -209,9 +209,11 @@ class Workbench extends React.Component<WorkbenchProps, WorkbenchState> {
     renderProjectPanel = (props: RouteComponentProps<{ id: string }>) => <ProjectPanel
         onItemRouteChange={itemId => this.props.dispatch<any>(setProjectItem(itemId, ItemMode.ACTIVE))}
         onItemClick={item =>  {
-            this.props.dispatch<any>(setProjectItem(item.uuid, ItemMode.ACTIVE));
             this.props.dispatch<any>(loadDetails(item.uuid, item.kind as ResourceKind));
         }}
+        onItemDoubleClick={item => {
+            this.props.dispatch<any>(setProjectItem(item.uuid, ItemMode.ACTIVE));
+        }}
         {...props} />
 
 }

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list