Added missing onChange functions

This commit is contained in:
Daniel Cojocea committed 2024-07-19 18:30:44 -04:00
1 parent 1aef3300f0
commit d615f9c120
1 file changed
+8 -4
@@ -70,8 +70,8 @@ const Configure = () => {
const idMap = { const idMap = {
"monitor-url": "url", "monitor-url": "url",
"monitor-name": "name", "monitor-name": "name",
"monitor-type": "type", "monitor-checks-http": "type",
"monitor-interval": "interval", "monitor-checks-ping": "type",
}; };
const [config, setConfig] = useState(); const [config, setConfig] = useState();
@@ -96,9 +96,9 @@ const Configure = () => {
fetchMonitor(); fetchMonitor();
}, [monitorId, authToken]); }, [monitorId, authToken]);
const handleChange = (event) => { const handleChange = (event, name) => {
const { value, id } = event.target; const { value, id } = event.target;
const name = idMap[id]; if (!name) name = idMap[id];
setMonitor((prev) => ({ setMonitor((prev) => ({
...prev, ...prev,
[name]: value, [name]: value,
@@ -258,6 +258,7 @@ const Configure = () => {
size="small" size="small"
value="http" value="http"
checked={monitor?.type === "http"} checked={monitor?.type === "http"}
onChange={handleChange}
/> />
<RadioButton <RadioButton
id="monitor-checks-ping" id="monitor-checks-ping"
@@ -266,6 +267,7 @@ const Configure = () => {
size="small" size="small"
value="ping" value="ping"
checked={monitor?.type === "ping"} checked={monitor?.type === "ping"}
onChange={handleChange}
/> />
<Box className="error-container"> <Box className="error-container">
{errors["type"] ? ( {errors["type"] ? (
@@ -291,6 +293,7 @@ const Configure = () => {
<Select <Select
id="monitor-interval" id="monitor-interval"
value={monitor?.interval || 1} value={monitor?.interval || 1}
inputProps={{ id: "monitor-interval-select" }}
MenuProps={{ MenuProps={{
PaperProps: { PaperProps: {
style: { style: {
@@ -299,6 +302,7 @@ const Configure = () => {
}, },
}} }}
IconComponent={KeyboardArrowDownIcon} IconComponent={KeyboardArrowDownIcon}
onChange={(event) => handleChange(event, "interval")}
> >
{frequencies.map((freq) => ( {frequencies.map((freq) => (
<MenuItem <MenuItem