diff --git a/packages/ui/src/ui-component/dialog/ShareWithWorkspaceDialog.jsx b/packages/ui/src/ui-component/dialog/ShareWithWorkspaceDialog.jsx index f9ba47e73fd..67fa1e57920 100644 --- a/packages/ui/src/ui-component/dialog/ShareWithWorkspaceDialog.jsx +++ b/packages/ui/src/ui-component/dialog/ShareWithWorkspaceDialog.jsx @@ -6,7 +6,7 @@ import { enqueueSnackbar as enqueueSnackbarAction, closeSnackbar as closeSnackba import { cloneDeep } from 'lodash' // Material -import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Box, Stack, OutlinedInput, Typography } from '@mui/material' +import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Box, Stack, OutlinedInput, Typography, Checkbox, FormControlLabel } from '@mui/material' // Project imports import { StyledButton } from '@/ui-component/button/StyledButton' @@ -47,6 +47,28 @@ const ShareWithWorkspaceDialog = ({ show, dialogProps, onCancel, setError }) => const [outputSchema, setOutputSchema] = useState([]) const [name, setName] = useState('') + const [selectAll, setSelectAll] = useState(false) + + // Handle select all / deselect all + const handleSelectAllChange = (event) => { + const checked = event.target.checked + setSelectAll(checked) + setOutputSchema((prevRows) => { + return prevRows.map((row) => ({ + ...row, + shared: checked + })) + }) + } + + // Update selectAll state when individual rows change + useEffect(() => { + if (outputSchema.length > 0) { + const allSelected = outputSchema.every((row) => row.shared) + const noneSelected = outputSchema.every((row) => !row.shared) + setSelectAll(allSelected ? true : noneSelected ? false : false) + } + }, [outputSchema]) const onRowUpdate = (newRow) => { setTimeout(() => { @@ -187,6 +209,13 @@ const ShareWithWorkspaceDialog = ({ show, dialogProps, onCancel, setError }) => + + Workspaces + } + label={Select All} + /> + diff --git a/packages/ui/src/ui-component/tooltip/MoreItemsTooltip.jsx b/packages/ui/src/ui-component/tooltip/MoreItemsTooltip.jsx index 260240453f3..c10a710c505 100644 --- a/packages/ui/src/ui-component/tooltip/MoreItemsTooltip.jsx +++ b/packages/ui/src/ui-component/tooltip/MoreItemsTooltip.jsx @@ -2,7 +2,7 @@ import { Tooltip, Typography } from '@mui/material' import { styled } from '@mui/material/styles' import PropTypes from 'prop-types' -const StyledOl = styled('ol')(() => ({ +const StyledUl = styled('ul')(() => ({ paddingLeft: 20, margin: 0 })) @@ -17,13 +17,13 @@ const MoreItemsTooltip = ({ images, children }) => { return ( + {images.map((img) => ( {img.label} ))} - + } placement='top' >