Merge pull request #1263 from bluewave-labs/fix/fe/create-monitor-field-adornment

fix: remove start adornment from non-http type monitors
This commit is contained in:
Alexander Holliday authored and GitHub committed 2024-12-03 17:54:23 -08:00
commit a95c4b26f9
1 file changed
+24 -1
@@ -35,6 +35,24 @@ const CreateMonitor = () => {
{ _id: 5, name: "5 minutes" },
];
const monitorTypeMaps = {
http: {
label: "URL to monitor",
placeholder: "google.com",
namePlaceholder: "Google",
},
ping: {
label: "IP address to monitor",
placeholder: "1.1.1.1",
namePlaceholder: "Google",
},
docker: {
label: "Container ID",
placeholder: "abc123",
namePlaceholder: "My Container",
},
};
const { user, authToken } = useSelector((state) => state.auth);
const { monitors, isLoading } = useSelector((state) => state.uptimeMonitors);
const dispatch = useDispatch();
@@ -224,7 +242,12 @@ const CreateMonitor = () => {
<TextInput
type={monitor.type === "http" ? "url" : "text"}
id="monitor-url"
startAdornment={<HttpAdornment https={https} />}
startAdornment={
monitor.type === "http" ? <HttpAdornment https={https} /> : null
}
label={monitorTypeMaps[monitor.type].label || "URL to monitor"}
https={https}
placeholder={monitorTypeMaps[monitor.type].placeholder || ""}
value={monitor.url}
onChange={(event) => handleChange(event, "url")}
error={errors["url"] ? true : false}