add a checkbox to enable/disable advanced settings
This commit is contained in:
1 parent
1a7842164d
commit
e53901f6fd
1 file changed
+18
-4
@@ -13,10 +13,10 @@ import Stack from "@mui/material/Stack";
|
|||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import Switch from "@mui/material/Switch";
|
import Switch from "@mui/material/Switch";
|
||||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||||
|
import Checkbox from "../../../Components/Inputs/Checkbox";
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useNavigate } from "react-router-dom";
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -38,6 +38,8 @@ const CreateMonitor = () => {
|
|||||||
name: "",
|
name: "",
|
||||||
type: "http",
|
type: "http",
|
||||||
matchMethod: "equal",
|
matchMethod: "equal",
|
||||||
|
expectedValue: "",
|
||||||
|
jsonPath: "",
|
||||||
notifications: [],
|
notifications: [],
|
||||||
interval: 1,
|
interval: 1,
|
||||||
ignoreTlsErrors: false,
|
ignoreTlsErrors: false,
|
||||||
@@ -46,7 +48,6 @@ const CreateMonitor = () => {
|
|||||||
// Setup
|
// Setup
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const navigate = useNavigate();
|
|
||||||
const [notifications, notificationsAreLoading, error] = useGetNotificationsByTeamId();
|
const [notifications, notificationsAreLoading, error] = useGetNotificationsByTeamId();
|
||||||
const [createMonitor, isCreating] = useCreateMonitor();
|
const [createMonitor, isCreating] = useCreateMonitor();
|
||||||
|
|
||||||
@@ -147,7 +148,8 @@ const CreateMonitor = () => {
|
|||||||
notifications: monitor.notifications,
|
notifications: monitor.notifications,
|
||||||
};
|
};
|
||||||
|
|
||||||
await createMonitor({ monitor: form, redirect: "/uptime" });
|
console.log(JSON.stringify(form, null, 2));
|
||||||
|
// await createMonitor({ monitor: form, redirect: "/uptime" });
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChange = (event) => {
|
const onChange = (event) => {
|
||||||
@@ -156,6 +158,12 @@ const CreateMonitor = () => {
|
|||||||
if (name === "ignoreTlsErrors") {
|
if (name === "ignoreTlsErrors") {
|
||||||
newValue = checked;
|
newValue = checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (name === "useAdvancedMatching") {
|
||||||
|
setUseAdvancedMatching(checked);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const updatedMonitor = {
|
const updatedMonitor = {
|
||||||
...monitor,
|
...monitor,
|
||||||
[name]: newValue,
|
[name]: newValue,
|
||||||
@@ -393,7 +401,13 @@ const CreateMonitor = () => {
|
|||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
items={SELECT_VALUES}
|
items={SELECT_VALUES}
|
||||||
/>
|
/>
|
||||||
{monitor.type === "http" && (
|
<Checkbox
|
||||||
|
name="useAdvancedMatching"
|
||||||
|
label={t("advancedMatching")}
|
||||||
|
isChecked={useAdvancedMatching}
|
||||||
|
onChange={onChange}
|
||||||
|
/>
|
||||||
|
{monitor.type === "http" && useAdvancedMatching && (
|
||||||
<>
|
<>
|
||||||
<Select
|
<Select
|
||||||
name="matchMethod"
|
name="matchMethod"
|
||||||
|
|||||||
Reference in new issue
Block a user