incidnet details
This commit is contained in:
1 parent
f34520cdbf
commit
874d1b277a
6 files changed
+81
-12
No files matched your search
@@ -45,7 +45,7 @@ export const DialogInput = ({
|
|||||||
maxWidth={maxWidth}
|
maxWidth={maxWidth}
|
||||||
fullWidth={fullWidth}
|
fullWidth={fullWidth}
|
||||||
>
|
>
|
||||||
<DialogTitle sx={{ fontSize: typographyLevels.l }}>{title}</DialogTitle>
|
{title && <DialogTitle sx={{ fontSize: typographyLevels.l }}>{title}</DialogTitle>}
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
{content && <DialogContentText>{content}</DialogContentText>}
|
{content && <DialogContentText>{content}</DialogContentText>}
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import Stack from "@mui/material/Stack";
|
||||||
|
import Grid from "@mui/material/Grid";
|
||||||
|
import Box from "@mui/material/Box";
|
||||||
|
import Divider from "@mui/material/Divider";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { BaseBox, ValueLabel } from "@/Components/v2/design-elements";
|
||||||
|
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import type { Monitor } from "@/Types/Monitor";
|
||||||
|
import type { Incident } from "@/Types/Incident";
|
||||||
|
import { useTheme } from "@mui/material";
|
||||||
|
|
||||||
|
interface CardDetailsProps {
|
||||||
|
incident: Incident | null;
|
||||||
|
monitor: Monitor | null;
|
||||||
|
sx?: React.CSSProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const CardDetails = ({ incident, monitor, sx }: CardDetailsProps) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
|
if (!incident) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<Stack gap={theme.spacing(4)}>
|
||||||
|
<Typography textTransform={"uppercase"}>
|
||||||
|
{t("pages.incidents.dialog.details.title")}
|
||||||
|
</Typography>
|
||||||
|
<BaseBox padding={8}>
|
||||||
|
<Typography textTransform={"uppercase"}>
|
||||||
|
{t("pages.incidents.dialog.details.overview")}
|
||||||
|
</Typography>
|
||||||
|
<Divider />
|
||||||
|
|
||||||
|
<Grid container>
|
||||||
|
<Grid>
|
||||||
|
<Box>
|
||||||
|
<ValueLabel
|
||||||
|
value={incident.status ? "positive" : "negative"}
|
||||||
|
text={
|
||||||
|
incident.status
|
||||||
|
? t("common.labels.active")
|
||||||
|
: t("common.labels.resolved")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</BaseBox>
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
};
|
||||||
File renamed without changes.
@@ -1,10 +1,14 @@
|
|||||||
import { Dialog } from "@/Components/v2/inputs";
|
import { Dialog } from "@/Components/v2/inputs";
|
||||||
|
import { CardDetails } from "@/Pages/Incidents/Components/CardDetails";
|
||||||
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import type { Incident } from "@/Types/Incident";
|
import type { Incident } from "@/Types/Incident";
|
||||||
|
import type { Monitor } from "@/Types/Monitor";
|
||||||
|
|
||||||
interface DialogIncidentDetailsProps {
|
interface DialogIncidentDetailsProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
incident: Incident | null;
|
incident: Incident | null;
|
||||||
|
monitor: Monitor | null;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
onResolve: () => void;
|
onResolve: () => void;
|
||||||
}
|
}
|
||||||
@@ -12,19 +16,15 @@ interface DialogIncidentDetailsProps {
|
|||||||
export const DialogIncidentDetails = ({
|
export const DialogIncidentDetails = ({
|
||||||
open,
|
open,
|
||||||
incident,
|
incident,
|
||||||
|
monitor,
|
||||||
onClose,
|
onClose,
|
||||||
onResolve,
|
onResolve,
|
||||||
}: DialogIncidentDetailsProps) => {
|
}: DialogIncidentDetailsProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
if (!incident) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
open={open}
|
open={open}
|
||||||
title={t("pages.incidents.dialog.details.title")}
|
|
||||||
onCancel={onClose}
|
onCancel={onClose}
|
||||||
onConfirm={onResolve}
|
onConfirm={onResolve}
|
||||||
cancelText={t("common.buttons.cancel")}
|
cancelText={t("common.buttons.cancel")}
|
||||||
@@ -32,7 +32,10 @@ export const DialogIncidentDetails = ({
|
|||||||
maxWidth="md"
|
maxWidth="md"
|
||||||
fullWidth
|
fullWidth
|
||||||
>
|
>
|
||||||
<pre>{JSON.stringify(incident, null, 2)}</pre>
|
<CardDetails
|
||||||
|
incident={incident}
|
||||||
|
monitor={monitor}
|
||||||
|
/>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
SummaryCardActiveIncidents,
|
SummaryCardActiveIncidents,
|
||||||
SummaryCardLatestIncidents,
|
SummaryCardLatestIncidents,
|
||||||
SummaryCardStats,
|
SummaryCardStats,
|
||||||
} from "@/Pages/Incidents/Components/SummaryCard";
|
} from "@/Pages/Incidents/Components/CardSummary";
|
||||||
import { IncidentsTable } from "@/Pages/Incidents/Components/IncidentTable";
|
import { IncidentsTable } from "@/Pages/Incidents/Components/IncidentTable";
|
||||||
import { DialogResolution } from "@/Pages/Incidents/Components/DialogResolution";
|
import { DialogResolution } from "@/Pages/Incidents/Components/DialogResolution";
|
||||||
import { DialogIncidentDetails } from "@/Pages/Incidents/Components/DialogIncidentDetails";
|
import { DialogIncidentDetails } from "@/Pages/Incidents/Components/DialogIncidentDetails";
|
||||||
@@ -35,6 +35,9 @@ const IncidentsPage = () => {
|
|||||||
// Details dialog state
|
// Details dialog state
|
||||||
const [isDetailsDialogOpen, setIsDetailsDialogOpen] = useState(false);
|
const [isDetailsDialogOpen, setIsDetailsDialogOpen] = useState(false);
|
||||||
const [selectedIncident, setSelectedIncident] = useState<Incident | null>(null);
|
const [selectedIncident, setSelectedIncident] = useState<Incident | null>(null);
|
||||||
|
const [selectedIncidentMonitor, setSelectedIncidentMonitor] = useState<Monitor | null>(
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
// Build incidents URL with query params
|
// Build incidents URL with query params
|
||||||
const incidentsUrl = useMemo(() => {
|
const incidentsUrl = useMemo(() => {
|
||||||
@@ -100,13 +103,16 @@ const IncidentsPage = () => {
|
|||||||
|
|
||||||
const handleOpenDetails = (incidentId: string) => {
|
const handleOpenDetails = (incidentId: string) => {
|
||||||
const incident = incidents.find((i) => i.id === incidentId) ?? null;
|
const incident = incidents.find((i) => i.id === incidentId) ?? null;
|
||||||
setSelectedIncident(incident);
|
const monitor = monitorsData?.find((m) => m.id === incident?.monitorId) ?? null;
|
||||||
setIsDetailsDialogOpen(true);
|
setIsDetailsDialogOpen(true);
|
||||||
|
setSelectedIncident(incident);
|
||||||
|
setSelectedIncidentMonitor(monitor);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDetailsClose = () => {
|
const handleDetailsClose = () => {
|
||||||
setIsDetailsDialogOpen(false);
|
setIsDetailsDialogOpen(false);
|
||||||
setSelectedIncident(null);
|
setSelectedIncident(null);
|
||||||
|
setSelectedIncidentMonitor(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDetailsResolve = () => {
|
const handleDetailsResolve = () => {
|
||||||
@@ -169,6 +175,7 @@ const IncidentsPage = () => {
|
|||||||
<DialogIncidentDetails
|
<DialogIncidentDetails
|
||||||
open={isDetailsDialogOpen}
|
open={isDetailsDialogOpen}
|
||||||
incident={selectedIncident}
|
incident={selectedIncident}
|
||||||
|
monitor={selectedIncidentMonitor}
|
||||||
onClose={handleDetailsClose}
|
onClose={handleDetailsClose}
|
||||||
onResolve={handleDetailsResolve}
|
onResolve={handleDetailsResolve}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -6,7 +6,9 @@
|
|||||||
"details": "Details"
|
"details": "Details"
|
||||||
},
|
},
|
||||||
"labels": {
|
"labels": {
|
||||||
"responseTime": "Response time"
|
"responseTime": "Response time",
|
||||||
|
"active": "Active",
|
||||||
|
"resolved": "Resolved"
|
||||||
},
|
},
|
||||||
"buttons": {
|
"buttons": {
|
||||||
"toggleTheme": "Toggles light & dark",
|
"toggleTheme": "Toggles light & dark",
|
||||||
@@ -21,6 +23,7 @@
|
|||||||
"save": "Save",
|
"save": "Save",
|
||||||
"test": "Test"
|
"test": "Test"
|
||||||
},
|
},
|
||||||
|
|
||||||
"alerts": {
|
"alerts": {
|
||||||
"pageSpeedApiKey": {
|
"pageSpeedApiKey": {
|
||||||
"content": "Warning: You haven't added a Google PageSpeed API key yet. Visit <settingsLink>Settings</settingsLink> to add one. Without it, the PageSpeed monitor won't function."
|
"content": "Warning: You haven't added a Google PageSpeed API key yet. Visit <settingsLink>Settings</settingsLink> to add one. Without it, the PageSpeed monitor won't function."
|
||||||
@@ -373,6 +376,7 @@
|
|||||||
"avgResolutionTime": "Average resolution time"
|
"avgResolutionTime": "Average resolution time"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"table": {
|
"table": {
|
||||||
"headers": {
|
"headers": {
|
||||||
"startTime": "Start Time",
|
"startTime": "Start Time",
|
||||||
@@ -392,8 +396,9 @@
|
|||||||
},
|
},
|
||||||
"dialog": {
|
"dialog": {
|
||||||
"details": {
|
"details": {
|
||||||
"title": "Incident Details",
|
"title": "Incident details",
|
||||||
"resolve": "Resolve Incident"
|
"resolve": "Resolve Incident",
|
||||||
|
"overview": "Overview"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user