From 3c43fab7a6d82f176f8fddf0a656be603cc12c81 Mon Sep 17 00:00:00 2001
From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca>
Date: Fri, 14 Mar 2025 21:37:03 -0400
Subject: [PATCH 01/18] use config button component in monitorstatusheader
---
src/Pages/Infrastructure/Details/index.jsx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/Pages/Infrastructure/Details/index.jsx b/src/Pages/Infrastructure/Details/index.jsx
index 0006caf4e..f7f96f931 100644
--- a/src/Pages/Infrastructure/Details/index.jsx
+++ b/src/Pages/Infrastructure/Details/index.jsx
@@ -31,6 +31,7 @@ const InfrastructureDetails = () => {
const theme = useTheme();
const { monitorId } = useParams();
const { t } = useTranslation();
+ const isAdmin = useIsAdmin();
const { isLoading, networkError, monitor } = useHardwareMonitorsFetch({
monitorId,
@@ -74,7 +75,7 @@ const InfrastructureDetails = () => {
From f10b5b1e14738d1746074d6e54b573909aa1b5ae Mon Sep 17 00:00:00 2001
From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca>
Date: Fri, 14 Mar 2025 21:40:12 -0400
Subject: [PATCH 02/18] add the route for configure page
---
src/Routes/index.jsx | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/Routes/index.jsx b/src/Routes/index.jsx
index bf88c92f0..82d7af7ca 100644
--- a/src/Routes/index.jsx
+++ b/src/Routes/index.jsx
@@ -148,6 +148,10 @@ const Routes = () => {
path="infrastructure/create"
element={}
/>
+ }
+ />
}
From 55bd7d797309224bbfd4fa22f739a4bade35214c Mon Sep 17 00:00:00 2001
From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca>
Date: Fri, 14 Mar 2025 22:12:52 -0400
Subject: [PATCH 03/18] add isCreate flag to determine create/edit
---
src/Pages/Infrastructure/Create/index.jsx | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/Pages/Infrastructure/Create/index.jsx b/src/Pages/Infrastructure/Create/index.jsx
index 2c2a5505f..69e8e480a 100644
--- a/src/Pages/Infrastructure/Create/index.jsx
+++ b/src/Pages/Infrastructure/Create/index.jsx
@@ -1,12 +1,13 @@
// React, Redux, Router
import { useTheme } from "@emotion/react";
-import { useNavigate } from "react-router-dom";
-import { useState } from "react";
+import { useNavigate, useParams } from "react-router-dom";
+import { useState, useEffect } from "react";
import { useSelector, useDispatch } from "react-redux";
// Utility and Network
import { infrastructureMonitorValidation } from "../../../Validation/validation";
-import { createInfrastructureMonitor } from "../../../Features/InfrastructureMonitors/infrastructureMonitorsSlice";
+import { createInfrastructureMonitor, updateInfrastructureMonitor } from "../../../Features/InfrastructureMonitors/infrastructureMonitorsSlice";
+import { useHardwareMonitorsFetch } from "../Details/Hooks/useHardwareMonitorsFetch";
import { capitalizeFirstLetter } from "../../../Utils/stringUtils";
import { useTranslation } from "react-i18next";
@@ -53,7 +54,14 @@ const CreateInfrastructureMonitor = () => {
const monitorState = useSelector((state) => state.infrastructureMonitor);
const dispatch = useDispatch();
const navigate = useNavigate();
- const { t } = useTranslation();
+ const { monitorId } = useParams();
+ const { t } = useTranslation();
+
+ // Determine if we are creating or editing
+ const isCreate = typeof monitorId === "undefined";
+
+ // Fetch monitor details if editing
+ const { monitor, isLoading, networkError } = useHardwareMonitorsFetch({ monitorId });
// State
const [errors, setErrors] = useState({});
From 6b15a5814d8efe6afa34db3e9c96ef6854815429 Mon Sep 17 00:00:00 2001
From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca>
Date: Fri, 14 Mar 2025 22:14:06 -0400
Subject: [PATCH 04/18] implement useffect to populate form when editing
---
src/Pages/Infrastructure/Create/index.jsx | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/Pages/Infrastructure/Create/index.jsx b/src/Pages/Infrastructure/Create/index.jsx
index 69e8e480a..2cb554b95 100644
--- a/src/Pages/Infrastructure/Create/index.jsx
+++ b/src/Pages/Infrastructure/Create/index.jsx
@@ -82,6 +82,28 @@ const CreateInfrastructureMonitor = () => {
secret: "",
});
+ // Populate form fields if editing
+ useEffect(() => {
+ if (isCreate || !monitor) return;
+
+ setInfrastructureMonitor({
+ url: monitor.url.replace(/^https?:\/\//, ""),
+ name: monitor.name || "",
+ notifications: monitor.notifications || [],
+ interval: monitor.interval / MS_PER_MINUTE,
+ cpu: monitor.cpu || false,
+ usage_cpu: monitor.usage_cpu || "",
+ memory: monitor.memory || false,
+ usage_memory: monitor.usage_memory || "",
+ disk: monitor.disk || false,
+ usage_disk: monitor.usage_disk || "",
+ temperature: monitor.temperature || false,
+ usage_temperature: monitor.usage_temperature || "",
+ secret: monitor.secret || "",
+ });
+ setHttps(monitor.url.startsWith("https"));
+ }, [isCreate, monitor]);
+
// Handlers
const handleCreateInfrastructureMonitor = async (event) => {
event.preventDefault();
From b1029c9cec2a69d928c9ab1ed539e9c2314451c7 Mon Sep 17 00:00:00 2001
From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca>
Date: Fri, 14 Mar 2025 22:16:57 -0400
Subject: [PATCH 05/18] modify dispatch action to handle editing
---
src/Pages/Infrastructure/Create/index.jsx | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/Pages/Infrastructure/Create/index.jsx b/src/Pages/Infrastructure/Create/index.jsx
index 2cb554b95..d8a6eb00d 100644
--- a/src/Pages/Infrastructure/Create/index.jsx
+++ b/src/Pages/Infrastructure/Create/index.jsx
@@ -179,12 +179,17 @@ const CreateInfrastructureMonitor = () => {
thresholds,
};
- const action = await dispatch(createInfrastructureMonitor({ monitor: form }));
+ // Handle create or update
+ const action = isCreate
+ ? await dispatch(createInfrastructureMonitor({ monitor: form }))
+ : await dispatch(updateInfrastructureMonitor({ monitorId, monitor: form }));
if (action.meta.requestStatus === "fulfilled") {
- createToast({ body: "Infrastructure monitor created successfully!" });
+ createToast({
+ body: isCreate ? "Infrastructure monitor created successfully!" : "Infrastructure monitor updated successfully!",
+ });
navigate("/infrastructure");
} else {
- createToast({ body: "Failed to create monitor." });
+ createToast({ body: "Failed to save monitor." });
}
};
From bbe5c65b837d7824d6833d05e2e1472a5e1d48dc Mon Sep 17 00:00:00 2001
From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca>
Date: Fri, 14 Mar 2025 22:19:07 -0400
Subject: [PATCH 06/18] update breadcrumbs to include path for configure
---
src/Pages/Infrastructure/Create/index.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Pages/Infrastructure/Create/index.jsx b/src/Pages/Infrastructure/Create/index.jsx
index d8a6eb00d..3973d2181 100644
--- a/src/Pages/Infrastructure/Create/index.jsx
+++ b/src/Pages/Infrastructure/Create/index.jsx
@@ -250,7 +250,7 @@ const CreateInfrastructureMonitor = () => {
Date: Fri, 14 Mar 2025 22:33:21 -0400
Subject: [PATCH 07/18] update gb.json to include edit translations
---
src/Pages/Infrastructure/Create/index.jsx | 4 ++--
src/locales/gb.json | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/Pages/Infrastructure/Create/index.jsx b/src/Pages/Infrastructure/Create/index.jsx
index 3973d2181..fa228828a 100644
--- a/src/Pages/Infrastructure/Create/index.jsx
+++ b/src/Pages/Infrastructure/Create/index.jsx
@@ -270,7 +270,7 @@ const CreateInfrastructureMonitor = () => {
component="span"
fontSize="inherit"
>
- {t("infrastructureCreateYour")}{" "}
+ {t(isCreate? "infrastructureCreateYour": "infrastructureEditYour")}{" "}
{
onClick={handleCreateInfrastructureMonitor}
loading={monitorState?.isLoading}
>
- {t("infrastructureCreateMonitor")}
+ {t(isCreate? "infrastructureCreateMonitor": "infrastructureEditMonitor")}
diff --git a/src/locales/gb.json b/src/locales/gb.json
index e8ba56ffc..d01dad274 100644
--- a/src/locales/gb.json
+++ b/src/locales/gb.json
@@ -150,11 +150,13 @@
"incidentsOptionsHeaderLastWeek": "Last week",
"incidentsOptionsPlaceholderAllServers": "All servers",
"infrastructureCreateYour": "Create your",
+ "infrastructureEditYour": "Edit your",
"infrastructureCreateGeneralSettingsDescription": "Here you can select the URL of the host, together with the friendly name and authorization secret to connect to the server agent.",
"infrastructureServerRequirement": "The server you are monitoring must be running the",
"infrastructureCustomizeAlerts": "Customize alerts",
"infrastructureAlertNotificationDescription": "Send a notification to user(s) when thresholds exceed a specified percentage.",
"infrastructureCreateMonitor": "Create Infrastructure Monitor",
+ "infrastructureEditMonitor": "Save Infrastructure Monitor",
"infrastructureProtocol": "Protocol",
"infrastructureServerUrlLabel": "Server URL",
"infrastructureDisplayNameLabel": "Display name",
From 9e773f6917ce74d96d215da0166c66a0bbce031f Mon Sep 17 00:00:00 2001
From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca>
Date: Sat, 15 Mar 2025 00:21:37 -0400
Subject: [PATCH 08/18] format notifications to return object and added to
validation list
---
.../infrastructureMonitorsSlice.js | 8 ++--
src/Pages/Infrastructure/Create/index.jsx | 41 ++++++++++---------
src/Validation/validation.js | 6 +++
3 files changed, 32 insertions(+), 23 deletions(-)
diff --git a/src/Features/InfrastructureMonitors/infrastructureMonitorsSlice.js b/src/Features/InfrastructureMonitors/infrastructureMonitorsSlice.js
index af453a7ee..15d9c05cd 100644
--- a/src/Features/InfrastructureMonitors/infrastructureMonitorsSlice.js
+++ b/src/Features/InfrastructureMonitors/infrastructureMonitorsSlice.js
@@ -96,9 +96,8 @@ export const getInfrastructureMonitorsByTeamId = createAsyncThunk(
export const updateInfrastructureMonitor = createAsyncThunk(
"infrastructureMonitors/updateMonitor",
- async (data, thunkApi) => {
+ async ({ monitorId, monitor }, thunkApi) => {
try {
- const { monitor } = data;
const updatedFields = {
name: monitor.name,
description: monitor.description,
@@ -107,8 +106,9 @@ export const updateInfrastructureMonitor = createAsyncThunk(
threshold: monitor.threshold,
};
const res = await networkService.updateMonitor({
- monitorId: monitor._id,
- updatedFields: updatedFields,
+ monitorId,
+ monitor,
+ updatedFields,
});
return res.data;
} catch (error) {
diff --git a/src/Pages/Infrastructure/Create/index.jsx b/src/Pages/Infrastructure/Create/index.jsx
index fa228828a..c291b04b5 100644
--- a/src/Pages/Infrastructure/Create/index.jsx
+++ b/src/Pages/Infrastructure/Create/index.jsx
@@ -70,6 +70,7 @@ const CreateInfrastructureMonitor = () => {
url: "",
name: "",
notifications: [],
+ notify_email: false,
interval: 0.25,
cpu: false,
usage_cpu: "",
@@ -89,7 +90,8 @@ const CreateInfrastructureMonitor = () => {
setInfrastructureMonitor({
url: monitor.url.replace(/^https?:\/\//, ""),
name: monitor.name || "",
- notifications: monitor.notifications || [],
+ notifications: monitor.notifications?.filter(n => typeof n === "object") || [],
+ notify_email: (monitor.notifications?.length ?? 0) > 0,
interval: monitor.interval / MS_PER_MINUTE,
cpu: monitor.cpu || false,
usage_cpu: monitor.usage_cpu || "",
@@ -108,6 +110,14 @@ const CreateInfrastructureMonitor = () => {
const handleCreateInfrastructureMonitor = async (event) => {
event.preventDefault();
+ const formattedNotifications = infrastructureMonitor.notifications.map((n) =>
+ typeof n === "string" ? { type: "email", address: n } : n
+ );
+
+ if (infrastructureMonitor.notify_email) {
+ formattedNotifications.push({ type: "email", address: user.email });
+ }
+
// Build the form
let form = {
url: `http${https ? "s" : ""}://` + infrastructureMonitor.url,
@@ -133,6 +143,7 @@ const CreateInfrastructureMonitor = () => {
? { usage_temperature: infrastructureMonitor.usage_temperature }
: {}),
secret: infrastructureMonitor.secret,
+ notifications: formattedNotifications,
};
const { error } = infrastructureMonitorValidation.validate(form, {
@@ -220,30 +231,24 @@ const CreateInfrastructureMonitor = () => {
};
const handleNotifications = (event, type) => {
- const { value } = event.target;
+ const { value, checked } = event.target;
let notifications = [...infrastructureMonitor.notifications];
- const notificationExists = notifications.some((notification) => {
- if (notification.type === type && notification.address === value) {
- return true;
+
+ if (checked) {
+ if (!notifications.some((n) => n.type === type && n.address === value)) {
+ notifications.push({ type, address: value });
}
- return false;
- });
- if (notificationExists) {
- notifications = notifications.filter((notification) => {
- if (notification.type === type && notification.address === value) {
- return false;
- }
- return true;
- });
} else {
- notifications.push({ type, address: value });
+ notifications = notifications.filter((n) => !(n.type === type && n.address === value));
}
-
+
setInfrastructureMonitor((prev) => ({
...prev,
notifications,
+ notify_email: checked,
}));
};
+
return (
@@ -363,9 +368,7 @@ const CreateInfrastructureMonitor = () => {
notification.type === "email"
- )}
+ isChecked={infrastructureMonitor.notify_email}
value={user?.email}
onChange={(event) => handleNotifications(event, "email")}
/>
diff --git a/src/Validation/validation.js b/src/Validation/validation.js
index ed0aaf6b8..6e8ff76cb 100644
--- a/src/Validation/validation.js
+++ b/src/Validation/validation.js
@@ -349,6 +349,12 @@ const infrastructureMonitorValidation = joi.object({
"number.base": "Frequency must be a number.",
"any.required": "Frequency is required.",
}),
+ notifications: joi.array().items(
+ joi.object({
+ type: joi.string().valid("email").required(),
+ address: joi.string().email({ tlds: { allow: false } }).required(),
+ })
+ )
});
export {
From 2e449269de9d8d5b2d4aabf2ca33da2ee5098067 Mon Sep 17 00:00:00 2001
From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca>
Date: Sat, 15 Mar 2025 00:30:00 -0400
Subject: [PATCH 09/18] disable url textbox and hide protocol buttons in edit
mode
---
src/Pages/Infrastructure/Create/index.jsx | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/Pages/Infrastructure/Create/index.jsx b/src/Pages/Infrastructure/Create/index.jsx
index c291b04b5..feea6db7a 100644
--- a/src/Pages/Infrastructure/Create/index.jsx
+++ b/src/Pages/Infrastructure/Create/index.jsx
@@ -314,7 +314,9 @@ const CreateInfrastructureMonitor = () => {
onChange={handleChange}
error={errors["url"] ? true : false}
helperText={errors["url"]}
+ disabled={!isCreate}
/>
+ {isCreate && (
{t("infrastructureProtocol")}
@@ -334,6 +336,7 @@ const CreateInfrastructureMonitor = () => {
+ )}
Date: Sat, 15 Mar 2025 00:49:19 -0400
Subject: [PATCH 10/18] fix threshold values handling to populate when editing
---
src/Pages/Infrastructure/Create/index.jsx | 27 +++++++++++++----------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/src/Pages/Infrastructure/Create/index.jsx b/src/Pages/Infrastructure/Create/index.jsx
index feea6db7a..dba0b88ab 100644
--- a/src/Pages/Infrastructure/Create/index.jsx
+++ b/src/Pages/Infrastructure/Create/index.jsx
@@ -93,14 +93,17 @@ const CreateInfrastructureMonitor = () => {
notifications: monitor.notifications?.filter(n => typeof n === "object") || [],
notify_email: (monitor.notifications?.length ?? 0) > 0,
interval: monitor.interval / MS_PER_MINUTE,
- cpu: monitor.cpu || false,
- usage_cpu: monitor.usage_cpu || "",
- memory: monitor.memory || false,
- usage_memory: monitor.usage_memory || "",
- disk: monitor.disk || false,
- usage_disk: monitor.usage_disk || "",
- temperature: monitor.temperature || false,
- usage_temperature: monitor.usage_temperature || "",
+ cpu: monitor.thresholds?.usage_cpu !== undefined,
+ usage_cpu: monitor.thresholds?.usage_cpu ? monitor.thresholds.usage_cpu * 100 : "",
+
+ memory: monitor.thresholds?.usage_memory !== undefined,
+ usage_memory: monitor.thresholds?.usage_memory ? monitor.thresholds.usage_memory * 100 : "",
+
+ disk: monitor.thresholds?.usage_disk !== undefined,
+ usage_disk: monitor.thresholds?.usage_disk ? monitor.thresholds.usage_disk * 100 : "",
+
+ temperature: monitor.thresholds?.usage_temperature !== undefined,
+ usage_temperature: monitor.thresholds?.usage_temperature ? monitor.thresholds.usage_temperature * 100 : "",
secret: monitor.secret || "",
});
setHttps(monitor.url.startsWith("https"));
@@ -174,10 +177,10 @@ const CreateInfrastructureMonitor = () => {
} = form;
const thresholds = {
- ...(cpu ? { usage_cpu: usage_cpu / 100 } : {}),
- ...(memory ? { usage_memory: usage_memory / 100 } : {}),
- ...(disk ? { usage_disk: usage_disk / 100 } : {}),
- ...(temperature ? { usage_temperature: usage_temperature / 100 } : {}),
+ ...(infrastructureMonitor.cpu ? { usage_cpu: parseFloat(infrastructureMonitor.usage_cpu) / 100 } : {}),
+ ...(infrastructureMonitor.memory ? { usage_memory: parseFloat(infrastructureMonitor.usage_memory) / 100 } : {}),
+ ...(infrastructureMonitor.disk ? { usage_disk: parseFloat(infrastructureMonitor.usage_disk) / 100 } : {}),
+ ...(infrastructureMonitor.temperature ? { usage_temperature: parseFloat(infrastructureMonitor.usage_temperature) / 100 } : {}),
};
form = {
From c07f68dfb18ff0ff6abfebe2473513e6ecd4b4be Mon Sep 17 00:00:00 2001
From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca>
Date: Sat, 15 Mar 2025 01:38:52 -0400
Subject: [PATCH 11/18] update network service to handle all monitors properly
---
.../InfrastructureMonitors/infrastructureMonitorsSlice.js | 3 ++-
src/Utils/NetworkService.js | 6 +++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/Features/InfrastructureMonitors/infrastructureMonitorsSlice.js b/src/Features/InfrastructureMonitors/infrastructureMonitorsSlice.js
index 15d9c05cd..62bdf4811 100644
--- a/src/Features/InfrastructureMonitors/infrastructureMonitorsSlice.js
+++ b/src/Features/InfrastructureMonitors/infrastructureMonitorsSlice.js
@@ -103,7 +103,8 @@ export const updateInfrastructureMonitor = createAsyncThunk(
description: monitor.description,
interval: monitor.interval,
notifications: monitor.notifications,
- threshold: monitor.threshold,
+ thresholds: monitor.thresholds,
+ secret: monitor.secret,
};
const res = await networkService.updateMonitor({
monitorId,
diff --git a/src/Utils/NetworkService.js b/src/Utils/NetworkService.js
index ec8a10abf..e40edeecf 100644
--- a/src/Utils/NetworkService.js
+++ b/src/Utils/NetworkService.js
@@ -257,14 +257,14 @@ class NetworkService {
* @returns {Promise} The response from the axios PUT request.
*/
async updateMonitor(config) {
- const { monitorId, monitor } = config;
- const updatedFields = {
+ const { monitorId, monitor, updatedFields } = config;
+ const payload = updatedFields ?? {
name: monitor.name,
description: monitor.description,
interval: monitor.interval,
notifications: monitor.notifications,
};
- return this.axiosInstance.put(`/monitors/${monitorId}`, updatedFields, {
+ return this.axiosInstance.put(`/monitors/${monitorId}`, payload, {
headers: {
"Content-Type": "application/json",
},
From f9e4c0f857753876555a02a49dd5eacb1bb8398f Mon Sep 17 00:00:00 2001
From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca>
Date: Sat, 15 Mar 2025 01:54:20 -0400
Subject: [PATCH 12/18] update breadcrumbs to include configure
---
src/Pages/Infrastructure/Create/index.jsx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/Pages/Infrastructure/Create/index.jsx b/src/Pages/Infrastructure/Create/index.jsx
index dba0b88ab..a251be5b3 100644
--- a/src/Pages/Infrastructure/Create/index.jsx
+++ b/src/Pages/Infrastructure/Create/index.jsx
@@ -258,7 +258,10 @@ const CreateInfrastructureMonitor = () => {
Date: Sat, 15 Mar 2025 02:48:02 -0400
Subject: [PATCH 13/18] minor bug fixes and code cleanup
---
src/Pages/Infrastructure/Create/index.jsx | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/Pages/Infrastructure/Create/index.jsx b/src/Pages/Infrastructure/Create/index.jsx
index a251be5b3..6857be61e 100644
--- a/src/Pages/Infrastructure/Create/index.jsx
+++ b/src/Pages/Infrastructure/Create/index.jsx
@@ -61,7 +61,7 @@ const CreateInfrastructureMonitor = () => {
const isCreate = typeof monitorId === "undefined";
// Fetch monitor details if editing
- const { monitor, isLoading, networkError } = useHardwareMonitorsFetch({ monitorId });
+ const { monitor, isLoading, networkError } = isCreate ? {} : useHardwareMonitorsFetch({ monitorId });
// State
const [errors, setErrors] = useState({});
@@ -113,7 +113,7 @@ const CreateInfrastructureMonitor = () => {
const handleCreateInfrastructureMonitor = async (event) => {
event.preventDefault();
- const formattedNotifications = infrastructureMonitor.notifications.map((n) =>
+ const formattedNotifications = infrastructureMonitor.notifications.map((n) =>
typeof n === "string" ? { type: "email", address: n } : n
);
@@ -177,10 +177,10 @@ const CreateInfrastructureMonitor = () => {
} = form;
const thresholds = {
- ...(infrastructureMonitor.cpu ? { usage_cpu: parseFloat(infrastructureMonitor.usage_cpu) / 100 } : {}),
- ...(infrastructureMonitor.memory ? { usage_memory: parseFloat(infrastructureMonitor.usage_memory) / 100 } : {}),
- ...(infrastructureMonitor.disk ? { usage_disk: parseFloat(infrastructureMonitor.usage_disk) / 100 } : {}),
- ...(infrastructureMonitor.temperature ? { usage_temperature: parseFloat(infrastructureMonitor.usage_temperature) / 100 } : {}),
+ ...(cpu ? { usage_cpu: usage_cpu / 100 } : {}),
+ ...(memory ? { usage_memory: usage_memory / 100 } : {}),
+ ...(disk ? { usage_disk: usage_disk / 100 } : {}),
+ ...(temperature ? { usage_temperature: usage_temperature / 100 } : {}),
};
form = {
@@ -408,7 +408,7 @@ const CreateInfrastructureMonitor = () => {
isChecked={infrastructureMonitor[metric]}
fieldId={METRIC_PREFIX + metric}
fieldName={METRIC_PREFIX + metric}
- fieldValue={infrastructureMonitor[METRIC_PREFIX + metric]}
+ fieldValue={String(infrastructureMonitor[METRIC_PREFIX + metric])}
onFieldChange={handleChange}
alertUnit={metric == "temperature" ? "°C" : "%"}
/>
From 5c74c0e452b96b199a52383ebd11c14a928187a4 Mon Sep 17 00:00:00 2001
From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca>
Date: Tue, 18 Mar 2025 12:18:52 -0400
Subject: [PATCH 14/18] removed conditional calling of hook and added early
return in useHardwareMonitorsFetch
---
src/Pages/Infrastructure/Create/index.jsx | 2 +-
.../Details/Hooks/useHardwareMonitorsFetch.jsx | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/Pages/Infrastructure/Create/index.jsx b/src/Pages/Infrastructure/Create/index.jsx
index 6857be61e..be45439dc 100644
--- a/src/Pages/Infrastructure/Create/index.jsx
+++ b/src/Pages/Infrastructure/Create/index.jsx
@@ -61,7 +61,7 @@ const CreateInfrastructureMonitor = () => {
const isCreate = typeof monitorId === "undefined";
// Fetch monitor details if editing
- const { monitor, isLoading, networkError } = isCreate ? {} : useHardwareMonitorsFetch({ monitorId });
+ const { monitor, isLoading, networkError } = useHardwareMonitorsFetch({ monitorId });
// State
const [errors, setErrors] = useState({});
diff --git a/src/Pages/Infrastructure/Details/Hooks/useHardwareMonitorsFetch.jsx b/src/Pages/Infrastructure/Details/Hooks/useHardwareMonitorsFetch.jsx
index a5b84cfa4..229561966 100644
--- a/src/Pages/Infrastructure/Details/Hooks/useHardwareMonitorsFetch.jsx
+++ b/src/Pages/Infrastructure/Details/Hooks/useHardwareMonitorsFetch.jsx
@@ -2,6 +2,11 @@ import { useEffect, useState } from "react";
import { networkService } from "../../../../main";
const useHardwareMonitorsFetch = ({ monitorId, dateRange }) => {
+
+ // Abort early if creating monitor
+ if (!monitorId) {
+ return { monitor: null, isLoading: false, networkError: null };
+ }
const [isLoading, setIsLoading] = useState(true);
const [networkError, setNetworkError] = useState(false);
const [monitor, setMonitor] = useState(undefined);
From a006d7194e1a2efa152efe60a696fb011d8b1d3f Mon Sep 17 00:00:00 2001
From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca>
Date: Tue, 18 Mar 2025 13:59:11 -0400
Subject: [PATCH 15/18] fix notify_email state to only update for email
notification types
---
src/Pages/Infrastructure/Create/index.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Pages/Infrastructure/Create/index.jsx b/src/Pages/Infrastructure/Create/index.jsx
index be45439dc..6fd0f1fbe 100644
--- a/src/Pages/Infrastructure/Create/index.jsx
+++ b/src/Pages/Infrastructure/Create/index.jsx
@@ -248,7 +248,7 @@ const CreateInfrastructureMonitor = () => {
setInfrastructureMonitor((prev) => ({
...prev,
notifications,
- notify_email: checked,
+ ...(type === "email" ? { notify_email: checked } : {})
}));
};
From 7dfc9bff5fe5eadf73a38666774095afe5d82bd9 Mon Sep 17 00:00:00 2001
From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca>
Date: Wed, 19 Mar 2025 10:32:25 -0400
Subject: [PATCH 16/18] resolve merge conflicts
---
src/locales/gb.json | 311 +++++++++++++++++++++++++++++---------------
1 file changed, 204 insertions(+), 107 deletions(-)
diff --git a/src/locales/gb.json b/src/locales/gb.json
index d01dad274..f57c2ef67 100644
--- a/src/locales/gb.json
+++ b/src/locales/gb.json
@@ -1,49 +1,26 @@
{
"dontHaveAccount": "Don't have account",
- "and": "and",
- "https": "HTTPS",
- "http": "HTTP",
- "add": "Add",
- "monitor": "monitor",
- "monitors": "monitors",
- "aboutus": "About Us",
"email": "E-mail",
"forgotPassword": "Forgot Password",
"password": "password",
- "signUp": "Sign Up",
+ "signUp": "Sign up",
"submit": "Submit",
"title": "Title",
"continue": "Continue",
- "now": "Now",
- "delete": "Delete",
- "configure": "Configure",
- "networkError": "Network error",
- "responseTime": "Response time:",
- "ms": "ms",
- "bar": "Bar",
- "area": "Area",
- "country": "COUNTRY",
- "city": "CITY",
- "response": "RESPONSE",
- "checkConnection": "Please check your connection",
"enterEmail": "Enter your email",
"authLoginTitle": "Log In",
"authLoginEnterPassword": "Enter your password",
"commonPassword": "Password",
- "createPassword": "Create your password",
- "createAPassword": "Create a password",
"commonBack": "Back",
"authForgotPasswordTitle": "Forgot password?",
"authForgotPasswordResetPassword": "Reset password",
- "passwordreset": "Password Reset",
+ "createPassword": "Create your password",
+ "createAPassword": "Create a password",
"authRegisterAlreadyHaveAccount": "Already have an account?",
"commonAppName": "Checkmate",
"authLoginEnterEmail": "Enter your email",
"authRegisterTitle": "Create an account",
- "authRegisterTerms": "Terms of Service",
- "authRegisterPrivacy": "Privacy Policy.",
"authRegisterStepOneTitle": "Create your account",
- "authRegisterStepOnePersonalDetails": "Enter your personal details",
"authRegisterStepOneDescription": "Enter your details to get started",
"authRegisterStepTwoTitle": "Set up your profile",
"authRegisterStepTwoDescription": "Tell us more about yourself",
@@ -56,7 +33,6 @@
"authCheckEmailDescription": "We sent a password reset link to",
"authCheckEmailResendEmail": "Resend email",
"authCheckEmailBackTo": "Back to",
- "authCheckEmailOpenEmailButton": "Open email app",
"goBackTo": "Go back to",
"authCheckEmailDidntReceiveEmail": "Didn't receive the email?",
"authCheckEmailClickToResend": "Click to resend",
@@ -66,7 +42,6 @@
"authSetNewPasswordConfirmPassword": "Confirm password",
"confirmPassword": "Confirm your password",
"authSetNewPasswordResetPassword": "Reset password",
- "authNewPasswordConfirmed": "Your password has been successfully reset. Click below to log in magically.",
"authSetNewPasswordBackTo": "Back to",
"authPasswordMustBeAtLeast": "Must be at least",
"authPasswordCharactersLong": "8 characters long",
@@ -81,13 +56,100 @@
"authRegisterCreateSuperAdminAccount": "Create your Super admin account to get started",
"authRegisterSignUpWithEmail": "Sign up with Email",
"authRegisterBySigningUp": "By signing up, you agree to our",
+ "distributedStatusHeaderText": "Real-time, real-device coverage",
+ "distributedStatusSubHeaderText": "Powered by millions devices worldwide, view a system performance by global region, country or city",
+ "settingsGeneralSettings": "General settings",
+ "settingsDisplayTimezone": "Display timezone",
+ "settingsDisplayTimezoneDescription": "The timezone of the dashboard you publicly display.",
+ "settingsAppearance": "Appearance",
+ "settingsAppearanceDescription": "Switch between light and dark mode, or change user interface language",
+ "settingsThemeMode": "Theme Mode",
+ "settingsLanguage": "Language",
+ "settingsDistributedUptime": "Distributed uptime",
+ "settingsDistributedUptimeDescription": "Enable/disable distributed uptime monitoring.",
+ "settingsEnabled": "Enabled",
+ "settingsDisabled": "Disabled",
+ "settingsHistoryAndMonitoring": "History and monitoring",
+ "settingsHistoryAndMonitoringDescription": "Define here for how long you want to keep the data. You can also remove all past data.",
+ "settingsTTLLabel": "The days you want to keep monitoring history.",
+ "settingsTTLOptionalLabel": "0 for infinite",
+ "settingsClearAllStats": "Clear all stats. This is irreversible.",
+ "settingsClearAllStatsButton": "Clear all stats",
+ "settingsClearAllStatsDialogTitle": "Do you want to clear all stats?",
+ "settingsClearAllStatsDialogDescription": "Once deleted, your monitors cannot be retrieved.",
+ "settingsClearAllStatsDialogConfirm": "Yes, clear all stats",
+ "settingsDemoMonitors": "Demo monitors",
+ "settingsDemoMonitorsDescription": "Here you can add and remove demo monitors.",
+ "settingsAddDemoMonitors": "Add demo monitors",
+ "settingsAddDemoMonitorsButton": "Add demo monitors",
+ "settingsRemoveAllMonitors": "Remove all monitors",
+ "settingsRemoveAllMonitorsButton": "Remove all monitors",
+ "settingsRemoveAllMonitorsDialogTitle": "Do you want to remove all monitors?",
+ "settingsRemoveAllMonitorsDialogConfirm": "Yes, clear all monitors",
+ "settingsWallet": "Wallet",
+ "settingsWalletDescription": "Connect your wallet here. This is required for the Distributed Uptime monitor to connect to multiple nodes globally.",
+ "settingsAbout": "About",
+ "settingsDevelopedBy": "Developed by Bluewave Labs.",
+ "settingsSave": "Save",
+ "settingsSuccessSaved": "Settings saved successfully",
+ "settingsFailedToSave": "Failed to save settings",
+ "settingsStatsCleared": "Stats cleared successfully",
+ "settingsFailedToClearStats": "Failed to clear stats",
+ "settingsDemoMonitorsAdded": "Successfully added demo monitors",
+ "settingsFailedToAddDemoMonitors": "Failed to add demo monitors",
+ "settingsMonitorsDeleted": "Successfully deleted all monitors",
+ "settingsFailedToDeleteMonitors": "Failed to delete all monitors",
+ "starPromptTitle": "Star Checkmate",
+ "starPromptDescription": "See the latest releases and help grow the community on GitHub",
+ "https": "HTTPS",
+ "http": "HTTP",
+ "monitor": "monitor",
+ "aboutus": "About Us",
+ "signUP": "Sign Up",
+ "now": "Now",
+ "createYour": "Create your",
+ "createMonitor": "Create monitor",
+ "actions": "Actions",
+ "pause": "Pause",
+ "resume": "Resume",
+ "editing": "Editing...",
+ "url": "URL",
+ "access": "Access",
+ "timezone": "Timezone",
+ "features": "Features",
+ "administrator": "Administrator?",
+ "loginHere": "Login here",
+ "displayName": "Display name",
+ "urlMonitor": "URL to monitor",
+ "portToMonitor": "Port to monitor",
+ "websiteMonitoring": "Website monitoring",
+ "websiteMonitoringDescription": "Use HTTP(s) to monitor your website or API endpoint.",
+ "pingMonitoring": "Ping monitoring",
+ "pingMonitoringDescription": "Check whether your server is available or not.",
+ "dockerContainerMonitoring": "Docker container monitoring",
+ "dockerContainerMonitoringDescription": "Check whether your Docker container is running or not.",
+ "portMonitoring": "Port monitoring",
+ "portMonitoringDescription": "Check whether your port is open or not.",
+ "delete": "Delete",
+ "configure": "Configure",
+ "networkError": "Network error",
+ "responseTime": "Response time:",
+ "ms": "ms",
+ "bar": "Bar",
+ "area": "Area",
+ "country": "COUNTRY",
+ "city": "CITY",
+ "response": "RESPONSE",
+ "checkConnection": "Please check your connection",
+ "passwordreset": "Password Reset",
+ "authRegisterStepOnePersonalDetails": "Enter your personal details",
+ "authCheckEmailOpenEmailButton": "Open email app",
+ "authNewPasswordConfirmed": "Your password has been successfully reset. Click below to log in magically.",
"monitorStatusUp": "Monitor {name} ({url}) is now UP and responding",
"monitorStatusDown": "Monitor {name} ({url}) is DOWN and not responding",
"webhookSendSuccess": "Webhook notification sent successfully",
"webhookSendError": "Error sending webhook notification to {platform}",
"webhookUnsupportedPlatform": "Unsupported platform: {platform}",
- "distributedStatusHeaderText": "Real-time, real-device coverage",
- "distributedStatusSubHeaderText": "Powered by millions devices worldwide, view a system performance by global region, country or city",
"distributedRightCategoryTitle": "Monitor",
"distributedStatusServerMonitors": "Server Monitors",
"distributedStatusServerMonitorsDescription": "Monitor status of related servers",
@@ -104,6 +166,116 @@
"distributedUptimeDetailsMonitorHeader": "Distributed Uptime Monitoring powered by DePIN",
"distributedUptimeDetailsStatusHeaderUptime": "Uptime:",
"distributedUptimeDetailsStatusHeaderLastUpdate": "Last updated",
+ "createMaintenanceWindow": "Create maintenance window",
+ "createMaintenance": "Create maintenance",
+ "editMaintenance": "Edit maintenance",
+ "maintenanceWindowName": "Maintenance Window Name",
+ "friendlyNameInput": "Friendly name",
+ "friendlyNamePlaceholder": "Maintenance at __ : __ for ___ minutes",
+ "maintenanceRepeat": "Maintenance Repeat",
+ "maintenance": "maintenance",
+ "duration": "Duration",
+ "addMonitors": "Add monitors",
+ "window": "window",
+ "cancel": "Cancel",
+ "status": "Status",
+ "message": "Message",
+ "low": "low",
+ "high": "high",
+ "host": "Host",
+ "statusCode": "Status code",
+ "date&Time": "Date & Time",
+ "type": "Type",
+ "statusPageName": "Status page name",
+ "publicURL": "Public URL",
+ "repeat": "Repeat",
+ "edit": "Edit",
+ "createA": "Create a",
+ "remove": "Remove",
+ "maintenanceWindowDescription": "Your pings won't be sent during this time frame",
+ "startTime": "Start time",
+ "timeZoneInfo": "All dates and times are in GMT+0 time zone.",
+ "monitorsToApply": "Monitors to apply maintenance window to",
+ "nextWindow": "Next window",
+ "notFoundButton": "Go to the main dashboard",
+ "pageSpeedConfigureSettingsDescription": "Here you can select the URL of the host, together with the type of monitor.",
+ "monitorDisplayName": "Monitor display name",
+ "whenNewIncident": "When there is a new incident,",
+ "notifySMS": "Notify via SMS (coming soon)",
+ "notifyEmails": "Also notify via email to multiple addresses (coming soon)",
+ "seperateEmails": "You can separate multiple emails with a comma",
+ "checkFrequency": "Check frequency",
+ "matchMethod": "Match Method",
+ "expectedValue": "Expected value",
+ "deleteDialogTitle": "Do you really want to delete this monitor?",
+ "deleteDialogDescription": "Once deleted, this monitor cannot be retrieved.",
+ "pageSpeedMonitor": "PageSpeed monitor",
+ "shown": "Shown",
+ "ago": "ago",
+ "companyName": "Company name",
+ "pageSpeedDetailsPerformanceReport": "Values are estimated and may vary.",
+ "pageSpeedDetailsPerformanceReportCalculator": "See calculator",
+ "checkingEvery": "Checking every",
+ "statusPageCreateSettings": "If your status page is ready, you can mark it as published.",
+ "basicInformation": "Basic Information",
+ "statusPageCreateBasicInfoDescription": "Define company name and the subdomain that your status page points to.",
+ "statusPageCreateSelectTimeZoneDescription": "Select the timezone that your status page will be displayed in.",
+ "statusPageCreateAppearanceDescription": "Define the default look and feel of your public status page.",
+ "statusPageCreateSettingsCheckboxLabel": "Published and visible to the public",
+ "statusPageCreateBasicInfoStatusPageAddress": "Your status page address",
+ "statusPageCreateTabsContent": "Status page servers",
+ "statusPageCreateTabsContentDescription": "You can add any number of servers that you monitor to your status page. You can also reorder them for the best viewing experience.",
+ "statusPageCreateTabsContentFeaturesDescription": "Show more details on the status page",
+ "showCharts": "Show charts",
+ "showUptimePercentage": "Show uptime percentage",
+ "removeLogo": "Remove Logo",
+ "statusPageStatus": "A public status page is not set up.",
+ "statusPageStatusContactAdmin": "Please contact to your administrator",
+ "statusPageStatusNotPublic": "This status page is not public.",
+ "statusPageStatusNoPage": "There's no status page here.",
+ "statusPageStatusServiceStatus": "Service status",
+ "deleteStatusPage": "Do you want to delete this status page?",
+ "deleteStatusPageConfirm": "Yes, delete status page",
+ "deleteStatusPageDescription": "Once deleted, your status page cannot be retrieved.",
+ "uptimeCreate": "The expected value is used to match against response result, and the match determines the status.",
+ "uptimeCreateJsonPath": "This expression will be evaluated against the reponse JSON data and the result will be used to match against the expected value. See",
+ "uptimeCreateJsonPathQuery": "for query language documentation.",
+ "maintenanceTableActionMenuDialogTitle": "Do you really want to remove this maintenance window?",
+ "notifications": {
+ "enableNotifications": "Enable {{platform}} notifications",
+ "testNotification": "Test notification",
+ "addOrEditNotifications": "Add or edit notifications",
+ "slack": {
+ "label": "Slack",
+ "description": "To enable Slack notifications, create a Slack app and enable incoming webhooks. After that, simply provide the webhook URL here.",
+ "webhookLabel": "Webhook URL",
+ "webhookPlaceholder": "https://hooks.slack.com/services/..."
+ },
+ "discord": {
+ "label": "Discord",
+ "description": "To send data to a Discord channel from Checkmate via Discord notifications using webhooks, you can use Discord's incoming Webhooks feature.",
+ "webhookLabel": "Discord Webhook URL",
+ "webhookPlaceholder": "https://discord.com/api/webhooks/..."
+ },
+ "telegram": {
+ "label": "Telegram",
+ "description": "To enable Telegram notifications, create a Telegram bot using BotFather, an official bot for creating and managing Telegram bots. Then, get the API token and chat ID and write them down here.",
+ "tokenLabel": "Your bot token",
+ "tokenPlaceholder": "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11",
+ "chatIdLabel": "Your Chat ID",
+ "chatIdPlaceholder": "-1001234567890"
+ },
+ "webhook": {
+ "label": "Webhooks",
+ "description": "You can set up a custom webhook to receive notifications when incidents occur.",
+ "urlLabel": "Webhook URL",
+ "urlPlaceholder": "https://your-server.com/webhook"
+ },
+ "testNotificationDevelop": "Test notification 2"
+ },
+ "testLocale": "",
+ "add": "Add",
+ "monitors": "monitors",
"distributedUptimeStatusCreateStatusPage": "status page",
"distributedUptimeStatusCreateStatusPageAccess": "Access",
"distributedUptimeStatusCreateStatusPageReady": "If your status page is ready, you can mark it as published.",
@@ -191,80 +363,5 @@
"integrationsDiscord": "Discord",
"integrationsDiscordInfo": "Connect with Discord and view incidents directly in a channel",
"integrationsZapier": "Zapier",
- "integrationsZapierInfo": "Send all incidents to Zapier, and then see them everywhere",
-
- "settingsGeneralSettings": "General settings",
- "settingsDisplayTimezone": "Display timezone",
- "settingsDisplayTimezoneDescription": "The timezone of the dashboard you publicly display.",
- "settingsAppearance": "Appearance",
- "settingsAppearanceDescription": "Switch between light and dark mode, or change user interface language",
- "settingsThemeMode": "Theme Mode",
- "settingsLanguage": "Language",
- "settingsDistributedUptime": "Distributed uptime",
- "settingsDistributedUptimeDescription": "Enable/disable distributed uptime monitoring.",
- "settingsEnabled": "Enabled",
- "settingsDisabled": "Disabled",
- "settingsHistoryAndMonitoring": "History and monitoring",
- "settingsHistoryAndMonitoringDescription": "Define here for how long you want to keep the data. You can also remove all past data.",
- "settingsTTLLabel": "The days you want to keep monitoring history.",
- "settingsTTLOptionalLabel": "0 for infinite",
- "settingsClearAllStats": "Clear all stats. This is irreversible.",
- "settingsClearAllStatsButton": "Clear all stats",
- "settingsClearAllStatsDialogTitle": "Do you want to clear all stats?",
- "settingsClearAllStatsDialogDescription": "Once deleted, your monitors cannot be retrieved.",
- "settingsClearAllStatsDialogConfirm": "Yes, clear all stats",
- "settingsDemoMonitors": "Demo monitors",
- "settingsDemoMonitorsDescription": "Here you can add and remove demo monitors.",
- "settingsAddDemoMonitors": "Add demo monitors",
- "settingsAddDemoMonitorsButton": "Add demo monitors",
- "settingsRemoveAllMonitors": "Remove all monitors",
- "settingsRemoveAllMonitorsButton": "Remove all monitors",
- "settingsRemoveAllMonitorsDialogTitle": "Do you want to remove all monitors?",
- "settingsRemoveAllMonitorsDialogConfirm": "Yes, clear all monitors",
- "settingsWallet": "Wallet",
- "settingsWalletDescription": "Connect your wallet here. This is required for the Distributed Uptime monitor to connect to multiple nodes globally.",
- "settingsAbout": "About",
- "settingsDevelopedBy": "Developed by Bluewave Labs.",
- "settingsSave": "Save",
- "settingsSuccessSaved": "Settings saved successfully",
- "settingsFailedToSave": "Failed to save settings",
- "settingsStatsCleared": "Stats cleared successfully",
- "settingsFailedToClearStats": "Failed to clear stats",
- "settingsDemoMonitorsAdded": "Successfully added demo monitors",
- "settingsFailedToAddDemoMonitors": "Failed to add demo monitors",
- "settingsMonitorsDeleted": "Successfully deleted all monitors",
- "settingsFailedToDeleteMonitors": "Failed to delete all monitors",
- "starPromptTitle": "Star Checkmate",
- "starPromptDescription": "See the latest releases and help grow the community on GitHub",
- "notifications": {
- "enableNotifications": "Enable {{platform}} notifications",
- "testNotification": "Test notification",
- "addOrEditNotifications": "Add or edit notifications",
- "slack": {
- "label": "Slack",
- "description": "To enable Slack notifications, create a Slack app and enable incoming webhooks. After that, simply provide the webhook URL here.",
- "webhookLabel": "Webhook URL",
- "webhookPlaceholder": "https://hooks.slack.com/services/..."
- },
- "discord": {
- "label": "Discord",
- "description": "To send data to a Discord channel from Checkmate via Discord notifications using webhooks, you can use Discord's incoming Webhooks feature.",
- "webhookLabel": "Discord Webhook URL",
- "webhookPlaceholder": "https://discord.com/api/webhooks/..."
- },
- "telegram": {
- "label": "Telegram",
- "description": "To enable Telegram notifications, create a Telegram bot using BotFather, an official bot for creating and managing Telegram bots. Then, get the API token and chat ID and write them down here.",
- "tokenLabel": "Your bot token",
- "tokenPlaceholder": "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11",
- "chatIdLabel": "Your Chat ID",
- "chatIdPlaceholder": "-1001234567890"
- },
- "webhook": {
- "label": "Webhooks",
- "description": "You can set up a custom webhook to receive notifications when incidents occur.",
- "urlLabel": "Webhook URL",
- "urlPlaceholder": "https://your-server.com/webhook"
- }
- }
-}
+ "integrationsZapierInfo": "Send all incidents to Zapier, and then see them everywhere"
+ }
\ No newline at end of file
From ced3ad17575a2a9323ca2f6b85875c36bd103791 Mon Sep 17 00:00:00 2001
From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca>
Date: Wed, 19 Mar 2025 15:50:36 -0400
Subject: [PATCH 17/18] update statevalues to use undefined
---
.../Infrastructure/Details/Hooks/useHardwareMonitorsFetch.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Pages/Infrastructure/Details/Hooks/useHardwareMonitorsFetch.jsx b/src/Pages/Infrastructure/Details/Hooks/useHardwareMonitorsFetch.jsx
index 229561966..dfdf92715 100644
--- a/src/Pages/Infrastructure/Details/Hooks/useHardwareMonitorsFetch.jsx
+++ b/src/Pages/Infrastructure/Details/Hooks/useHardwareMonitorsFetch.jsx
@@ -5,7 +5,7 @@ const useHardwareMonitorsFetch = ({ monitorId, dateRange }) => {
// Abort early if creating monitor
if (!monitorId) {
- return { monitor: null, isLoading: false, networkError: null };
+ return { monitor: undefined, isLoading: false, networkError: undefined };
}
const [isLoading, setIsLoading] = useState(true);
const [networkError, setNetworkError] = useState(false);
From 139ae006136d0cda7ee42b610dd6768fbc39af4b Mon Sep 17 00:00:00 2001
From: Vishnu Sreekumaran Nair <200557136@student.georgianc.on.ca>
Date: Wed, 19 Mar 2025 15:55:39 -0400
Subject: [PATCH 18/18] extract success toast message strings
---
src/Pages/Infrastructure/Create/index.jsx | 2 +-
src/locales/gb.json | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/Pages/Infrastructure/Create/index.jsx b/src/Pages/Infrastructure/Create/index.jsx
index 6fd0f1fbe..144f499fd 100644
--- a/src/Pages/Infrastructure/Create/index.jsx
+++ b/src/Pages/Infrastructure/Create/index.jsx
@@ -199,7 +199,7 @@ const CreateInfrastructureMonitor = () => {
: await dispatch(updateInfrastructureMonitor({ monitorId, monitor: form }));
if (action.meta.requestStatus === "fulfilled") {
createToast({
- body: isCreate ? "Infrastructure monitor created successfully!" : "Infrastructure monitor updated successfully!",
+ body: isCreate ? t("infrastructureMonitorCreated") : t("infrastructureMonitorUpdated"),
});
navigate("/infrastructure");
} else {
diff --git a/src/locales/gb.json b/src/locales/gb.json
index dbc40ec9c..ab5b581d1 100644
--- a/src/locales/gb.json
+++ b/src/locales/gb.json
@@ -326,6 +326,8 @@
"infrastructureAlertNotificationDescription": "Send a notification to user(s) when thresholds exceed a specified percentage.",
"infrastructureCreateMonitor": "Create Infrastructure Monitor",
"infrastructureEditMonitor": "Save Infrastructure Monitor",
+ "infrastructureMonitorCreated": "Infrastructure monitor created successfully!",
+ "infrastructureMonitorUpdated": "Infrastructure monitor updated successfully!",
"infrastructureProtocol": "Protocol",
"infrastructureServerUrlLabel": "Server URL",
"infrastructureDisplayNameLabel": "Display name",