diff --git a/Client/src/Components/Dialog/index.jsx b/Client/src/Components/Dialog/index.jsx
index d87baa42a..2053304ee 100644
--- a/Client/src/Components/Dialog/index.jsx
+++ b/Client/src/Components/Dialog/index.jsx
@@ -2,30 +2,30 @@ import LoadingButton from "@mui/lab/LoadingButton";
import { Button, Stack, Typography } from "@mui/material";
import PropTypes from "prop-types";
import { GenericDialog } from "./genericDialog";
+import { useId } from "react";
const Dialog = ({
- modelTitle,
- modelDescription,
open,
onClose,
- title,
- confirmationBtnLbl,
- confirmationBtnOnClick,
- cancelBtnLbl,
- cancelBtnOnClick,
theme,
- isLoading,
+ title,
description,
+ onCancel,
+ confirmationButtonLabel,
+ onConfirm,
+ isLoading,
}) => {
+ const titleId = useId();
+ const descriptionId = useId();
return (
{description && (
{description}
@@ -50,17 +50,17 @@ const Dialog = ({
- {confirmationBtnLbl}
+ {confirmationButtonLabel}
@@ -68,18 +68,15 @@ const Dialog = ({
};
Dialog.propTypes = {
- modelTitle: PropTypes.string.isRequired,
- modelDescription: PropTypes.string.isRequired,
open: PropTypes.bool.isRequired,
onClose: PropTypes.func.isRequired,
- title: PropTypes.string.isRequired,
- confirmationBtnLbl: PropTypes.string.isRequired,
- confirmationBtnOnClick: PropTypes.func.isRequired,
- cancelBtnLbl: PropTypes.string.isRequired,
- cancelBtnOnClick: PropTypes.func.isRequired,
theme: PropTypes.object.isRequired,
- isLoading: PropTypes.bool.isRequired,
+ title: PropTypes.string.isRequired,
description: PropTypes.string,
+ onCancel: PropTypes.func.isRequired,
+ confirmationButtonLabel: PropTypes.string.isRequired,
+ onConfirm: PropTypes.func.isRequired,
+ isLoading: PropTypes.bool.isRequired,
};
export default Dialog;
diff --git a/Client/src/Components/TabPanels/Account/ProfilePanel.jsx b/Client/src/Components/TabPanels/Account/ProfilePanel.jsx
index f5ac95bc8..988c4d1d5 100644
--- a/Client/src/Components/TabPanels/Account/ProfilePanel.jsx
+++ b/Client/src/Components/TabPanels/Account/ProfilePanel.jsx
@@ -16,6 +16,7 @@ import { createToast } from "../../../Utils/toastUtils";
import { logger } from "../../../Utils/Logger";
import LoadingButton from "@mui/lab/LoadingButton";
import { GenericDialog } from "../../Dialog/genericDialog";
+import Dialog from "../../Dialog";
/**
* ProfilePanel component displays a form for editing user profile information
@@ -370,56 +371,26 @@ const ProfilePanel = () => {
)}
{/* TODO - Update ModalPopup Component with @mui for reusability */}
- setIsOpen("")}
+ onClose={() => setIsOpen("")}
theme={theme}
- /* disablePortal ? */
- >
-
- Really delete this account?
-
-
- If you delete your account, you will no longer be able to sign in, and all of
- your data will be deleted. Deleting your account is permanent and
- non-recoverable action.
-
-
-
-
- Delete account
-
-
-
+ title={"Really delete this account?"}
+ description={
+ "If you delete your account, you will no longer be able to sign in, and all of your data will be deleted. Deleting your account is permanent and non-recoverable action."
+ }
+ onCancel={() => setIsOpen("")}
+ confirmationButtonLabel={"Delete account"}
+ onConfirm={handleDeleteAccount}
+ isLoading={isLoading}
+ />
+
{
title={"modal-invite-member"}
description={"invite-member-to-team"}
open={isOpen}
- close={closeInviteModal}
+ onClose={closeInviteModal}
theme={theme}
>
diff --git a/Client/src/Pages/Maintenance/MaintenanceTable/ActionsMenu/index.jsx b/Client/src/Pages/Maintenance/MaintenanceTable/ActionsMenu/index.jsx
index a4ed0edae..b0e571fd6 100644
--- a/Client/src/Pages/Maintenance/MaintenanceTable/ActionsMenu/index.jsx
+++ b/Client/src/Pages/Maintenance/MaintenanceTable/ActionsMenu/index.jsx
@@ -2,14 +2,14 @@ import { useState } from "react";
import { useTheme } from "@emotion/react";
import { useNavigate } from "react-router-dom";
import { useSelector } from "react-redux";
-import { Button, IconButton, Menu, MenuItem, Stack, Typography } from "@mui/material";
-import LoadingButton from "@mui/lab/LoadingButton";
+import { IconButton, Menu, MenuItem } from "@mui/material";
import { logger } from "../../../../Utils/Logger";
import Settings from "../../../../assets/icons/settings-bold.svg?react";
import PropTypes from "prop-types";
import { networkService } from "../../../../main";
import { createToast } from "../../../../Utils/toastUtils";
-import { GenericDialog } from "../../../../Components/Dialog/genericDialog";
+
+import Dialog from "../../../../Components/Dialog";
const ActionsMenu = ({ /* isAdmin, */ maintenanceWindow, updateCallback }) => {
maintenanceWindow;
@@ -148,52 +148,25 @@ const ActionsMenu = ({ /* isAdmin, */ maintenanceWindow, updateCallback }) => {
Remove
- {
+ onClose={(e) => {
e.stopPropagation();
setIsOpen(false);
}}
theme={theme}
- >
-
- Do you really want to remove this maintenance window?
-
-
-
- {
- e.stopPropagation(e);
- handleRemove(e);
- }}
- >
- Delete
-
-
-
+ title={"Do you really want to remove this maintenance window?"}
+ onCancel={(e) => {
+ e.stopPropagation();
+ setIsOpen(false);
+ }}
+ confirmationButtonLabel={"Delete"}
+ onConfirm={(e) => {
+ e.stopPropagation(e);
+ handleRemove(e);
+ }}
+ isLoading={isLoading}
+ />
>
);
};
diff --git a/Client/src/Pages/Monitors/Configure/index.jsx b/Client/src/Pages/Monitors/Configure/index.jsx
index 9eb27c478..8ef557f5e 100644
--- a/Client/src/Pages/Monitors/Configure/index.jsx
+++ b/Client/src/Pages/Monitors/Configure/index.jsx
@@ -453,20 +453,18 @@ const Configure = () => {
>
)}
+
+ onCancel={() => setIsOpen(false)}
+ confirmationButtonLabel="Delete"
+ onConfirm={handleRemove}
+ isLoading={isLoading}
+ />
);
};
diff --git a/Client/src/Pages/Monitors/Home/actionsMenu.jsx b/Client/src/Pages/Monitors/Home/actionsMenu.jsx
index fb3bd4b49..e72bb545f 100644
--- a/Client/src/Pages/Monitors/Home/actionsMenu.jsx
+++ b/Client/src/Pages/Monitors/Home/actionsMenu.jsx
@@ -188,25 +188,26 @@ const ActionsMenu = ({ monitor, isAdmin, updateCallback }) => {
)}
+ modelTitle="modal-delete-monitor"
+ modelDescription="delete-monitor-confirmation"
+ />
>
);
};
diff --git a/Client/src/Pages/PageSpeed/Configure/index.jsx b/Client/src/Pages/PageSpeed/Configure/index.jsx
index 49d18e4c8..e0ad1516b 100644
--- a/Client/src/Pages/PageSpeed/Configure/index.jsx
+++ b/Client/src/Pages/PageSpeed/Configure/index.jsx
@@ -26,6 +26,7 @@ import SkeletonLayout from "./skeleton";
import useUtils from "../../Monitors/utils";
import "./index.css";
import { GenericDialog } from "../../../Components/Dialog/genericDialog";
+import Dialog from "../../../Components/Dialog";
const PageSpeedConfigure = () => {
const theme = useTheme();
@@ -38,6 +39,7 @@ const PageSpeedConfigure = () => {
const [monitor, setMonitor] = useState({});
const [errors, setErrors] = useState({});
const { statusColor, pagespeedStatusMsg, determineState } = useUtils();
+ const [buttonLoading, setButtonLoading] = useState(false);
const idMap = {
"monitor-url": "url",
"monitor-name": "name",
@@ -157,12 +159,14 @@ const PageSpeedConfigure = () => {
const [isOpen, setIsOpen] = useState(false);
const handleRemove = async (event) => {
event.preventDefault();
+ setButtonLoading(true);
const action = await dispatch(deletePageSpeed({ authToken, monitor }));
if (action.meta.requestStatus === "fulfilled") {
navigate("/pagespeed");
} else {
createToast({ body: "Failed to delete monitor." });
}
+ setButtonLoading(false);
};
return (
@@ -429,11 +433,22 @@ const PageSpeedConfigure = () => {
>
)}
+
+ />
)}
{isAdmin && (
@@ -314,18 +312,15 @@ const Settings = ({ isAdmin }) => {
+ />
)}
{isAdmin && (