- WIP
This commit is contained in:
1 parent
bb8cfa7985
commit
4452cb90e6
1 file changed
+113
-67
@@ -3,7 +3,10 @@ import { Box, Button, ButtonGroup, Stack, Typography } from "@mui/material";
|
|||||||
import LoadingButton from "@mui/lab/LoadingButton";
|
import LoadingButton from "@mui/lab/LoadingButton";
|
||||||
import { useSelector, useDispatch } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
import { monitorValidation } from "../../../Validation/validation";
|
import { monitorValidation } from "../../../Validation/validation";
|
||||||
import { createInfrastructureMonitor, checkInfrastructureEndpointResolution } from "../../../Features/InfrastructureMonitors/infrastructureMonitorsSlice"
|
import {
|
||||||
|
createInfrastructureMonitor,
|
||||||
|
checkInfrastructureEndpointResolution,
|
||||||
|
} from "../../../Features/InfrastructureMonitors/infrastructureMonitorsSlice";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { createToast } from "../../../Utils/toastUtils";
|
import { createToast } from "../../../Utils/toastUtils";
|
||||||
@@ -140,7 +143,9 @@ const CreateInfrastructureMonitor = () => {
|
|||||||
userId: user._id,
|
userId: user._id,
|
||||||
notifications: infrastructureMonitor.notifications,
|
notifications: infrastructureMonitor.notifications,
|
||||||
};
|
};
|
||||||
const action = await dispatch(createInfrastructureMonitor({ authToken, monitor: form }));
|
const action = await dispatch(
|
||||||
|
createInfrastructureMonitor({ authToken, monitor: form })
|
||||||
|
);
|
||||||
if (action.meta.requestStatus === "fulfilled") {
|
if (action.meta.requestStatus === "fulfilled") {
|
||||||
createToast({ body: "Infrastructure monitor created successfully!" });
|
createToast({ body: "Infrastructure monitor created successfully!" });
|
||||||
navigate("/infrastructure-monitors/create");
|
navigate("/infrastructure-monitors/create");
|
||||||
@@ -281,28 +286,60 @@ const CreateInfrastructureMonitor = () => {
|
|||||||
or percentage.
|
or percentage.
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<Stack
|
<Stack gap={theme.spacing(6)}>
|
||||||
gap={theme.spacing(6)}
|
<Stack
|
||||||
>
|
direction={"row"}
|
||||||
<Stack direction={"row"}
|
sx={{
|
||||||
sx={{
|
justifyContent: "space-between",
|
||||||
justifyContent: "space-between",
|
width: "75%",
|
||||||
|
}}
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<Box>
|
<Box>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
id="customize-cpu"
|
id="customize-cpu"
|
||||||
label={`CPU`}
|
label={`CPU`}
|
||||||
value={user?.email}
|
value={true}
|
||||||
onChange={(event) => handleChange(event)}
|
onChange={(event) => handleChange(event)}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Stack
|
<Stack
|
||||||
direction={"row"}
|
direction={"row"}
|
||||||
|
sx={{
|
||||||
|
justifyContent: "flex-end",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box>
|
||||||
|
<Field type="text"></Field>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Typography
|
||||||
|
component="p"
|
||||||
|
m={theme.spacing(3)}
|
||||||
|
>
|
||||||
|
%
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
<Stack
|
||||||
|
direction={"row"}
|
||||||
|
sx={{
|
||||||
|
width: "75%",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box>
|
||||||
|
<Checkbox
|
||||||
|
id="customize-memory"
|
||||||
|
label={`Memory`}
|
||||||
|
value={true}
|
||||||
|
onChange={(event) => handleChange(event)}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
<Stack
|
||||||
|
direction={"row"}
|
||||||
sx={{
|
sx={{
|
||||||
justifyContent: "flex-end",
|
justifyContent: "flex-end",
|
||||||
alignItems: "center",
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Field type="text"></Field>
|
<Field type="text"></Field>
|
||||||
@@ -314,41 +351,15 @@ const CreateInfrastructureMonitor = () => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack direction={"row"}
|
|
||||||
sx={{
|
|
||||||
justifyContent: "space-between",
|
|
||||||
|
|
||||||
}}>
|
|
||||||
|
|
||||||
<Box>
|
|
||||||
<Checkbox
|
|
||||||
id="customize-memory"
|
|
||||||
label={`Memory`}
|
|
||||||
value={user?.email}
|
|
||||||
onChange={(event) => handleChange(event)}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
<Stack
|
|
||||||
direction={"row"}
|
|
||||||
sx={{
|
|
||||||
justifyContent: "flex-end",
|
|
||||||
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Field type="text" sx={{flexGrow:3}}></Field>
|
|
||||||
<Typography
|
|
||||||
component="p"
|
|
||||||
m={theme.spacing(3)}
|
|
||||||
>
|
|
||||||
%
|
|
||||||
</Typography>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
|
||||||
<Stack
|
<Stack
|
||||||
direction={"row"}
|
direction={"row"}
|
||||||
flexGrow={1}
|
sx={{
|
||||||
|
width: "75%",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Box flex={0.1}>
|
<Box>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
id="customize-disk"
|
id="customize-disk"
|
||||||
label={`Disk`}
|
label={`Disk`}
|
||||||
@@ -356,16 +367,30 @@ const CreateInfrastructureMonitor = () => {
|
|||||||
onChange={(event) => handleChange(event)}
|
onChange={(event) => handleChange(event)}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Field type="text"></Field>
|
<Stack
|
||||||
<Typography
|
direction={"row"}
|
||||||
component="p"
|
sx={{
|
||||||
m={theme.spacing(3)}
|
justifyContent: "flex-end",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
%
|
<Field type="text"></Field>
|
||||||
</Typography>
|
<Typography
|
||||||
|
component="p"
|
||||||
|
m={theme.spacing(3)}
|
||||||
|
>
|
||||||
|
%
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack direction={"row"}>
|
|
||||||
<Box flex={0.1}>
|
<Stack
|
||||||
|
direction={"row"}
|
||||||
|
sx={{
|
||||||
|
width: "75%",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
id="customize-temparature"
|
id="customize-temparature"
|
||||||
label={`Temparature`}
|
label={`Temparature`}
|
||||||
@@ -373,16 +398,30 @@ const CreateInfrastructureMonitor = () => {
|
|||||||
onChange={(event) => handleChange(event)}
|
onChange={(event) => handleChange(event)}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Field type="text"></Field>
|
<Stack
|
||||||
<Typography
|
direction={"row"}
|
||||||
component="p"
|
sx={{
|
||||||
m={theme.spacing(3)}
|
justifyContent: "flex-end",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
°C
|
<Field type="text"></Field>
|
||||||
</Typography>
|
<Typography
|
||||||
|
component="p"
|
||||||
|
m={theme.spacing(3)}
|
||||||
|
>
|
||||||
|
°C
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack direction={"row"}>
|
|
||||||
<Box flex={0.1}>
|
<Stack
|
||||||
|
direction={"row"}
|
||||||
|
sx={{
|
||||||
|
width: "75%",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
id="customize-systemload"
|
id="customize-systemload"
|
||||||
label={`System load`}
|
label={`System load`}
|
||||||
@@ -390,13 +429,20 @@ const CreateInfrastructureMonitor = () => {
|
|||||||
onChange={(event) => handleChange(event)}
|
onChange={(event) => handleChange(event)}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Field type="text"></Field>
|
<Stack
|
||||||
<Typography
|
direction={"row"}
|
||||||
component="p"
|
sx={{
|
||||||
m={theme.spacing(3)}
|
justifyContent: "flex-end",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
%
|
<Field type="text"></Field>
|
||||||
</Typography>
|
<Typography
|
||||||
|
component="p"
|
||||||
|
m={theme.spacing(3)}
|
||||||
|
>
|
||||||
|
%
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</ConfigBox>
|
</ConfigBox>
|
||||||
|
|||||||
Reference in new issue
Block a user