Merge pull request #2462 from bluewave-labs/fix/infrastructure-header
fix: add universal header to infra details
This commit is contained in:
2 files changed
+16
-8
No files matched your search
@@ -221,7 +221,7 @@ const useFetchMonitorById = ({ monitorId, setMonitor, updateTrigger }) => {
|
|||||||
return [isLoading];
|
return [isLoading];
|
||||||
};
|
};
|
||||||
|
|
||||||
const useFetchHardwareMonitorById = ({ monitorId, dateRange }) => {
|
const useFetchHardwareMonitorById = ({ monitorId, dateRange, updateTrigger }) => {
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [networkError, setNetworkError] = useState(false);
|
const [networkError, setNetworkError] = useState(false);
|
||||||
const [monitor, setMonitor] = useState(undefined);
|
const [monitor, setMonitor] = useState(undefined);
|
||||||
@@ -244,7 +244,7 @@ const useFetchHardwareMonitorById = ({ monitorId, dateRange }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
fetchMonitor();
|
fetchMonitor();
|
||||||
}, [monitorId, dateRange]);
|
}, [monitorId, dateRange, updateTrigger]);
|
||||||
return [monitor, isLoading, networkError];
|
return [monitor, isLoading, networkError];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Components
|
// Components
|
||||||
import { Stack, Typography } from "@mui/material";
|
import { Stack, Typography } from "@mui/material";
|
||||||
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
import Breadcrumbs from "../../../Components/Breadcrumbs";
|
||||||
import MonitorStatusHeader from "../../../Components/MonitorStatusHeader";
|
import MonitorDetailsControlHeader from "../../../Components/MonitorDetailsControlHeader";
|
||||||
import MonitorTimeFrameHeader from "../../../Components/MonitorTimeFrameHeader";
|
import MonitorTimeFrameHeader from "../../../Components/MonitorTimeFrameHeader";
|
||||||
import StatusBoxes from "./Components/StatusBoxes";
|
import StatusBoxes from "./Components/StatusBoxes";
|
||||||
import GaugeBoxes from "./Components/GaugeBoxes";
|
import GaugeBoxes from "./Components/GaugeBoxes";
|
||||||
@@ -26,6 +26,7 @@ const InfrastructureDetails = () => {
|
|||||||
|
|
||||||
// Local state
|
// Local state
|
||||||
const [dateRange, setDateRange] = useState("recent");
|
const [dateRange, setDateRange] = useState("recent");
|
||||||
|
const [trigger, setTrigger] = useState(false);
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@@ -36,8 +37,13 @@ const InfrastructureDetails = () => {
|
|||||||
const [monitor, isLoading, networkError] = useFetchHardwareMonitorById({
|
const [monitor, isLoading, networkError] = useFetchHardwareMonitorById({
|
||||||
monitorId,
|
monitorId,
|
||||||
dateRange,
|
dateRange,
|
||||||
|
updateTrigger: trigger,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const triggerUpdate = () => {
|
||||||
|
setTrigger(!trigger);
|
||||||
|
};
|
||||||
|
|
||||||
if (networkError === true) {
|
if (networkError === true) {
|
||||||
return (
|
return (
|
||||||
<GenericFallback>
|
<GenericFallback>
|
||||||
@@ -57,11 +63,12 @@ const InfrastructureDetails = () => {
|
|||||||
return (
|
return (
|
||||||
<Stack gap={theme.spacing(10)}>
|
<Stack gap={theme.spacing(10)}>
|
||||||
<Breadcrumbs list={BREADCRUMBS} />
|
<Breadcrumbs list={BREADCRUMBS} />
|
||||||
<MonitorStatusHeader
|
<MonitorDetailsControlHeader
|
||||||
path={"infrastructure"}
|
path={"infrastructure"}
|
||||||
isAdmin={false}
|
isLoading={isLoading}
|
||||||
shouldRender={!isLoading}
|
isAdmin={isAdmin}
|
||||||
monitor={monitor}
|
monitor={monitor}
|
||||||
|
triggerUpdate={triggerUpdate}
|
||||||
/>
|
/>
|
||||||
<GenericFallback>
|
<GenericFallback>
|
||||||
<Typography>{t("distributedUptimeDetailsNoMonitorHistory")}</Typography>
|
<Typography>{t("distributedUptimeDetailsNoMonitorHistory")}</Typography>
|
||||||
@@ -73,11 +80,12 @@ const InfrastructureDetails = () => {
|
|||||||
return (
|
return (
|
||||||
<Stack gap={theme.spacing(10)}>
|
<Stack gap={theme.spacing(10)}>
|
||||||
<Breadcrumbs list={BREADCRUMBS} />
|
<Breadcrumbs list={BREADCRUMBS} />
|
||||||
<MonitorStatusHeader
|
<MonitorDetailsControlHeader
|
||||||
path={"infrastructure"}
|
path={"infrastructure"}
|
||||||
|
isLoading={isLoading}
|
||||||
isAdmin={isAdmin}
|
isAdmin={isAdmin}
|
||||||
shouldRender={!isLoading}
|
|
||||||
monitor={monitor}
|
monitor={monitor}
|
||||||
|
triggerUpdate={triggerUpdate}
|
||||||
/>
|
/>
|
||||||
<StatusBoxes
|
<StatusBoxes
|
||||||
shouldRender={!isLoading}
|
shouldRender={!isLoading}
|
||||||
|
|||||||
Reference in new issue
Block a user