Merge pull request #2223 from Br0wnHammer/feat/fe/uptime-ignore-tls-error-config

Feat: Ignore TLS/SSL Error Option in Config
This commit is contained in:
Alexander Holliday authored and GitHub committed 2025-05-08 13:14:45 -07:00
commit 07dca41220
3 files changed
+42 -20

No files matched your search

@@ -81,11 +81,13 @@ export const updateUptimeMonitor = createAsyncThunk(
notifications: monitor.notifications,
matchMethod: monitor.matchMethod,
expectedValue: monitor.expectedValue,
ignoreTlsErrors: monitor.ignoreTlsErrors,
jsonPath: monitor.jsonPath,
...(monitor.type === "port" && { port: monitor.port }),
};
const res = await networkService.updateMonitor({
monitorId: monitor._id,
monitor,
updatedFields,
});
return res.data;
} catch (error) {
+35 -4
View File
@@ -2,7 +2,15 @@ import { useNavigate, useParams } from "react-router";
import { useTheme } from "@emotion/react";
import { useDispatch, useSelector } from "react-redux";
import { useEffect, useState } from "react";
import { Box, Stack, Tooltip, Typography, Button } from "@mui/material";
import {
Box,
Stack,
Tooltip,
Typography,
Button,
FormControlLabel,
Switch,
} from "@mui/material";
import { monitorValidation } from "../../../Validation/validation";
import { createToast } from "../../../Utils/toastUtils";
import { logger } from "../../../Utils/Logger";
@@ -95,7 +103,7 @@ const Configure = () => {
}, [monitorId, navigate]);
const handleChange = (event, name) => {
let { value, id } = event.target;
let { checked, value, id } = event.target;
if (!name) name = idMap[id];
if (name.includes("notification-")) {
@@ -127,6 +135,9 @@ const Configure = () => {
if (name === "interval") {
value = value * MS_PER_MINUTE;
}
if (name === "ignoreTlsErrors") {
value = checked;
}
setMonitor((prev) => ({
...prev,
[name]: value,
@@ -208,7 +219,6 @@ const Configure = () => {
setIsNotificationModalOpen(false);
};
const statusColor = {
true: theme.palette.success.main,
false: theme.palette.error.main,
@@ -476,7 +486,28 @@ const Configure = () => {
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">{t("distributedUptimeCreateAdvancedSettings")}</Typography>
<Typography component="h2">{t("ignoreTLSError")}</Typography>
<Typography component="p">{t("ignoreTLSErrorDescription")}</Typography>
</Box>
<Stack>
<FormControlLabel
control={
<Switch
name="ignore-error"
checked={monitor.ignoreTlsErrors}
onChange={(event) => handleChange(event, "ignoreTlsErrors")}
sx={{ mr: theme.spacing(2) }}
/>
}
label={t("tlsErrorIgnored")}
/>
</Stack>
</ConfigBox>
<ConfigBox>
<Box>
<Typography component="h2">
{t("distributedUptimeCreateAdvancedSettings")}
</Typography>
</Box>
<Stack gap={theme.spacing(20)}>
<Select
+4 -15
View File
@@ -52,7 +52,7 @@ class NetworkService {
// Return an empty resolved promise to stop the error propagation
return Promise.reject(error);
}
// Handle authentication errors
if (error.response && error.response.status === 401) {
@@ -267,17 +267,8 @@ class NetworkService {
* @returns {Promise<AxiosResponse>} The response from the axios PUT request.
*/
async updateMonitor(config) {
const { monitorId, monitor, updatedFields } = config;
const payload = updatedFields ?? {
name: monitor.name,
description: monitor.description,
interval: monitor.interval,
notifications: monitor.notifications,
matchMethod: monitor.matchMethod,
expectedValue: monitor.expectedValue,
jsonPath: monitor.jsonPath,
...(monitor.type === "port" && { port: monitor.port }),
};
const { monitorId, updatedFields } = config;
const payload = updatedFields;
return this.axiosInstance.put(`/monitors/${monitorId}`, payload, {
headers: {
"Content-Type": "application/json",
@@ -515,8 +506,6 @@ class NetworkService {
return this.axiosInstance.get("/auth/users/superadmin");
}
/**
* ************************************
* Get all users
@@ -933,7 +922,7 @@ class NetworkService {
onOpen?.();
};
this.eventSource.addEventListener("open", (e) => { });
this.eventSource.addEventListener("open", (e) => {});
this.eventSource.onmessage = (event) => {
const data = JSON.parse(event.data);