Merge branch 'bluewave-labs:develop' into Error-wrap-maintenance-page
This commit is contained in:
4 files changed
+19
-6
No files matched your search
@@ -30,7 +30,6 @@ const StatusHeader = ({ monitor, connectionStatus, elementToCapture }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let bgColor = COLOR_MAP[connectionStatus];
|
let bgColor = COLOR_MAP[connectionStatus];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ColContainer backgroundColor={bgColor}>
|
<ColContainer backgroundColor={bgColor}>
|
||||||
<Stack
|
<Stack
|
||||||
@@ -61,7 +60,8 @@ const StatusHeader = ({ monitor, connectionStatus, elementToCapture }) => {
|
|||||||
backgroundColor={theme.palette.successSecondary.lowContrast}
|
backgroundColor={theme.palette.successSecondary.lowContrast}
|
||||||
color={theme.palette.success.lowContrast}
|
color={theme.palette.success.lowContrast}
|
||||||
>
|
>
|
||||||
{t("distributedUptimeDetailsStatusHeaderUptime")} {(monitor.totalUptime * 100).toFixed(2)}%
|
{t("distributedUptimeDetailsStatusHeaderUptime")}{" "}
|
||||||
|
{(monitor.uptimePercentage * 100).toFixed(2)}%
|
||||||
</Typography>
|
</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Typography
|
<Typography
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ const PublicStatus = () => {
|
|||||||
const [isDeleteOpen, setIsDeleteOpen] = useState(false);
|
const [isDeleteOpen, setIsDeleteOpen] = useState(false);
|
||||||
// Utils
|
// Utils
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isAdmin = useIsAdmin();
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
@@ -33,7 +32,6 @@ const PublicStatus = () => {
|
|||||||
const [deleteStatusPage, isDeleting] = useStatusPageDelete(fetchStatusPage, url);
|
const [deleteStatusPage, isDeleting] = useStatusPageDelete(fetchStatusPage, url);
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
const currentPath = location.pathname;
|
|
||||||
let sx = { paddingLeft: theme.spacing(20), paddingRight: theme.spacing(20) };
|
let sx = { paddingLeft: theme.spacing(20), paddingRight: theme.spacing(20) };
|
||||||
let link = undefined;
|
let link = undefined;
|
||||||
const isPublic = location.pathname.startsWith("/status/uptime/public");
|
const isPublic = location.pathname.startsWith("/status/uptime/public");
|
||||||
|
|||||||
@@ -2,18 +2,30 @@ import { useState } from "react";
|
|||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { networkService } from "../../../../main";
|
import { networkService } from "../../../../main";
|
||||||
import { createToast } from "../../../../Utils/toastUtils";
|
import { createToast } from "../../../../Utils/toastUtils";
|
||||||
export const useChecksFetch = ({ monitorId, dateRange, page, rowsPerPage }) => {
|
export const useChecksFetch = ({
|
||||||
|
monitorId,
|
||||||
|
monitorType,
|
||||||
|
dateRange,
|
||||||
|
page,
|
||||||
|
rowsPerPage,
|
||||||
|
}) => {
|
||||||
const [checks, setChecks] = useState(undefined);
|
const [checks, setChecks] = useState(undefined);
|
||||||
const [checksCount, setChecksCount] = useState(undefined);
|
const [checksCount, setChecksCount] = useState(undefined);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [networkError, setNetworkError] = useState(false);
|
const [networkError, setNetworkError] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!monitorType) {
|
||||||
|
console.warn("Monitor Type is not provided. Fetching checks will not proceed.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const fetchChecks = async () => {
|
const fetchChecks = async () => {
|
||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
const res = await networkService.getChecksByMonitor({
|
const res = await networkService.getChecksByMonitor({
|
||||||
monitorId: monitorId,
|
monitorId: monitorId,
|
||||||
|
type: monitorType,
|
||||||
sortOrder: "desc",
|
sortOrder: "desc",
|
||||||
limit: null,
|
limit: null,
|
||||||
dateRange: dateRange,
|
dateRange: dateRange,
|
||||||
@@ -31,7 +43,7 @@ export const useChecksFetch = ({ monitorId, dateRange, page, rowsPerPage }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
fetchChecks();
|
fetchChecks();
|
||||||
}, [monitorId, dateRange, page, rowsPerPage]);
|
}, [monitorId, monitorType, dateRange, page, rowsPerPage]);
|
||||||
|
|
||||||
return [checks, checksCount, isLoading, networkError];
|
return [checks, checksCount, isLoading, networkError];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -59,8 +59,11 @@ const UptimeDetails = () => {
|
|||||||
uiTimezone,
|
uiTimezone,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const monitorType = monitor?.type;
|
||||||
|
|
||||||
const [checks, checksCount, checksAreLoading, checksNetworkError] = useChecksFetch({
|
const [checks, checksCount, checksAreLoading, checksNetworkError] = useChecksFetch({
|
||||||
monitorId,
|
monitorId,
|
||||||
|
monitorType,
|
||||||
dateRange,
|
dateRange,
|
||||||
page,
|
page,
|
||||||
rowsPerPage,
|
rowsPerPage,
|
||||||
|
|||||||
Reference in new issue
Block a user