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