standardize uptime directory structure, use shared components
This commit is contained in:
1 parent
ac669d8fe1
commit
9840999183
5 files changed
+28
-11
No files matched your search
File renamed without changes.
File renamed without changes.
@@ -30,7 +30,7 @@ const StatusBoxes = ({ shouldRender, monitorsSummary }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
StatusBoxes.propTypes = {
|
StatusBoxes.propTypes = {
|
||||||
monitorsSummary: PropTypes.object.isRequired,
|
monitorsSummary: PropTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default StatusBoxes;
|
export default StatusBoxes;
|
||||||
@@ -12,7 +12,9 @@ import { useState } from "react";
|
|||||||
import SearchComponent from "../SearchComponent";
|
import SearchComponent from "../SearchComponent";
|
||||||
import CircularCount from "../../../../../Components/CircularCount";
|
import CircularCount from "../../../../../Components/CircularCount";
|
||||||
import LoadingSpinner from "../LoadingSpinner";
|
import LoadingSpinner from "../LoadingSpinner";
|
||||||
|
import MonitorCountHeader from "../../../../../Components/MonitorCountHeader";
|
||||||
import UptimeDataTableSkeleton from "./skeleton";
|
import UptimeDataTableSkeleton from "./skeleton";
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import useUtils from "../../Hooks/useUtils";
|
import useUtils from "../../Hooks/useUtils";
|
||||||
@@ -214,21 +216,19 @@ const UptimeDataTable = (props) => {
|
|||||||
flex={1}
|
flex={1}
|
||||||
py={theme.spacing(8)}
|
py={theme.spacing(8)}
|
||||||
>
|
>
|
||||||
<Stack
|
<MonitorCountHeader
|
||||||
direction="row"
|
shouldRender={!monitorsAreLoading}
|
||||||
alignItems="center"
|
monitorCount={monitorCount}
|
||||||
mb={theme.spacing(8)}
|
heading="Uptime monitors"
|
||||||
gap={theme.spacing(2)}
|
sx={{ mb: theme.spacing(8) }}
|
||||||
>
|
>
|
||||||
<Heading component="h2">Uptime monitors</Heading>
|
|
||||||
<CircularCount count={monitorCount} />
|
|
||||||
<SearchComponent
|
<SearchComponent
|
||||||
monitorsAreLoading={monitorsAreLoading}
|
monitorsAreLoading={monitorsAreLoading}
|
||||||
monitors={monitors}
|
monitors={monitors}
|
||||||
onSearchChange={setSearch}
|
onSearchChange={setSearch}
|
||||||
setIsSearching={setIsSearching}
|
setIsSearching={setIsSearching}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</MonitorCountHeader>
|
||||||
|
|
||||||
<MonitorDataTable
|
<MonitorDataTable
|
||||||
shouldRender={!monitorsAreLoading}
|
shouldRender={!monitorsAreLoading}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import Greeting from "../../../Utils/greeting";
|
|||||||
import StatusBoxes from "./Components/StatusBoxes";
|
import StatusBoxes from "./Components/StatusBoxes";
|
||||||
import UptimeDataTable from "./Components/UptimeDataTable";
|
import UptimeDataTable from "./Components/UptimeDataTable";
|
||||||
import Pagination from "../../../Components/Table/TablePagination";
|
import Pagination from "../../../Components/Table/TablePagination";
|
||||||
|
import CreateMonitorHeader from "../../../Components/CreateMonitorHeader";
|
||||||
|
import Fallback from "../../../Components/Fallback";
|
||||||
// MUI Components
|
// MUI Components
|
||||||
import { Stack, Box, Button } from "@mui/material";
|
import { Stack, Box, Button } from "@mui/material";
|
||||||
|
|
||||||
@@ -99,13 +100,29 @@ const UptimeMonitors = () => {
|
|||||||
});
|
});
|
||||||
const totalMonitors = monitorsSummary?.totalMonitors ?? 0;
|
const totalMonitors = monitorsSummary?.totalMonitors ?? 0;
|
||||||
|
|
||||||
|
if (!isLoading && monitors?.length === 0) {
|
||||||
|
return (
|
||||||
|
<Fallback
|
||||||
|
vowelStart={true}
|
||||||
|
title="uptime monitor"
|
||||||
|
checks={["Check if a website or service is up and running"]}
|
||||||
|
link="/uptime/create"
|
||||||
|
isAdmin={isAdmin}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
className="monitors"
|
className="monitors"
|
||||||
gap={theme.spacing(10)}
|
gap={theme.spacing(10)}
|
||||||
>
|
>
|
||||||
<Breadcrumbs list={BREADCRUMBS} />
|
<Breadcrumbs list={BREADCRUMBS} />
|
||||||
<CreateMonitorButton shouldRender={true} />
|
<CreateMonitorHeader
|
||||||
|
isAdmin={isAdmin}
|
||||||
|
shouldRender={!isLoading}
|
||||||
|
path="/uptime/create"
|
||||||
|
/>
|
||||||
<Greeting type="uptime" />
|
<Greeting type="uptime" />
|
||||||
<StatusBoxes
|
<StatusBoxes
|
||||||
monitorsSummary={monitorsSummary}
|
monitorsSummary={monitorsSummary}
|
||||||
|
|||||||
Reference in new issue
Block a user