From 89d010a54bdf1fd76a4468e27603dd93d7c563d4 Mon Sep 17 00:00:00 2001 From: mohadeseh safari Date: Tue, 25 Mar 2025 18:16:11 -0400 Subject: [PATCH 1/5] uptime form improvement --- src/Pages/Uptime/Configure/index.jsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Pages/Uptime/Configure/index.jsx b/src/Pages/Uptime/Configure/index.jsx index 4a119bd0f..7434014c2 100644 --- a/src/Pages/Uptime/Configure/index.jsx +++ b/src/Pages/Uptime/Configure/index.jsx @@ -68,9 +68,9 @@ const Configure = () => { ]; const expectedValuePlaceholders = { - regex: "^[\w.-]+@gmail.com$", - equal: "janet@gmail.com", - include: "@gmail.com", + regex: "^2[0-9]{2}$", + equal: "200", + include: "success", }; useEffect(() => { @@ -479,8 +479,7 @@ const Configure = () => { color={theme.palette.primary.contrastTextTertiary} opacity={0.8} > - The expected value is used to match against response result, and - the match determines the status. + The expected value to check in the response. Examples: HTTP status code, text in response body, or specific value from JSON data. @@ -489,7 +488,7 @@ const Configure = () => { id="json-path" label="JSON Path" isOptional={true} - placeholder="data.email" + placeholder="data.status" value={monitor.jsonPath} onChange={(event) => handleChange(event, "jsonPath")} error={errors["jsonPath"] ? true : false} @@ -500,8 +499,7 @@ const Configure = () => { color={theme.palette.primary.contrastTextTertiary} opacity={0.8} > - This expression will be evaluated against the reponse JSON data - and the result will be used to match against the expected value. + Optional path to extract specific data from JSON responses. Common examples: "status", "data.status", "meta.code". Leave empty to check the entire response. See  Date: Tue, 25 Mar 2025 20:54:50 -0400 Subject: [PATCH 2/5] improve form --- src/Pages/Uptime/Create/index.jsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Pages/Uptime/Create/index.jsx b/src/Pages/Uptime/Create/index.jsx index 3b295f586..f7d0f6a4a 100644 --- a/src/Pages/Uptime/Create/index.jsx +++ b/src/Pages/Uptime/Create/index.jsx @@ -41,9 +41,9 @@ const CreateMonitor = () => { ]; const expectedValuePlaceholders = { - regex: "^[\w.-]+@gmail.com$", - equal: "janet@gmail.com", - include: "@gmail.com", + regex: "^2[0-9]{2}$", + equal: "200", + include: "success", }; const monitorTypeMaps = { @@ -465,8 +465,7 @@ const CreateMonitor = () => { color={theme.palette.primary.contrastTextTertiary} opacity={0.8} > - The expected value is used to match against response result, and the - match determines the status. + The expected value to check in the response. Examples: HTTP status code, text in response body, or specific value from JSON data. @@ -475,7 +474,7 @@ const CreateMonitor = () => { id="json-path" label="JSON Path" isOptional={true} - placeholder="data.email" + placeholder="data.status" value={monitor.jsonPath} onChange={(event) => handleChange(event, "jsonPath")} error={errors["jsonPath"] ? true : false} @@ -486,8 +485,8 @@ const CreateMonitor = () => { color={theme.palette.primary.contrastTextTertiary} opacity={0.8} > - This expression will be evaluated against the reponse JSON data and - the result will be used to match against the expected value. See  + Optional path to extract specific data from JSON responses. Common examples: "status", "data.status", "meta.code". Leave empty to check the entire response. + See  Date: Fri, 28 Mar 2025 11:59:10 -0400 Subject: [PATCH 3/5] modify --- src/Pages/Uptime/Configure/index.jsx | 2 +- src/Pages/Uptime/Create/index.jsx | 2 +- src/Utils/NetworkService.js | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Pages/Uptime/Configure/index.jsx b/src/Pages/Uptime/Configure/index.jsx index 7434014c2..5b58bf8be 100644 --- a/src/Pages/Uptime/Configure/index.jsx +++ b/src/Pages/Uptime/Configure/index.jsx @@ -479,7 +479,7 @@ const Configure = () => { color={theme.palette.primary.contrastTextTertiary} opacity={0.8} > - The expected value to check in the response. Examples: HTTP status code, text in response body, or specific value from JSON data. + The expected value to check in the response body content. Examples: specific text, HTML elements, or JSON values in the response. diff --git a/src/Pages/Uptime/Create/index.jsx b/src/Pages/Uptime/Create/index.jsx index f7d0f6a4a..2e264086f 100644 --- a/src/Pages/Uptime/Create/index.jsx +++ b/src/Pages/Uptime/Create/index.jsx @@ -465,7 +465,7 @@ const CreateMonitor = () => { color={theme.palette.primary.contrastTextTertiary} opacity={0.8} > - The expected value to check in the response. Examples: HTTP status code, text in response body, or specific value from JSON data. + The expected value to check in the response body content. Examples: specific text, HTML elements, or JSON values in the response. diff --git a/src/Utils/NetworkService.js b/src/Utils/NetworkService.js index ec8a10abf..30f447761 100644 --- a/src/Utils/NetworkService.js +++ b/src/Utils/NetworkService.js @@ -263,6 +263,9 @@ class NetworkService { description: monitor.description, interval: monitor.interval, notifications: monitor.notifications, + matchMethod: monitor.matchMethod, + expectedValue: monitor.expectedValue, + jsonPath: monitor.jsonPath, }; return this.axiosInstance.put(`/monitors/${monitorId}`, updatedFields, { headers: { From 5908b4457b0ea28b895e43c02e727a942bc0fe3e Mon Sep 17 00:00:00 2001 From: mohadeseh safari Date: Fri, 28 Mar 2025 13:06:40 -0400 Subject: [PATCH 4/5] change placeholders --- src/Pages/Uptime/Configure/index.jsx | 12 +++++++----- src/Pages/Uptime/Create/index.jsx | 13 +++++++------ src/Utils/NetworkService.js | 3 --- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Pages/Uptime/Configure/index.jsx b/src/Pages/Uptime/Configure/index.jsx index 5b58bf8be..e88f12441 100644 --- a/src/Pages/Uptime/Configure/index.jsx +++ b/src/Pages/Uptime/Configure/index.jsx @@ -68,9 +68,9 @@ const Configure = () => { ]; const expectedValuePlaceholders = { - regex: "^2[0-9]{2}$", - equal: "200", - include: "success", + regex: "^(success|ok)$", + equal: "success", + include: "ok", }; useEffect(() => { @@ -479,7 +479,8 @@ const Configure = () => { color={theme.palette.primary.contrastTextTertiary} opacity={0.8} > - The expected value to check in the response body content. Examples: specific text, HTML elements, or JSON values in the response. + The expected value is used to match against response result, and + the match determines the status. @@ -499,7 +500,8 @@ const Configure = () => { color={theme.palette.primary.contrastTextTertiary} opacity={0.8} > - Optional path to extract specific data from JSON responses. Common examples: "status", "data.status", "meta.code". Leave empty to check the entire response. + This expression will be evaluated against the reponse JSON data + and the result will be used to match against the expected value. See  { ]; const expectedValuePlaceholders = { - regex: "^2[0-9]{2}$", - equal: "200", - include: "success", + regex: "^(success|ok)$", + equal: "success", + include: "ok", }; const monitorTypeMaps = { @@ -465,7 +465,8 @@ const CreateMonitor = () => { color={theme.palette.primary.contrastTextTertiary} opacity={0.8} > - The expected value to check in the response body content. Examples: specific text, HTML elements, or JSON values in the response. + The expected value is used to match against response result, and the + match determines the status. @@ -485,8 +486,8 @@ const CreateMonitor = () => { color={theme.palette.primary.contrastTextTertiary} opacity={0.8} > - Optional path to extract specific data from JSON responses. Common examples: "status", "data.status", "meta.code". Leave empty to check the entire response. - See  + This expression will be evaluated against the reponse JSON data and + the result will be used to match against the expected value. See  Date: Fri, 28 Mar 2025 13:11:48 -0400 Subject: [PATCH 5/5] fix: save monitor configuration changes --- src/Utils/NetworkService.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Utils/NetworkService.js b/src/Utils/NetworkService.js index ec8a10abf..30f447761 100644 --- a/src/Utils/NetworkService.js +++ b/src/Utils/NetworkService.js @@ -263,6 +263,9 @@ class NetworkService { description: monitor.description, interval: monitor.interval, notifications: monitor.notifications, + matchMethod: monitor.matchMethod, + expectedValue: monitor.expectedValue, + jsonPath: monitor.jsonPath, }; return this.axiosInstance.put(`/monitors/${monitorId}`, updatedFields, { headers: {