Add Breadcrumbs component to status page for improved navigation
This commit is contained in:
1 parent
c6ef77a886
commit
68354aac06
2 files changed
+21
-1
No files matched your search
@@ -3,6 +3,7 @@ import { Stack, Button, Typography } from "@mui/material";
|
|||||||
import Tabs from "./Components/Tabs";
|
import Tabs from "./Components/Tabs";
|
||||||
import GenericFallback from "../../../Components/GenericFallback";
|
import GenericFallback from "../../../Components/GenericFallback";
|
||||||
import SkeletonLayout from "./Components/Skeleton";
|
import SkeletonLayout from "./Components/Skeleton";
|
||||||
|
import Breadcrumbs from "../../../Components/Breadcrumbs/index.jsx";
|
||||||
//Utils
|
//Utils
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useState, useEffect, useRef, useCallback } from "react";
|
import { useState, useEffect, useRef, useCallback } from "react";
|
||||||
@@ -59,6 +60,19 @@ const CreateStatusPage = () => {
|
|||||||
const [statusPage, statusPageMonitors, statusPageIsLoading, statusPageNetworkError] =
|
const [statusPage, statusPageMonitors, statusPageIsLoading, statusPageNetworkError] =
|
||||||
useStatusPageFetch(isCreate, url);
|
useStatusPageFetch(isCreate, url);
|
||||||
|
|
||||||
|
// Breadcrumbs
|
||||||
|
const crumbs = [
|
||||||
|
{ name: "status pages", path: "/status" },
|
||||||
|
];
|
||||||
|
if (isCreate) {
|
||||||
|
crumbs.push({ name: "create", path: "/status/create" });
|
||||||
|
} else {
|
||||||
|
crumbs.push(
|
||||||
|
{ name: "details", path: `/status/uptime/${statusPage?.url}` },
|
||||||
|
{ name: "configure", path: "" }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
const handleFormChange = (e) => {
|
const handleFormChange = (e) => {
|
||||||
let { type, name, value, checked } = e.target;
|
let { type, name, value, checked } = e.target;
|
||||||
@@ -218,6 +232,7 @@ const CreateStatusPage = () => {
|
|||||||
// Load fields
|
// Load fields
|
||||||
return (
|
return (
|
||||||
<Stack gap={theme.spacing(10)}>
|
<Stack gap={theme.spacing(10)}>
|
||||||
|
<Breadcrumbs list={crumbs} />
|
||||||
<Tabs
|
<Tabs
|
||||||
form={form}
|
form={form}
|
||||||
errors={errors}
|
errors={errors}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import SkeletonLayout from "./Components/Skeleton";
|
|||||||
import StatusBar from "./Components/StatusBar";
|
import StatusBar from "./Components/StatusBar";
|
||||||
import MonitorsList from "./Components/MonitorsList";
|
import MonitorsList from "./Components/MonitorsList";
|
||||||
import Dialog from "../../../Components/Dialog";
|
import Dialog from "../../../Components/Dialog";
|
||||||
|
import Breadcrumbs from "../../../Components/Breadcrumbs/index.jsx";
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { useStatusPageFetch } from "./Hooks/useStatusPageFetch";
|
import { useStatusPageFetch } from "./Hooks/useStatusPageFetch";
|
||||||
@@ -28,6 +29,10 @@ const PublicStatus = () => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const crumbs = [
|
||||||
|
{ name: "status pages", path: "/status" },
|
||||||
|
{ name: "details", path: "" },
|
||||||
|
];
|
||||||
|
|
||||||
const [statusPage, monitors, isLoading, networkError, fetchStatusPage] =
|
const [statusPage, monitors, isLoading, networkError, fetchStatusPage] =
|
||||||
useStatusPageFetch(false, url);
|
useStatusPageFetch(false, url);
|
||||||
@@ -123,9 +128,9 @@ const PublicStatus = () => {
|
|||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
gap={theme.spacing(10)}
|
gap={theme.spacing(10)}
|
||||||
alignItems="center"
|
|
||||||
sx={{ ...sx, position: "relative" }}
|
sx={{ ...sx, position: "relative" }}
|
||||||
>
|
>
|
||||||
|
{!isPublic && <Breadcrumbs list={crumbs} />}
|
||||||
<ControlsHeader
|
<ControlsHeader
|
||||||
statusPage={statusPage}
|
statusPage={statusPage}
|
||||||
isDeleting={isDeleting}
|
isDeleting={isDeleting}
|
||||||
|
|||||||
Reference in new issue
Block a user