detail modal fixes and filters options

This commit is contained in:
karenvicent committed 2026-01-21 15:33:00 -05:00
1 parent 90eee474d2
commit 09513696ee
12 files changed
+49 -685

No files matched your search

@@ -168,7 +168,6 @@ const IncidentDetailsModal = ({ open, incidentId, onClose, onResolved }) => {
>
<Typography
variant="body1"
color="text.secondary"
fontWeight={500}
sx={{ minWidth: 70 }}
>
@@ -188,7 +187,6 @@ const IncidentDetailsModal = ({ open, incidentId, onClose, onResolved }) => {
>
<Typography
variant="body1"
color="text.secondary"
fontWeight={500}
sx={{ minWidth: 70 }}
>
@@ -2,7 +2,7 @@
import IconButton from "@mui/material/IconButton";
import Menu from "@mui/material/Menu";
import MenuItem from "@mui/material/MenuItem";
//import Settings from "../../../../assets/icons/settings-bold.svg?react";
import Icon from "@/Components/v1/Icon/index.jsx";
import ResolveIncidentDialog from "../ResolveIncidentDialog/index.jsx";
import useFetchIncidents from "../../hooks/useFetchIncidents";
@@ -51,7 +51,7 @@ const IncidentActionsMenu = ({ incident, onResolve, onOpenDetails }) => {
e.stopPropagation();
closeMenu(e);
if (onOpenDetails) {
onOpenDetails(incident._id);
onOpenDetails(incident.id);
}
};
@@ -59,8 +59,7 @@ const IncidentActionsMenu = ({ incident, onResolve, onOpenDetails }) => {
e.stopPropagation();
closeMenu(e);
try {
const incidentData = await fetchIncidentById(incident._id);
console.log(incidentData);
const incidentData = await fetchIncidentById(incident.id);
if (incidentData) {
const { type, _id: monitorId } = incidentData.monitorId;
const path = TypeToPathMap[type];
@@ -94,7 +93,10 @@ const IncidentActionsMenu = ({ incident, onResolve, onOpenDetails }) => {
},
}}
>
{/* <Settings /> */}M
<Icon
name="Settings"
size={20}
/>
</IconButton>
<Menu
@@ -134,7 +136,7 @@ const IncidentActionsMenu = ({ incident, onResolve, onOpenDetails }) => {
</Menu>
<ResolveIncidentDialog
open={isDialogOpen}
incidentId={incident._id}
incidentId={incident.id}
onClose={closeDialog}
onResolve={onResolve}
/>
@@ -144,7 +146,7 @@ const IncidentActionsMenu = ({ incident, onResolve, onOpenDetails }) => {
IncidentActionsMenu.propTypes = {
incident: PropTypes.shape({
_id: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
status: PropTypes.bool.isRequired,
}).isRequired,
onResolve: PropTypes.func.isRequired,
@@ -13,7 +13,7 @@ import { formatDateWithTz } from "../../../../Utils/timeUtils.js";
import { useSelector } from "react-redux";
import PropTypes from "prop-types";
import { useTranslation } from "react-i18next";
import { Button, Typography, useTheme } from "@mui/material";
import { Typography, useTheme } from "@mui/material";
const IncidentTable = ({
monitors = [],
@@ -36,7 +36,7 @@ const IncidentTable = ({
const handleResolveIncident = async (incidentId, options = {}) => {
try {
await resolveIncident(incidentId);
await resolveIncident(incidentId, options);
handleUpdateTrigger();
} catch (error) {
console.error(t("incidentsPage.errorResolvingIncident"), error);
@@ -48,7 +48,6 @@ const IncidentTable = ({
id: "monitorName",
content: t("incidentsTableMonitorName"),
render: (row) => {
console.log(monitors, row);
const monitor = monitors.find((monitor) => monitor.id === row.monitorId);
return monitor ? monitor.name : "N/A";
},
@@ -84,7 +84,7 @@ const LatestIncidentsPanel = ({ incidents = [], isLoading = false, error = null
) : (
<Stack gap={theme.spacing(4)}>
{incidents.map((incident, index) => (
<Box key={incident._id}>
<Box key={incident.id}>
<IncidentItem incident={incident} />
{index < incidents.length - 1 && <Divider sx={{ mt: theme.spacing(2) }} />}
</Box>
@@ -26,6 +26,7 @@ const OptionsHeader = ({
{ _id: "active", name: t("incidentsPage.incidentsOptionsHeaderFilterActive") },
{ _id: "resolved", name: t("incidentsPage.incidentsOptionsHeaderFilterResolved") },
{ _id: "manual", name: t("incidentsPage.incidentsOptionsHeaderFilterManual") },
{ _id: "automatic", name: t("incidentsPage.incidentsOptionsHeaderFilterAutomatic") },
];
const stackStyles = {
@@ -13,7 +13,7 @@ const ResolveIncidentDialog = ({
onResolve,
onAfterResolve,
onResolved,
isLoading,
isLoading = false,
}) => {
const { t } = useTranslation();
const theme = useTheme();
@@ -90,7 +90,7 @@ const ResolveIncidentDialog = ({
ResolveIncidentDialog.propTypes = {
open: PropTypes.bool.isRequired,
incidentId: PropTypes.string.isRequired,
incidentId: PropTypes.string,
onClose: PropTypes.func.isRequired,
onResolve: PropTypes.func.isRequired,
onAfterResolve: PropTypes.func,
@@ -98,8 +98,4 @@ ResolveIncidentDialog.propTypes = {
onResolved: PropTypes.func,
};
ResolveIncidentDialog.defaultProps = {
isLoading: false,
};
export default ResolveIncidentDialog;
@@ -71,7 +71,28 @@ const useFetchIncidents = () => {
},
[fetchIncidentsByTeam]
);
const fetchManualResolvedIncidents = useCallback(
async (config = {}) => {
await fetchIncidentsByTeam({
status: false,
resolutionType: "manual",
sortOrder: "desc",
...config,
});
},
[fetchIncidentsByTeam]
);
const fetchAutomaticResolvedIncidents = useCallback(
async (config = {}) => {
await fetchIncidentsByTeam({
status: false,
resolutionType: "automatic",
sortOrder: "desc",
...config,
});
},
[fetchIncidentsByTeam]
);
/**
* Fetch resolved incidents
*
@@ -154,6 +175,7 @@ const useFetchIncidents = () => {
createToast({ body: t("incidentsPage.errorResolvingIncident") });
}
} catch (error) {
console.log("cayo a error");
setNetworkError(true);
console.error(t("incidentsPage.errorResolvingIncident"), error);
const errorMessage =
@@ -198,6 +220,8 @@ const useFetchIncidents = () => {
fetchIncidentById,
resolveIncident,
fetchIncidentSummary,
fetchManualResolvedIncidents,
fetchAutomaticResolvedIncidents,
};
};
+8
View File
@@ -49,6 +49,8 @@ const Incidents2 = () => {
fetchActiveIncidents,
fetchResolvedIncidents,
resolveIncident,
fetchManualResolvedIncidents,
fetchAutomaticResolvedIncidents,
} = useFetchIncidents();
const networkError = monitorsNetworkError || incidentsNetworkError;
@@ -72,6 +74,10 @@ const Incidents2 = () => {
fetchActiveIncidents(config);
} else if (filter === "resolved") {
fetchResolvedIncidents(config);
} else if (filter === "manual") {
fetchManualResolvedIncidents(config);
} else if (filter === "automatic") {
fetchAutomaticResolvedIncidents(config);
} else {
fetchIncidents(config);
}
@@ -85,6 +91,8 @@ const Incidents2 = () => {
fetchActiveIncidents,
fetchResolvedIncidents,
fetchIncidents,
fetchManualResolvedIncidents,
fetchAutomaticResolvedIncidents,
]);
useEffect(() => {