- Create new status page and retrieval are now working end to end, except the fields that currently does not have BE counterparts, including all checkboxes and uploaded logo
This commit is contained in:
1 parent
23d97f8e56
commit
a5df7be6a1
5 files changed
+39
-30
No files matched your search
@@ -14,7 +14,7 @@ import { networkService } from "../../../main";
|
||||
const ContentPanel = () => {
|
||||
const theme = useTheme();
|
||||
const { form, setForm, errors, setErrors } = useContext(StatusFormContext);
|
||||
const [cards, setCards] = useState(form.monitors.length>0? form.monitors.map((m, idx)=>({id: idx, val: m})): []);
|
||||
const [cards, setCards] = useState([]);
|
||||
const {user, authToken } = useSelector((state) => state.auth);
|
||||
const [monitors, setMonitors] = useState([]);
|
||||
|
||||
@@ -30,7 +30,15 @@ const ContentPanel = () => {
|
||||
if(response.data.data.monitors.length==0){
|
||||
setErrors({monitors: "Please config monitors to setup status page"})
|
||||
}
|
||||
setMonitors(response.data.data.monitors);
|
||||
const fullMonitors = response.data.data.monitors ;
|
||||
setMonitors(fullMonitors);
|
||||
if (form.monitors.length > 0)
|
||||
setCards(
|
||||
form.monitors.map((mid, idx) => ({
|
||||
id: "" + idx,
|
||||
val: fullMonitors.filter((fM) => fM._id == mid)[0],
|
||||
}))
|
||||
);
|
||||
} catch (error) {
|
||||
createToast({ body: "Failed to fetch monitors data" });
|
||||
logger.error("Failed to fetch monitors", error);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useState, useRef, useContext } from "react";
|
||||
import { Box, Stack, Typography } from "@mui/material";
|
||||
import ConfigBox from "../../../Components/ConfigBox";
|
||||
import Checkbox from "../../Inputs/Checkbox";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import TabPanel from "@mui/lab/TabPanel";
|
||||
import TextInput from "../../Inputs/TextInput";
|
||||
@@ -25,7 +24,7 @@ const GeneralSettingsPanel = () => {
|
||||
const { form, setForm, errors, setErrors } = useContext(StatusFormContext);
|
||||
const [progress, setProgress] = useState({ value: 0, isLoading: false });
|
||||
const intervalRef = useRef(null);
|
||||
|
||||
|
||||
// Clears specific error from errors state
|
||||
const clearError = (err) => {
|
||||
setErrors((prev) => {
|
||||
@@ -131,13 +130,13 @@ const GeneralSettingsPanel = () => {
|
||||
</Stack>
|
||||
</Box>
|
||||
<Stack gap={theme.spacing(6)}>
|
||||
<Checkbox
|
||||
{/* <Checkbox
|
||||
id="published-to-public"
|
||||
label={`Published and visible to the public`}
|
||||
isChecked={form.publish}
|
||||
onChange={handleChange}
|
||||
onBlur={handleBlur}
|
||||
/>
|
||||
/> */}
|
||||
</Stack>
|
||||
</ConfigBox>
|
||||
|
||||
|
||||
Reference in new issue
Block a user