[arvados-workbench2] updated: 2.6.0-3-g0284278f

git repository hosting git at public.arvados.org
Thu Apr 20 16:00:07 UTC 2023


Summary of changes:
 src/components/data-table/data-table.tsx | 39 ++++++++++++++++----------------
 1 file changed, 20 insertions(+), 19 deletions(-)

       via  0284278f61c66ccd75a6559c815ca299e912665f (commit)
      from  21fd1f3889338c2dcacd28b5f59411f4ccf37f9a (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 0284278f61c66ccd75a6559c815ca299e912665f
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Thu Apr 20 12:00:01 2023 -0400

    15768: basic select function working Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/src/components/data-table/data-table.tsx b/src/components/data-table/data-table.tsx
index a2fc5e67..54c87566 100644
--- a/src/components/data-table/data-table.tsx
+++ b/src/components/data-table/data-table.tsx
@@ -13,7 +13,6 @@ import { countNodes, getTreeDirty } from 'models/tree';
 import { IconType, PendingIcon } from 'components/icon/icon';
 import { SvgIconProps } from '@material-ui/core/SvgIcon';
 import ArrowDownwardIcon from '@material-ui/icons/ArrowDownward';
-//lisa
 import { Checkbox } from '@material-ui/core';
 import { createTree } from 'models/tree';
 
@@ -90,24 +89,29 @@ const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
     },
 });
 
+const selectedList = new Set();
+
+const handleResourceSelect = (uuid) => {
+    if (selectedList.has(uuid)) selectedList.delete(uuid);
+    else selectedList.add(uuid);
+    console.log(selectedList);
+};
+
 const checkBoxColumn: DataColumn<any, any> = {
-    name: 'foo',
+    name: '',
     selected: true,
     configurable: false,
     filters: createTree(),
-    render: () => <></>,
+    render: (item) => <Checkbox color='primary' onChange={() => handleResourceSelect(item)} />,
 };
 
 type DataTableProps<T> = DataTableDataProps<T> & WithStyles<CssRules>;
 
 export const DataTable = withStyles(styles)(
     class Component<T> extends React.Component<DataTableProps<T>> {
-        handleResourceSelect = (uuid) => {
-            console.log(uuid);
-        };
         render() {
-            const { items, classes, working } = this.props;
-            this.props.columns.unshift(checkBoxColumn);
+            const { items, classes, working, columns } = this.props;
+            if (columns[0] !== checkBoxColumn) columns.unshift(checkBoxColumn);
             return (
                 <div className={classes.root}>
                     <div className={classes.content}>
@@ -183,17 +187,14 @@ export const DataTable = withStyles(styles)(
                     onDoubleClick={(event) => onRowDoubleClick && onRowDoubleClick(event, item)}
                     selected={item === currentItemUuid}
                 >
-                    {this.mapVisibleColumns((column, index) => {
-                        return index === 0 ? (
-                            <TableCell key={column.key || index} className={classes.checkBoxCell}>
-                                <Checkbox color='primary' onChange={() => this.handleResourceSelect(item)} />
-                            </TableCell>
-                        ) : (
-                            <TableCell key={column.key || index} className={currentRoute === '/workflows' ? classes.tableCellWorkflows : classes.tableCell}>
-                                {column.render(item)}
-                            </TableCell>
-                        );
-                    })}
+                    {this.mapVisibleColumns((column, index) => (
+                        <TableCell
+                            key={column.key || index}
+                            className={currentRoute === '/workflows' ? classes.tableCellWorkflows : index === 0 ? classes.checkBoxCell : classes.tableCell}
+                        >
+                            {column.render(item)}
+                        </TableCell>
+                    ))}
                 </TableRow>
             );
         };

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list