Merge upstream/develop into fix/3120-data-leak

This commit is contained in:
Craig Lawson committed 2026-01-15 11:06:27 +00:00
commit f0a6fc4fdf
309 files changed
+8413 -4468

No files matched your search

+599 -722
View File
File diff suppressed because it is too large. Load diff
@@ -12,7 +12,7 @@ import { useNavigate } from "react-router-dom";
import { createToast } from "../../../Utils/toastUtils.jsx"; import { createToast } from "../../../Utils/toastUtils.jsx";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { usePauseMonitor, useDeleteMonitor } from "../../../Hooks/v1/monitorHooks.js"; import { usePauseMonitor, useDeleteMonitor } from "../../../Hooks/monitorHooks.js";
const ActionsMenu = ({ const ActionsMenu = ({
monitor, monitor,
@@ -31,7 +31,8 @@ const ActionsMenu = ({
const handleRemove = async (event) => { const handleRemove = async (event) => {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
let monitor = { _id: actions.id }; let monitor = { id: actions.id };
console.log(monitor);
await deleteMonitor({ monitor }); await deleteMonitor({ monitor });
updateRowCallback(); updateRowCallback();
}; };
@@ -39,7 +40,7 @@ const ActionsMenu = ({
const handlePause = async () => { const handlePause = async () => {
try { try {
setIsLoading(true); setIsLoading(true);
await pauseMonitor({ monitorId: monitor._id }); await pauseMonitor({ monitorId: monitor.id });
pauseCallback(); pauseCallback();
} catch (error) { } catch (error) {
createToast({ body: "Failed to pause monitor." }); createToast({ body: "Failed to pause monitor." });
@@ -72,7 +73,7 @@ const ActionsMenu = ({
aria-label="monitor actions" aria-label="monitor actions"
onClick={(event) => { onClick={(event) => {
event.stopPropagation(); event.stopPropagation();
openMenu(event, monitor._id, monitor.type === "ping" ? null : monitor.url); openMenu(event, monitor.id, monitor.type === "ping" ? null : monitor.url);
}} }}
sx={{ sx={{
"&:focus": { "&:focus": {
@@ -197,6 +198,7 @@ const ActionsMenu = ({
confirmationButtonLabel="Delete" confirmationButtonLabel="Delete"
/* Do we need stop propagation? */ /* Do we need stop propagation? */
onConfirm={(e) => { onConfirm={(e) => {
console.log(e);
e.stopPropagation(); e.stopPropagation();
handleRemove(e); handleRemove(e);
}} }}
@@ -210,7 +212,7 @@ const ActionsMenu = ({
ActionsMenu.propTypes = { ActionsMenu.propTypes = {
monitor: PropTypes.shape({ monitor: PropTypes.shape({
_id: PropTypes.string, id: PropTypes.string,
url: PropTypes.string, url: PropTypes.string,
type: PropTypes.string, type: PropTypes.string,
isActive: PropTypes.bool, isActive: PropTypes.bool,
@@ -103,7 +103,7 @@ const BarChart = ({ checks = [] }) => {
</> </>
} }
placement="top" placement="top"
key={`check-${check?._id}`} key={`check-${check?.id}`}
slotProps={{ slotProps={{
popper: { popper: {
className: "bar-tooltip", className: "bar-tooltip",
@@ -145,7 +145,7 @@ const BarChart = ({ checks = [] }) => {
position="relative" position="relative"
width="9px" width="9px"
height="100%" height="100%"
backgroundColor={theme.palette.primary.lowContrast} // CAIO_REVIEW backgroundColor={theme.palette.primary.lowContrast}
sx={{ sx={{
borderRadius: theme.spacing(1.5), borderRadius: theme.spacing(1.5),
/* /*
@@ -85,7 +85,12 @@ const Search = ({
const enhancedOptions = React.useMemo(() => { const enhancedOptions = React.useMemo(() => {
return multiple && isAdorned return multiple && isAdorned
? [ ? [
{ [filteredBy]: t("selectAll"), isSelectAll: true, _id: "select_all" }, {
[filteredBy]: t("selectAll"),
isSelectAll: true,
_id: "select_all",
id: "select_all",
},
...options, ...options,
] ]
: options; : options;
@@ -93,7 +98,7 @@ const Search = ({
const isOptionSelected = (option) => { const isOptionSelected = (option) => {
if (!multiple && !isAdorned) return false; if (!multiple && !isAdorned) return false;
if (Array.isArray(value)) { if (Array.isArray(value)) {
return value.some((item) => item._id === option._id); return value.some((item) => (item._id ?? item.id) === (option._id ?? option.id));
} }
return false; return false;
}; };
@@ -145,7 +150,9 @@ const Search = ({
disableClearable disableClearable
options={enhancedOptions} options={enhancedOptions}
getOptionLabel={(option) => option[filteredBy]} getOptionLabel={(option) => option[filteredBy]}
isOptionEqualToValue={(option, value) => option._id === value._id} // Compare by unique identifier isOptionEqualToValue={(option, value) =>
(option._id ?? option.id) === (value?._id ?? value?.id)
} // Compare by unique identifier
renderInput={(params) => ( renderInput={(params) => (
<FieldWrapper <FieldWrapper
label={label} label={label}
@@ -206,7 +213,7 @@ const Search = ({
return filtered; return filtered;
}} }}
getOptionKey={(option) => { getOptionKey={(option) => {
return option._id; return option._id ?? option.id;
}} }}
renderOption={(props, option) => { renderOption={(props, option) => {
const { key, ...optionProps } = props; const { key, ...optionProps } = props;
@@ -62,6 +62,7 @@ const Select = ({
fieldWrapperSx = {}, fieldWrapperSx = {},
}) => { }) => {
const theme = useTheme(); const theme = useTheme();
const getItemValue = (item) => item?._id ?? item?.id;
const itemStyles = { const itemStyles = {
fontSize: "var(--env-var-font-size-medium)", fontSize: "var(--env-var-font-size-medium)",
color: theme.palette.primary.contrastTextTertiary, color: theme.palette.primary.contrastTextTertiary,
@@ -123,7 +124,7 @@ const Select = ({
...sx, ...sx,
}} }}
renderValue={(selected) => { renderValue={(selected) => {
const selectedItem = items.find((item) => item._id === selected); const selectedItem = items.find((item) => getItemValue(item) === selected);
const displayName = selectedItem ? selectedItem.name : placeholder; const displayName = selectedItem ? selectedItem.name : placeholder;
return ( return (
<Typography <Typography
@@ -152,17 +153,25 @@ const Select = ({
{placeholder} {placeholder}
</MenuItem> </MenuItem>
)} )}
{items.map((item) => ( {items
<MenuItem .map((item) => {
value={item._id} const itemValue = getItemValue(item);
key={`${id}-${item._id}`} if (itemValue === undefined || itemValue === null) {
sx={{ return null;
...itemStyles, }
}} return (
> <MenuItem
{item.name} value={itemValue}
</MenuItem> key={`${id}-${itemValue}`}
))} sx={{
...itemStyles,
}}
>
{item.name}
</MenuItem>
);
})
.filter(Boolean)}
</MuiSelect> </MuiSelect>
</FieldWrapper> </FieldWrapper>
); );
@@ -179,8 +188,8 @@ Select.propTypes = {
.isRequired, .isRequired,
items: PropTypes.arrayOf( items: PropTypes.arrayOf(
PropTypes.shape({ PropTypes.shape({
_id: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]) _id: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
.isRequired, id: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
name: PropTypes.string.isRequired, name: PropTypes.string.isRequired,
}) })
@@ -11,7 +11,7 @@ import MenuList from "@mui/material/MenuList";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { createToast } from "../../../Utils/toastUtils.jsx"; import { createToast } from "../../../Utils/toastUtils.jsx";
import { useExportMonitors } from "../../../Hooks/v1/monitorHooks.js"; import { useExportMonitors } from "../../../Hooks/monitorHooks.js";
const MonitorActions = ({ isLoading }) => { const MonitorActions = ({ isLoading }) => {
const [open, setOpen] = React.useState(false); const [open, setOpen] = React.useState(false);
@@ -12,10 +12,10 @@ import EmailIcon from "@mui/icons-material/Email";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import { usePauseMonitor } from "../../../Hooks/v1/monitorHooks.js"; import { usePauseMonitor } from "../../../Hooks/monitorHooks.js";
import { useSendTestEmail } from "../../../Hooks/v1/useSendTestEmail.js"; import { useSendTestEmail } from "../../../Hooks/useSendTestEmail.js";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useTestAllNotifications } from "../../../Hooks/v1/useNotifications.js"; import { useTestAllNotifications } from "../../../Hooks/useNotifications.js";
/** /**
* MonitorDetailsControlHeader component displays the control header for monitor details. * MonitorDetailsControlHeader component displays the control header for monitor details.
* It includes status display, pause/resume button, and a configure button for admins. * It includes status display, pause/resume button, and a configure button for admins.
@@ -7,7 +7,7 @@ import Dot from "../Dot/index.jsx";
import { formatDurationRounded } from "../../../Utils/timeUtils.js"; import { formatDurationRounded } from "../../../Utils/timeUtils.js";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useMonitorUtils } from "../../../Hooks/v1/useMonitorUtils.js"; import { useMonitorUtils } from "../../../Hooks/useMonitorUtils.js";
import { formatMonitorUrl } from "../../../Utils/utils.js"; import { formatMonitorUrl } from "../../../Utils/utils.js";
/** /**
* Status component displays the status information of a monitor. * Status component displays the status information of a monitor.
@@ -3,7 +3,7 @@ import Fallback from "../Fallback/index.jsx";
import { Typography } from "@mui/material"; import { Typography } from "@mui/material";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useIsAdmin } from "../../../Hooks/v1/useIsAdmin.js"; import { useIsAdmin } from "@/Hooks/useIsAdmin.js";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
const PageStateWrapper = ({ const PageStateWrapper = ({
networkError, networkError,
+1 -1
View File
@@ -2,7 +2,7 @@ import { Stack, Typography } from "@mui/material";
import Image from "../Image/index.jsx"; import Image from "../Image/index.jsx";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useMonitorUtils } from "../../../Hooks/v1/useMonitorUtils.js"; import { useMonitorUtils } from "../../../Hooks/useMonitorUtils.js";
/** /**
* StatBox Component * StatBox Component
@@ -1,6 +1,6 @@
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import { networkService } from "../../main.jsx"; import { networkService } from "../main.jsx";
import { createToast } from "../../Utils/toastUtils.jsx"; import { createToast } from "../Utils/toastUtils.jsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
const useFetchChecksTeam = ({ const useFetchChecksTeam = ({
@@ -1,5 +1,5 @@
import { useState } from "react"; import { useState } from "react";
import { networkService } from "../../main.jsx"; import { networkService } from "../main.jsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
const CLIENT_HOST = import.meta.env.VITE_APP_CLIENT_HOST; const CLIENT_HOST = import.meta.env.VITE_APP_CLIENT_HOST;
@@ -1,6 +1,6 @@
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import { networkService } from "../../main.jsx"; import { networkService } from "../main.jsx";
import { createToast } from "../../Utils/toastUtils.jsx"; import { createToast } from "../Utils/toastUtils.jsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
const useFetchLogs = () => { const useFetchLogs = () => {
@@ -1,12 +1,12 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { networkService } from "../../main.jsx"; import { networkService } from "../main.jsx";
import { createToast } from "../../Utils/toastUtils.jsx"; import { createToast } from "../Utils/toastUtils.jsx";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useMonitorUtils } from "./useMonitorUtils.js"; import { useMonitorUtils } from "./useMonitorUtils.js";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
const useFetchMonitorsWithSummary = ({ types, monitorUpdateTrigger }) => { export const useFetchMonitorsWithSummary = ({ types, monitorUpdateTrigger }) => {
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const [monitors, setMonitors] = useState(undefined); const [monitors, setMonitors] = useState(undefined);
const [monitorsSummary, setMonitorsSummary] = useState(undefined); const [monitorsSummary, setMonitorsSummary] = useState(undefined);
@@ -37,7 +37,7 @@ const useFetchMonitorsWithSummary = ({ types, monitorUpdateTrigger }) => {
return [monitors, monitorsSummary, isLoading, networkError]; return [monitors, monitorsSummary, isLoading, networkError];
}; };
const useFetchMonitorsWithChecks = ({ export const useFetchMonitorsWithChecks = ({
types, types,
limit, limit,
page, page,
@@ -67,12 +67,13 @@ const useFetchMonitorsWithChecks = ({
field, field,
order, order,
}); });
const { count, monitors } = res?.data?.data ?? {}; const { count, monitors } = res?.data?.data ?? {};
const mappedMonitors = monitors.map((monitor) => const mappedMonitors = monitors.map((monitor) =>
getMonitorWithPercentage(monitor, theme) getMonitorWithPercentage(monitor, theme)
); );
setMonitors(mappedMonitors); setMonitors(mappedMonitors);
setCount(count?.monitorsCount ?? 0); setCount(count || 0);
} catch (error) { } catch (error) {
console.error(error); console.error(error);
setNetworkError(true); setNetworkError(true);
@@ -99,22 +100,9 @@ const useFetchMonitorsWithChecks = ({
return [monitors, count, isLoading, networkError]; return [monitors, count, isLoading, networkError];
}; };
const useFetchMonitorsByTeamId = ({ export const useFetchMonitorsByTeamId = ({ types, filter, updateTrigger }) => {
types,
limit,
page,
rowsPerPage,
filter,
field,
order,
checkOrder,
normalize,
status,
updateTrigger,
}) => {
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const [monitors, setMonitors] = useState(undefined); const [monitors, setMonitors] = useState(undefined);
const [summary, setSummary] = useState(undefined);
const [networkError, setNetworkError] = useState(false); const [networkError, setNetworkError] = useState(false);
useEffect(() => { useEffect(() => {
@@ -122,20 +110,11 @@ const useFetchMonitorsByTeamId = ({
try { try {
setIsLoading(true); setIsLoading(true);
const res = await networkService.getMonitorsByTeamId({ const res = await networkService.getMonitorsByTeamId({
limit,
types, types,
page,
rowsPerPage,
filter, filter,
field,
order,
checkOrder,
status,
normalize,
}); });
if (res?.data?.data?.filteredMonitors) { if (res?.data?.data) {
setMonitors(res.data.data.filteredMonitors); setMonitors(res.data.data);
setSummary(res.data.data.summary);
} }
} catch (error) { } catch (error) {
setNetworkError(true); setNetworkError(true);
@@ -147,23 +126,11 @@ const useFetchMonitorsByTeamId = ({
} }
}; };
fetchMonitors(); fetchMonitors();
}, [ }, [types, filter, updateTrigger]);
types, return [monitors, isLoading, networkError];
limit,
page,
rowsPerPage,
filter,
field,
order,
updateTrigger,
checkOrder,
normalize,
status,
]);
return [monitors, summary, isLoading, networkError];
}; };
const useFetchStatsByMonitorId = ({ export const useFetchStatsByMonitorId = ({
monitorId, monitorId,
sortOrder, sortOrder,
limit, limit,
@@ -202,7 +169,7 @@ const useFetchStatsByMonitorId = ({
return [monitor, audits, isLoading, networkError]; return [monitor, audits, isLoading, networkError];
}; };
const useFetchMonitorGames = ({ setGames, updateTrigger }) => { export const useFetchMonitorGames = ({ setGames, updateTrigger }) => {
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
useEffect(() => { useEffect(() => {
const fetchGames = async () => { const fetchGames = async () => {
@@ -221,7 +188,7 @@ const useFetchMonitorGames = ({ setGames, updateTrigger }) => {
return [isLoading]; return [isLoading];
}; };
const useFetchMonitorById = ({ monitorId, setMonitor, updateTrigger }) => { export const useFetchMonitorById = ({ monitorId, setMonitor, updateTrigger }) => {
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
useEffect(() => { useEffect(() => {
if (typeof monitorId === "undefined") { if (typeof monitorId === "undefined") {
@@ -244,7 +211,7 @@ const useFetchMonitorById = ({ monitorId, setMonitor, updateTrigger }) => {
return [isLoading]; return [isLoading];
}; };
const useFetchHardwareMonitorById = ({ monitorId, dateRange, updateTrigger }) => { export const useFetchHardwareMonitorById = ({ monitorId, dateRange, updateTrigger }) => {
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
const [networkError, setNetworkError] = useState(false); const [networkError, setNetworkError] = useState(false);
const [monitor, setMonitor] = useState(undefined); const [monitor, setMonitor] = useState(undefined);
@@ -270,8 +237,34 @@ const useFetchHardwareMonitorById = ({ monitorId, dateRange, updateTrigger }) =>
}, [monitorId, dateRange, updateTrigger]); }, [monitorId, dateRange, updateTrigger]);
return [monitor, isLoading, networkError]; return [monitor, isLoading, networkError];
}; };
export const useFetchPageSpeedMonitorById = ({ monitorId, dateRange, updateTrigger }) => {
const [isLoading, setIsLoading] = useState(true);
const [networkError, setNetworkError] = useState(false);
const [monitor, setMonitor] = useState(undefined);
const useFetchUptimeMonitorById = ({ monitorId, dateRange, trigger }) => { useEffect(() => {
const fetchMonitor = async () => {
try {
if (!monitorId) {
return { monitor: undefined, isLoading: false, networkError: undefined };
}
const response = await networkService.getPageSpeedDetailsByMonitorId({
monitorId: monitorId,
dateRange: dateRange,
});
setMonitor(response.data.data);
} catch (error) {
setNetworkError(true);
} finally {
setIsLoading(false);
}
};
fetchMonitor();
}, [monitorId, dateRange, updateTrigger]);
return [monitor, isLoading, networkError];
};
export const useFetchUptimeMonitorById = ({ monitorId, dateRange, trigger }) => {
const [networkError, setNetworkError] = useState(false); const [networkError, setNetworkError] = useState(false);
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
const [monitor, setMonitor] = useState(undefined); const [monitor, setMonitor] = useState(undefined);
@@ -299,7 +292,7 @@ const useFetchUptimeMonitorById = ({ monitorId, dateRange, trigger }) => {
return [monitor, monitorStats, isLoading, networkError]; return [monitor, monitorStats, isLoading, networkError];
}; };
const useCreateMonitor = () => { export const useCreateMonitor = () => {
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const navigate = useNavigate(); const navigate = useNavigate();
const createMonitor = async ({ monitor, redirect }) => { const createMonitor = async ({ monitor, redirect }) => {
@@ -319,7 +312,7 @@ const useCreateMonitor = () => {
return [createMonitor, isLoading]; return [createMonitor, isLoading];
}; };
const useFetchGlobalSettings = () => { export const useFetchGlobalSettings = () => {
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
const [globalSettings, setGlobalSettings] = useState(undefined); const [globalSettings, setGlobalSettings] = useState(undefined);
useEffect(() => { useEffect(() => {
@@ -341,13 +334,14 @@ const useFetchGlobalSettings = () => {
return [globalSettings, isLoading]; return [globalSettings, isLoading];
}; };
const useDeleteMonitor = () => { export const useDeleteMonitor = () => {
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const navigate = useNavigate(); const navigate = useNavigate();
const deleteMonitor = async ({ monitor, redirect }) => { const deleteMonitor = async ({ monitor, redirect }) => {
try { try {
setIsLoading(true); setIsLoading(true);
await networkService.deleteMonitorById({ monitorId: monitor._id }); console.log(monitor);
await networkService.deleteMonitorById({ monitorId: monitor.id });
createToast({ body: "Monitor deleted successfully!" }); createToast({ body: "Monitor deleted successfully!" });
if (redirect) { if (redirect) {
navigate(redirect); navigate(redirect);
@@ -361,7 +355,7 @@ const useDeleteMonitor = () => {
return [deleteMonitor, isLoading]; return [deleteMonitor, isLoading];
}; };
const useUpdateMonitor = () => { export const useUpdateMonitor = () => {
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const navigate = useNavigate(); const navigate = useNavigate();
const updateMonitor = async ({ monitor, redirect }) => { const updateMonitor = async ({ monitor, redirect }) => {
@@ -408,7 +402,7 @@ const useUpdateMonitor = () => {
return [updateMonitor, isLoading]; return [updateMonitor, isLoading];
}; };
const usePauseMonitor = () => { export const usePauseMonitor = () => {
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState(undefined); const [error, setError] = useState(undefined);
const pauseMonitor = async ({ monitorId, triggerUpdate }) => { const pauseMonitor = async ({ monitorId, triggerUpdate }) => {
@@ -431,7 +425,7 @@ const usePauseMonitor = () => {
return [pauseMonitor, isLoading, error]; return [pauseMonitor, isLoading, error];
}; };
const useAddDemoMonitors = () => { export const useAddDemoMonitors = () => {
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const { t } = useTranslation(); const { t } = useTranslation();
const addDemoMonitors = async () => { const addDemoMonitors = async () => {
@@ -448,7 +442,7 @@ const useAddDemoMonitors = () => {
return [addDemoMonitors, isLoading]; return [addDemoMonitors, isLoading];
}; };
const useDeleteAllMonitors = () => { export const useDeleteAllMonitors = () => {
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const { t } = useTranslation(); const { t } = useTranslation();
const deleteAllMonitors = async () => { const deleteAllMonitors = async () => {
@@ -465,7 +459,7 @@ const useDeleteAllMonitors = () => {
return [deleteAllMonitors, isLoading]; return [deleteAllMonitors, isLoading];
}; };
const useDeleteMonitorStats = () => { export const useDeleteMonitorStats = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const deleteMonitorStats = async () => { const deleteMonitorStats = async () => {
@@ -483,7 +477,7 @@ const useDeleteMonitorStats = () => {
return [deleteMonitorStats, isLoading]; return [deleteMonitorStats, isLoading];
}; };
const useCreateBulkMonitors = () => { export const useCreateBulkMonitors = () => {
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const createBulkMonitors = async (file, user) => { const createBulkMonitors = async (file, user) => {
@@ -506,7 +500,7 @@ const useCreateBulkMonitors = () => {
return [createBulkMonitors, isLoading]; return [createBulkMonitors, isLoading];
}; };
const useExportMonitors = () => { export const useExportMonitors = () => {
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const { t } = useTranslation(); const { t } = useTranslation();
@@ -539,7 +533,7 @@ const useExportMonitors = () => {
return [exportMonitors, isLoading]; return [exportMonitors, isLoading];
}; };
const useFetchJson = () => { export const useFetchJson = () => {
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const fetchJson = async () => { const fetchJson = async () => {
try { try {
@@ -555,25 +549,3 @@ const useFetchJson = () => {
}; };
return [fetchJson, isLoading]; return [fetchJson, isLoading];
}; };
export {
useFetchMonitorsWithSummary,
useFetchMonitorsWithChecks,
useFetchMonitorsByTeamId,
useFetchStatsByMonitorId,
useFetchMonitorById,
useFetchUptimeMonitorById,
useFetchHardwareMonitorById,
useCreateMonitor,
useFetchGlobalSettings,
useDeleteMonitor,
useUpdateMonitor,
usePauseMonitor,
useAddDemoMonitors,
useDeleteAllMonitors,
useDeleteMonitorStats,
useCreateBulkMonitors,
useExportMonitors,
useFetchMonitorGames,
useFetchJson,
};
@@ -1,6 +1,6 @@
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import { networkService } from "../../main.jsx"; import { networkService } from "../main.jsx";
import { createToast } from "../../Utils/toastUtils.jsx"; import { createToast } from "../Utils/toastUtils.jsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
const useFetchSettings = ({ setSettingsData, setIsApiKeySet, setIsEmailPasswordSet }) => { const useFetchSettings = ({ setSettingsData, setIsApiKeySet, setIsEmailPasswordSet }) => {
@@ -42,11 +42,11 @@ const useSaveSettings = ({
setIsLoading(true); setIsLoading(true);
try { try {
const settingsResponse = await networkService.updateAppSettings({ settings }); const settingsResponse = await networkService.updateAppSettings({ settings });
if (settings.checkTTL) { // if (settings.checkTTL) {
await networkService.updateChecksTTL({ // await networkService.updateChecksTTL({
ttl: settings.checkTTL, // ttl: settings.checkTTL,
}); // });
} // }
setIsApiKeySet(settingsResponse.data.data.pagespeedKeySet); setIsApiKeySet(settingsResponse.data.data.pagespeedKeySet);
setIsEmailPasswordSet(settingsResponse.data.data.emailPasswordSet); setIsEmailPasswordSet(settingsResponse.data.data.emailPasswordSet);
if (settingsResponse.data.data.pagespeedKeySet === true) { if (settingsResponse.data.data.pagespeedKeySet === true) {
File renamed without changes.
File renamed without changes.
@@ -1,9 +1,9 @@
import { useState, useEffect, useCallback } from "react"; import { useState, useEffect, useCallback } from "react";
import { createToast } from "../../Utils/toastUtils.jsx"; import { createToast } from "../Utils/toastUtils.jsx";
import { networkService } from "../../main.jsx"; import { networkService } from "../main.jsx";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { NOTIFICATION_TYPES } from "../../Pages/v1/Notifications/utils.js"; import { NOTIFICATION_TYPES } from "../Pages/Notifications/utils.js";
const useCreateNotification = () => { const useCreateNotification = () => {
const navigate = useNavigate(); const navigate = useNavigate();
@@ -1,7 +1,7 @@
import { useState } from "react"; import { useState } from "react";
import { networkService } from "../../main.jsx"; import { networkService } from "../main.jsx";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { createToast } from "../../Utils/toastUtils.jsx"; import { createToast } from "../Utils/toastUtils.jsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
const useSendTestEmail = () => { const useSendTestEmail = () => {
@@ -1,6 +1,6 @@
import { useEffect, useState, useCallback } from "react"; import { useEffect, useState, useCallback } from "react";
import { networkService } from "../../main.jsx"; import { networkService } from "../main.jsx";
import { createToast } from "../../Utils/toastUtils.jsx"; import { createToast } from "../Utils/toastUtils.jsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
export const useGetUser = (userId) => { export const useGetUser = (userId) => {
File renamed without changes.
@@ -1,8 +1,8 @@
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import { ROLES } from "../../../../../Utils/roleUtils.js"; import { ROLES } from "../../../../Utils/roleUtils.js";
import { editUserValidation } from "../../../../../Validation/validation.js"; import { editUserValidation } from "../../../../Validation/validation.js";
import Joi from "joi"; import Joi from "joi";
import { createToast } from "../../../../../Utils/toastUtils.jsx"; import { createToast } from "../../../../Utils/toastUtils.jsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
export const useEditUserForm = (user) => { export const useEditUserForm = (user) => {
const [searchInput, setSearchInput] = useState(""); const [searchInput, setSearchInput] = useState("");
@@ -11,8 +11,8 @@ import ChangePasswordModal from "@/Pages/Account/components/ChangePasswordModal/
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useGetUser, useEditUser } from "../../../../Hooks/v1/userHooks.js"; import { useGetUser, useEditUser } from "../../../Hooks/userHooks.js";
import { EDITABLE_ROLES, ROLES } from "../../../../Utils/roleUtils.js"; import { EDITABLE_ROLES, ROLES } from "../../../Utils/roleUtils.js";
import { useEditUserForm, useValidateEditUserForm } from "./hooks/editUser.js"; import { useEditUserForm, useValidateEditUserForm } from "./hooks/editUser.js";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
@@ -1,5 +1,5 @@
import { useState } from "react"; import { useState } from "react";
import { newOrChangedCredentials } from "../../../../../../Validation/validation.js"; import { newOrChangedCredentials } from "../../../../../Validation/validation.js";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
const useAddTeamMember = () => { const useAddTeamMember = () => {
const { t } = useTranslation(); const { t } = useTranslation();
@@ -2,10 +2,10 @@ import { Button, Stack } from "@mui/material";
import { GenericDialog } from "@/Components/v1/Dialog/genericDialog.jsx"; import { GenericDialog } from "@/Components/v1/Dialog/genericDialog.jsx";
import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx"; import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx";
import Select from "@/Components/v1/Inputs/Select/index.jsx"; import Select from "@/Components/v1/Inputs/Select/index.jsx";
import { useGetInviteToken } from "../../../../../Hooks/v1/inviteHooks.js"; import { useGetInviteToken } from "../../../../Hooks/inviteHooks.js";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { createToast } from "../../../../../Utils/toastUtils.jsx"; import { createToast } from "../../../../Utils/toastUtils.jsx";
import { useState } from "react"; import { useState } from "react";
import PasswordTooltip from "../../../Auth/components/PasswordTooltip.jsx"; import PasswordTooltip from "../../../Auth/components/PasswordTooltip.jsx";
import useAddTeamMember from "./hooks/useAddTeamMember.jsx"; import useAddTeamMember from "./hooks/useAddTeamMember.jsx";
@@ -2,12 +2,12 @@ import { useState } from "react";
import { Button, Stack } from "@mui/material"; import { Button, Stack } from "@mui/material";
import { GenericDialog } from "@/Components/v1/Dialog/genericDialog"; import { GenericDialog } from "@/Components/v1/Dialog/genericDialog";
import TextInput from "@/Components/v1/Inputs/TextInput"; import TextInput from "@/Components/v1/Inputs/TextInput";
import PasswordTooltip from "@/Pages/v1/Auth/components/PasswordTooltip"; import PasswordTooltip from "@/Pages/Auth/components/PasswordTooltip";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { createToast } from "../../../../Utils/toastUtils"; import { createToast } from "../../../../Utils/toastUtils";
import { PasswordEndAdornment } from "@/Components/v1/Inputs/TextInput/Adornments"; import { PasswordEndAdornment } from "@/Components/v1/Inputs/TextInput/Adornments";
import usePasswordFeedback from "@/Pages/v1/Auth/hooks/usePasswordFeedback"; import usePasswordFeedback from "@/Pages/Auth/hooks/usePasswordFeedback";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
const ChangePasswordModal = ({ isSaving, isLoading, changePassword }) => { const ChangePasswordModal = ({ isSaving, isLoading, changePassword }) => {
@@ -4,12 +4,12 @@ import { useTheme } from "@emotion/react";
import { Box, Stack, Typography, Button } from "@mui/material"; import { Box, Stack, Typography, Button } from "@mui/material";
import { PasswordEndAdornment } from "@/Components/v1/Inputs/TextInput/Adornments/index.jsx"; import { PasswordEndAdornment } from "@/Components/v1/Inputs/TextInput/Adornments/index.jsx";
import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx"; import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx";
import { newOrChangedCredentials } from "../../../../Validation/validation.js"; import { newOrChangedCredentials } from "../../../Validation/validation.js";
import Alert from "@/Components/v1/Alert/index.jsx"; import Alert from "@/Components/v1/Alert/index.jsx";
import { update } from "../../../../Features/Auth/authSlice.js"; import { update } from "../../../Features/Auth/authSlice.js";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { createToast } from "../../../../Utils/toastUtils.jsx"; import { createToast } from "../../../Utils/toastUtils.jsx";
import { getTouchedFieldErrors } from "../../../../Validation/error.js"; import { getTouchedFieldErrors } from "../../../Validation/error.js";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
const defaultPasswordsState = { const defaultPasswordsState = {
@@ -5,15 +5,11 @@ import { Box, Button, Divider, Stack, Typography } from "@mui/material";
import Avatar from "@/Components/v1/Avatar/index.jsx"; import Avatar from "@/Components/v1/Avatar/index.jsx";
import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx"; import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx";
import ImageUpload from "@/Components/v1/Inputs/ImageUpload/index.jsx"; import ImageUpload from "@/Components/v1/Inputs/ImageUpload/index.jsx";
import { newOrChangedCredentials } from "../../../../Validation/validation.js"; import { newOrChangedCredentials } from "../../../Validation/validation.js";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { import { clearAuthState, deleteUser, update } from "../../../Features/Auth/authSlice.js";
clearAuthState, import { createToast } from "../../../Utils/toastUtils.jsx";
deleteUser, import { logger } from "../../../Utils/Logger.js";
update,
} from "../../../../Features/Auth/authSlice.js";
import { createToast } from "../../../../Utils/toastUtils.jsx";
import { logger } from "../../../../Utils/Logger.js";
import { GenericDialog } from "@/Components/v1/Dialog/genericDialog.jsx"; import { GenericDialog } from "@/Components/v1/Dialog/genericDialog.jsx";
import Dialog from "@/Components/v1/Dialog/index.jsx"; import Dialog from "@/Components/v1/Dialog/index.jsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -3,7 +3,7 @@ import DataTable from "@/Components/v1/Table/index.jsx";
import DeleteOutlineRoundedIcon from "@mui/icons-material/DeleteOutlineRounded"; import DeleteOutlineRoundedIcon from "@mui/icons-material/DeleteOutlineRounded";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { ROLES } from "../../../../../Utils/roleUtils.js"; import { ROLES } from "../../../../Utils/roleUtils.js";
const RoleTable = ({ roles, handleDeleteRole }) => { const RoleTable = ({ roles, handleDeleteRole }) => {
const { t } = useTranslation(); const { t } = useTranslation();
@@ -4,16 +4,16 @@ import { Button, ButtonGroup, Stack, Typography } from "@mui/material";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx"; import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx";
import { newOrChangedCredentials } from "../../../../Validation/validation.js"; import { newOrChangedCredentials } from "../../../Validation/validation.js";
import { networkService } from "../../../../main.jsx"; import { networkService } from "../../../main.jsx";
import { createToast } from "../../../../Utils/toastUtils.jsx"; import { createToast } from "../../../Utils/toastUtils.jsx";
import Select from "@/Components/v1/Inputs/Select/index.jsx"; import Select from "@/Components/v1/Inputs/Select/index.jsx";
import { GenericDialog } from "@/Components/v1/Dialog/genericDialog.jsx"; import { GenericDialog } from "@/Components/v1/Dialog/genericDialog.jsx";
import AddTeamMember from "./AddTeamMember/index.jsx"; import AddTeamMember from "./AddTeamMember/index.jsx";
import DataTable from "@/Components/v1/Table/index.jsx"; import DataTable from "@/Components/v1/Table/index.jsx";
import { useGetInviteToken } from "../../../../Hooks/v1/inviteHooks.js"; import { useGetInviteToken } from "../../../Hooks/inviteHooks.js";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useIsSuperAdmin } from "../../../../Hooks/v1/useIsAdmin.js"; import { useIsSuperAdmin } from "@/Hooks/useIsAdmin.js";
import AddMemberMenu from "./AddMemberMenu/index.jsx"; import AddMemberMenu from "./AddMemberMenu/index.jsx";
/** /**
* TeamPanel component manages the organization and team members, * TeamPanel component manages the organization and team members,
File renamed without changes.
@@ -3,12 +3,12 @@ import { useEffect, useState } from "react";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useDispatch } from "react-redux"; import { useDispatch } from "react-redux";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { createToast } from "../../../Utils/toastUtils.jsx"; import { createToast } from "../../Utils/toastUtils.jsx";
import { forgotPassword } from "../../../Features/Auth/authSlice.js"; import { forgotPassword } from "../../Features/Auth/authSlice.js";
import { Trans, useTranslation } from "react-i18next"; import { Trans, useTranslation } from "react-i18next";
import Background from "../../../assets/Images/background-grid.svg?react"; import Background from "@/assets/Images/background-grid.svg?react";
import EmailIcon from "../../../assets/icons/email.svg?react"; import EmailIcon from "@/assets/icons/email.svg?react";
import Logo from "../../../assets/icons/checkmate-icon.svg?react"; import Logo from "@/assets/icons/checkmate-icon.svg?react";
import IconBox from "@/Components/v1/IconBox/index.jsx"; import IconBox from "@/Components/v1/IconBox/index.jsx";
import "./index.css"; import "./index.css";
@@ -1,15 +1,15 @@
import { Box, Stack, Typography, Button } from "@mui/material"; import { Box, Stack, Typography, Button } from "@mui/material";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { createToast } from "../../../Utils/toastUtils.jsx"; import { createToast } from "../../Utils/toastUtils.jsx";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { forgotPassword } from "../../../Features/Auth/authSlice.js"; import { forgotPassword } from "../../Features/Auth/authSlice.js";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { newOrChangedCredentials } from "../../../Validation/validation.js"; import { newOrChangedCredentials } from "../../Validation/validation.js";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx"; import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx";
import Logo from "../../../assets/icons/checkmate-icon.svg?react"; import Logo from "@/assets/icons/checkmate-icon.svg?react";
import Key from "../../../assets/icons/key.svg?react"; import Key from "@/assets/icons/key.svg?react";
import Background from "../../../assets/Images/background-grid.svg?react"; import Background from "@/assets/Images/background-grid.svg?react";
import IconBox from "@/Components/v1/IconBox/index.jsx"; import IconBox from "@/Components/v1/IconBox/index.jsx";
import { Trans, useTranslation } from "react-i18next"; import { Trans, useTranslation } from "react-i18next";
import "./index.css"; import "./index.css";
@@ -1,7 +1,7 @@
import { useDispatch } from "react-redux"; import { useDispatch } from "react-redux";
import { login } from "../../../../../Features/Auth/authSlice.js"; import { login } from "../../../../Features/Auth/authSlice.js";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { createToast } from "../../../../../Utils/toastUtils.jsx"; import { createToast } from "../../../../Utils/toastUtils.jsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
const useLoginSubmit = () => { const useLoginSubmit = () => {
@@ -1,5 +1,5 @@
import { useState } from "react"; import { useState } from "react";
import { loginCredentials } from "../../../../../Validation/validation.js"; import { loginCredentials } from "../../../../Validation/validation.js";
const useValidateLoginForm = () => { const useValidateLoginForm = () => {
const [errors, setErrors] = useState({ const [errors, setErrors] = useState({
@@ -2,10 +2,10 @@ import { Box, Button, Stack, Typography } from "@mui/material";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useDispatch } from "react-redux"; import { useDispatch } from "react-redux";
import { clearAuthState } from "../../../Features/Auth/authSlice.js"; import { clearAuthState } from "../../Features/Auth/authSlice.js";
import Background from "../../../assets/Images/background-grid.svg?react"; import Background from "@/assets/Images/background-grid.svg?react";
import ConfirmIcon from "../../../assets/icons/check-outlined.svg?react"; import ConfirmIcon from "@/assets/icons/check-outlined.svg?react";
import Logo from "../../../assets/icons/checkmate-icon.svg?react"; import Logo from "@/assets/icons/checkmate-icon.svg?react";
import IconBox from "@/Components/v1/IconBox/index.jsx"; import IconBox from "@/Components/v1/IconBox/index.jsx";
import { Trans, useTranslation } from "react-i18next"; import { Trans, useTranslation } from "react-i18next";
import "./index.css"; import "./index.css";
@@ -13,11 +13,11 @@ import { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { networkService } from "../../../../main.jsx"; import { networkService } from "../../../main.jsx";
import { newOrChangedCredentials } from "../../../../Validation/validation.js"; import { newOrChangedCredentials } from "../../../Validation/validation.js";
import { register } from "../../../../Features/Auth/authSlice.js"; import { register } from "../../../Features/Auth/authSlice.js";
import AuthPageWrapper from "../components/AuthPageWrapper.jsx"; import AuthPageWrapper from "../components/AuthPageWrapper.jsx";
import { createToast } from "../../../../Utils/toastUtils.jsx"; import { createToast } from "../../../Utils/toastUtils.jsx";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
const getFeedbackStatus = (form, errors, field, criteria) => { const getFeedbackStatus = (form, errors, field, criteria) => {
@@ -4,16 +4,16 @@ import { useNavigate } from "react-router-dom";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { Box, Stack, Typography, Button } from "@mui/material"; import { Box, Stack, Typography, Button } from "@mui/material";
import { setNewPassword } from "../../../Features/Auth/authSlice.js"; import { setNewPassword } from "../../Features/Auth/authSlice.js";
import { createToast } from "../../../Utils/toastUtils.jsx"; import { createToast } from "../../Utils/toastUtils.jsx";
import { newOrChangedCredentials } from "../../../Validation/validation.js"; import { newOrChangedCredentials } from "../../Validation/validation.js";
import Check from "@/Components/v1/Check/Check.jsx"; import Check from "@/Components/v1/Check/Check.jsx";
import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx"; import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx";
import { PasswordEndAdornment } from "@/Components/v1/Inputs/TextInput/Adornments/index.jsx"; import { PasswordEndAdornment } from "@/Components/v1/Inputs/TextInput/Adornments/index.jsx";
import IconBox from "@/Components/v1/IconBox/index.jsx"; import IconBox from "@/Components/v1/IconBox/index.jsx";
import LockIcon from "../../../assets/icons/lock.svg?react"; import LockIcon from "@/assets/icons/lock.svg?react";
import Logo from "../../../assets/icons/checkmate-icon.svg?react"; import Logo from "@/assets/icons/checkmate-icon.svg?react";
import Background from "../../../assets/Images/background-grid.svg?react"; import Background from "@/assets/Images/background-grid.svg?react";
import "./index.css"; import "./index.css";
import { useValidatePassword } from "./hooks/useValidatePassword.jsx"; import { useValidatePassword } from "./hooks/useValidatePassword.jsx";
import { Trans, useTranslation } from "react-i18next"; import { Trans, useTranslation } from "react-i18next";
@@ -1,8 +1,8 @@
// Components // Components
import Stack from "@mui/material/Stack"; import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Logo from "../../../../assets/icons/checkmate-icon.svg?react"; import Logo from "@/assets/icons/checkmate-icon.svg?react";
import LanguageSelector from "../../../../Components/LanguageSelector.jsx"; import LanguageSelector from "@/Components/LanguageSelector.jsx";
import ThemeSwitch from "@/Components/v1/ThemeSwitch/index.jsx"; import ThemeSwitch from "@/Components/v1/ThemeSwitch/index.jsx";
// Utils // Utils
@@ -1,10 +1,10 @@
import Background from "../../../../assets/Images/background-grid.svg?react"; import Background from "@/assets/Images/background-grid.svg?react";
import Stack from "@mui/material/Stack"; import Stack from "@mui/material/Stack";
import Box from "@mui/material/Box"; import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import AuthHeader from "./AuthHeader.jsx"; import AuthHeader from "./AuthHeader.jsx";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import Logo from "../../../../assets/icons/checkmate-icon.svg?react"; import Logo from "@/assets/icons/checkmate-icon.svg?react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
const AuthPageWrapper = ({ children, heading, welcome }) => { const AuthPageWrapper = ({ children, heading, welcome }) => {
@@ -1,5 +1,5 @@
import { useState } from "react"; import { useState } from "react";
import { newOrChangedCredentials } from "../../../../Validation/validation.js"; import { newOrChangedCredentials } from "../../../Validation/validation.js";
const usePasswordFeedback = () => { const usePasswordFeedback = () => {
const [feedback, setFeedback] = useState({}); const [feedback, setFeedback] = useState({});
@@ -1,5 +1,5 @@
import { useMemo, useState } from "react"; import { useMemo, useState } from "react";
import { newOrChangedCredentials } from "../../../../Validation/validation.js"; import { newOrChangedCredentials } from "../../../Validation/validation.js";
const getFeedbackStatus = (form, errors, field, criteria) => { const getFeedbackStatus = (form, errors, field, criteria) => {
const fieldErrors = errors[field]; const fieldErrors = errors[field];
File renamed without changes.
@@ -13,14 +13,16 @@ import GenericFallback from "@/Components/v1/GenericFallback/index.jsx";
import NetworkError from "@/Components/v1/GenericFallback/NetworkError.jsx"; import NetworkError from "@/Components/v1/GenericFallback/NetworkError.jsx";
//Utils //Utils
import { formatDateWithTz } from "../../../../../Utils/timeUtils.js"; import { formatDateWithTz } from "@/Utils/timeUtils.js";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { useState } from "react"; import { useState } from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useFetchChecksTeam } from "../../../../../Hooks/v1/checkHooks.js"; import {
import { useFetchChecksByMonitor } from "../../../../../Hooks/v1/checkHooks.js"; useFetchChecksTeam,
import { useResolveIncident } from "../../../../../Hooks/v1/checkHooks.js"; useFetchChecksByMonitor,
useResolveIncident,
} from "@/Hooks/checkHooks.js";
import { Button, Typography, useTheme } from "@mui/material"; import { Button, Typography, useTheme } from "@mui/material";
import { lighten } from "@mui/material/styles"; import { lighten } from "@mui/material/styles";
@@ -1,11 +1,11 @@
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { Box, Stack, Typography } from "@mui/material"; import { Box, Stack, Typography } from "@mui/material";
import Background from "../../../../../assets/Images/background-grid.svg?react"; import Background from "@/assets/Images/background-grid.svg?react";
import AlertIcon from "../../../../../assets/icons/alert-icon.svg?react"; import AlertIcon from "@/assets/icons/alert-icon.svg?react";
import CheckIcon from "../../../../../assets/icons/check-icon.svg?react"; import CheckIcon from "@/assets/icons/check-icon.svg?react";
import CloseIcon from "../../../../../assets/icons/close-icon.svg?react"; import CloseIcon from "@/assets/icons/close-icon.svg?react";
import WarningIcon from "../../../../../assets/icons/warning-icon.svg?react"; import WarningIcon from "@/assets/icons/warning-icon.svg?react";
const StatusBox = ({ title, value, status }) => { const StatusBox = ({ title, value, status }) => {
const theme = useTheme(); const theme = useTheme();
@@ -9,9 +9,11 @@ import { Box, Button } from "@mui/material";
//Utils //Utils
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useFetchMonitorsByTeamId } from "../../../Hooks/v1/monitorHooks.js"; import { useFetchMonitorsByTeamId } from "@/Hooks/monitorHooks.js";
import { useFetchChecksSummaryByTeamId } from "../../../Hooks/v1/checkHooks.js"; import {
import { useAcknowledgeChecks } from "../../../Hooks/v1/checkHooks.js"; useFetchChecksSummaryByTeamId,
useAcknowledgeChecks,
} from "@/Hooks/checkHooks.js";
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import NetworkError from "@/Components/v1/GenericFallback/NetworkError.jsx"; import NetworkError from "@/Components/v1/GenericFallback/NetworkError.jsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -8,7 +8,7 @@ import GenericFallback from "@/Components/v1/GenericFallback/index.jsx";
import NetworkError from "@/Components/v1/GenericFallback/NetworkError.jsx"; import NetworkError from "@/Components/v1/GenericFallback/NetworkError.jsx";
//Utils //Utils
import { formatDateWithTz } from "../../../../../Utils/timeUtils.js"; import { formatDateWithTz } from "../../../../Utils/timeUtils.js";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -1,6 +1,6 @@
import { useState, useCallback } from "react"; import { useState, useCallback } from "react";
import { networkService } from "../../../../main.jsx"; import { networkService } from "../../../main.jsx";
import { createToast } from "../../../../Utils/toastUtils.jsx"; import { createToast } from "../../../Utils/toastUtils.jsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
/** /**
* Hook to fetch and manage incidents * Hook to fetch and manage incidents
@@ -14,7 +14,7 @@ import { useTranslation } from "react-i18next";
// Hooks // Hooks
import useFetchIncidents from "./hooks/useFetchIncidents.js"; import useFetchIncidents from "./hooks/useFetchIncidents.js";
import { useFetchMonitorsByTeamId } from "../../../Hooks/v1/monitorHooks.js"; import { useFetchMonitorsByTeamId } from "../../Hooks/monitorHooks.js";
const Incidents2 = () => { const Incidents2 = () => {
const { t } = useTranslation(); const { t } = useTranslation();
@@ -34,7 +34,7 @@ const Incidents2 = () => {
setUpdateTrigger((prev) => !prev); setUpdateTrigger((prev) => !prev);
}; };
const [monitors, , isLoadingMonitors, monitorsNetworkError] = useFetchMonitorsByTeamId( const [monitors, isLoadingMonitors, monitorsNetworkError] = useFetchMonitorsByTeamId(
{} {}
); );
@@ -1,7 +1,7 @@
import ConfigBox from "@/Components/v1/ConfigBox/index.jsx"; import ConfigBox from "@/Components/v1/ConfigBox/index.jsx";
import { Box, Stack, Typography } from "@mui/material"; import { Box, Stack, Typography } from "@mui/material";
import { CustomThreshold } from "./CustomThreshold/index.jsx"; import { CustomThreshold } from "./CustomThreshold/index.jsx";
import { capitalizeFirstLetter } from "../../../../../Utils/stringUtils.js"; import { capitalizeFirstLetter } from "../../../../Utils/stringUtils.js";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
@@ -1,5 +1,5 @@
import { Box, Stack, Tooltip, Typography } from "@mui/material"; import { Box, Stack, Tooltip, Typography } from "@mui/material";
import { useMonitorUtils } from "../../../../../Hooks/v1/useMonitorUtils.js"; import { useMonitorUtils } from "../../../../Hooks/useMonitorUtils.js";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import PulseDot from "@/Components/v1/Animated/PulseDot.jsx"; import PulseDot from "@/Components/v1/Animated/PulseDot.jsx";
@@ -1,7 +1,4 @@
import { import { useCreateMonitor, useUpdateMonitor } from "../../../../Hooks/monitorHooks.js";
useCreateMonitor,
useUpdateMonitor,
} from "../../../../../Hooks/v1/monitorHooks.js";
const useInfrastructureSubmit = () => { const useInfrastructureSubmit = () => {
const [createMonitor, isCreating] = useCreateMonitor(); const [createMonitor, isCreating] = useCreateMonitor();
const [updateMonitor, isUpdating] = useUpdateMonitor(); const [updateMonitor, isUpdating] = useUpdateMonitor();
@@ -1,6 +1,6 @@
import { useState } from "react"; import { useState } from "react";
import { infrastructureMonitorValidation } from "../../../../../Validation/validation.js"; import { infrastructureMonitorValidation } from "../../../../Validation/validation.js";
import { createToast } from "../../../../../Utils/toastUtils.jsx"; import { createToast } from "../../../../Utils/toastUtils.jsx";
const useValidateInfrastructureForm = () => { const useValidateInfrastructureForm = () => {
const [errors, setErrors] = useState({}); const [errors, setErrors] = useState({});
@@ -13,8 +13,8 @@ import CustomAlertsSection from "./Components/CustomAlertsSection.jsx";
import DiskSelection from "./Components/DiskSelection.jsx"; import DiskSelection from "./Components/DiskSelection.jsx";
// Utils // Utils
import NotificationsConfig from "@/Components/v1/NotificationConfig/index.jsx"; import NotificationsConfig from "@/Components/v1/NotificationConfig/index.jsx";
import { useGetNotificationsByTeamId } from "../../../../Hooks/v1/useNotifications.js"; import { useGetNotificationsByTeamId } from "../../../Hooks/useNotifications.js";
import { networkService } from "../../../../Utils/NetworkService"; import { networkService } from "../../../Utils/NetworkService.js";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
@@ -24,7 +24,7 @@ import {
useFetchGlobalSettings, useFetchGlobalSettings,
useFetchHardwareMonitorById, useFetchHardwareMonitorById,
usePauseMonitor, usePauseMonitor,
} from "../../../../Hooks/v1/monitorHooks.js"; } from "../../../Hooks/monitorHooks.js";
import useInfrastructureMonitorForm from "./hooks/useInfrastructureMonitorForm.jsx"; import useInfrastructureMonitorForm from "./hooks/useInfrastructureMonitorForm.jsx";
import useValidateInfrastructureForm from "./hooks/useValidateInfrastructureForm.jsx"; import useValidateInfrastructureForm from "./hooks/useValidateInfrastructureForm.jsx";
import useInfrastructureSubmit from "./hooks/useInfrastructureSubmit.jsx"; import useInfrastructureSubmit from "./hooks/useInfrastructureSubmit.jsx";
@@ -150,7 +150,8 @@ const CreateInfrastructureMonitor = () => {
const handleRemove = async (event) => { const handleRemove = async (event) => {
event.preventDefault(); event.preventDefault();
await deleteMonitor({ monitor, redirect: "/infrastructure" }); const TEMP_MONITOR = { id: monitor._id };
await deleteMonitor({ monitor: TEMP_MONITOR, redirect: "/infrastructure" });
}; };
const isBusy = const isBusy =
@@ -4,7 +4,7 @@ import StatusBoxes from "@/Components/v1/StatusBoxes/index.jsx";
import StatBox from "@/Components/v1/StatBox/index.jsx"; import StatBox from "@/Components/v1/StatBox/index.jsx";
//Utils //Utils
import { useMonitorUtils } from "../../../../../../Hooks/v1/useMonitorUtils.js"; import { useMonitorUtils } from "../../../../../Hooks/useMonitorUtils.js";
import { useHardwareUtils } from "../../Hooks/useHardwareUtils.jsx"; import { useHardwareUtils } from "../../Hooks/useHardwareUtils.jsx";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -13,8 +13,8 @@ import TabContext from "@mui/lab/TabContext";
// Utils // Utils
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useIsAdmin } from "../../../../Hooks/v1/useIsAdmin.js"; import { useIsAdmin } from "@/Hooks/useIsAdmin.js";
import { useFetchHardwareMonitorById } from "../../../../Hooks/v1/monitorHooks.js"; import { useFetchHardwareMonitorById } from "../../../Hooks/monitorHooks.js";
import { useState } from "react"; import { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
@@ -7,12 +7,12 @@ import { Stack } from "@mui/material";
import { InfrastructureMenu } from "../MonitorsTableMenu/index.jsx"; import { InfrastructureMenu } from "../MonitorsTableMenu/index.jsx";
import LoadingSpinner from "../../../../Uptime/Monitors/Components/LoadingSpinner/index.jsx"; import LoadingSpinner from "../../../../Uptime/Monitors/Components/LoadingSpinner/index.jsx";
// Assets // Assets
import CPUChipIcon from "../../../../../../assets/icons/cpu-chip.svg?react"; import CPUChipIcon from "@/assets/icons/cpu-chip.svg?react";
import CustomGauge from "@/Components/v1/Charts/CustomGauge/index.jsx"; import CustomGauge from "@/Components/v1/Charts/CustomGauge/index.jsx";
// Utils // Utils
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useMonitorUtils } from "../../../../../../Hooks/v1/useMonitorUtils.js"; import { useMonitorUtils } from "../../../../../Hooks/useMonitorUtils.js";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -115,7 +115,7 @@ const MonitorsTable = ({
: theme.palette.success.main; : theme.palette.success.main;
return { return {
id: monitor._id, id: monitor.id,
name: monitor.name, name: monitor.name,
url: monitor.url, url: monitor.url,
processor, processor,
@@ -3,13 +3,13 @@
import { useRef, useState } from "react"; import { useRef, useState } from "react";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { createToast } from "../../../../../../Utils/toastUtils.jsx"; import { createToast } from "@/Utils/toastUtils.jsx";
import { IconButton, Menu, MenuItem } from "@mui/material"; import { IconButton, Menu, MenuItem } from "@mui/material";
import Settings from "../../../../../../assets/icons/settings-bold.svg?react"; import Settings from "@/assets/icons/settings-bold.svg?react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import Dialog from "@/Components/v1/Dialog/index.jsx"; import Dialog from "@/Components/v1/Dialog/index.jsx";
import { networkService } from "../../../../../../Utils/NetworkService.js"; import { networkService } from "@/Utils/NetworkService.js";
import { usePauseMonitor } from "../../../../../../Hooks/v1/monitorHooks.js"; import { usePauseMonitor } from "@/Hooks/monitorHooks.js";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
/** /**
@@ -11,11 +11,12 @@ import SearchComponent from "../../Uptime/Monitors/Components/SearchComponent/in
// Utils // Utils
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useIsAdmin } from "../../../../Hooks/v1/useIsAdmin.js"; import { useIsAdmin } from "@/Hooks/useIsAdmin.js";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useFetchMonitorsByTeamId } from "../../../../Hooks/v1/monitorHooks.js"; import { useFetchMonitorsWithChecks } from "@/Hooks/monitorHooks.js";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { setRowsPerPage } from "../../../../Features/UI/uiSlice.js"; import { setRowsPerPage } from "../../../Features/UI/uiSlice.js";
// Constants // Constants
const TYPES = ["hardware"]; const TYPES = ["hardware"];
const BREADCRUMBS = [{ name: `infrastructure`, path: "/infrastructure" }]; const BREADCRUMBS = [{ name: `infrastructure`, path: "/infrastructure" }];
@@ -70,14 +71,14 @@ const InfrastructureMonitors = () => {
const field = toFilterStatus !== undefined ? "status" : undefined; const field = toFilterStatus !== undefined ? "status" : undefined;
const [monitors, summary, isLoading, networkError] = useFetchMonitorsByTeamId({ const [monitors, count, isLoading, networkError] = useFetchMonitorsWithChecks({
limit: 1,
types: TYPES, types: TYPES,
page, limit: 1,
page: page,
field: field, field: field,
filter: toFilterStatus ?? search, filter: toFilterStatus ?? search,
rowsPerPage, rowsPerPage: rowsPerPage,
updateTrigger, monitorUpdateTrigger: updateTrigger,
}); });
return ( return (
@@ -99,7 +100,7 @@ const InfrastructureMonitors = () => {
<Stack direction={"row"}> <Stack direction={"row"}>
<MonitorCountHeader <MonitorCountHeader
isLoading={isLoading} isLoading={isLoading}
monitorCount={summary?.totalMonitors ?? 0} monitorCount={count || 0}
/> />
<Filter <Filter
selectedStatus={selectedStatus} selectedStatus={selectedStatus}
@@ -122,7 +123,7 @@ const InfrastructureMonitors = () => {
isSearching={isSearching} isSearching={isSearching}
/> />
<Pagination <Pagination
itemCount={summary?.totalMonitors} itemCount={count || 0}
paginationLabel={t("monitors")} paginationLabel={t("monitors")}
page={page} page={page}
rowsPerPage={rowsPerPage} rowsPerPage={rowsPerPage}
@@ -7,7 +7,7 @@ import CircularProgress from "@mui/material/CircularProgress";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { getHumanReadableDuration } from "../../../../../../Utils/timeUtils.js"; import { getHumanReadableDuration } from "../../../../../Utils/timeUtils.js";
import { formatBytes } from "../../utils/utils.js"; import { formatBytes } from "../../utils/utils.js";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -6,8 +6,8 @@ import StatBox from "@/Components/v1/StatBox/index.jsx";
import StatusBoxes from "@/Components/v1/StatusBoxes/index.jsx"; import StatusBoxes from "@/Components/v1/StatusBoxes/index.jsx";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useFetchDiagnostics } from "../../../../Hooks/v1/logHooks.js"; import { useFetchDiagnostics } from "../../../Hooks/logHooks.js";
import { getHumanReadableDuration } from "../../../../Utils/timeUtils.js"; import { getHumanReadableDuration } from "../../../Utils/timeUtils.js";
import { formatBytes, getPercentage } from "./utils/utils.js"; import { formatBytes, getPercentage } from "./utils/utils.js";
const Diagnostics = () => { const Diagnostics = () => {
@@ -26,12 +26,12 @@ const Diagnostics = () => {
status="up" status="up"
heading={t("status")} heading={t("status")}
subHeading={ subHeading={
error error
? t("logsPage.logLevelSelect.values.error") ? t("logsPage.logLevelSelect.values.error")
: isLoading : isLoading
? t("commonSaving") ? t("commonSaving")
: diagnostics : diagnostics
? t("diagnosticsPage.diagnosticDescription") ? t("diagnosticsPage.diagnosticDescription")
: t("general.noOptionsFound", { unit: "data" }) : t("general.noOptionsFound", { unit: "data" })
} }
/> />
@@ -4,7 +4,7 @@ import Select from "@/Components/v1/Inputs/Select/index.jsx";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Divider from "@mui/material/Divider"; import Divider from "@mui/material/Divider";
import { useFetchLogs } from "../../../../Hooks/v1/logHooks.js"; import { useFetchLogs } from "../../../Hooks/logHooks.js";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import { useState } from "react"; import { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -51,7 +51,6 @@ const Logs = () => {
]; ];
return ( return (
<Stack gap={theme.spacing(4)}> <Stack gap={theme.spacing(4)}>
<Stack <Stack
direction="row" direction="row"
alignItems="center" alignItems="center"
Loaded 100 of 309 files, more files were not shown because too many files have changed in this diff. Show more