TLS/SSL
This commit is contained in:
1 parent
24ce64b439
commit
943e88c54d
4 files changed
+77
No files matched your search
@@ -0,0 +1,37 @@
|
|||||||
|
import { forwardRef } from "react";
|
||||||
|
import Switch from "@mui/material/Switch";
|
||||||
|
import type { SwitchProps } from "@mui/material/Switch";
|
||||||
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
|
||||||
|
export const SwitchComponent = forwardRef<HTMLInputElement, SwitchProps>(
|
||||||
|
function SwitchComponent({ sx, ...props }, ref) {
|
||||||
|
const theme = useTheme();
|
||||||
|
const additionalSx = Array.isArray(sx) ? sx : sx ? [sx] : [];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Switch
|
||||||
|
{...props}
|
||||||
|
slotProps={{
|
||||||
|
input: {
|
||||||
|
ref: ref,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
sx={[
|
||||||
|
{
|
||||||
|
"& .MuiSwitch-switchBase": {
|
||||||
|
"&.Mui-checked": {
|
||||||
|
color: "#E0E0E0",
|
||||||
|
"& + .MuiSwitch-track": {
|
||||||
|
backgroundColor: theme.palette.primary.main,
|
||||||
|
opacity: 1,
|
||||||
|
border: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
...additionalSx,
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -10,3 +10,4 @@ export {
|
|||||||
} from "./ToggleButton";
|
} from "./ToggleButton";
|
||||||
export { DialogInput as Dialog } from "./Dialog";
|
export { DialogInput as Dialog } from "./Dialog";
|
||||||
export * from "./Radio";
|
export * from "./Radio";
|
||||||
|
export * from "./Switch";
|
||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
TextField,
|
TextField,
|
||||||
Select,
|
Select,
|
||||||
Autocomplete,
|
Autocomplete,
|
||||||
|
SwitchComponent as Switch,
|
||||||
} from "@/Components/v2/inputs";
|
} from "@/Components/v2/inputs";
|
||||||
import { useGet } from "@/Hooks/UseApi";
|
import { useGet } from "@/Hooks/UseApi";
|
||||||
import { useMonitorForm } from "@/Hooks/useMonitorForm";
|
import { useMonitorForm } from "@/Hooks/useMonitorForm";
|
||||||
@@ -396,6 +397,35 @@ const CreateMonitorPage = () => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{/* TLS/SSL ConfigBox - only for HTTP monitors */}
|
||||||
|
{watchedType === "http" && (
|
||||||
|
<ConfigBox
|
||||||
|
title={t("pages.createMonitor.form.ignoreTls.title")}
|
||||||
|
subtitle={t("pages.createMonitor.form.ignoreTls.description")}
|
||||||
|
rightContent={
|
||||||
|
<Controller
|
||||||
|
name="ignoreTlsErrors"
|
||||||
|
control={control}
|
||||||
|
render={({ field }) => (
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
alignItems="center"
|
||||||
|
spacing={theme.spacing(2)}
|
||||||
|
>
|
||||||
|
<Switch
|
||||||
|
checked={field.value ?? false}
|
||||||
|
onChange={(e) => field.onChange(e.target.checked)}
|
||||||
|
/>
|
||||||
|
<Typography>
|
||||||
|
{t("pages.createMonitor.form.ignoreTls.option.tls.label")}
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Submit Button */}
|
{/* Submit Button */}
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
|
|||||||
@@ -278,6 +278,15 @@
|
|||||||
"notifications": {
|
"notifications": {
|
||||||
"title": "Notifications",
|
"title": "Notifications",
|
||||||
"description": "Select the notification channels you want to use"
|
"description": "Select the notification channels you want to use"
|
||||||
|
},
|
||||||
|
"ignoreTls": {
|
||||||
|
"title": "TLS/SSL settings",
|
||||||
|
"description": "Configure TLS/SSL certificate validation for HTTPS connections.",
|
||||||
|
"option": {
|
||||||
|
"tls": {
|
||||||
|
"label": "Ignore TLS/SSL errors"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user