Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcd6786149 | ||
|
|
45bfdbdce0 | ||
|
|
1537c2141f | ||
|
|
ea968ebf3c | ||
|
|
3ba1a52644 | ||
|
|
a015cc6706 | ||
|
|
5bad362793 | ||
|
|
5520756edd | ||
|
|
ba954a1d6e | ||
|
|
2944ff298c | ||
|
|
80d121e87a | ||
|
|
8a7b852974 | ||
|
|
ed8352d857 | ||
|
|
41f64ca9fe | ||
|
|
738e49dc92 | ||
|
|
68a16257c6 | ||
|
|
5dcbae55f4 | ||
|
|
e0d963256c | ||
|
|
2bff4bbd15 | ||
|
|
a0eba89f34 | ||
|
|
4e78de9da2 | ||
|
|
85f00eb7e8 | ||
|
|
8e13855b66 | ||
|
|
06f49e24c2 | ||
|
|
e598ae45f7 | ||
|
|
ad7f469e06 | ||
|
|
27d613b594 |
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { Box, Stack, Tooltip, Typography } from "@mui/material";
|
import { Box, Stack, Tooltip, Typography } from "@mui/material";
|
||||||
import { formatDateWithTz } from "../../../Utils/timeUtils";
|
import { formatDateWithTz } from "../../../Utils/timeUtils";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState, forwardRef } from "react";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
@@ -17,23 +17,29 @@ import PropTypes from "prop-types";
|
|||||||
* @returns {JSX.Element} The Bar component.
|
* @returns {JSX.Element} The Bar component.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const Bar = ({ width, height, backgroundColor, borderRadius, children }) => {
|
const Bar = forwardRef(
|
||||||
const theme = useTheme();
|
({ width, height, backgroundColor, borderRadius, children, ...otherProps }, ref) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
width={width}
|
ref={ref}
|
||||||
position="relative"
|
position="relative"
|
||||||
height={height}
|
width={width}
|
||||||
backgroundColor={backgroundColor}
|
height={height}
|
||||||
sx={{
|
backgroundColor={backgroundColor}
|
||||||
borderRadius: borderRadius || theme.spacing(1.5),
|
sx={{
|
||||||
}}
|
borderRadius: borderRadius || theme.spacing(1.5),
|
||||||
>
|
}}
|
||||||
{children}
|
{...otherProps}
|
||||||
</Box>
|
>
|
||||||
);
|
{children}
|
||||||
};
|
</Box>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
Bar.displayName = "Bar";
|
||||||
|
|
||||||
Bar.propTypes = {
|
Bar.propTypes = {
|
||||||
width: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
|
width: PropTypes.oneOfType([PropTypes.string, PropTypes.object]).isRequired,
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
import GenericFallback from "../GenericFallback";
|
||||||
|
import Fallback from "../Fallback";
|
||||||
|
import { Typography } from "@mui/material";
|
||||||
|
import { useTheme } from "@emotion/react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useIsAdmin } from "../../Hooks/useIsAdmin";
|
||||||
|
import PropTypes from "prop-types";
|
||||||
|
const PageStateWrapper = ({
|
||||||
|
networkError,
|
||||||
|
isLoading,
|
||||||
|
items,
|
||||||
|
type,
|
||||||
|
fallbackLink,
|
||||||
|
fallbackChildren,
|
||||||
|
children,
|
||||||
|
}) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const isAdmin = useIsAdmin();
|
||||||
|
const isEmpty = items === null || (Array.isArray(items) && items.length === 0);
|
||||||
|
const hasInitialized = items !== undefined && !(isLoading && isEmpty);
|
||||||
|
const showEmpty = !isLoading && isEmpty;
|
||||||
|
if (networkError) {
|
||||||
|
return (
|
||||||
|
<GenericFallback>
|
||||||
|
<Typography
|
||||||
|
variant="h1"
|
||||||
|
marginY={theme.spacing(4)}
|
||||||
|
color={theme.palette.primary.contrastTextTertiary}
|
||||||
|
>
|
||||||
|
{t("common.toasts.networkError")}
|
||||||
|
</Typography>
|
||||||
|
<Typography>{t("common.toasts.checkConnection")}</Typography>
|
||||||
|
</GenericFallback>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!hasInitialized) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (showEmpty) {
|
||||||
|
return (
|
||||||
|
<Fallback
|
||||||
|
type={type}
|
||||||
|
title={t(`${type}.fallback.title`)}
|
||||||
|
checks={t(`${type}.fallback.checks`, { returnObjects: true })}
|
||||||
|
link={fallbackLink}
|
||||||
|
isAdmin={isAdmin}
|
||||||
|
>
|
||||||
|
{fallbackChildren}
|
||||||
|
</Fallback>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return <>{children}</>;
|
||||||
|
};
|
||||||
|
|
||||||
|
PageStateWrapper.propTypes = {
|
||||||
|
networkError: PropTypes.any,
|
||||||
|
isLoading: PropTypes.bool,
|
||||||
|
items: PropTypes.oneOfType([PropTypes.array, PropTypes.oneOf([null])]),
|
||||||
|
type: PropTypes.string,
|
||||||
|
fallbackLink: PropTypes.string,
|
||||||
|
fallbackChildren: PropTypes.node,
|
||||||
|
children: PropTypes.node,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PageStateWrapper;
|
||||||
@@ -34,7 +34,7 @@ const useCreateNotification = () => {
|
|||||||
|
|
||||||
const useGetNotificationsByTeamId = (updateTrigger) => {
|
const useGetNotificationsByTeamId = (updateTrigger) => {
|
||||||
const [notifications, setNotifications] = useState([]);
|
const [notifications, setNotifications] = useState([]);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
// Components
|
// Components
|
||||||
import { Stack, Typography } from "@mui/material";
|
import { Stack } from "@mui/material";
|
||||||
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
||||||
import MonitorCountHeader from "../../../Components/MonitorCountHeader";
|
import MonitorCountHeader from "../../../Components/MonitorCountHeader";
|
||||||
import MonitorCreateHeader from "../../../Components/MonitorCreateHeader";
|
import MonitorCreateHeader from "../../../Components/MonitorCreateHeader";
|
||||||
import MonitorsTable from "./Components/MonitorsTable";
|
import MonitorsTable from "./Components/MonitorsTable";
|
||||||
import Pagination from "../../..//Components/Table/TablePagination";
|
import Pagination from "../../..//Components/Table/TablePagination";
|
||||||
import GenericFallback from "../../../Components/GenericFallback";
|
import PageStateWrapper from "../../../Components/PageStateWrapper";
|
||||||
import Fallback from "../../../Components/Fallback";
|
|
||||||
import Filter from "./Components/Filters";
|
import Filter from "./Components/Filters";
|
||||||
import SearchComponent from "../../Uptime/Monitors/Components/SearchComponent";
|
import SearchComponent from "../../Uptime/Monitors/Components/SearchComponent";
|
||||||
// Utils
|
// Utils
|
||||||
@@ -81,75 +80,58 @@ const InfrastructureMonitors = () => {
|
|||||||
updateTrigger,
|
updateTrigger,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (networkError === true) {
|
|
||||||
return (
|
|
||||||
<GenericFallback>
|
|
||||||
<Typography
|
|
||||||
variant="h1"
|
|
||||||
marginY={theme.spacing(4)}
|
|
||||||
color={theme.palette.primary.contrastTextTertiary}
|
|
||||||
>
|
|
||||||
{t("common.toasts.networkError")}
|
|
||||||
</Typography>
|
|
||||||
<Typography>{t("common.toasts.checkConnection")}</Typography>
|
|
||||||
</GenericFallback>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isLoading && typeof summary?.totalMonitors === "undefined") {
|
|
||||||
return (
|
|
||||||
<Fallback
|
|
||||||
type="infrastructureMonitor"
|
|
||||||
title={t("infrastructureMonitor.fallback.title")}
|
|
||||||
checks={t("infrastructureMonitor.fallback.checks", { returnObjects: true })}
|
|
||||||
link="/infrastructure/create"
|
|
||||||
isAdmin={isAdmin}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack gap={theme.spacing(10)}>
|
<>
|
||||||
<Breadcrumbs list={BREADCRUMBS} />
|
<PageStateWrapper
|
||||||
<MonitorCreateHeader
|
networkError={networkError}
|
||||||
isAdmin={isAdmin}
|
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
path="/infrastructure/create"
|
items={monitors}
|
||||||
/>
|
type="infrastructureMonitor"
|
||||||
<Stack direction={"row"}>
|
fallbackLink="/infrastructure/create"
|
||||||
<MonitorCountHeader
|
>
|
||||||
isLoading={isLoading}
|
<Stack gap={theme.spacing(10)}>
|
||||||
monitorCount={summary?.totalMonitors ?? 0}
|
<Breadcrumbs list={BREADCRUMBS} />
|
||||||
/>
|
<MonitorCreateHeader
|
||||||
<Filter
|
isAdmin={isAdmin}
|
||||||
selectedStatus={selectedStatus}
|
isLoading={isLoading}
|
||||||
setSelectedStatus={setSelectedStatus}
|
path="/infrastructure/create"
|
||||||
setToFilterStatus={setToFilterStatus}
|
/>
|
||||||
handleReset={handleReset}
|
<Stack direction={"row"}>
|
||||||
/>
|
<MonitorCountHeader
|
||||||
<SearchComponent
|
isLoading={isLoading}
|
||||||
monitors={monitors}
|
monitorCount={summary?.totalMonitors ?? 0}
|
||||||
onSearchChange={setSearch}
|
/>
|
||||||
setIsSearching={setIsSearching}
|
<Filter
|
||||||
/>
|
selectedStatus={selectedStatus}
|
||||||
</Stack>
|
setSelectedStatus={setSelectedStatus}
|
||||||
|
setToFilterStatus={setToFilterStatus}
|
||||||
|
handleReset={handleReset}
|
||||||
|
/>
|
||||||
|
<SearchComponent
|
||||||
|
monitors={monitors}
|
||||||
|
onSearchChange={setSearch}
|
||||||
|
setIsSearching={setIsSearching}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
<MonitorsTable
|
<MonitorsTable
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
monitors={monitors}
|
monitors={monitors}
|
||||||
isAdmin={isAdmin}
|
isAdmin={isAdmin}
|
||||||
handleActionMenuDelete={handleActionMenuDelete}
|
handleActionMenuDelete={handleActionMenuDelete}
|
||||||
isSearching={isSearching}
|
isSearching={isSearching}
|
||||||
/>
|
/>
|
||||||
<Pagination
|
<Pagination
|
||||||
itemCount={summary?.totalMonitors}
|
itemCount={summary?.totalMonitors}
|
||||||
paginationLabel={t("monitors")}
|
paginationLabel={t("monitors")}
|
||||||
page={page}
|
page={page}
|
||||||
rowsPerPage={rowsPerPage}
|
rowsPerPage={rowsPerPage}
|
||||||
handleChangePage={handleChangePage}
|
handleChangePage={handleChangePage}
|
||||||
handleChangeRowsPerPage={handleChangeRowsPerPage}
|
handleChangeRowsPerPage={handleChangeRowsPerPage}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
</PageStateWrapper>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { Stack, Button } from "@mui/material";
|
import { Stack, Button } from "@mui/material";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import Fallback from "../../Components/Fallback";
|
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import "./index.css";
|
import "./index.css";
|
||||||
import MaintenanceTable from "./MaintenanceTable";
|
import MaintenanceTable from "./MaintenanceTable";
|
||||||
@@ -8,24 +7,21 @@ import { useSelector } from "react-redux";
|
|||||||
import { networkService } from "../../main";
|
import { networkService } from "../../main";
|
||||||
import Breadcrumbs from "../../Components/Breadcrumbs";
|
import Breadcrumbs from "../../Components/Breadcrumbs";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useIsAdmin } from "../../Hooks/useIsAdmin";
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Typography } from "@mui/material";
|
import PageStateWrapper from "../../Components/PageStateWrapper";
|
||||||
import GenericFallback from "../../Components/GenericFallback";
|
|
||||||
|
|
||||||
const Maintenance = () => {
|
const Maintenance = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const rowsPerPage = useSelector((state) => state?.ui?.maintenance?.rowsPerPage ?? 5);
|
const rowsPerPage = useSelector((state) => state?.ui?.maintenance?.rowsPerPage ?? 5);
|
||||||
const isAdmin = useIsAdmin();
|
const [maintenanceWindows, setMaintenanceWindows] = useState(undefined);
|
||||||
const [maintenanceWindows, setMaintenanceWindows] = useState([]);
|
|
||||||
const [maintenanceWindowCount, setMaintenanceWindowCount] = useState(0);
|
const [maintenanceWindowCount, setMaintenanceWindowCount] = useState(0);
|
||||||
const [page, setPage] = useState(0);
|
const [page, setPage] = useState(0);
|
||||||
const [sort, setSort] = useState({});
|
const [sort, setSort] = useState({});
|
||||||
const [updateTrigger, setUpdateTrigger] = useState(false);
|
const [updateTrigger, setUpdateTrigger] = useState(false);
|
||||||
const [networkError, setNetworkError] = useState(false);
|
const [networkError, setNetworkError] = useState(false);
|
||||||
const [isDataFetched, setIsDataFetched] = useState(false);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
|
|
||||||
const handleActionMenuDelete = () => {
|
const handleActionMenuDelete = () => {
|
||||||
setUpdateTrigger((prev) => !prev);
|
setUpdateTrigger((prev) => !prev);
|
||||||
@@ -34,80 +30,65 @@ const Maintenance = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchMaintenanceWindows = async () => {
|
const fetchMaintenanceWindows = async () => {
|
||||||
try {
|
try {
|
||||||
|
setNetworkError(false);
|
||||||
|
setIsLoading(true);
|
||||||
const response = await networkService.getMaintenanceWindowsByTeamId({
|
const response = await networkService.getMaintenanceWindowsByTeamId({
|
||||||
page: page,
|
page: page,
|
||||||
rowsPerPage: rowsPerPage,
|
rowsPerPage: rowsPerPage,
|
||||||
});
|
});
|
||||||
const { maintenanceWindows, maintenanceWindowCount } = response.data.data;
|
const { maintenanceWindows, maintenanceWindowCount } = response.data.data;
|
||||||
setMaintenanceWindows(maintenanceWindows);
|
setMaintenanceWindows(maintenanceWindows ?? []);
|
||||||
setMaintenanceWindowCount(maintenanceWindowCount);
|
setMaintenanceWindowCount(maintenanceWindowCount ?? 0);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setNetworkError(true);
|
setNetworkError(true);
|
||||||
} finally {
|
} finally {
|
||||||
setIsDataFetched(true);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
fetchMaintenanceWindows();
|
fetchMaintenanceWindows();
|
||||||
}, [page, rowsPerPage, updateTrigger]);
|
}, [page, rowsPerPage, updateTrigger]);
|
||||||
|
|
||||||
if (networkError) {
|
|
||||||
return (
|
|
||||||
<GenericFallback>
|
|
||||||
<Typography
|
|
||||||
variant="h1"
|
|
||||||
marginY={theme.spacing(4)}
|
|
||||||
color={theme.palette.primary.contrastTextTertiary}
|
|
||||||
>
|
|
||||||
{t("common.toasts.networkError")}
|
|
||||||
</Typography>
|
|
||||||
<Typography>{t("common.toasts.checkConnection")}</Typography>
|
|
||||||
</GenericFallback>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// Only show the fallback if we've fetched data and there are no maintenance windows
|
|
||||||
if (isDataFetched && maintenanceWindows.length === 0) {
|
|
||||||
return (
|
|
||||||
<Fallback
|
|
||||||
type="maintenanceWindow"
|
|
||||||
title={t("maintenanceWindow.fallback.title")}
|
|
||||||
checks={t("maintenanceWindow.fallback.checks", { returnObjects: true })}
|
|
||||||
link="/maintenance/create"
|
|
||||||
isAdmin={isAdmin}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack gap={theme.spacing(10)}>
|
<>
|
||||||
<Stack
|
<PageStateWrapper
|
||||||
direction="row"
|
networkError={networkError}
|
||||||
justifyContent="space-between"
|
isLoading={isLoading}
|
||||||
alignItems="center"
|
items={maintenanceWindows}
|
||||||
mt={theme.spacing(5)}
|
type="maintenanceWindow"
|
||||||
|
fallbackLink="/maintenance/create"
|
||||||
>
|
>
|
||||||
<Breadcrumbs list={[{ name: "maintenance", path: "/maintenance" }]} />
|
<Stack gap={theme.spacing(10)}>
|
||||||
<Button
|
<Stack
|
||||||
variant="contained"
|
direction="row"
|
||||||
color="accent"
|
justifyContent="space-between"
|
||||||
onClick={() => {
|
alignItems="center"
|
||||||
navigate("/maintenance/create");
|
mt={theme.spacing(5)}
|
||||||
}}
|
>
|
||||||
sx={{ fontWeight: 500 }}
|
<Breadcrumbs list={[{ name: "maintenance", path: "/maintenance" }]} />
|
||||||
>
|
<Button
|
||||||
{t("createMaintenanceWindow")}
|
variant="contained"
|
||||||
</Button>
|
color="accent"
|
||||||
</Stack>
|
onClick={() => {
|
||||||
<MaintenanceTable
|
navigate("/maintenance/create");
|
||||||
page={page}
|
}}
|
||||||
setPage={setPage}
|
sx={{ fontWeight: 500 }}
|
||||||
rowsPerPage={rowsPerPage}
|
>
|
||||||
sort={sort}
|
{t("createMaintenanceWindow")}
|
||||||
setSort={setSort}
|
</Button>
|
||||||
maintenanceWindows={maintenanceWindows}
|
</Stack>
|
||||||
maintenanceWindowCount={maintenanceWindowCount}
|
<MaintenanceTable
|
||||||
updateCallback={handleActionMenuDelete}
|
page={page}
|
||||||
/>
|
setPage={setPage}
|
||||||
</Stack>
|
rowsPerPage={rowsPerPage}
|
||||||
|
sort={sort}
|
||||||
|
setSort={setSort}
|
||||||
|
maintenanceWindows={maintenanceWindows}
|
||||||
|
maintenanceWindowCount={maintenanceWindowCount}
|
||||||
|
updateCallback={handleActionMenuDelete}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</PageStateWrapper>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,10 @@ import Typography from "@mui/material/Typography";
|
|||||||
import Breadcrumbs from "../../Components/Breadcrumbs";
|
import Breadcrumbs from "../../Components/Breadcrumbs";
|
||||||
import Button from "@mui/material/Button";
|
import Button from "@mui/material/Button";
|
||||||
import DataTable from "../../Components/Table";
|
import DataTable from "../../Components/Table";
|
||||||
import Fallback from "../../Components/Fallback";
|
|
||||||
import ActionMenu from "./components/ActionMenu";
|
import ActionMenu from "./components/ActionMenu";
|
||||||
|
import PageStateWrapper from "../../Components/PageStateWrapper";
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { useIsAdmin } from "../../Hooks/useIsAdmin";
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
@@ -23,7 +22,6 @@ const Notifications = () => {
|
|||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const BREADCRUMBS = [{ name: "notifications", path: "/notifications" }];
|
const BREADCRUMBS = [{ name: "notifications", path: "/notifications" }];
|
||||||
const [updateTrigger, setUpdateTrigger] = useState(false);
|
const [updateTrigger, setUpdateTrigger] = useState(false);
|
||||||
const isAdmin = useIsAdmin();
|
|
||||||
const [notifications, isLoading, error] = useGetNotificationsByTeamId(updateTrigger);
|
const [notifications, isLoading, error] = useGetNotificationsByTeamId(updateTrigger);
|
||||||
const [deleteNotification, isDeleting, deleteError] = useDeleteNotification();
|
const [deleteNotification, isDeleting, deleteError] = useDeleteNotification();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -76,49 +74,47 @@ const Notifications = () => {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
if (notifications?.length === 0) {
|
|
||||||
return (
|
|
||||||
<Fallback
|
|
||||||
type="notifications"
|
|
||||||
title={t("notifications.fallback.title")}
|
|
||||||
checks={t("notifications.fallback.checks", { returnObjects: true })}
|
|
||||||
link="/notifications/create"
|
|
||||||
isAdmin={isAdmin}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack gap={theme.spacing(10)}>
|
<>
|
||||||
<Breadcrumbs list={BREADCRUMBS} />
|
<PageStateWrapper
|
||||||
<Stack
|
networkError={error}
|
||||||
direction="row"
|
isLoading={isLoading}
|
||||||
justifyContent="flex-end"
|
items={notifications}
|
||||||
|
type="notifications"
|
||||||
|
fallbackLink="/notifications/create"
|
||||||
>
|
>
|
||||||
<Button
|
<Stack gap={theme.spacing(10)}>
|
||||||
variant="contained"
|
<Breadcrumbs list={BREADCRUMBS} />
|
||||||
color="accent"
|
<Stack
|
||||||
onClick={() => navigate("/notifications/create")}
|
direction="row"
|
||||||
>
|
justifyContent="flex-end"
|
||||||
{t("notifications.createButton")}
|
>
|
||||||
</Button>
|
<Button
|
||||||
</Stack>
|
variant="contained"
|
||||||
<Typography variant="h1">{t("notifications.createTitle")}</Typography>
|
color="accent"
|
||||||
<DataTable
|
onClick={() => navigate("/notifications/create")}
|
||||||
config={{
|
>
|
||||||
onRowClick: (row) => navigate(`/notifications/${row._id}`),
|
{t("notifications.createButton")}
|
||||||
rowSX: {
|
</Button>
|
||||||
cursor: "pointer",
|
</Stack>
|
||||||
"&:hover td": {
|
<Typography variant="h1">{t("notifications.createTitle")}</Typography>
|
||||||
backgroundColor: theme.palette.tertiary.main,
|
<DataTable
|
||||||
transition: "background-color .3s ease",
|
config={{
|
||||||
},
|
onRowClick: (row) => navigate(`/notifications/${row._id}`),
|
||||||
},
|
rowSX: {
|
||||||
}}
|
cursor: "pointer",
|
||||||
headers={headers}
|
"&:hover td": {
|
||||||
data={notifications}
|
backgroundColor: theme.palette.tertiary.main,
|
||||||
/>
|
transition: "background-color .3s ease",
|
||||||
</Stack>
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
headers={headers}
|
||||||
|
data={notifications}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</PageStateWrapper>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,16 @@
|
|||||||
// Components
|
// Components
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
||||||
import { Stack, Typography } from "@mui/material";
|
import { Stack } from "@mui/material";
|
||||||
import CreateMonitorHeader from "../../../Components/MonitorCreateHeader";
|
import CreateMonitorHeader from "../../../Components/MonitorCreateHeader";
|
||||||
import MonitorCountHeader from "../../../Components/MonitorCountHeader";
|
import MonitorCountHeader from "../../../Components/MonitorCountHeader";
|
||||||
import MonitorGrid from "./Components/MonitorGrid";
|
import MonitorGrid from "./Components/MonitorGrid";
|
||||||
import Fallback from "../../../Components/Fallback";
|
import PageStateWrapper from "../../../Components/PageStateWrapper";
|
||||||
import GenericFallback from "../../../Components/GenericFallback";
|
|
||||||
import FallbackPageSpeedWarning from "../../../Components/Fallback/FallbackPageSpeedWarning";
|
import FallbackPageSpeedWarning from "../../../Components/Fallback/FallbackPageSpeedWarning";
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
|
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
import { useFetchMonitorsByTeamId } from "../../../Hooks/monitorHooks";
|
import { useFetchMonitorsByTeamId } from "../../../Hooks/monitorHooks";
|
||||||
import { useFetchSettings } from "../../../Hooks/settingsHooks";
|
import { useFetchSettings } from "../../../Hooks/settingsHooks";
|
||||||
// Constants
|
// Constants
|
||||||
@@ -20,7 +18,6 @@ const BREADCRUMBS = [{ name: `pagespeed`, path: "/pagespeed" }];
|
|||||||
const TYPES = ["pagespeed"];
|
const TYPES = ["pagespeed"];
|
||||||
const PageSpeed = () => {
|
const PageSpeed = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { t } = useTranslation();
|
|
||||||
const isAdmin = useIsAdmin();
|
const isAdmin = useIsAdmin();
|
||||||
|
|
||||||
const [monitors, monitorsSummary, isLoading, networkError] = useFetchMonitorsByTeamId({
|
const [monitors, monitorsSummary, isLoading, networkError] = useFetchMonitorsByTeamId({
|
||||||
@@ -40,56 +37,42 @@ const PageSpeed = () => {
|
|||||||
setIsEmailPasswordSet: () => {},
|
setIsEmailPasswordSet: () => {},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (networkError === true) {
|
|
||||||
return (
|
|
||||||
<GenericFallback>
|
|
||||||
<Typography
|
|
||||||
variant="h1"
|
|
||||||
marginY={theme.spacing(4)}
|
|
||||||
color={theme.palette.primary.contrastTextTertiary}
|
|
||||||
>
|
|
||||||
{t("common.toasts.networkError")}
|
|
||||||
</Typography>
|
|
||||||
<Typography>{t("common.toasts.checkConnection")}</Typography>
|
|
||||||
</GenericFallback>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isLoading && monitors?.length === 0) {
|
|
||||||
return (
|
|
||||||
<Fallback
|
|
||||||
type="pageSpeed"
|
|
||||||
title={t("pageSpeed.fallback.title")}
|
|
||||||
checks={t("pageSpeed.fallback.checks", { returnObjects: true })}
|
|
||||||
link="/pagespeed/create"
|
|
||||||
isAdmin={isAdmin}
|
|
||||||
>
|
|
||||||
{isAdmin && settingsData && !settingsData.pagespeedApiKey && (
|
|
||||||
<FallbackPageSpeedWarning settingsData={settingsData} />
|
|
||||||
)}
|
|
||||||
</Fallback>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack gap={theme.spacing(10)}>
|
<>
|
||||||
<Breadcrumbs list={BREADCRUMBS} />
|
<PageStateWrapper
|
||||||
<CreateMonitorHeader
|
networkError={networkError}
|
||||||
isAdmin={isAdmin}
|
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
path="/pagespeed/create"
|
items={monitors}
|
||||||
/>
|
type="pageSpeed"
|
||||||
<MonitorCountHeader
|
fallbackLink="/pagespeed/create"
|
||||||
isLoading={isLoading}
|
fallbackChildren={
|
||||||
monitorCount={monitorsSummary?.totalMonitors}
|
isAdmin &&
|
||||||
sx={{ mb: theme.spacing(8) }}
|
settingsData &&
|
||||||
/>
|
!settingsData.pagespeedApiKey && (
|
||||||
<MonitorGrid
|
<FallbackPageSpeedWarning settingsData={settingsData} />
|
||||||
size={6}
|
)
|
||||||
shouldRender={!isLoading}
|
}
|
||||||
monitors={monitors}
|
>
|
||||||
/>
|
<Stack gap={theme.spacing(10)}>
|
||||||
</Stack>
|
<Breadcrumbs list={BREADCRUMBS} />
|
||||||
|
<CreateMonitorHeader
|
||||||
|
isAdmin={isAdmin}
|
||||||
|
isLoading={isLoading}
|
||||||
|
path="/pagespeed/create"
|
||||||
|
/>
|
||||||
|
<MonitorCountHeader
|
||||||
|
isLoading={isLoading}
|
||||||
|
monitorCount={monitorsSummary?.totalMonitors}
|
||||||
|
sx={{ mb: theme.spacing(8) }}
|
||||||
|
/>
|
||||||
|
<MonitorGrid
|
||||||
|
size={6}
|
||||||
|
shouldRender={!isLoading}
|
||||||
|
monitors={monitors}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</PageStateWrapper>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,12 @@ import PropTypes from "prop-types";
|
|||||||
|
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
const MonitorsList = ({ isLoading = false, shouldRender = true, monitors = [] }) => {
|
const MonitorsList = ({
|
||||||
|
isLoading = false,
|
||||||
|
shouldRender = true,
|
||||||
|
monitors = [],
|
||||||
|
statusPage = {},
|
||||||
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { determineState } = useMonitorUtils();
|
const { determineState } = useMonitorUtils();
|
||||||
|
|
||||||
@@ -40,10 +45,12 @@ const MonitorsList = ({ isLoading = false, shouldRender = true, monitors = [] })
|
|||||||
alignItems="center"
|
alignItems="center"
|
||||||
gap={theme.spacing(20)}
|
gap={theme.spacing(20)}
|
||||||
>
|
>
|
||||||
<Box flex={9}>
|
{statusPage.showCharts !== false && (
|
||||||
<StatusPageBarChart checks={monitor?.checks?.slice().reverse()} />
|
<Box flex={9}>
|
||||||
</Box>
|
<StatusPageBarChart checks={monitor?.checks?.slice().reverse()} />
|
||||||
<Box flex={1}>
|
</Box>
|
||||||
|
)}
|
||||||
|
<Box flex={statusPage.showCharts !== false ? 1 : 10}>
|
||||||
<StatusLabel
|
<StatusLabel
|
||||||
status={status}
|
status={status}
|
||||||
text={status}
|
text={status}
|
||||||
@@ -60,6 +67,7 @@ const MonitorsList = ({ isLoading = false, shouldRender = true, monitors = [] })
|
|||||||
|
|
||||||
MonitorsList.propTypes = {
|
MonitorsList.propTypes = {
|
||||||
monitors: PropTypes.array.isRequired,
|
monitors: PropTypes.array.isRequired,
|
||||||
|
statusPage: PropTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default MonitorsList;
|
export default MonitorsList;
|
||||||
@@ -154,7 +154,10 @@ const PublicStatus = () => {
|
|||||||
/>
|
/>
|
||||||
<Typography variant="h2">{t("statusPageStatusServiceStatus")}</Typography>
|
<Typography variant="h2">{t("statusPageStatusServiceStatus")}</Typography>
|
||||||
<StatusBar monitors={monitors} />
|
<StatusBar monitors={monitors} />
|
||||||
<MonitorsList monitors={monitors} />
|
<MonitorsList
|
||||||
|
monitors={monitors}
|
||||||
|
statusPage={statusPage}
|
||||||
|
/>
|
||||||
{link}
|
{link}
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
// Components
|
// Components
|
||||||
import { Stack, Typography } from "@mui/material";
|
import { Stack } from "@mui/material";
|
||||||
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
||||||
import Fallback from "../../../Components/Fallback";
|
|
||||||
import MonitorCreateHeader from "../../../Components/MonitorCreateHeader";
|
import MonitorCreateHeader from "../../../Components/MonitorCreateHeader";
|
||||||
import GenericFallback from "../../../Components/GenericFallback";
|
|
||||||
import StatusPagesTable from "./Components/StatusPagesTable";
|
import StatusPagesTable from "./Components/StatusPagesTable";
|
||||||
import SkeletonLayout from "../../../Components/Skeletons/FullPage";
|
import PageStateWrapper from "../../../Components/PageStateWrapper";
|
||||||
// Utils
|
// Utils
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
import { useStatusPagesFetch } from "./Hooks/useStatusPagesFetch";
|
import { useStatusPagesFetch } from "./Hooks/useStatusPagesFetch";
|
||||||
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
|
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
|
||||||
const BREADCRUMBS = [{ name: `Status Pages`, path: "" }];
|
const BREADCRUMBS = [{ name: `Status Pages`, path: "" }];
|
||||||
@@ -16,52 +13,30 @@ const BREADCRUMBS = [{ name: `Status Pages`, path: "" }];
|
|||||||
const StatusPages = () => {
|
const StatusPages = () => {
|
||||||
// Utils
|
// Utils
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { t } = useTranslation();
|
|
||||||
const isAdmin = useIsAdmin();
|
const isAdmin = useIsAdmin();
|
||||||
const [isLoading, networkError, statusPages] = useStatusPagesFetch();
|
const [isLoading, networkError, statusPages] = useStatusPagesFetch();
|
||||||
|
|
||||||
if (isLoading) {
|
|
||||||
return <SkeletonLayout />;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (networkError === true) {
|
|
||||||
return (
|
|
||||||
<GenericFallback>
|
|
||||||
<Typography
|
|
||||||
variant="h1"
|
|
||||||
marginY={theme.spacing(4)}
|
|
||||||
color={theme.palette.primary.contrastTextTertiary}
|
|
||||||
>
|
|
||||||
{t("common.toasts.networkError")}
|
|
||||||
</Typography>
|
|
||||||
<Typography>{t("common.toasts.checkConnection")}</Typography>
|
|
||||||
</GenericFallback>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isLoading && typeof statusPages !== "undefined" && statusPages.length === 0) {
|
|
||||||
return (
|
|
||||||
<Fallback
|
|
||||||
title={t("statusPage.fallback.title")}
|
|
||||||
checks={t("statusPage.fallback.checks", { returnObjects: true })}
|
|
||||||
type="statusPage"
|
|
||||||
link="/status/uptime/create"
|
|
||||||
isAdmin={isAdmin}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack gap={theme.spacing(10)}>
|
<>
|
||||||
<Breadcrumbs list={BREADCRUMBS} />
|
<PageStateWrapper
|
||||||
<MonitorCreateHeader
|
networkError={networkError}
|
||||||
label="Create status page"
|
|
||||||
isAdmin={isAdmin}
|
|
||||||
path="/status/uptime/create"
|
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
/>
|
items={statusPages}
|
||||||
<StatusPagesTable data={statusPages} />
|
type="statusPage"
|
||||||
</Stack>
|
fallbackLink="/status/uptime/create"
|
||||||
|
>
|
||||||
|
<Stack gap={theme.spacing(10)}>
|
||||||
|
<Breadcrumbs list={BREADCRUMBS} />
|
||||||
|
<MonitorCreateHeader
|
||||||
|
label="Create status page"
|
||||||
|
isAdmin={isAdmin}
|
||||||
|
path="/status/uptime/create"
|
||||||
|
isLoading={isLoading}
|
||||||
|
/>
|
||||||
|
<StatusPagesTable data={statusPages} />
|
||||||
|
</Stack>
|
||||||
|
</PageStateWrapper>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,16 +10,14 @@ 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/MonitorCreateHeader";
|
import CreateMonitorHeader from "../../../Components/MonitorCreateHeader";
|
||||||
import Fallback from "../../../Components/Fallback";
|
|
||||||
import GenericFallback from "../../../Components/GenericFallback";
|
|
||||||
import SearchComponent from "./Components/SearchComponent";
|
import SearchComponent from "./Components/SearchComponent";
|
||||||
import Filter from "./Components/Filter";
|
import Filter from "./Components/Filter";
|
||||||
|
import PageStateWrapper from "../../../Components/PageStateWrapper";
|
||||||
|
|
||||||
import MonitorCountHeader from "../../../Components/MonitorCountHeader";
|
import MonitorCountHeader from "../../../Components/MonitorCountHeader";
|
||||||
|
|
||||||
// MUI Components
|
// MUI Components
|
||||||
import { Stack, Box, Button, Typography } from "@mui/material";
|
import { Stack, Box, Button } from "@mui/material";
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { useState, useCallback, useEffect } from "react";
|
import { useState, useCallback, useEffect } from "react";
|
||||||
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
|
import { useIsAdmin } from "../../../Hooks/useIsAdmin";
|
||||||
@@ -153,93 +151,75 @@ const UptimeMonitors = () => {
|
|||||||
}, [isSearching]);
|
}, [isSearching]);
|
||||||
|
|
||||||
const isLoading = monitorsWithSummaryIsLoading || monitorsWithChecksIsLoading;
|
const isLoading = monitorsWithSummaryIsLoading || monitorsWithChecksIsLoading;
|
||||||
if (networkError) {
|
|
||||||
return (
|
|
||||||
<GenericFallback>
|
|
||||||
<Typography
|
|
||||||
variant="h1"
|
|
||||||
marginY={theme.spacing(4)}
|
|
||||||
color={theme.palette.primary.contrastTextTertiary}
|
|
||||||
>
|
|
||||||
{t("common.toasts.networkError")}
|
|
||||||
</Typography>
|
|
||||||
<Typography>{t("common.toasts.checkConnection")}</Typography>
|
|
||||||
</GenericFallback>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
!isLoading &&
|
|
||||||
(monitorsSummary?.totalMonitors === 0 ||
|
|
||||||
typeof monitorsSummary?.totalMonitors === "undefined")
|
|
||||||
) {
|
|
||||||
return (
|
|
||||||
<Fallback
|
|
||||||
type="uptimeMonitor"
|
|
||||||
title={t("uptimeMonitor.fallback.title")}
|
|
||||||
checks={t("uptimeMonitor.fallback.checks", { returnObjects: true })}
|
|
||||||
link="/uptime/create"
|
|
||||||
isAdmin={isAdmin}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<Stack
|
|
||||||
className="monitors"
|
|
||||||
gap={theme.spacing(10)}
|
|
||||||
>
|
|
||||||
<Breadcrumbs list={BREADCRUMBS} />
|
|
||||||
<CreateMonitorHeader
|
|
||||||
isAdmin={isAdmin}
|
|
||||||
isLoading={isLoading}
|
|
||||||
path="/uptime/create"
|
|
||||||
bulkPath="/uptime/bulk-import"
|
|
||||||
/>
|
|
||||||
<Greeting type="uptime" />
|
|
||||||
<StatusBoxes
|
|
||||||
monitorsSummary={monitorsSummary}
|
|
||||||
shouldRender={!monitorsWithSummaryIsLoading}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Stack direction={"row"}>
|
return (
|
||||||
<MonitorCountHeader
|
<>
|
||||||
isLoading={monitorsWithSummaryIsLoading}
|
<PageStateWrapper
|
||||||
monitorCount={monitorsSummary?.totalMonitors}
|
networkError={networkError}
|
||||||
/>
|
isLoading={isLoading}
|
||||||
<Filter
|
items={monitors}
|
||||||
selectedTypes={selectedTypes}
|
type="uptimeMonitor"
|
||||||
setSelectedTypes={setSelectedTypes}
|
fallbackLink="/uptime/create"
|
||||||
selectedStatus={selectedStatus}
|
>
|
||||||
setSelectedStatus={setSelectedStatus}
|
<Stack
|
||||||
selectedState={selectedState}
|
className="monitors"
|
||||||
setSelectedState={setSelectedState}
|
gap={theme.spacing(10)}
|
||||||
setToFilterStatus={setToFilterStatus}
|
>
|
||||||
setToFilterActive={setToFilterActive}
|
<Breadcrumbs list={BREADCRUMBS} />
|
||||||
handleReset={handleReset}
|
<CreateMonitorHeader
|
||||||
/>
|
isAdmin={isAdmin}
|
||||||
<SearchComponent
|
isLoading={isLoading}
|
||||||
monitors={monitors}
|
path="/uptime/create"
|
||||||
onSearchChange={setSearch}
|
bulkPath="/uptime/bulk-import"
|
||||||
setIsSearching={setIsSearching}
|
/>
|
||||||
/>
|
<Greeting type="uptime" />
|
||||||
</Stack>
|
<StatusBoxes
|
||||||
<UptimeDataTable
|
monitorsSummary={monitorsSummary}
|
||||||
isAdmin={isAdmin}
|
shouldRender={!monitorsWithSummaryIsLoading}
|
||||||
isSearching={isSearching}
|
/>
|
||||||
filteredMonitors={monitorsWithChecks}
|
|
||||||
sort={sort}
|
<Stack direction={"row"}>
|
||||||
setSort={setSort}
|
<MonitorCountHeader
|
||||||
monitorsAreLoading={monitorsWithChecksIsLoading}
|
isLoading={monitorsWithSummaryIsLoading}
|
||||||
triggerUpdate={triggerUpdate}
|
monitorCount={monitorsSummary?.totalMonitors}
|
||||||
/>
|
/>
|
||||||
<Pagination
|
<Filter
|
||||||
itemCount={monitorsWithChecksCount}
|
selectedTypes={selectedTypes}
|
||||||
paginationLabel="monitors"
|
setSelectedTypes={setSelectedTypes}
|
||||||
page={page}
|
selectedStatus={selectedStatus}
|
||||||
rowsPerPage={rowsPerPage}
|
setSelectedStatus={setSelectedStatus}
|
||||||
handleChangePage={handleChangePage}
|
selectedState={selectedState}
|
||||||
handleChangeRowsPerPage={handleChangeRowsPerPage}
|
setSelectedState={setSelectedState}
|
||||||
/>
|
setToFilterStatus={setToFilterStatus}
|
||||||
</Stack>
|
setToFilterActive={setToFilterActive}
|
||||||
|
handleReset={handleReset}
|
||||||
|
/>
|
||||||
|
<SearchComponent
|
||||||
|
monitors={monitors}
|
||||||
|
onSearchChange={setSearch}
|
||||||
|
setIsSearching={setIsSearching}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
<UptimeDataTable
|
||||||
|
isAdmin={isAdmin}
|
||||||
|
isSearching={isSearching}
|
||||||
|
filteredMonitors={monitorsWithChecks}
|
||||||
|
sort={sort}
|
||||||
|
setSort={setSort}
|
||||||
|
monitorsAreLoading={monitorsWithChecksIsLoading}
|
||||||
|
triggerUpdate={triggerUpdate}
|
||||||
|
/>
|
||||||
|
<Pagination
|
||||||
|
itemCount={monitorsWithChecksCount}
|
||||||
|
paginationLabel="monitors"
|
||||||
|
page={page}
|
||||||
|
rowsPerPage={rowsPerPage}
|
||||||
|
handleChangePage={handleChangePage}
|
||||||
|
handleChangeRowsPerPage={handleChangeRowsPerPage}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
</PageStateWrapper>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { execSync } from "child_process";
|
|||||||
|
|
||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig(({ mode }) => {
|
||||||
const env = loadEnv(mode, process.cwd(), "");
|
const env = loadEnv(mode, process.cwd(), "");
|
||||||
let version = "3.1.5";
|
let version = "3.1.8";
|
||||||
|
|
||||||
return {
|
return {
|
||||||
base: "/",
|
base: "/",
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
FROM node:20-slim
|
FROM node:20-slim
|
||||||
|
|
||||||
|
# Install ping
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y iputils-ping \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY ../../package*.json ./
|
COPY ../../package*.json ./
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
FROM node:20-slim
|
FROM node:20-slim
|
||||||
|
|
||||||
|
# Install ping
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y iputils-ping \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY ./server/package*.json ./
|
COPY ./server/package*.json ./
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
# ---------------------
|
# ---------------------
|
||||||
FROM node:24-slim AS frontend-build
|
FROM node:24-slim AS frontend-build
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WORKDIR /app/client
|
WORKDIR /app/client
|
||||||
|
|
||||||
COPY client/package.json ./
|
COPY client/package.json ./
|
||||||
@@ -20,6 +22,11 @@ RUN npm run build
|
|||||||
# ---------------------
|
# ---------------------
|
||||||
FROM node:24-slim AS backend
|
FROM node:24-slim AS backend
|
||||||
|
|
||||||
|
# Install ping
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y iputils-ping \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app/server
|
WORKDIR /app/server
|
||||||
|
|
||||||
COPY server/package.json ./
|
COPY server/package.json ./
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
services:
|
services:
|
||||||
server:
|
server:
|
||||||
image: ghcr.io/bluewave-labs/checkmate-backend-mono:latest
|
image: ghcr.io/bluewave-labs/checkmate-backend-mono:latest
|
||||||
|
pull_policy: always
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "52345:52345"
|
- "52345:52345"
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ RUN npm run build
|
|||||||
|
|
||||||
FROM node:20-slim AS app
|
FROM node:20-slim AS app
|
||||||
|
|
||||||
|
# Install ping
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y iputils-ping \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app/server
|
WORKDIR /app/server
|
||||||
|
|
||||||
COPY server ./
|
COPY server ./
|
||||||
|
|||||||
Vendored
+5
@@ -1,5 +1,10 @@
|
|||||||
FROM node:20-slim
|
FROM node:20-slim
|
||||||
|
|
||||||
|
# Install ping
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y iputils-ping \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY ./server/package*.json ./
|
COPY ./server/package*.json ./
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
FROM node:20-slim
|
FROM node:20-slim
|
||||||
|
|
||||||
|
# Install ping
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y iputils-ping \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
ENV NODE_OPTIONS="--max-old-space-size=2048"
|
ENV NODE_OPTIONS="--max-old-space-size=2048"
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
FROM node:20-slim
|
FROM node:20-slim
|
||||||
|
|
||||||
|
# Install ping
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y iputils-ping \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
ENV NODE_OPTIONS="--max-old-space-size=2048"
|
ENV NODE_OPTIONS="--max-old-space-size=2048"
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
@@ -162,6 +162,14 @@ class StatusPageModule {
|
|||||||
as: "monitors.checks",
|
as: "monitors.checks",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
$lookup: {
|
||||||
|
from: "monitorstats",
|
||||||
|
localField: "monitors._id",
|
||||||
|
foreignField: "monitorId",
|
||||||
|
as: "monitors.stats",
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
$addFields: {
|
$addFields: {
|
||||||
"monitors.orderIndex": {
|
"monitors.orderIndex": {
|
||||||
@@ -181,6 +189,9 @@ class StatusPageModule {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"monitors.uptimePercentage": {
|
||||||
|
$arrayElemAt: ["$monitors.stats.uptimePercentage", 0],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ $match: { "monitors.orderIndex": { $ne: -1 } } },
|
{ $match: { "monitors.orderIndex": { $ne: -1 } } },
|
||||||
|
|||||||
@@ -75,6 +75,9 @@ class NetworkService {
|
|||||||
const { response, responseTime, error } = await this.timeRequest(() => this.ping.promise.probe(monitor.url));
|
const { response, responseTime, error } = await this.timeRequest(() => this.ping.promise.probe(monitor.url));
|
||||||
|
|
||||||
if (!response) {
|
if (!response) {
|
||||||
|
if (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
throw new Error("Ping failed - no result returned");
|
throw new Error("Ping failed - no result returned");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user