diff --git a/mapping_workbench/frontend/src/components/app/list/list-file-collection-actions.js b/mapping_workbench/frontend/src/components/app/list/list-file-collection-actions.js index d5468fb7..6fa94016 100644 --- a/mapping_workbench/frontend/src/components/app/list/list-file-collection-actions.js +++ b/mapping_workbench/frontend/src/components/app/list/list-file-collection-actions.js @@ -1,17 +1,16 @@ import {Button} from '@mui/material'; - import {usePopover} from 'src/hooks/use-popover'; import {useCallback, useState} from "react"; import {paths} from 'src/paths'; -import {useRouter} from "../../../hooks/use-router"; +import {useRouter} from "next/router"; +import {MenuActionButton} from '../../menu-actions'; import ConfirmDialog from "../dialog/confirm-dialog"; export const ListFileCollectionActions = (props) => { const router = useRouter(); const {itemctx} = props; - const popover = usePopover(); const handleResourceManagerAction = useCallback(async () => { router.push({ @@ -48,116 +47,30 @@ export const ListFileCollectionActions = (props) => { return ( <> -
- {/**/} - - - - - Are you sure you want to delete it? - -
- {/* - - - - - - - + + setConfirmOpen(true)} + text='Delete' + /> + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */} + Are you sure you want to delete it? + ); }; diff --git a/mapping_workbench/frontend/src/components/app/list/list-item-actions.js b/mapping_workbench/frontend/src/components/app/list/list-item-actions.js index e76ca4c1..dc52c3fd 100644 --- a/mapping_workbench/frontend/src/components/app/list/list-item-actions.js +++ b/mapping_workbench/frontend/src/components/app/list/list-item-actions.js @@ -6,23 +6,16 @@ import VisibilityIcon from '@mui/icons-material/Visibility'; import BorderColorIcon from '@mui/icons-material/BorderColor'; import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline'; -import {useTheme} from '@mui/material/styles'; -import MenuItem from '@mui/material/MenuItem'; -import ListItemIcon from '@mui/material/ListItemIcon'; -import ListItemText from '@mui/material/ListItemText'; import {paths} from 'src/paths'; import {ACTION} from "../../../api/section"; -import {MenuActionButton} from '../../menu-action-button'; +import {MenuActionButton} from '../../menu-actions'; + import ConfirmDialog from "../dialog/confirm-dialog"; import {toastError} from "../../app-toast"; export const ListItemActions = (props) => { const router = useRouter(); - const theme = useTheme() - - console.log(theme) - const {itemctx, pathnames, onDeleteAction, confirmDialogContent, confirmDialogFooter} = props; const handleViewAction = () => { @@ -81,7 +74,7 @@ export const ListItemActions = (props) => { id="delete_button" last action={() => setConfirmOpen(true)} - icon={} + icon={} text='Delete' /> { + const [anchor, setAnchor] = useState(null) + return <> + setAnchor(e.target)}> + + + setAnchor(null)}> + {children} + + +} + export const MenuActionButton = ({id, icon, text, action, last}) => { const theme = useTheme() return { const { @@ -76,25 +79,18 @@ export const ListTableRow = (props) => { {item.target_property_path} - - + + } + action={() => onEdit(item)}/> + } + action={() => setConfirmOpen(true)} + text='Delete'/> + { @@ -810,12 +811,14 @@ export const ListTableRow = (props) => { - paths.app.conceptual_mapping_rules.overview - }} - /> + + paths.app.conceptual_mapping_rules.overview + }} + /> + {isCurrent && ( @@ -1029,9 +1032,7 @@ export const ListTable = (props) => { sx={{ whiteSpace: "nowrap" }} - > - Actions - + /> diff --git a/mapping_workbench/frontend/src/sections/app/fields-registry/list-table.js b/mapping_workbench/frontend/src/sections/app/fields-registry/list-table.js index e8d7b13f..db98f399 100644 --- a/mapping_workbench/frontend/src/sections/app/fields-registry/list-table.js +++ b/mapping_workbench/frontend/src/sections/app/fields-registry/list-table.js @@ -25,6 +25,7 @@ import TablePagination from "src/sections/components/table-pagination"; import {ListItemActions} from 'src/components/app/list/list-item-actions'; import TableSorterHeader from "src/sections/components/table-sorter-header"; import {ForListItemAction} from 'src/contexts/app/section/for-list-item-action'; +import {MenuActions} from '../../../components/menu-actions'; export const ListTable = (props) => { @@ -87,9 +88,7 @@ export const ListTable = (props) => { - - Actions - + @@ -156,14 +155,16 @@ export const ListTable = (props) => { {item.element_type} - paths.app.fields_and_nodes.overview.elements, - edit: () => paths.app.fields_and_nodes.overview.elements.edit(item_id), - view: () => paths.app.fields_and_nodes.overview.elements.view(item_id) - }} - /> + + paths.app.fields_and_nodes.overview.elements, + edit: () => paths.app.fields_and_nodes.overview.elements.edit(item_id), + view: () => paths.app.fields_and_nodes.overview.elements.view(item_id) + }} + /> + {isCurrent && ( diff --git a/mapping_workbench/frontend/src/sections/app/file-manager/file-collection-list-table.js b/mapping_workbench/frontend/src/sections/app/file-manager/file-collection-list-table.js index 53319b0c..14546d8a 100644 --- a/mapping_workbench/frontend/src/sections/app/file-manager/file-collection-list-table.js +++ b/mapping_workbench/frontend/src/sections/app/file-manager/file-collection-list-table.js @@ -1,3 +1,5 @@ +import BorderColorIcon from '@mui/icons-material/BorderColor'; +import UploadIcon from '@mui/icons-material/Upload'; import {useEffect, useState} from 'react'; import PropTypes from 'prop-types'; @@ -14,8 +16,8 @@ import TableRow from '@mui/material/TableRow'; import TableBody from '@mui/material/TableBody'; import TableCell from '@mui/material/TableCell'; import TableHead from '@mui/material/TableHead'; -import CardContent from '@mui/material/CardContent'; import Typography from '@mui/material/Typography'; +import CardContent from '@mui/material/CardContent'; import {paths} from "src/paths"; import {useDialog} from "src/hooks/use-dialog"; @@ -33,6 +35,7 @@ import TableSorterHeader from 'src/sections/components/table-sorter-header'; import {ForListItemAction} from 'src/contexts/app/section/for-list-item-action'; import {ListFileCollectionActions} from "src/components/app/list/list-file-collection-actions"; import {MappingPackagesBulkAssigner} from "src/sections/app/mapping-package/components/mapping-packages-bulk-assigner"; +import {MenuActionButton, MenuActions} from '../../../components/menu-actions'; export const ListTableRow = (props) => { const { @@ -124,16 +127,15 @@ export const ListTableRow = (props) => { {timeTransformer(item.created_at, timeSetting)} - - + + } + action={() => openUploadModal?.(item._id)} + text='Upload' + /> - + {isCurrent && ( @@ -341,9 +343,7 @@ export const FileCollectionListTable = (props) => { - - Actions - + diff --git a/mapping_workbench/frontend/src/sections/app/file-manager/test-data-collection-list-table.js b/mapping_workbench/frontend/src/sections/app/file-manager/test-data-collection-list-table.js index 608d521c..316e57e4 100644 --- a/mapping_workbench/frontend/src/sections/app/file-manager/test-data-collection-list-table.js +++ b/mapping_workbench/frontend/src/sections/app/file-manager/test-data-collection-list-table.js @@ -1,11 +1,9 @@ import {useEffect, useState} from 'react'; import PropTypes from 'prop-types'; -import MoreHorizIcon from '@mui/icons-material/MoreHoriz'; import UploadIcon from '@mui/icons-material/Upload'; import {Box} from "@mui/system"; -import Menu from '@mui/material/Menu'; import Chip from '@mui/material/Chip'; import Grid from '@mui/material/Grid'; import Paper from '@mui/material/Paper'; @@ -18,7 +16,6 @@ import TableRow from '@mui/material/TableRow'; import TableBody from '@mui/material/TableBody'; import TableCell from '@mui/material/TableCell'; import TableHead from '@mui/material/TableHead'; -import IconButton from '@mui/material/IconButton'; import Typography from '@mui/material/Typography'; import CardContent from '@mui/material/CardContent'; @@ -32,11 +29,11 @@ import timeTransformer from "src/utils/time-transformer"; import {PropertyList} from "src/components/property-list"; import {useGlobalState} from "src/hooks/use-global-state"; import {mappingPackagesApi} from "src/api/mapping-packages"; -import {MenuActionButton} from 'src/components/menu-action-button'; import {PropertyListItem} from "src/components/property-list-item"; import {ChevronButton} from 'src/sections/components/chevron-button'; import ConfirmDialog from "src/components/app/dialog/confirm-dialog"; import TablePagination from "src/sections/components/table-pagination"; +import {MenuActions, MenuActionButton} from 'src/components/menu-actions'; import {ListItemActions} from "src/components/app/list/list-item-actions"; import TableSorterHeader from 'src/sections/components/table-sorter-header'; import {ForListItemAction} from 'src/contexts/app/section/for-list-item-action'; @@ -61,7 +58,6 @@ export const ListTableRow = (props) => { const {timeSetting} = useGlobalState() const [collectionResources, setCollectionResources] = useState([]); const [confirmOpen, setConfirmOpen] = useState(false); - const [actionsMenu, setActionsMenu] = useState(null) const uploadDialog = useDialog() useEffect(() => { @@ -163,19 +159,14 @@ export const ListTableRow = (props) => { {timeTransformer(item.created_at, timeSetting)} - setActionsMenu(e.target)}> - - - setActionsMenu(null)}> + uploadDialog.handleOpen({id: item_id})} icon={} text='Import test data'/> - + {isCurrent && ( @@ -371,7 +362,7 @@ export const TestDataCollectionListTable = (props) => { handleItemsSelectAll(event.target.checked)} + onChange={event => handleItemsSelectAll(event.target.checked)} /> { - - Actions - + @@ -257,8 +256,10 @@ export const ListTable = (props) => { {timeTransformer(item.created_at, timeSetting)} - + + + {isCurrent && ( diff --git a/mapping_workbench/frontend/src/sections/app/ontology-namespace-custom/list-table.js b/mapping_workbench/frontend/src/sections/app/ontology-namespace-custom/list-table.js index 0a3f3a15..cd439530 100644 --- a/mapping_workbench/frontend/src/sections/app/ontology-namespace-custom/list-table.js +++ b/mapping_workbench/frontend/src/sections/app/ontology-namespace-custom/list-table.js @@ -9,11 +9,12 @@ import TableHead from '@mui/material/TableHead'; import Typography from '@mui/material/Typography'; import {Scrollbar} from 'src/components/scrollbar'; +import TablePagination from 'src/sections/components/table-pagination'; import {ListItemActions} from 'src/components/app/list/list-item-actions'; +import TableSorterHeader from 'src/sections/components/table-sorter-header'; +import {toastError, toastLoad, toastSuccess} from "src/components/app-toast"; import {ForListItemAction} from 'src/contexts/app/section/for-list-item-action'; -import {toastError, toastLoad, toastSuccess} from "../../../components/app-toast"; -import TablePagination from '../../components/table-pagination'; -import TableSorterHeader from '../../components/table-sorter-header'; +import {MenuActions} from '../../../components/menu-actions'; export const ListTable = (props) => { const { @@ -72,9 +73,7 @@ export const ListTable = (props) => { - - Actions - + @@ -94,10 +93,12 @@ export const ListTable = (props) => { {item.uri} - handleDeleteAction(item_id)} - /> + + handleDeleteAction(item_id)} + /> + ); diff --git a/mapping_workbench/frontend/src/sections/app/ontology-namespace/list-table.js b/mapping_workbench/frontend/src/sections/app/ontology-namespace/list-table.js index 1241f912..9c2e0c53 100644 --- a/mapping_workbench/frontend/src/sections/app/ontology-namespace/list-table.js +++ b/mapping_workbench/frontend/src/sections/app/ontology-namespace/list-table.js @@ -1,6 +1,6 @@ -import Paper from '@mui/material/Paper'; import PropTypes from 'prop-types'; +import Paper from '@mui/material/Paper'; import Table from '@mui/material/Table'; import Switch from "@mui/material/Switch"; import TableRow from '@mui/material/TableRow'; @@ -10,11 +10,12 @@ import TableHead from '@mui/material/TableHead'; import Typography from '@mui/material/Typography'; import {Scrollbar} from 'src/components/scrollbar'; +import TablePagination from "src/sections/components/table-pagination"; import {ListItemActions} from 'src/components/app/list/list-item-actions'; +import TableSorterHeader from 'src/sections/components/table-sorter-header'; +import {toastError, toastLoad, toastSuccess} from "src/components/app-toast"; import {ForListItemAction} from 'src/contexts/app/section/for-list-item-action'; -import {toastError, toastLoad, toastSuccess} from "../../../components/app-toast"; -import TablePagination from "../../components/table-pagination"; -import TableSorterHeader from '../../components/table-sorter-header'; +import {MenuActions} from '../../../components/menu-actions'; export const ListTable = (props) => { const { @@ -76,9 +77,7 @@ export const ListTable = (props) => { Syncable - - Actions - + @@ -106,10 +105,12 @@ export const ListTable = (props) => { /> - handleDeleteAction(item_id)} - /> + + handleDeleteAction(item_id)} + /> + ); diff --git a/mapping_workbench/frontend/src/sections/app/ontology-term/list-table.js b/mapping_workbench/frontend/src/sections/app/ontology-term/list-table.js index e6fe294a..1933df31 100644 --- a/mapping_workbench/frontend/src/sections/app/ontology-term/list-table.js +++ b/mapping_workbench/frontend/src/sections/app/ontology-term/list-table.js @@ -14,6 +14,7 @@ import CardContent from '@mui/material/CardContent'; import {Scrollbar} from 'src/components/scrollbar'; import {ListItemActions} from 'src/components/app/list/list-item-actions'; import {ForListItemAction} from 'src/contexts/app/section/for-list-item-action'; +import {MenuActions} from '../../../components/menu-actions'; import {ChevronButton} from '../../components/chevron-button'; import TablePagination from "../../components/table-pagination"; import TableSorterHeader from "../../components/table-sorter-header"; @@ -75,9 +76,7 @@ export const ListTable = (props) => { title='Term'/> - - Actions - + @@ -121,8 +120,10 @@ export const ListTable = (props) => { {item.type} - + + + {isCurrent && (