diff --git a/client/src/Pages/Incidents/Components/IncidentDetailsModal/index.jsx b/client/src/Pages/Incidents/Components/IncidentDetailsModal/index.jsx index 25af835b9..1290c69ff 100644 --- a/client/src/Pages/Incidents/Components/IncidentDetailsModal/index.jsx +++ b/client/src/Pages/Incidents/Components/IncidentDetailsModal/index.jsx @@ -2,7 +2,7 @@ import { Stack, Typography, Grid, Box, Button, Divider } from "@mui/material"; import { GenericDialog } from "@/Components/v1/Dialog/genericDialog.jsx"; import GenericFallback from "@/Components/v1/GenericFallback/index.jsx"; -import SummaryCard from "@/Pages/Incidents2/Components/SummaryCard"; +import SummaryCard from "../SummaryCard/index.jsx"; import ResolveIncidentDialog from "../ResolveIncidentDialog/index.jsx"; // Utils @@ -14,8 +14,8 @@ import { useSelector } from "react-redux"; import PropTypes from "prop-types"; // Hooks -import useFetchIncidents from "@/Pages/Incidents2/hooks/useFetchIncidents"; -import useGetIncidentsDuration from "@/Pages/Incidents2/hooks/useGetIncidentsDuration"; +import useFetchIncidents from "../../hooks/useFetchIncidents.js"; +import useGetIncidentsDuration from "../../hooks/useGetIncidentsDuration.js"; const IncidentDetailsModal = ({ open, incidentId, onClose, onResolved }) => { const theme = useTheme(); diff --git a/client/src/Pages/Incidents/Components/IncidentTable/IncidentActionsMenu.jsx b/client/src/Pages/Incidents/Components/IncidentTable/IncidentActionsMenu.jsx index 2902da049..1e9a3be85 100644 --- a/client/src/Pages/Incidents/Components/IncidentTable/IncidentActionsMenu.jsx +++ b/client/src/Pages/Incidents/Components/IncidentTable/IncidentActionsMenu.jsx @@ -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 Settings from "../../../../assets/icons/settings-bold.svg?react"; import ResolveIncidentDialog from "../ResolveIncidentDialog/index.jsx"; import useFetchIncidents from "../../hooks/useFetchIncidents"; @@ -94,7 +94,7 @@ const IncidentActionsMenu = ({ incident, onResolve, onOpenDetails }) => { }, }} > - + {/* */}M { const uiTimezone = useSelector((state) => state.ui.timezone); diff --git a/client/src/Pages/Incidents/Components/ResolveIncidentDialog/index.jsx b/client/src/Pages/Incidents/Components/ResolveIncidentDialog/index.jsx new file mode 100644 index 000000000..e2be5fed2 --- /dev/null +++ b/client/src/Pages/Incidents/Components/ResolveIncidentDialog/index.jsx @@ -0,0 +1,105 @@ +import { useEffect, useState } from "react"; +import PropTypes from "prop-types"; +import { Button, Stack } from "@mui/material"; +import { useTranslation } from "react-i18next"; +import { useTheme } from "@emotion/react"; +import { GenericDialog } from "@/Components/v1/Dialog/genericDialog.jsx"; +import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx"; + +const ResolveIncidentDialog = ({ + open, + incidentId, + onClose, + onResolve, + onAfterResolve, + onResolved, + isLoading, +}) => { + const { t } = useTranslation(); + const theme = useTheme(); + const [comment, setComment] = useState(""); + const [isSubmitting, setIsSubmitting] = useState(false); + + useEffect(() => { + if (open) { + setComment(""); + } + }, [open]); + + const handleConfirm = async () => { + if (!incidentId) return; + const trimmed = comment.trim(); + try { + setIsSubmitting(true); + await onResolve(incidentId, trimmed ? { comment: trimmed } : {}); + if (onAfterResolve) { + await onAfterResolve(); + } + onResolved?.(); + onClose(); + } catch (error) { + console.error("Error resolving incident:", error); + } finally { + setIsSubmitting(false); + } + }; + + return ( + + + setComment(e.target.value)} + maxWidth="100%" + /> + + + + + + + ); +}; + +ResolveIncidentDialog.propTypes = { + open: PropTypes.bool.isRequired, + incidentId: PropTypes.string.isRequired, + onClose: PropTypes.func.isRequired, + onResolve: PropTypes.func.isRequired, + onAfterResolve: PropTypes.func, + isLoading: PropTypes.bool, + onResolved: PropTypes.func, +}; + +ResolveIncidentDialog.defaultProps = { + isLoading: false, +}; + +export default ResolveIncidentDialog; diff --git a/client/src/Pages/Incidents/index.jsx b/client/src/Pages/Incidents/index.jsx index 2721f42ad..abf24989b 100644 --- a/client/src/Pages/Incidents/index.jsx +++ b/client/src/Pages/Incidents/index.jsx @@ -157,7 +157,7 @@ const Incidents2 = () => { handleUpdateTrigger={handleUpdateTrigger} onOpenDetails={handleOpenDetails} /> -