diff --git a/Client/src/Components/Inputs/TextInput/index.jsx b/Client/src/Components/Inputs/TextInput/index.jsx index d97d1ebac..4d648803a 100644 --- a/Client/src/Components/Inputs/TextInput/index.jsx +++ b/Client/src/Components/Inputs/TextInput/index.jsx @@ -56,6 +56,7 @@ Optional.propTypes = { const TextInput = forwardRef( ( { + id, type, value, placeholder, @@ -63,12 +64,14 @@ const TextInput = forwardRef( isOptional, optionalLabel, onChange, + onBlur, error = false, helperText = null, startAdornment = null, endAdornment = null, label = null, maxWidth = "100%", + disabled = false, }, ref ) => { @@ -87,10 +90,12 @@ const TextInput = forwardRef( {isOptional && } ); @@ -113,18 +119,21 @@ TextInput.displayName = "TextInput"; TextInput.propTypes = { type: PropTypes.string, + id: PropTypes.string.isRequired, value: PropTypes.string, placeholder: PropTypes.string, isRequired: PropTypes.bool, isOptional: PropTypes.bool, optionalLabel: PropTypes.string, onChange: PropTypes.func, + onBlur: PropTypes.func, error: PropTypes.bool, helperText: PropTypes.string, startAdornment: PropTypes.node, endAdornment: PropTypes.node, label: PropTypes.string, maxWidth: PropTypes.string, + disabled: PropTypes.bool, }; export default TextInput; diff --git a/Client/src/Pages/Infrastructure/CreateMonitor/CustomThreshold/index.jsx b/Client/src/Pages/Infrastructure/CreateMonitor/CustomThreshold/index.jsx index 3b664eb5d..71f392d6b 100644 --- a/Client/src/Pages/Infrastructure/CreateMonitor/CustomThreshold/index.jsx +++ b/Client/src/Pages/Infrastructure/CreateMonitor/CustomThreshold/index.jsx @@ -1,5 +1,6 @@ import { Box, Stack, Typography } from "@mui/material"; import Field from "../../../../Components/Inputs/Field"; +import TextInput from "../../../../Components/Inputs/TextInput"; import Checkbox from "../../../../Components/Inputs/Checkbox"; import { useTheme } from "@emotion/react"; import PropTypes from "prop-types"; @@ -57,17 +58,17 @@ export const CustomThreshold = ({ justifyContent: "flex-end", }} > - + /> + { event.preventDefault(); const { value, id } = event.target; let name = appendedId ?? idMap[id] ?? id; - if (name.includes("notification-")) { name = name.replace("notification-", ""); let hasNotif = infrastructureMonitor.notifications.some( @@ -240,7 +239,7 @@ const CreateInfrastructureMonitor = () => { - { value={infrastructureMonitor.url} onBlur={handleBlur} onChange={handleChange} - error={errors["url"]} + error={errors["url"] ? true : false} + helperText={errors["url"]} /> - { onChange={handleChange} error={errors["name"]} /> - @@ -297,7 +298,8 @@ const CreateInfrastructureMonitor = () => { Customize alerts - Send a notification to user(s) when thresholds exceed a specified percentage. + Send a notification to user(s) when thresholds exceed a specified + percentage.