Add prevent default to action toggle

This commit is contained in:
Alex Holliday committed 2024-08-02 10:53:24 -07:00
1 parent b5e12dabc4
commit 6dde4646d8
2 files changed
+13 -4

No files matched your search

+3 -1
View File
@@ -135,7 +135,9 @@ const BasicTable = ({ data, paginated, reversed, rowsPerPage = 5 }) => {
{displayData.map((row) => {
return (
<TableRow
sx={{ cursor: row.handleClick ? "pointer" : "default" }}
sx={{
cursor: row.handleClick ? "pointer" : "default",
}}
key={row.id}
onClick={row.handleClick ? row.handleClick : null}
>
+10 -3
View File
@@ -60,6 +60,7 @@ const Monitors = () => {
const [anchorEl, setAnchorEl] = useState(null);
const [actions, setActions] = useState({});
const openMenu = (event, id, url) => {
event.preventDefault();
setAnchorEl(event.currentTarget);
setActions({ id: id, url: url });
};
@@ -137,7 +138,7 @@ const Monitors = () => {
return {
id: monitor._id,
// disabled for now
// handleClick: () => navigate(`/monitors/${monitor._id}`),
handleClick: () => navigate(`/monitors/${monitor._id}`),
data: [
{ id: idx, data: <Host params={params} /> },
{
@@ -163,7 +164,10 @@ const Monitors = () => {
<>
<IconButton
aria-label="monitor actions"
onClick={(event) => openMenu(event, monitor._id, monitor.url)}
onClick={(event) => {
event.stopPropagation();
openMenu(event, monitor._id, monitor.url);
}}
sx={{
"&:focus": {
outline: "none",
@@ -227,7 +231,10 @@ const Monitors = () => {
onClose={closeMenu}
>
<MenuItem
onClick={() => window.open(actions.url, "_blank", "noreferrer")}
onClick={(event) => {
event.stopPropagation();
window.open(actions.url, "_blank", "noreferrer");
}}
>
Open site
</MenuItem>