diff --git a/Client/src/Features/UptimeMonitors/uptimeMonitorsSlice.js b/Client/src/Features/UptimeMonitors/uptimeMonitorsSlice.js index 76f56a2ca..4c2ab7237 100644 --- a/Client/src/Features/UptimeMonitors/uptimeMonitorsSlice.js +++ b/Client/src/Features/UptimeMonitors/uptimeMonitorsSlice.js @@ -88,6 +88,9 @@ export const updateUptimeMonitor = createAsyncThunk( description: monitor.description, interval: monitor.interval, notifications: monitor.notifications, + matchMethod: monitor.matchMethod, + expectedValue: monitor.expectedValue, + jsonPath: monitor.jsonPath, }; const res = await networkService.updateMonitor({ authToken: authToken, diff --git a/Client/src/Pages/Uptime/Configure/index.jsx b/Client/src/Pages/Uptime/Configure/index.jsx index 4839fd6f7..243e8ab36 100644 --- a/Client/src/Pages/Uptime/Configure/index.jsx +++ b/Client/src/Pages/Uptime/Configure/index.jsx @@ -61,6 +61,18 @@ const Configure = () => { "notify-email-default": "notification-email", }; + const matchMethodOptions = [ + { _id: "equal", name: "Equal" }, + { _id: "include", name: "Include" }, + { _id: "regex", name: "Regex" }, + ]; + + const expectedValuePlaceholders = { + regex: "^[\w.-]+@gmail.com$", + equal: "janet@gmail.com", + include: "@gmail.com" + }; + useEffect(() => { const fetchMonitor = async () => { try { @@ -439,6 +451,61 @@ const Configure = () => { onChange={(event) => handleChange(event, "interval")} items={frequencies} /> + { + monitor.type === "http" && <> + handleChange(event, "matchMethod")} + items={matchMethodOptions} + /> + + handleChange(event, "expectedValue")} + error={errors["expectedValue"] ? true : false} + helperText={errors["expectedValue"]} + /> + + The expected value is used to match against response result, and the match determines the status. + + + + handleChange(event, "jsonPath")} + error={errors["jsonPath"] ? true : false} + helperText={errors["jsonPath"]} + /> + + This expression will be evaluated against the reponse JSON data and the result will be used to match against the expected value. See  + + jmespath.org + +  for query language documentation. + + + + }