resolve merge conflict
This commit is contained in:
1 parent
15defa33eb
commit
2b425a27cf
3 files changed
+31
-2
No files matched your search
@@ -59,6 +59,10 @@ function App() {
|
|||||||
path="/monitors/create"
|
path="/monitors/create"
|
||||||
element={<ProtectedRoute Component={CreateMonitor} />}
|
element={<ProtectedRoute Component={CreateMonitor} />}
|
||||||
/>
|
/>
|
||||||
|
<Route
|
||||||
|
path="/monitors/clone/:monitorId"
|
||||||
|
element={<ProtectedRoute Component={CreateMonitor} />}
|
||||||
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/monitors/:monitorId/"
|
path="/monitors/:monitorId/"
|
||||||
element={<ProtectedRoute Component={DetailsWithAdminProp} />}
|
element={<ProtectedRoute Component={DetailsWithAdminProp} />}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { useState } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { Box, ButtonGroup, Stack, Typography } from "@mui/material";
|
import { Box, ButtonGroup, Stack, Typography } from "@mui/material";
|
||||||
import { useSelector, useDispatch } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
import { monitorValidation } from "../../../Validation/validation";
|
import { monitorValidation } from "../../../Validation/validation";
|
||||||
import { createUptimeMonitor } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice";
|
import { createUptimeMonitor } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { createToast } from "../../../Utils/toastUtils";
|
import { createToast } from "../../../Utils/toastUtils";
|
||||||
import { logger } from "../../../Utils/Logger";
|
import { logger } from "../../../Utils/Logger";
|
||||||
@@ -19,6 +19,7 @@ import "./index.css";
|
|||||||
const CreateMonitor = () => {
|
const CreateMonitor = () => {
|
||||||
const MS_PER_MINUTE = 60000;
|
const MS_PER_MINUTE = 60000;
|
||||||
const { user, authToken } = useSelector((state) => state.auth);
|
const { user, authToken } = useSelector((state) => state.auth);
|
||||||
|
const { monitors } = useSelector((state) => state.uptimeMonitors);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@@ -31,6 +32,7 @@ const CreateMonitor = () => {
|
|||||||
"notify-email-default": "notification-email",
|
"notify-email-default": "notification-email",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const { monitorId } = useParams();
|
||||||
const [monitor, setMonitor] = useState({
|
const [monitor, setMonitor] = useState({
|
||||||
url: "",
|
url: "",
|
||||||
name: "",
|
name: "",
|
||||||
@@ -41,6 +43,21 @@ const CreateMonitor = () => {
|
|||||||
const [https, setHttps] = useState(true);
|
const [https, setHttps] = useState(true);
|
||||||
const [errors, setErrors] = useState({});
|
const [errors, setErrors] = useState({});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if(monitorId){
|
||||||
|
const data = monitors.find((monitor) => monitor._id === monitorId);
|
||||||
|
if (!data) {
|
||||||
|
console.error("Error fetching monitor of id: " + monitorId);
|
||||||
|
navigate("/not-found");
|
||||||
|
}
|
||||||
|
const {url, name, ...rest} = data;
|
||||||
|
rest.interval = rest.interval/60000;
|
||||||
|
setMonitor({
|
||||||
|
...rest,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [monitorId, authToken, monitors]);
|
||||||
|
|
||||||
const handleChange = (event, name) => {
|
const handleChange = (event, name) => {
|
||||||
const { value, id } = event.target;
|
const { value, id } = event.target;
|
||||||
if (!name) name = idMap[id];
|
if (!name) name = idMap[id];
|
||||||
|
|||||||
@@ -145,6 +145,14 @@ const ActionsMenu = ({ monitor, isAdmin }) => {
|
|||||||
Configure
|
Configure
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)}
|
)}
|
||||||
|
<MenuItem
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
navigate(`/monitors/clone/${actions.id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Clone
|
||||||
|
</MenuItem>
|
||||||
{isAdmin && (
|
{isAdmin && (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
|
|||||||
Reference in new issue
Block a user