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

File renamed without changes.
@@ -1,8 +1,8 @@
import { useState, useEffect } from "react";
import { ROLES } from "../../../../../Utils/roleUtils.js";
import { editUserValidation } from "../../../../../Validation/validation.js";
import { ROLES } from "../../../../Utils/roleUtils.js";
import { editUserValidation } from "../../../../Validation/validation.js";
import Joi from "joi";
import { createToast } from "../../../../../Utils/toastUtils.jsx";
import { createToast } from "../../../../Utils/toastUtils.jsx";
import { useTranslation } from "react-i18next";
export const useEditUserForm = (user) => {
const [searchInput, setSearchInput] = useState("");
@@ -11,8 +11,8 @@ import ChangePasswordModal from "@/Pages/Account/components/ChangePasswordModal/
import { useParams } from "react-router-dom";
import { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next";
import { useGetUser, useEditUser } from "../../../../Hooks/v1/userHooks.js";
import { EDITABLE_ROLES, ROLES } from "../../../../Utils/roleUtils.js";
import { useGetUser, useEditUser } from "../../../Hooks/userHooks.js";
import { EDITABLE_ROLES, ROLES } from "../../../Utils/roleUtils.js";
import { useEditUserForm, useValidateEditUserForm } from "./hooks/editUser.js";
import { useSelector } from "react-redux";
@@ -1,5 +1,5 @@
import { useState } from "react";
import { newOrChangedCredentials } from "../../../../../../Validation/validation.js";
import { newOrChangedCredentials } from "../../../../../Validation/validation.js";
import { useTranslation } from "react-i18next";
const useAddTeamMember = () => {
const { t } = useTranslation();
@@ -2,10 +2,10 @@ import { Button, Stack } from "@mui/material";
import { GenericDialog } from "@/Components/v1/Dialog/genericDialog.jsx";
import TextInput from "@/Components/v1/Inputs/TextInput/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 { useTranslation } from "react-i18next";
import { createToast } from "../../../../../Utils/toastUtils.jsx";
import { createToast } from "../../../../Utils/toastUtils.jsx";
import { useState } from "react";
import PasswordTooltip from "../../../Auth/components/PasswordTooltip.jsx";
import useAddTeamMember from "./hooks/useAddTeamMember.jsx";
@@ -2,12 +2,12 @@ import { useState } from "react";
import { Button, Stack } from "@mui/material";
import { GenericDialog } from "@/Components/v1/Dialog/genericDialog";
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 { useTranslation } from "react-i18next";
import { createToast } from "../../../../Utils/toastUtils";
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";
const ChangePasswordModal = ({ isSaving, isLoading, changePassword }) => {
@@ -4,12 +4,12 @@ import { useTheme } from "@emotion/react";
import { Box, Stack, Typography, Button } from "@mui/material";
import { PasswordEndAdornment } from "@/Components/v1/Inputs/TextInput/Adornments/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 { update } from "../../../../Features/Auth/authSlice.js";
import { update } from "../../../Features/Auth/authSlice.js";
import { useDispatch, useSelector } from "react-redux";
import { createToast } from "../../../../Utils/toastUtils.jsx";
import { getTouchedFieldErrors } from "../../../../Validation/error.js";
import { createToast } from "../../../Utils/toastUtils.jsx";
import { getTouchedFieldErrors } from "../../../Validation/error.js";
import { useTranslation } from "react-i18next";
const defaultPasswordsState = {
@@ -5,15 +5,11 @@ import { Box, Button, Divider, Stack, Typography } from "@mui/material";
import Avatar from "@/Components/v1/Avatar/index.jsx";
import TextInput from "@/Components/v1/Inputs/TextInput/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 {
clearAuthState,
deleteUser,
update,
} from "../../../../Features/Auth/authSlice.js";
import { createToast } from "../../../../Utils/toastUtils.jsx";
import { logger } from "../../../../Utils/Logger.js";
import { clearAuthState, deleteUser, 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 Dialog from "@/Components/v1/Dialog/index.jsx";
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 { useTranslation } from "react-i18next";
import { ROLES } from "../../../../../Utils/roleUtils.js";
import { ROLES } from "../../../../Utils/roleUtils.js";
const RoleTable = ({ roles, handleDeleteRole }) => {
const { t } = useTranslation();
@@ -4,16 +4,16 @@ import { Button, ButtonGroup, Stack, Typography } from "@mui/material";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx";
import { newOrChangedCredentials } from "../../../../Validation/validation.js";
import { networkService } from "../../../../main.jsx";
import { createToast } from "../../../../Utils/toastUtils.jsx";
import { newOrChangedCredentials } from "../../../Validation/validation.js";
import { networkService } from "../../../main.jsx";
import { createToast } from "../../../Utils/toastUtils.jsx";
import Select from "@/Components/v1/Inputs/Select/index.jsx";
import { GenericDialog } from "@/Components/v1/Dialog/genericDialog.jsx";
import AddTeamMember from "./AddTeamMember/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 { useIsSuperAdmin } from "../../../../Hooks/v1/useIsAdmin.js";
import { useIsSuperAdmin } from "@/Hooks/useIsAdmin.js";
import AddMemberMenu from "./AddMemberMenu/index.jsx";
/**
* 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 { useDispatch } from "react-redux";
import { useNavigate } from "react-router-dom";
import { createToast } from "../../../Utils/toastUtils.jsx";
import { forgotPassword } from "../../../Features/Auth/authSlice.js";
import { createToast } from "../../Utils/toastUtils.jsx";
import { forgotPassword } from "../../Features/Auth/authSlice.js";
import { Trans, useTranslation } from "react-i18next";
import Background from "../../../assets/Images/background-grid.svg?react";
import EmailIcon from "../../../assets/icons/email.svg?react";
import Logo from "../../../assets/icons/checkmate-icon.svg?react";
import Background from "@/assets/Images/background-grid.svg?react";
import EmailIcon from "@/assets/icons/email.svg?react";
import Logo from "@/assets/icons/checkmate-icon.svg?react";
import IconBox from "@/Components/v1/IconBox/index.jsx";
import "./index.css";
@@ -1,15 +1,15 @@
import { Box, Stack, Typography, Button } from "@mui/material";
import { useTheme } from "@emotion/react";
import { createToast } from "../../../Utils/toastUtils.jsx";
import { createToast } from "../../Utils/toastUtils.jsx";
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 { newOrChangedCredentials } from "../../../Validation/validation.js";
import { newOrChangedCredentials } from "../../Validation/validation.js";
import { useNavigate } from "react-router-dom";
import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx";
import Logo from "../../../assets/icons/checkmate-icon.svg?react";
import Key from "../../../assets/icons/key.svg?react";
import Background from "../../../assets/Images/background-grid.svg?react";
import Logo from "@/assets/icons/checkmate-icon.svg?react";
import Key from "@/assets/icons/key.svg?react";
import Background from "@/assets/Images/background-grid.svg?react";
import IconBox from "@/Components/v1/IconBox/index.jsx";
import { Trans, useTranslation } from "react-i18next";
import "./index.css";
@@ -1,7 +1,7 @@
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 { createToast } from "../../../../../Utils/toastUtils.jsx";
import { createToast } from "../../../../Utils/toastUtils.jsx";
import { useTranslation } from "react-i18next";
const useLoginSubmit = () => {
@@ -1,5 +1,5 @@
import { useState } from "react";
import { loginCredentials } from "../../../../../Validation/validation.js";
import { loginCredentials } from "../../../../Validation/validation.js";
const useValidateLoginForm = () => {
const [errors, setErrors] = useState({
@@ -2,10 +2,10 @@ import { Box, Button, Stack, Typography } from "@mui/material";
import { useTheme } from "@emotion/react";
import { useNavigate } from "react-router-dom";
import { useDispatch } from "react-redux";
import { clearAuthState } from "../../../Features/Auth/authSlice.js";
import Background from "../../../assets/Images/background-grid.svg?react";
import ConfirmIcon from "../../../assets/icons/check-outlined.svg?react";
import Logo from "../../../assets/icons/checkmate-icon.svg?react";
import { clearAuthState } from "../../Features/Auth/authSlice.js";
import Background from "@/assets/Images/background-grid.svg?react";
import ConfirmIcon from "@/assets/icons/check-outlined.svg?react";
import Logo from "@/assets/icons/checkmate-icon.svg?react";
import IconBox from "@/Components/v1/IconBox/index.jsx";
import { Trans, useTranslation } from "react-i18next";
import "./index.css";
@@ -13,11 +13,11 @@ import { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom";
import { useDispatch, useSelector } from "react-redux";
import { useParams } from "react-router-dom";
import { networkService } from "../../../../main.jsx";
import { newOrChangedCredentials } from "../../../../Validation/validation.js";
import { register } from "../../../../Features/Auth/authSlice.js";
import { networkService } from "../../../main.jsx";
import { newOrChangedCredentials } from "../../../Validation/validation.js";
import { register } from "../../../Features/Auth/authSlice.js";
import AuthPageWrapper from "../components/AuthPageWrapper.jsx";
import { createToast } from "../../../../Utils/toastUtils.jsx";
import { createToast } from "../../../Utils/toastUtils.jsx";
import PropTypes from "prop-types";
const getFeedbackStatus = (form, errors, field, criteria) => {
@@ -4,16 +4,16 @@ import { useNavigate } from "react-router-dom";
import { useParams } from "react-router-dom";
import { useTheme } from "@emotion/react";
import { Box, Stack, Typography, Button } from "@mui/material";
import { setNewPassword } from "../../../Features/Auth/authSlice.js";
import { createToast } from "../../../Utils/toastUtils.jsx";
import { newOrChangedCredentials } from "../../../Validation/validation.js";
import { setNewPassword } from "../../Features/Auth/authSlice.js";
import { createToast } from "../../Utils/toastUtils.jsx";
import { newOrChangedCredentials } from "../../Validation/validation.js";
import Check from "@/Components/v1/Check/Check.jsx";
import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx";
import { PasswordEndAdornment } from "@/Components/v1/Inputs/TextInput/Adornments/index.jsx";
import IconBox from "@/Components/v1/IconBox/index.jsx";
import LockIcon from "../../../assets/icons/lock.svg?react";
import Logo from "../../../assets/icons/checkmate-icon.svg?react";
import Background from "../../../assets/Images/background-grid.svg?react";
import LockIcon from "@/assets/icons/lock.svg?react";
import Logo from "@/assets/icons/checkmate-icon.svg?react";
import Background from "@/assets/Images/background-grid.svg?react";
import "./index.css";
import { useValidatePassword } from "./hooks/useValidatePassword.jsx";
import { Trans, useTranslation } from "react-i18next";
@@ -1,8 +1,8 @@
// Components
import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography";
import Logo from "../../../../assets/icons/checkmate-icon.svg?react";
import LanguageSelector from "../../../../Components/LanguageSelector.jsx";
import Logo from "@/assets/icons/checkmate-icon.svg?react";
import LanguageSelector from "@/Components/LanguageSelector.jsx";
import ThemeSwitch from "@/Components/v1/ThemeSwitch/index.jsx";
// 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 Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import AuthHeader from "./AuthHeader.jsx";
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";
const AuthPageWrapper = ({ children, heading, welcome }) => {
@@ -1,5 +1,5 @@
import { useState } from "react";
import { newOrChangedCredentials } from "../../../../Validation/validation.js";
import { newOrChangedCredentials } from "../../../Validation/validation.js";
const usePasswordFeedback = () => {
const [feedback, setFeedback] = useState({});
@@ -1,5 +1,5 @@
import { useMemo, useState } from "react";
import { newOrChangedCredentials } from "../../../../Validation/validation.js";
import { newOrChangedCredentials } from "../../../Validation/validation.js";
const getFeedbackStatus = (form, errors, field, criteria) => {
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";
//Utils
import { formatDateWithTz } from "../../../../../Utils/timeUtils.js";
import { formatDateWithTz } from "@/Utils/timeUtils.js";
import { useSelector } from "react-redux";
import { useState } from "react";
import PropTypes from "prop-types";
import { useTranslation } from "react-i18next";
import { useFetchChecksTeam } from "../../../../../Hooks/v1/checkHooks.js";
import { useFetchChecksByMonitor } from "../../../../../Hooks/v1/checkHooks.js";
import { useResolveIncident } from "../../../../../Hooks/v1/checkHooks.js";
import {
useFetchChecksTeam,
useFetchChecksByMonitor,
useResolveIncident,
} from "@/Hooks/checkHooks.js";
import { Button, Typography, useTheme } from "@mui/material";
import { lighten } from "@mui/material/styles";
@@ -1,11 +1,11 @@
import PropTypes from "prop-types";
import { useTheme } from "@emotion/react";
import { Box, Stack, Typography } from "@mui/material";
import Background from "../../../../../assets/Images/background-grid.svg?react";
import AlertIcon from "../../../../../assets/icons/alert-icon.svg?react";
import CheckIcon from "../../../../../assets/icons/check-icon.svg?react";
import CloseIcon from "../../../../../assets/icons/close-icon.svg?react";
import WarningIcon from "../../../../../assets/icons/warning-icon.svg?react";
import Background from "@/assets/Images/background-grid.svg?react";
import AlertIcon from "@/assets/icons/alert-icon.svg?react";
import CheckIcon from "@/assets/icons/check-icon.svg?react";
import CloseIcon from "@/assets/icons/close-icon.svg?react";
import WarningIcon from "@/assets/icons/warning-icon.svg?react";
const StatusBox = ({ title, value, status }) => {
const theme = useTheme();
@@ -9,9 +9,11 @@ import { Box, Button } from "@mui/material";
//Utils
import { useTheme } from "@emotion/react";
import { useFetchMonitorsByTeamId } from "../../../Hooks/v1/monitorHooks.js";
import { useFetchChecksSummaryByTeamId } from "../../../Hooks/v1/checkHooks.js";
import { useAcknowledgeChecks } from "../../../Hooks/v1/checkHooks.js";
import { useFetchMonitorsByTeamId } from "@/Hooks/monitorHooks.js";
import {
useFetchChecksSummaryByTeamId,
useAcknowledgeChecks,
} from "@/Hooks/checkHooks.js";
import { useState, useEffect } from "react";
import NetworkError from "@/Components/v1/GenericFallback/NetworkError.jsx";
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";
//Utils
import { formatDateWithTz } from "../../../../../Utils/timeUtils.js";
import { formatDateWithTz } from "../../../../Utils/timeUtils.js";
import { useSelector } from "react-redux";
import PropTypes from "prop-types";
import { useTranslation } from "react-i18next";
@@ -1,6 +1,6 @@
import { useState, useCallback } from "react";
import { networkService } from "../../../../main.jsx";
import { createToast } from "../../../../Utils/toastUtils.jsx";
import { networkService } from "../../../main.jsx";
import { createToast } from "../../../Utils/toastUtils.jsx";
import { useTranslation } from "react-i18next";
/**
* Hook to fetch and manage incidents
@@ -14,7 +14,7 @@ import { useTranslation } from "react-i18next";
// Hooks
import useFetchIncidents from "./hooks/useFetchIncidents.js";
import { useFetchMonitorsByTeamId } from "../../../Hooks/v1/monitorHooks.js";
import { useFetchMonitorsByTeamId } from "../../Hooks/monitorHooks.js";
const Incidents2 = () => {
const { t } = useTranslation();
@@ -34,7 +34,7 @@ const Incidents2 = () => {
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 { Box, Stack, Typography } from "@mui/material";
import { CustomThreshold } from "./CustomThreshold/index.jsx";
import { capitalizeFirstLetter } from "../../../../../Utils/stringUtils.js";
import { capitalizeFirstLetter } from "../../../../Utils/stringUtils.js";
import { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next";
import PropTypes from "prop-types";
@@ -1,5 +1,5 @@
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 { useTranslation } from "react-i18next";
import PulseDot from "@/Components/v1/Animated/PulseDot.jsx";
@@ -1,7 +1,4 @@
import {
useCreateMonitor,
useUpdateMonitor,
} from "../../../../../Hooks/v1/monitorHooks.js";
import { useCreateMonitor, useUpdateMonitor } from "../../../../Hooks/monitorHooks.js";
const useInfrastructureSubmit = () => {
const [createMonitor, isCreating] = useCreateMonitor();
const [updateMonitor, isUpdating] = useUpdateMonitor();
@@ -1,6 +1,6 @@
import { useState } from "react";
import { infrastructureMonitorValidation } from "../../../../../Validation/validation.js";
import { createToast } from "../../../../../Utils/toastUtils.jsx";
import { infrastructureMonitorValidation } from "../../../../Validation/validation.js";
import { createToast } from "../../../../Utils/toastUtils.jsx";
const useValidateInfrastructureForm = () => {
const [errors, setErrors] = useState({});
@@ -13,8 +13,8 @@ import CustomAlertsSection from "./Components/CustomAlertsSection.jsx";
import DiskSelection from "./Components/DiskSelection.jsx";
// Utils
import NotificationsConfig from "@/Components/v1/NotificationConfig/index.jsx";
import { useGetNotificationsByTeamId } from "../../../../Hooks/v1/useNotifications.js";
import { networkService } from "../../../../Utils/NetworkService";
import { useGetNotificationsByTeamId } from "../../../Hooks/useNotifications.js";
import { networkService } from "../../../Utils/NetworkService.js";
import { useParams } from "react-router-dom";
import { useState, useEffect } from "react";
import { useTheme } from "@emotion/react";
@@ -24,7 +24,7 @@ import {
useFetchGlobalSettings,
useFetchHardwareMonitorById,
usePauseMonitor,
} from "../../../../Hooks/v1/monitorHooks.js";
} from "../../../Hooks/monitorHooks.js";
import useInfrastructureMonitorForm from "./hooks/useInfrastructureMonitorForm.jsx";
import useValidateInfrastructureForm from "./hooks/useValidateInfrastructureForm.jsx";
import useInfrastructureSubmit from "./hooks/useInfrastructureSubmit.jsx";
@@ -150,7 +150,8 @@ const CreateInfrastructureMonitor = () => {
const handleRemove = async (event) => {
event.preventDefault();
await deleteMonitor({ monitor, redirect: "/infrastructure" });
const TEMP_MONITOR = { id: monitor._id };
await deleteMonitor({ monitor: TEMP_MONITOR, redirect: "/infrastructure" });
};
const isBusy =
@@ -4,7 +4,7 @@ import StatusBoxes from "@/Components/v1/StatusBoxes/index.jsx";
import StatBox from "@/Components/v1/StatBox/index.jsx";
//Utils
import { useMonitorUtils } from "../../../../../../Hooks/v1/useMonitorUtils.js";
import { useMonitorUtils } from "../../../../../Hooks/useMonitorUtils.js";
import { useHardwareUtils } from "../../Hooks/useHardwareUtils.jsx";
import { useTranslation } from "react-i18next";
@@ -13,8 +13,8 @@ import TabContext from "@mui/lab/TabContext";
// Utils
import { useTheme } from "@emotion/react";
import { useIsAdmin } from "../../../../Hooks/v1/useIsAdmin.js";
import { useFetchHardwareMonitorById } from "../../../../Hooks/v1/monitorHooks.js";
import { useIsAdmin } from "@/Hooks/useIsAdmin.js";
import { useFetchHardwareMonitorById } from "../../../Hooks/monitorHooks.js";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { useParams } from "react-router-dom";
@@ -7,12 +7,12 @@ import { Stack } from "@mui/material";
import { InfrastructureMenu } from "../MonitorsTableMenu/index.jsx";
import LoadingSpinner from "../../../../Uptime/Monitors/Components/LoadingSpinner/index.jsx";
// 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";
// Utils
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 PropTypes from "prop-types";
import { useTranslation } from "react-i18next";
@@ -115,7 +115,7 @@ const MonitorsTable = ({
: theme.palette.success.main;
return {
id: monitor._id,
id: monitor.id,
name: monitor.name,
url: monitor.url,
processor,
@@ -3,13 +3,13 @@
import { useRef, useState } from "react";
import { useTheme } from "@emotion/react";
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 Settings from "../../../../../../assets/icons/settings-bold.svg?react";
import Settings from "@/assets/icons/settings-bold.svg?react";
import PropTypes from "prop-types";
import Dialog from "@/Components/v1/Dialog/index.jsx";
import { networkService } from "../../../../../../Utils/NetworkService.js";
import { usePauseMonitor } from "../../../../../../Hooks/v1/monitorHooks.js";
import { networkService } from "@/Utils/NetworkService.js";
import { usePauseMonitor } from "@/Hooks/monitorHooks.js";
import { useTranslation } from "react-i18next";
/**
@@ -11,11 +11,12 @@ import SearchComponent from "../../Uptime/Monitors/Components/SearchComponent/in
// Utils
import { useTheme } from "@emotion/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 { useFetchMonitorsByTeamId } from "../../../../Hooks/v1/monitorHooks.js";
import { useFetchMonitorsWithChecks } from "@/Hooks/monitorHooks.js";
import { useDispatch, useSelector } from "react-redux";
import { setRowsPerPage } from "../../../../Features/UI/uiSlice.js";
import { setRowsPerPage } from "../../../Features/UI/uiSlice.js";
// Constants
const TYPES = ["hardware"];
const BREADCRUMBS = [{ name: `infrastructure`, path: "/infrastructure" }];
@@ -70,14 +71,14 @@ const InfrastructureMonitors = () => {
const field = toFilterStatus !== undefined ? "status" : undefined;
const [monitors, summary, isLoading, networkError] = useFetchMonitorsByTeamId({
limit: 1,
const [monitors, count, isLoading, networkError] = useFetchMonitorsWithChecks({
types: TYPES,
page,
limit: 1,
page: page,
field: field,
filter: toFilterStatus ?? search,
rowsPerPage,
updateTrigger,
rowsPerPage: rowsPerPage,
monitorUpdateTrigger: updateTrigger,
});
return (
@@ -99,7 +100,7 @@ const InfrastructureMonitors = () => {
<Stack direction={"row"}>
<MonitorCountHeader
isLoading={isLoading}
monitorCount={summary?.totalMonitors ?? 0}
monitorCount={count || 0}
/>
<Filter
selectedStatus={selectedStatus}
@@ -122,7 +123,7 @@ const InfrastructureMonitors = () => {
isSearching={isSearching}
/>
<Pagination
itemCount={summary?.totalMonitors}
itemCount={count || 0}
paginationLabel={t("monitors")}
page={page}
rowsPerPage={rowsPerPage}
@@ -7,7 +7,7 @@ import CircularProgress from "@mui/material/CircularProgress";
import { useTheme } from "@emotion/react";
import PropTypes from "prop-types";
import { getHumanReadableDuration } from "../../../../../../Utils/timeUtils.js";
import { getHumanReadableDuration } from "../../../../../Utils/timeUtils.js";
import { formatBytes } from "../../utils/utils.js";
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 { useTheme } from "@emotion/react";
import { useTranslation } from "react-i18next";
import { useFetchDiagnostics } from "../../../../Hooks/v1/logHooks.js";
import { getHumanReadableDuration } from "../../../../Utils/timeUtils.js";
import { useFetchDiagnostics } from "../../../Hooks/logHooks.js";
import { getHumanReadableDuration } from "../../../Utils/timeUtils.js";
import { formatBytes, getPercentage } from "./utils/utils.js";
const Diagnostics = () => {
@@ -26,12 +26,12 @@ const Diagnostics = () => {
status="up"
heading={t("status")}
subHeading={
error
error
? t("logsPage.logLevelSelect.values.error")
: isLoading
: isLoading
? t("commonSaving")
: diagnostics
? t("diagnosticsPage.diagnosticDescription")
: diagnostics
? t("diagnosticsPage.diagnosticDescription")
: 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 Divider from "@mui/material/Divider";
import { useFetchLogs } from "../../../../Hooks/v1/logHooks.js";
import { useFetchLogs } from "../../../Hooks/logHooks.js";
import { useTheme } from "@emotion/react";
import { useState } from "react";
import { useTranslation } from "react-i18next";
@@ -51,7 +51,6 @@ const Logs = () => {
];
return (
<Stack gap={theme.spacing(4)}>
<Stack
direction="row"
alignItems="center"
@@ -4,7 +4,7 @@ import DataTable from "@/Components/v1/Table/index.jsx";
import { useNavigate } from "react-router-dom";
import { useTheme } from "@emotion/react";
import { TypeToPathMap } from "../../../../../../Utils/monitorUtils.js";
import { TypeToPathMap } from "../../../../../Utils/monitorUtils.js";
import PropTypes from "prop-types";
import { useTranslation } from "react-i18next";
@@ -5,7 +5,7 @@ import Typography from "@mui/material/Typography";
import PropTypes from "prop-types";
import { useTheme } from "@emotion/react";
import { useNavigate } from "react-router-dom";
import { TypeToPathMap } from "../../../../../../Utils/monitorUtils.js";
import { TypeToPathMap } from "../../../../../Utils/monitorUtils.js";
import { useTranslation } from "react-i18next";
import { createHeaderFactory } from "@/Components/v1/Table/TableUtils.js";
@@ -10,7 +10,7 @@ import Divider from "@mui/material/Divider";
// Utils
import { useState } from "react";
import { useFetchQueueData, useFlushQueue } from "../../../../Hooks/v1/logHooks.js";
import { useFetchQueueData, useFlushQueue } from "../../../Hooks/logHooks.js";
import { useTranslation } from "react-i18next";
import { useTheme } from "@emotion/react";
File renamed without changes.
@@ -24,7 +24,7 @@ const MonitorListItem = ({ monitor, onDelete }) => {
MonitorListItem.propTypes = {
monitor: PropTypes.shape({
_id: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
}).isRequired,
onDelete: PropTypes.func.isRequired,
@@ -33,7 +33,7 @@ MonitorListItem.propTypes = {
const MonitorList = ({ selectedMonitors, setSelectedMonitors }) => {
const onDelete = (monitorToDelete) => {
const newMonitors = selectedMonitors.filter(
(monitor) => monitor._id !== monitorToDelete._id
(monitor) => monitor.id !== monitorToDelete.id
);
setSelectedMonitors(newMonitors);
};
@@ -47,7 +47,7 @@ const MonitorList = ({ selectedMonitors, setSelectedMonitors }) => {
>
{selectedMonitors?.map((monitor) => (
<MonitorListItem
key={monitor._id}
key={monitor.id}
monitor={monitor}
onDelete={onDelete}
/>
@@ -59,7 +59,7 @@ const MonitorList = ({ selectedMonitors, setSelectedMonitors }) => {
MonitorList.propTypes = {
selectedMonitors: PropTypes.arrayOf(
PropTypes.shape({
_id: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
})
).isRequired,
@@ -1,4 +1,4 @@
import { networkService } from "../../../../../main.jsx";
import { networkService } from "../../../../main.jsx";
import dayjs from "dayjs";
import {
MS_PER_SECOND,
@@ -6,7 +6,7 @@ import {
MS_PER_HOUR,
MS_PER_DAY,
MS_PER_WEEK,
} from "../../../../../Utils/timeUtils.js";
} from "../../../../Utils/timeUtils.js";
const useMaintenanceActions = () => {
const MS_LOOKUP = {
@@ -22,6 +22,12 @@ const useMaintenanceActions = () => {
weekly: MS_PER_DAY * 7,
};
const handleSubmitForm = async (maintenanceWindowId, form) => {
const toStringId = (monitor) => {
if (!monitor) {
return "";
}
return monitor._id ?? monitor.id ?? "";
};
const start = dayjs(form.startDate)
.set("hour", form.startTime.hour())
.set("minute", form.startTime.minute());
@@ -33,7 +39,7 @@ const useMaintenanceActions = () => {
const repeat = REPEAT_LOOKUP[form.repeat];
const submit = {
monitors: form.monitors.map((monitor) => monitor._id),
monitors: form.monitors.map((monitor) => toStringId(monitor)).filter(Boolean),
name: form.name,
start: start.toISOString(),
end: end.toISOString(),
@@ -1,4 +1,4 @@
import { networkService } from "../../../../../main.jsx";
import { networkService } from "../../../../main.jsx";
import dayjs from "dayjs";
import {
MS_PER_SECOND,
@@ -6,7 +6,7 @@ import {
MS_PER_HOUR,
MS_PER_DAY,
MS_PER_WEEK,
} from "../../../../../Utils/timeUtils.js";
} from "../../../../Utils/timeUtils.js";
const useMaintenanceData = () => {
const REVERSE_REPEAT_LOOKUP = {
0: "none",
@@ -41,7 +41,7 @@ const useMaintenanceData = () => {
limit: null,
types: ["http", "ping", "pagespeed", "port"],
});
const fetchedMonitors = response.data.data.monitors;
const fetchedMonitors = response.data.data;
return fetchedMonitors;
};
@@ -55,7 +55,9 @@ const useMaintenanceData = () => {
const endTime = dayjs(end);
const durationInMs = endTime.diff(startTime, "milliseconds").toString();
const { duration, durationUnit } = getDurationAndUnit(durationInMs);
const monitor = monitorList.find((monitor) => monitor._id === monitorId);
const monitor = monitorList.find(
(monitor) => (monitor._id ?? monitor.id) === monitorId
);
const maintenanceWindowInformation = {
name,
repeat: REVERSE_REPEAT_LOOKUP[repeat],
@@ -7,8 +7,8 @@ import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
import { LocalizationProvider } from "@mui/x-date-pickers";
import { DatePicker } from "@mui/x-date-pickers/DatePicker";
import { MobileTimePicker } from "@mui/x-date-pickers/MobileTimePicker";
import { maintenanceWindowValidation } from "../../../../Validation/validation.js";
import { createToast } from "../../../../Utils/toastUtils.jsx";
import { maintenanceWindowValidation } from "@/Validation/validation.js";
import { createToast } from "@/Utils/toastUtils.jsx";
import MonitorList from "./Components/MonitorList/index.jsx";
import ConfigSelect from "./Components/ConfigSelect/index.jsx";
import useMaintenanceData from "./hooks/useMaintenanceData.jsx";
@@ -16,13 +16,13 @@ import useMaintenanceActions from "./hooks/useMaintenanceActions.jsx";
import TextInput from "@/Components/v1/Inputs/TextInput/index.jsx";
import Breadcrumbs from "@/Components/v1/Breadcrumbs/index.jsx";
import CalendarIcon from "../../../../assets/icons/calendar.svg?react";
import CalendarIcon from "@/assets/icons/calendar.svg?react";
import "./index.css";
import Search from "@/Components/v1/Inputs/Search/index.jsx";
import { logger } from "../../../../Utils/Logger.js";
import { logger } from "@/Utils/Logger.js";
import { useNavigate, useParams } from "react-router-dom";
import { buildErrors, hasValidationErrors } from "../../../../Validation/error.js";
import { buildErrors, hasValidationErrors } from "@/Validation/error.js";
import { useTranslation } from "react-i18next";
import dayjs from "dayjs";
@@ -108,6 +108,7 @@ const CreateMaintenance = () => {
const handleSubmit = async () => {
if (hasValidationErrors(form, maintenanceWindowValidation, setErrors)) return;
const request = handleSubmitForm(maintenanceWindowId, form);
try {
setIsLoading(true);
@@ -3,11 +3,11 @@ import { useTheme } from "@emotion/react";
import { useNavigate } from "react-router-dom";
import { useSelector } from "react-redux";
import { IconButton, Menu, MenuItem } from "@mui/material";
import { logger } from "../../../../../Utils/Logger.js";
import Settings from "../../../../../assets/icons/settings-bold.svg?react";
import { logger } from "@/Utils/Logger.js";
import Settings from "@/assets/icons/settings-bold.svg?react";
import PropTypes from "prop-types";
import { networkService } from "../../../../../main.jsx";
import { createToast } from "../../../../../Utils/toastUtils.jsx";
import { networkService } from "../../../../main.jsx";
import { createToast } from "@/Utils/toastUtils.jsx";
import { useTranslation } from "react-i18next";
import Dialog from "@/Components/v1/Dialog/index.jsx";
@@ -7,9 +7,9 @@ import ArrowUpwardRoundedIcon from "@mui/icons-material/ArrowUpwardRounded";
import ActionsMenu from "./ActionsMenu/index.jsx";
import { memo } from "react";
import { useDispatch, useSelector } from "react-redux";
import { formatDurationRounded } from "../../../../Utils/timeUtils.js";
import { formatDurationRounded } from "../../../Utils/timeUtils.js";
import { StatusLabel } from "@/Components/v1/Label/index.jsx";
import { setRowsPerPage } from "../../../../Features/UI/uiSlice.js";
import { setRowsPerPage } from "../../../Features/UI/uiSlice.js";
import { useTranslation } from "react-i18next";
import { useTheme } from "@emotion/react";
import { useNavigate } from "react-router-dom";
@@ -4,7 +4,7 @@ import { useState, useEffect } from "react";
import "./index.css";
import MaintenanceTable from "./MaintenanceTable/index.jsx";
import { useSelector } from "react-redux";
import { networkService } from "../../../main.jsx";
import { networkService } from "../../main.jsx";
import Breadcrumbs from "@/Components/v1/Breadcrumbs/index.jsx";
import { useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
@@ -1,5 +1,5 @@
import PropTypes from "prop-types";
import NotFoundSvg from "../../../assets/Images/sushi_404.svg";
import NotFoundSvg from "@/assets/Images/sushi_404.svg";
import { Button, Stack, Typography } from "@mui/material";
import { useNavigate } from "react-router-dom";
import { useTheme } from "@emotion/react";
@@ -18,9 +18,9 @@ import {
useEditNotification,
useTestNotification,
useDeleteNotification,
} from "../../../../Hooks/v1/useNotifications.js";
import { notificationValidation } from "../../../../Validation/validation.js";
import { createToast } from "../../../../Utils/toastUtils.jsx";
} from "../../../Hooks/useNotifications.js";
import { notificationValidation } from "../../../Validation/validation.js";
import { createToast } from "../../../Utils/toastUtils.jsx";
import { useTranslation } from "react-i18next";
import { useParams, useNavigate } from "react-router-dom";
import {
Loaded 100 of 309 files, more files were not shown because too many files have changed in this diff. Show more