Merge pull request #1234 from peterpardo/feat/create-monitor-display-name-v2

feat: Create monitor display name v2, resolves #992
This commit is contained in:
Alexander Holliday authored and GitHub committed 2024-12-01 18:53:40 -08:00
commit 1c41ed2860
4 files changed
+54 -1

No files matched your search

@@ -3,6 +3,7 @@ import { Box, Stack, Typography } from "@mui/material";
import LoadingButton from "@mui/lab/LoadingButton";
import { useSelector, useDispatch } from "react-redux";
import { infrastructureMonitorValidation } from "../../../Validation/validation";
import { parseDomainName } from "../../../Utils/monitorUtils";
import {
createInfrastructureMonitor,
checkInfrastructureEndpointResolution,
@@ -79,6 +80,15 @@ const CreateInfrastructureMonitor = () => {
const handleBlur = (event, appendID) => {
event.preventDefault();
const { value, id } = event.target;
let name = idMap[id] ?? id;
if (name === "url" && infrastructureMonitor.name === "") {
setInfrastructureMonitor((prev) => ({
...prev,
name: parseDomainName(value),
}));
}
if (id?.startsWith("notify-email-")) return;
const { error } = infrastructureMonitorValidation.validate(
{ [id ?? appendID]: value },