fix import routes
This commit is contained in:
1 parent
eb8c9bea76
commit
63416ceb4b
5 files changed
+112
-7
No files matched your search
@@ -2,7 +2,7 @@
|
|||||||
import { Stack, Typography, Grid, Box, Button, Divider } from "@mui/material";
|
import { Stack, Typography, Grid, Box, Button, Divider } from "@mui/material";
|
||||||
import { GenericDialog } from "@/Components/v1/Dialog/genericDialog.jsx";
|
import { GenericDialog } from "@/Components/v1/Dialog/genericDialog.jsx";
|
||||||
import GenericFallback from "@/Components/v1/GenericFallback/index.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";
|
import ResolveIncidentDialog from "../ResolveIncidentDialog/index.jsx";
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
@@ -14,8 +14,8 @@ import { useSelector } from "react-redux";
|
|||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
import useFetchIncidents from "@/Pages/Incidents2/hooks/useFetchIncidents";
|
import useFetchIncidents from "../../hooks/useFetchIncidents.js";
|
||||||
import useGetIncidentsDuration from "@/Pages/Incidents2/hooks/useGetIncidentsDuration";
|
import useGetIncidentsDuration from "../../hooks/useGetIncidentsDuration.js";
|
||||||
|
|
||||||
const IncidentDetailsModal = ({ open, incidentId, onClose, onResolved }) => {
|
const IncidentDetailsModal = ({ open, incidentId, onClose, onResolved }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import Menu from "@mui/material/Menu";
|
import Menu from "@mui/material/Menu";
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
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 ResolveIncidentDialog from "../ResolveIncidentDialog/index.jsx";
|
||||||
import useFetchIncidents from "../../hooks/useFetchIncidents";
|
import useFetchIncidents from "../../hooks/useFetchIncidents";
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ const IncidentActionsMenu = ({ incident, onResolve, onOpenDetails }) => {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Settings />
|
{/* <Settings /> */}M
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<Menu
|
<Menu
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const IncidentTable = ({
|
|||||||
handleChangeRowsPerPage,
|
handleChangeRowsPerPage,
|
||||||
resolveIncident,
|
resolveIncident,
|
||||||
handleUpdateTrigger,
|
handleUpdateTrigger,
|
||||||
onOpenDetails
|
onOpenDetails,
|
||||||
}) => {
|
}) => {
|
||||||
const uiTimezone = useSelector((state) => state.ui.timezone);
|
const uiTimezone = useSelector((state) => state.ui.timezone);
|
||||||
|
|
||||||
|
|||||||
@@ -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 (
|
||||||
|
<GenericDialog
|
||||||
|
open={open}
|
||||||
|
theme={theme}
|
||||||
|
title={t("incidentsPage.resolveIncidentDialogTitle")}
|
||||||
|
description={t("incidentsPage.resolveIncidentDialogDescription")}
|
||||||
|
onClose={onClose}
|
||||||
|
>
|
||||||
|
<Stack gap={theme.spacing(4)}>
|
||||||
|
<TextInput
|
||||||
|
label={t("incidentsPage.resolveIncidentDialogCommentLabel")}
|
||||||
|
placeholder={t("incidentsPage.resolveIncidentDialogCommentPlaceholder")}
|
||||||
|
value={comment}
|
||||||
|
onChange={(e) => setComment(e.target.value)}
|
||||||
|
maxWidth="100%"
|
||||||
|
/>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
gap={theme.spacing(4)}
|
||||||
|
mt={theme.spacing(4)}
|
||||||
|
justifyContent="flex-end"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
color="secondary"
|
||||||
|
onClick={onClose}
|
||||||
|
disabled={isLoading || isSubmitting}
|
||||||
|
>
|
||||||
|
{t("cancel", "Cancel")}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
color="error"
|
||||||
|
onClick={handleConfirm}
|
||||||
|
disabled={isLoading || isSubmitting}
|
||||||
|
>
|
||||||
|
{t("incidentsPage.resolveIncidentDialogConfirm")}
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</GenericDialog>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
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;
|
||||||
@@ -157,7 +157,7 @@ const Incidents2 = () => {
|
|||||||
handleUpdateTrigger={handleUpdateTrigger}
|
handleUpdateTrigger={handleUpdateTrigger}
|
||||||
onOpenDetails={handleOpenDetails}
|
onOpenDetails={handleOpenDetails}
|
||||||
/>
|
/>
|
||||||
<IncidentDetailsModal
|
<IncidentDetailsModal
|
||||||
open={isDetailsOpen}
|
open={isDetailsOpen}
|
||||||
incidentId={selectedIncidentId}
|
incidentId={selectedIncidentId}
|
||||||
onClose={handleCloseDetails}
|
onClose={handleCloseDetails}
|
||||||
|
|||||||
Reference in new issue
Block a user