[arvados-workbench2] updated: 2.6.0-4-g13d657b6
git repository hosting
git at public.arvados.org
Thu Apr 20 21:13:02 UTC 2023
Summary of changes:
src/components/data-table/data-table.tsx | 49 +++++++++++++++++++++++++++-----
1 file changed, 42 insertions(+), 7 deletions(-)
via 13d657b6685b6396ef352dce0a561605e664736c (commit)
from 0284278f61c66ccd75a6559c815ca299e912665f (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 13d657b6685b6396ef352dce0a561605e664736c
Author: Lisa Knox <lisaknox83 at gmail.com>
Date: Thu Apr 20 17:12:56 2023 -0400
15768: set up list for all multi-select functions, now resets on every new navigation 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 54c87566..e2ee6951 100644
--- a/src/components/data-table/data-table.tsx
+++ b/src/components/data-table/data-table.tsx
@@ -64,6 +64,7 @@ const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
checkBoxCell: {
// border: '1px dotted green',
padding: '0',
+ cursor: 'pointer',
},
tableCell: {
wordWrap: 'break-word',
@@ -89,26 +90,55 @@ const styles: StyleRulesCallback<CssRules> = (theme: Theme) => ({
},
});
-const selectedList = new Set();
+//master list for all things checked and unchecked
+const checkedList: Record<string, boolean> = {};
-const handleResourceSelect = (uuid) => {
- if (selectedList.has(uuid)) selectedList.delete(uuid);
- else selectedList.add(uuid);
- console.log(selectedList);
+const initializeCheckedList = (items: any[]): void => {
+ for (const uuid in checkedList) {
+ if (checkedList.hasOwnProperty(uuid)) {
+ delete checkedList[uuid];
+ }
+ }
+ items.forEach((uuid) => {
+ if (!checkedList.hasOwnProperty[uuid]) {
+ checkedList[uuid] = false;
+ }
+ });
+};
+
+const handleResourceSelect = (uuid: string) => {
+ if (!checkedList[uuid]) {
+ checkedList[uuid] = true;
+ } else {
+ checkedList[uuid] = false;
+ }
+ console.log(checkedList);
};
+const handleSelectAll = () => {};
+
+const handleDeselectAll = () => {};
+
const checkBoxColumn: DataColumn<any, any> = {
name: '',
selected: true,
configurable: false,
filters: createTree(),
- render: (item) => <Checkbox color='primary' onChange={() => handleResourceSelect(item)} />,
+ render: (item) => {
+ return <Checkbox color='primary' onClick={() => handleResourceSelect(item)} />;
+ },
};
type DataTableProps<T> = DataTableDataProps<T> & WithStyles<CssRules>;
export const DataTable = withStyles(styles)(
class Component<T> extends React.Component<DataTableProps<T>> {
+ componentDidUpdate(prevProps: Readonly<DataTableProps<T>>, prevState: Readonly<{}>, snapshot?: any): void {
+ if (prevProps.items !== this.props.items) {
+ console.log('hi');
+ initializeCheckedList(this.props.items);
+ }
+ }
render() {
const { items, classes, working, columns } = this.props;
if (columns[0] !== checkBoxColumn) columns.unshift(checkBoxColumn);
@@ -140,7 +170,12 @@ export const DataTable = withStyles(styles)(
renderHeadCell = (column: DataColumn<T, any>, index: number) => {
const { name, key, renderHeader, filters, sort } = column;
const { onSortToggle, onFiltersChange, classes } = this.props;
- return (
+ return index === 0 ? (
+ <TableCell key={key || index} className={classes.checkBoxCell}>
+ <div onClick={handleSelectAll}>select all</div>
+ <div onClick={handleDeselectAll}>deselect all</div>
+ </TableCell>
+ ) : (
<TableCell className={classes.tableCell} key={key || index}>
{renderHeader ? (
renderHeader()
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list