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:
4 files changed
+27
-1
No files matched your search
@@ -371,6 +371,17 @@ const Configure = () => {
|
|||||||
value={parsedUrl?.host || monitor?.url || ""}
|
value={parsedUrl?.host || monitor?.url || ""}
|
||||||
disabled={true}
|
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
|
<TextInput
|
||||||
type="text"
|
type="text"
|
||||||
id="monitor-name"
|
id="monitor-name"
|
||||||
|
|||||||
@@ -266,6 +266,7 @@ class NetworkService {
|
|||||||
matchMethod: monitor.matchMethod,
|
matchMethod: monitor.matchMethod,
|
||||||
expectedValue: monitor.expectedValue,
|
expectedValue: monitor.expectedValue,
|
||||||
jsonPath: monitor.jsonPath,
|
jsonPath: monitor.jsonPath,
|
||||||
|
...(monitor.type === "port" && { port: monitor.port }),
|
||||||
};
|
};
|
||||||
return this.axiosInstance.put(`/monitors/${monitorId}`, payload, {
|
return this.axiosInstance.put(`/monitors/${monitorId}`, payload, {
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -152,7 +152,20 @@ const monitorValidation = joi.object({
|
|||||||
"string.invalidUrl": "Please enter a valid URL with optional port",
|
"string.invalidUrl": "Please enter a valid URL with optional port",
|
||||||
"string.pattern.base": "Please enter a valid container ID.",
|
"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({
|
name: joi.string().trim().max(50).allow("").messages({
|
||||||
"string.max": "This field should not exceed the 50 characters limit.",
|
"string.max": "This field should not exceed the 50 characters limit.",
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -210,6 +210,7 @@ const editMonitorBodyValidation = joi.object({
|
|||||||
jsonPath: joi.string().allow(""),
|
jsonPath: joi.string().allow(""),
|
||||||
expectedValue: joi.string().allow(""),
|
expectedValue: joi.string().allow(""),
|
||||||
matchMethod: joi.string(),
|
matchMethod: joi.string(),
|
||||||
|
port: joi.number().min(1).max(65535),
|
||||||
thresholds: joi.object().keys({
|
thresholds: joi.object().keys({
|
||||||
usage_cpu: joi.number(),
|
usage_cpu: joi.number(),
|
||||||
usage_memory: joi.number(),
|
usage_memory: joi.number(),
|
||||||
|
|||||||
Reference in new issue
Block a user