Merge pull request #2175 from bluewave-labs/fix/edit-port-number

Add Port field edit support for Port Monitors Configure screen
This commit is contained in:
Alexander Holliday authored and GitHub committed 2025-05-02 09:16:25 -07:00
commit f1bd8fed53
4 files changed
+27 -1

No files matched your search

@@ -371,6 +371,17 @@ const Configure = () => {
value={parsedUrl?.host || monitor?.url || ""}
disabled={true}
/>
<TextInput
type="number"
id="monitor-port"
label={t("portToMonitor")}
placeholder="5173"
value={monitor.port || ""}
onChange={(event) => handleChange(event, "port")}
error={errors["port"] ? true : false}
helperText={errors["port"]}
hidden={monitor.type !== "port"}
/>
<TextInput
type="text"
id="monitor-name"
+1
View File
@@ -266,6 +266,7 @@ class NetworkService {
matchMethod: monitor.matchMethod,
expectedValue: monitor.expectedValue,
jsonPath: monitor.jsonPath,
...(monitor.type === "port" && { port: monitor.port }),
};
return this.axiosInstance.put(`/monitors/${monitorId}`, payload, {
headers: {
+14 -1
View File
@@ -152,7 +152,20 @@ const monitorValidation = joi.object({
"string.invalidUrl": "Please enter a valid URL with optional port",
"string.pattern.base": "Please enter a valid container ID.",
}),
port: joi.number(),
port: joi.number()
.integer()
.min(1)
.max(65535)
.when("type", {
is: "port",
then: joi.required().messages({
"number.base": "Port must be a number.",
"number.min": "Port must be at least 1.",
"number.max": "Port must be at most 65535.",
"any.required": "Port is required for port monitors.",
}),
otherwise: joi.optional(),
}),
name: joi.string().trim().max(50).allow("").messages({
"string.max": "This field should not exceed the 50 characters limit.",
}),
+1
View File
@@ -210,6 +210,7 @@ const editMonitorBodyValidation = joi.object({
jsonPath: joi.string().allow(""),
expectedValue: joi.string().allow(""),
matchMethod: joi.string(),
port: joi.number().min(1).max(65535),
thresholds: joi.object().keys({
usage_cpu: joi.number(),
usage_memory: joi.number(),