[arvados-workbench2] updated: 2.6.0-32-gc79e65e9
git repository hosting
git at public.arvados.org
Fri May 12 19:13:58 UTC 2023
Summary of changes:
src/components/data-explorer/data-explorer.tsx | 6 +++-
.../data-table-multiselect-popover.tsx | 2 +-
src/components/data-table/data-table.tsx | 4 ++-
.../multiselectToolbar/MultiselectToolbar.tsx | 42 +++++++++++-----------
src/store/multiselect/multiselect-actions.tsx | 7 ++++
src/store/multiselect/multiselect-reducer.tsx | 4 +++
.../data-explorer/data-explorer.tsx | 8 +++--
7 files changed, 46 insertions(+), 27 deletions(-)
via c79e65e93760c758aa297b9eb5561c69b36a1d46 (commit)
via 84f02cea829ead38669efcfcffb2ef0a984e27dc (commit)
via ae041e1ca4cceaf6c94b818a2823377cdd5c55a4 (commit)
from 37d61b71dad8e424563f1223f068a676ad7baf8e (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 c79e65e93760c758aa297b9eb5561c69b36a1d46
Author: Lisa Knox <lisaknox83 at gmail.com>
Date: Fri May 12 15:13:52 2023 -0400
15768: copy button copies string of selected uuids Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>
diff --git a/src/components/multiselectToolbar/MultiselectToolbar.tsx b/src/components/multiselectToolbar/MultiselectToolbar.tsx
index b39fd657..94570c6c 100644
--- a/src/components/multiselectToolbar/MultiselectToolbar.tsx
+++ b/src/components/multiselectToolbar/MultiselectToolbar.tsx
@@ -8,6 +8,7 @@ import { StyleRulesCallback, withStyles, WithStyles, Toolbar, Button } from '@ma
import { ArvadosTheme } from 'common/custom-theme';
import { RootState } from 'store/store';
import { CopyToClipboardSnackbar } from 'components/copy-to-clipboard-snackbar/copy-to-clipboard-snackbar';
+import { TCheckedList } from 'components/data-table/data-table';
type CssRules = 'root' | 'button';
@@ -23,37 +24,47 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
});
type MultiselectToolbarAction = {
- fn: (classes, i) => ReactElement;
+ fn: (checkedList) => ReactElement;
};
-export type MultiselectToolbarActions = {
+export type MultiselectToolbarProps = {
buttons: Array<MultiselectToolbarAction>;
+ checkedList: TCheckedList;
};
export const defaultActions: Array<MultiselectToolbarAction> = [
{
- fn: (classes, i) => MSToolbarCopyButton(classes, i),
+ fn: (checkedList) => MSToolbarCopyButton(checkedList),
},
];
-const MSToolbarCopyButton = (classes, i) => (
- <Button key={i} className={classes.button}>
- <CopyToClipboardSnackbar value='foo' children={<div>Copy</div>} />
- </Button>
-);
-
-type MultiselectToolbarProps = MultiselectToolbarActions & WithStyles<CssRules>;
+const MSToolbarCopyButton = (checkedList) => {
+ let stringifiedSelectedList: string = '';
+ for (const [key, value] of Object.entries(checkedList)) {
+ if (value === true) {
+ stringifiedSelectedList += key + '\n';
+ }
+ }
+ return <CopyToClipboardSnackbar value={stringifiedSelectedList} children={<div>Copy</div>} />;
+};
export const MultiselectToolbar = connect(mapStateToProps)(
- withStyles(styles)((props: MultiselectToolbarProps) => {
- const { classes, buttons } = props;
- return <Toolbar className={classes.root}>{buttons.map((btn, i) => btn.fn(classes, i))}</Toolbar>;
+ withStyles(styles)((props: MultiselectToolbarProps & WithStyles<CssRules>) => {
+ const { classes, buttons, checkedList } = props;
+ return (
+ <Toolbar className={classes.root}>
+ {buttons.map((btn, i) => (
+ <Button key={i} className={classes.button}>
+ {btn.fn(checkedList)}
+ </Button>
+ ))}
+ </Toolbar>
+ );
})
);
function mapStateToProps(state: RootState) {
- // console.log(state);
return {
- // state: state,
+ checkedList: state.multiselect.checkedList,
};
}
commit 84f02cea829ead38669efcfcffb2ef0a984e27dc
Author: Lisa Knox <lisaknox83 at gmail.com>
Date: Fri May 12 12:55:14 2023 -0400
15768: checkedlist in redux store Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>
diff --git a/src/components/data-explorer/data-explorer.tsx b/src/components/data-explorer/data-explorer.tsx
index 0446ee6f..3ef2e3f9 100644
--- a/src/components/data-explorer/data-explorer.tsx
+++ b/src/components/data-explorer/data-explorer.tsx
@@ -15,6 +15,7 @@ import { CloseIcon, IconType, MaximizeIcon, UnMaximizeIcon, MoreOptionsIcon } fr
import { PaperProps } from '@material-ui/core/Paper';
import { MPVPanelProps } from 'components/multi-panel-view/multi-panel-view';
import { MultiselectToolbar, defaultActions } from 'components/multiselectToolbar/MultiselectToolbar';
+import { TCheckedList } from 'components/data-table/data-table';
type CssRules = 'searchBox' | 'headerMenu' | 'toolbar' | 'footer' | 'root' | 'moreOptionsButton' | 'title' | 'dataTable' | 'container';
@@ -98,6 +99,7 @@ interface DataExplorerActionProps<T> {
onLoadMore: (page: number) => void;
extractKey?: (item: T) => React.Key;
toggleMSToolbar: (isVisible: boolean) => void;
+ setCheckedListOnStore: (checkedList: TCheckedList) => void;
}
type DataExplorerProps<T> = DataExplorerDataProps<T> & DataExplorerActionProps<T> & WithStyles<CssRules> & MPVPanelProps;
@@ -186,6 +188,7 @@ export const DataExplorer = withStyles(styles)(
elementPath,
isMSToolbarVisible,
toggleMSToolbar,
+ setCheckedListOnStore,
} = this.props;
return (
<Paper className={classes.root} {...paperProps} key={paperKey} data-cy={this.props['data-cy']}>
@@ -248,6 +251,7 @@ export const DataExplorer = withStyles(styles)(
currentItemUuid={currentItemUuid}
currentRoute={paperKey}
toggleMSToolbar={toggleMSToolbar}
+ setCheckedListOnStore={setCheckedListOnStore}
/>
</Grid>
<Grid item xs>
diff --git a/src/components/data-table-multiselect-popover/data-table-multiselect-popover.tsx b/src/components/data-table-multiselect-popover/data-table-multiselect-popover.tsx
index 1b58f9e8..875f1818 100644
--- a/src/components/data-table-multiselect-popover/data-table-multiselect-popover.tsx
+++ b/src/components/data-table-multiselect-popover/data-table-multiselect-popover.tsx
@@ -3,7 +3,7 @@
// SPDX-License-Identifier: AGPL-3.0
import React, { useEffect } from 'react';
-import { WithStyles, withStyles, ButtonBase, StyleRulesCallback, Theme, Popover, Button, Card, CardActions, Tooltip, IconButton } from '@material-ui/core';
+import { WithStyles, withStyles, ButtonBase, StyleRulesCallback, Theme, Popover, Card, Tooltip, IconButton } from '@material-ui/core';
import classnames from 'classnames';
import { DefaultTransformOrigin } from 'components/popover/helpers';
import debounce from 'lodash/debounce';
diff --git a/src/components/data-table/data-table.tsx b/src/components/data-table/data-table.tsx
index e89fe4dd..628405ce 100644
--- a/src/components/data-table/data-table.tsx
+++ b/src/components/data-table/data-table.tsx
@@ -53,6 +53,7 @@ export interface DataTableDataProps<I> {
currentItemUuid?: string;
currentRoute?: string;
toggleMSToolbar: (isVisible: boolean) => void;
+ setCheckedListOnStore: (checkedList: TCheckedList) => void;
}
type CssRules =
@@ -145,7 +146,7 @@ export const DataTable = withStyles(styles)(
}
componentDidUpdate(prevProps: Readonly<DataTableProps<T>>, prevState: DataTableState) {
- const { items, toggleMSToolbar } = this.props;
+ const { items, toggleMSToolbar, setCheckedListOnStore } = this.props;
const { isSelected, checkedList } = this.state;
if (!arraysAreCongruent(prevProps.items, items)) {
if (isSelected === true) this.setState({ isSelected: false });
@@ -153,6 +154,7 @@ export const DataTable = withStyles(styles)(
}
if (prevState.checkedList !== checkedList) {
toggleMSToolbar(this.isAnySelected() ? true : false);
+ setCheckedListOnStore(checkedList);
}
}
diff --git a/src/components/multiselectToolbar/MultiselectToolbar.tsx b/src/components/multiselectToolbar/MultiselectToolbar.tsx
index 6620792e..b39fd657 100644
--- a/src/components/multiselectToolbar/MultiselectToolbar.tsx
+++ b/src/components/multiselectToolbar/MultiselectToolbar.tsx
@@ -36,13 +36,11 @@ export const defaultActions: Array<MultiselectToolbarAction> = [
},
];
-const MSToolbarCopyButton = (classes, i) => {
- return (
- <Button key={i} className={classes.button}>
- <CopyToClipboardSnackbar value='foo' children={<div>Copy</div>} />
- </Button>
- );
-};
+const MSToolbarCopyButton = (classes, i) => (
+ <Button key={i} className={classes.button}>
+ <CopyToClipboardSnackbar value='foo' children={<div>Copy</div>} />
+ </Button>
+);
type MultiselectToolbarProps = MultiselectToolbarActions & WithStyles<CssRules>;
@@ -54,6 +52,7 @@ export const MultiselectToolbar = connect(mapStateToProps)(
);
function mapStateToProps(state: RootState) {
+ // console.log(state);
return {
// state: state,
};
diff --git a/src/store/multiselect/multiselect-actions.tsx b/src/store/multiselect/multiselect-actions.tsx
index 307423b5..ba8edf42 100644
--- a/src/store/multiselect/multiselect-actions.tsx
+++ b/src/store/multiselect/multiselect-actions.tsx
@@ -4,6 +4,7 @@
export const multiselectActions = {
TOGGLE_VISIBLITY: 'TOGGLE_VISIBLITY',
+ SET_CHECKEDLIST: 'SET_CHECKEDLIST',
};
export const toggleMSToolbar = (isVisible: boolean) => {
@@ -11,3 +12,9 @@ export const toggleMSToolbar = (isVisible: boolean) => {
dispatch({ type: multiselectActions.TOGGLE_VISIBLITY, payload: isVisible });
};
};
+
+export const setCheckedListOnStore = (checkedList) => {
+ return (dispatch) => {
+ dispatch({ type: multiselectActions.SET_CHECKEDLIST, payload: checkedList });
+ };
+};
diff --git a/src/store/multiselect/multiselect-reducer.tsx b/src/store/multiselect/multiselect-reducer.tsx
index 212f416b..6840df92 100644
--- a/src/store/multiselect/multiselect-reducer.tsx
+++ b/src/store/multiselect/multiselect-reducer.tsx
@@ -3,16 +3,20 @@
// SPDX-License-Identifier: AGPL-3.0
import { multiselectActions } from './multiselect-actions';
+import { TCheckedList } from 'components/data-table/data-table';
type MultiselectToolbarState = {
isVisible: boolean;
+ checkedList: TCheckedList;
};
const multiselectToolbarInitialState = {
isVisible: false,
+ checkedList: {},
};
export const multiselectReducer = (state: MultiselectToolbarState = multiselectToolbarInitialState, action) => {
if (action.type === multiselectActions.TOGGLE_VISIBLITY) return { ...state, isVisible: action.payload };
+ if (action.type === multiselectActions.SET_CHECKEDLIST) return { ...state, checkedList: action.payload };
return state;
};
diff --git a/src/views-components/data-explorer/data-explorer.tsx b/src/views-components/data-explorer/data-explorer.tsx
index be19319b..871389d4 100644
--- a/src/views-components/data-explorer/data-explorer.tsx
+++ b/src/views-components/data-explorer/data-explorer.tsx
@@ -9,10 +9,10 @@ import { getDataExplorer } from 'store/data-explorer/data-explorer-reducer';
import { Dispatch } from 'redux';
import { dataExplorerActions } from 'store/data-explorer/data-explorer-action';
import { DataColumn } from 'components/data-table/data-column';
-import { DataColumns } from 'components/data-table/data-table';
+import { DataColumns, TCheckedList } from 'components/data-table/data-table';
import { DataTableFilters } from 'components/data-table-filters/data-table-filters-tree';
import { LAST_REFRESH_TIMESTAMP } from 'components/refresh-button/refresh-button';
-import { toggleMSToolbar } from 'store/multiselect/multiselect-actions';
+import { toggleMSToolbar, setCheckedListOnStore } from 'store/multiselect/multiselect-actions';
interface Props {
id: string;
@@ -78,6 +78,10 @@ const mapDispatchToProps = (dispatchFn) => {
dispatchFn(toggleMSToolbar(isVisible));
},
+ setCheckedListOnStore: (checkedList: TCheckedList) => {
+ dispatchFn(setCheckedListOnStore(checkedList));
+ },
+
onRowClick,
onRowDoubleClick,
commit ae041e1ca4cceaf6c94b818a2823377cdd5c55a4
Author: Lisa Knox <lisaknox83 at gmail.com>
Date: Fri May 12 11:51:34 2023 -0400
15768: cleaned up toolbar types Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>
diff --git a/src/components/data-explorer/data-explorer.tsx b/src/components/data-explorer/data-explorer.tsx
index 8d16aed2..0446ee6f 100644
--- a/src/components/data-explorer/data-explorer.tsx
+++ b/src/components/data-explorer/data-explorer.tsx
@@ -228,7 +228,7 @@ export const DataExplorer = withStyles(styles)(
</Tooltip>
)}
</Toolbar>
- {isMSToolbarVisible && <MultiselectToolbar actions={defaultActions} />}
+ {isMSToolbarVisible && <MultiselectToolbar buttons={defaultActions} />}
</Grid>
)}
</div>
diff --git a/src/components/multiselectToolbar/MultiselectToolbar.tsx b/src/components/multiselectToolbar/MultiselectToolbar.tsx
index d857d7ff..6620792e 100644
--- a/src/components/multiselectToolbar/MultiselectToolbar.tsx
+++ b/src/components/multiselectToolbar/MultiselectToolbar.tsx
@@ -23,24 +23,22 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
});
type MultiselectToolbarAction = {
- name: string;
- fn: () => ReactElement;
+ fn: (classes, i) => ReactElement;
};
export type MultiselectToolbarActions = {
- actions: Array<MultiselectToolbarAction>;
+ buttons: Array<MultiselectToolbarAction>;
};
export const defaultActions: Array<MultiselectToolbarAction> = [
{
- name: 'foo',
- fn: () => MSToolbarCopyButton({ button: { border: '1px solid blue' } }),
+ fn: (classes, i) => MSToolbarCopyButton(classes, i),
},
];
-const MSToolbarCopyButton = (classes) => {
+const MSToolbarCopyButton = (classes, i) => {
return (
- <Button className={classes.button}>
+ <Button key={i} className={classes.button}>
<CopyToClipboardSnackbar value='foo' children={<div>Copy</div>} />
</Button>
);
@@ -50,18 +48,8 @@ type MultiselectToolbarProps = MultiselectToolbarActions & WithStyles<CssRules>;
export const MultiselectToolbar = connect(mapStateToProps)(
withStyles(styles)((props: MultiselectToolbarProps) => {
- const { classes, actions } = props;
- return (
- <Toolbar className={classes.root}>
- {actions.map((action, i) => (
- <Button key={i} className={classes.button} onClick={action.fn}>
- {action.name}
- </Button>
- ))}
- <MSToolbarCopyButton />
- {/* <CopyToClipboardSnackbar value='foo' children={<div>test</div>} /> */}
- </Toolbar>
- );
+ const { classes, buttons } = props;
+ return <Toolbar className={classes.root}>{buttons.map((btn, i) => btn.fn(classes, i))}</Toolbar>;
})
);
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list