- Add GetStatusPageByUrl to networkservice

- Make static status page and actual status config page toggleable
- Remove the sidebar nested menu item entry for status page tabs
- Pass context to status config page which contains general settings and contents tabs
- Status config page is now one submission and one validation
This commit is contained in:
Shemy Gan committed 2024-12-16 20:18:05 -05:00
1 parent 5045eafb8e
commit 219bcd4361
7 files changed
+120 -108

No files matched your search

@@ -1,4 +1,4 @@
import { useState, useCallback } from "react";
import { useState, useCallback, useContext } from "react";
import { Button, Box, Stack, Typography } from "@mui/material";
import { ConfigBox } from "../../../Pages/Settings/styled";
import { useTheme } from "@emotion/react";
@@ -8,20 +8,13 @@ import { buildErrors } from "../../../Validation/error";
import Card from "./Card";
import update from "immutability-helper";
import Checkbox from "../../Inputs/Checkbox";
import { StatusFormContext } from "../../../Pages/Status/TabContext";
const ContentPanel = ({errors, setErrors}) => {
const ContentPanel = () => {
const theme = useTheme();
const { form, setForm, errors, setErrors } = useContext(StatusFormContext);
const [cards, setCards] = useState(form.monitors);
// Clears specific error from errors state
const clearError = (err) => {
setErrors((prev) => {
const updatedErrors = { ...prev };
if (updatedErrors[err]) delete updatedErrors[err];
return updatedErrors;
});
};
const moveCard = useCallback(
(dragIndex, hoverIndex) => {
const dragCard = cards[dragIndex];
@@ -1,5 +1,5 @@
import { useState, useRef, useContext } from "react";
import { Button, Box, Stack, Typography } from "@mui/material";
import { Box, Stack, Typography } from "@mui/material";
import { ConfigBox } from "../../../Pages/Settings/styled";
import Checkbox from "../../Inputs/Checkbox";
import { useTheme } from "@emotion/react";
@@ -17,13 +17,12 @@ import { formatBytes } from "../../../Utils/fileUtils";
import ProgressUpload from "../../ProgressBars";
import ImageIcon from "@mui/icons-material/Image";
import { HttpAdornment } from "../../Inputs/TextInput/Adornments";
import { hasValidationErrors } from "../../../Validation/error";
import { StatusFormContext } from "../../../Pages/Status/TabContext";
const GeneralSettingsPanel = ({errors, setErrors}) => {
const GeneralSettingsPanel = () => {
const theme = useTheme();
const [logo, setLogo] = useState();
const { form, setForm } = useContext(StatusFormContext);
const { form, setForm, errors, setErrors } = useContext(StatusFormContext);
const [progress, setProgress] = useState({ value: 0, isLoading: false });
const intervalRef = useRef(null);