incident links
This commit is contained in:
1 parent
2b3c601a05
commit
c0a8398baa
5 files changed
+10
-9
No files matched your search
@@ -57,7 +57,7 @@ export const HeaderControls = ({
|
|||||||
<Button
|
<Button
|
||||||
startIcon={<Bug size={20} strokeWidth={1.5} />}
|
startIcon={<Bug size={20} strokeWidth={1.5} />}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
navigate(`/incidents/${monitor._id}`);
|
navigate(`/incidents?monitorId=${monitor._id}`);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("menu.incidents")}
|
{t("menu.incidents")}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { IncidentTable } from "@/pages/incidents/IncidentTable";
|
|||||||
import { HeaderRange } from "@/components/common/HeaderRange";
|
import { HeaderRange } from "@/components/common/HeaderRange";
|
||||||
|
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { useParams } from "react-router";
|
import { useSearchParams } from "react-router";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { useGet } from "@/hooks/UseApi";
|
import { useGet } from "@/hooks/UseApi";
|
||||||
import type { ApiResponse } from "@/hooks/UseApi";
|
import type { ApiResponse } from "@/hooks/UseApi";
|
||||||
@@ -17,7 +17,7 @@ import type { IMonitor } from "@/types/monitor";
|
|||||||
const IncidentsPage = () => {
|
const IncidentsPage = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const [selectedMonitorId, setSelectedMonitorId] = useState<string>("all");
|
const [selectedMonitorId, setSelectedMonitorId] = useState<string>("all");
|
||||||
const { id } = useParams<{ id: string }>();
|
const [searchParams] = useSearchParams();
|
||||||
|
|
||||||
const [page, setPage] = useState(0);
|
const [page, setPage] = useState(0);
|
||||||
const [rowsPerPage, setRowsPerPage] = useState(10);
|
const [rowsPerPage, setRowsPerPage] = useState(10);
|
||||||
@@ -51,10 +51,11 @@ const IncidentsPage = () => {
|
|||||||
const monitors: IMonitor[] = monitorResponse?.data || [];
|
const monitors: IMonitor[] = monitorResponse?.data || [];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (id) {
|
const monitorId = searchParams.get("monitorId");
|
||||||
setSelectedMonitorId(id);
|
if (monitorId) {
|
||||||
|
setSelectedMonitorId(monitorId);
|
||||||
}
|
}
|
||||||
}, [id]);
|
}, [searchParams]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BasePage>
|
<BasePage>
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ export const InfraMonitorsTable = ({
|
|||||||
id: 3,
|
id: 3,
|
||||||
label: "Incidents",
|
label: "Incidents",
|
||||||
action: () => {
|
action: () => {
|
||||||
navigate(`/incidents/${monitor._id}`);
|
navigate(`/incidents?monitorId=${monitor._id}`);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export const PageSpeedMonitorTable = ({
|
|||||||
id: 3,
|
id: 3,
|
||||||
label: "Incidents",
|
label: "Incidents",
|
||||||
action: () => {
|
action: () => {
|
||||||
navigate(`/incidents/${monitor._id}`);
|
navigate(`/incidents?monitorId=${monitor._id}`);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export const MonitorTable = ({
|
|||||||
id: 3,
|
id: 3,
|
||||||
label: "Incidents",
|
label: "Incidents",
|
||||||
action: () => {
|
action: () => {
|
||||||
navigate(`/incidents/${monitor._id}`);
|
navigate(`/incidents?monitorId=${monitor._id}`);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user