Merge pull request #530 from bluewave-labs/fix/monitor-table-row-click

Fix/monitor table row click
This commit is contained in:
Alexander Holliday authored and GitHub committed 2024-08-02 12:48:56 -07:00
commit 329a5627fd
3 files changed
+26 -6

No files matched your search

+3 -1
View File
@@ -135,7 +135,9 @@ const BasicTable = ({ data, paginated, reversed, rowsPerPage = 5 }) => {
{displayData.map((row) => { {displayData.map((row) => {
return ( return (
<TableRow <TableRow
sx={{ cursor: row.handleClick ? "pointer" : "default" }} sx={{
cursor: row.handleClick ? "pointer" : "default",
}}
key={row.id} key={row.id}
onClick={row.handleClick ? row.handleClick : null} onClick={row.handleClick ? row.handleClick : null}
> >
@@ -8,7 +8,12 @@ const ResponseTimeChart = ({ checks = [] }) => {
return ( return (
<div className="chart-container"> <div className="chart-container">
<ResponsiveContainer width="100%" height="100%"> <ResponsiveContainer width="100%" height="100%">
<BarChart width={150} height={40} data={normalizedChecks}> <BarChart
width={150}
height={40}
data={normalizedChecks}
style={{ cursor: "pointer" }}
>
<Bar maxBarSize={10} dataKey="responseTime"> <Bar maxBarSize={10} dataKey="responseTime">
{normalizedChecks.map((check, index) => ( {normalizedChecks.map((check, index) => (
<Cell <Cell
+17 -4
View File
@@ -41,7 +41,14 @@ import {
const Host = ({ params }) => { const Host = ({ params }) => {
return ( return (
<Stack direction="row" alignItems="center" className="host"> <Stack direction="row" alignItems="center" className="host">
<a href={params.url} target="_blank" rel="noreferrer"> <a
href={params.url}
target="_blank"
rel="noreferrer"
onClick={(event) => {
event.stopPropagation();
}}
>
<OpenInNewPage /> <OpenInNewPage />
</a> </a>
<Box> <Box>
@@ -64,6 +71,7 @@ const Monitors = () => {
const [anchorEl, setAnchorEl] = useState(null); const [anchorEl, setAnchorEl] = useState(null);
const [actions, setActions] = useState({}); const [actions, setActions] = useState({});
const openMenu = (event, id, url) => { const openMenu = (event, id, url) => {
event.preventDefault();
setAnchorEl(event.currentTarget); setAnchorEl(event.currentTarget);
setActions({ id: id, url: url }); setActions({ id: id, url: url });
}; };
@@ -141,7 +149,7 @@ const Monitors = () => {
return { return {
id: monitor._id, id: monitor._id,
// disabled for now // disabled for now
// handleClick: () => navigate(`/monitors/${monitor._id}`), handleClick: () => navigate(`/monitors/${monitor._id}`),
data: [ data: [
{ id: idx, data: <Host params={params} /> }, { id: idx, data: <Host params={params} /> },
{ {
@@ -167,7 +175,10 @@ const Monitors = () => {
<> <>
<IconButton <IconButton
aria-label="monitor actions" aria-label="monitor actions"
onClick={(event) => openMenu(event, monitor._id, monitor.url)} onClick={(event) => {
event.stopPropagation();
openMenu(event, monitor._id, monitor.url);
}}
sx={{ sx={{
"&:focus": { "&:focus": {
outline: "none", outline: "none",
@@ -231,7 +242,9 @@ const Monitors = () => {
onClose={closeMenu} onClose={closeMenu}
> >
<MenuItem <MenuItem
onClick={() => window.open(actions.url, "_blank", "noreferrer")} onClick={() => {
window.open(actions.url, "_blank", "noreferrer");
}}
> >
Open site Open site
</MenuItem> </MenuItem>