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';
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;
elementPath,
isMSToolbarVisible,
toggleMSToolbar,
+ setCheckedListOnStore,
} = this.props;
return (
<Paper className={classes.root} {...paperProps} key={paperKey} data-cy={this.props['data-cy']}>
currentItemUuid={currentItemUuid}
currentRoute={paperKey}
toggleMSToolbar={toggleMSToolbar}
+ setCheckedListOnStore={setCheckedListOnStore}
/>
</Grid>
<Grid item xs>
// 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';
currentItemUuid?: string;
currentRoute?: string;
toggleMSToolbar: (isVisible: boolean) => void;
+ setCheckedListOnStore: (checkedList: TCheckedList) => void;
}
type CssRules =
}
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 });
}
if (prevState.checkedList !== checkedList) {
toggleMSToolbar(this.isAnySelected() ? true : false);
+ setCheckedListOnStore(checkedList);
}
}
},
];
-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>;
);
function mapStateToProps(state: RootState) {
+ // console.log(state);
return {
// state: state,
};
export const multiselectActions = {
TOGGLE_VISIBLITY: 'TOGGLE_VISIBLITY',
+ SET_CHECKEDLIST: 'SET_CHECKEDLIST',
};
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 });
+ };
+};
// 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;
};
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;
dispatchFn(toggleMSToolbar(isVisible));
},
+ setCheckedListOnStore: (checkedList: TCheckedList) => {
+ dispatchFn(setCheckedListOnStore(checkedList));
+ },
+
onRowClick,
onRowDoubleClick,