Merge remote-tracking branch 'upstream/develop' into feat/monitor-notification-integration

This commit is contained in:
Skorpios committed 2025-03-23 20:46:27 -07:00
commit 7badb3c642
4 files changed
+41 -12

No files matched your search

+1
View File
@@ -78,6 +78,7 @@ const useSubscribeToDepinMonitors = (page, rowsPerPage) => {
}, },
onError: () => { onError: () => {
setIsLoading(false); setIsLoading(false);
setNetworkError(true);
}, },
}); });
+18 -1
View File
@@ -10,6 +10,8 @@ import Breadcrumbs from "../../Components/Breadcrumbs";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { useIsAdmin } from "../../Hooks/useIsAdmin"; import { useIsAdmin } from "../../Hooks/useIsAdmin";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Typography } from "@mui/material";
import GenericFallback from "../../Components/GenericFallback";
const Maintenance = () => { const Maintenance = () => {
const theme = useTheme(); const theme = useTheme();
@@ -22,6 +24,7 @@ const Maintenance = () => {
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 handleActionMenuDelete = () => { const handleActionMenuDelete = () => {
setUpdateTrigger((prev) => !prev); setUpdateTrigger((prev) => !prev);
@@ -38,12 +41,26 @@ const Maintenance = () => {
setMaintenanceWindows(maintenanceWindows); setMaintenanceWindows(maintenanceWindows);
setMaintenanceWindowCount(maintenanceWindowCount); setMaintenanceWindowCount(maintenanceWindowCount);
} catch (error) { } catch (error) {
console.log(error); setNetworkError(true);
} }
}; };
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("networkError")}
</Typography>
<Typography>{t("checkConnection")}</Typography>
</GenericFallback>
);
}
if (maintenanceWindows.length === 0) { if (maintenanceWindows.length === 0) {
return ( return (
<Fallback <Fallback
+9 -2
View File
@@ -134,6 +134,7 @@ const Settings = () => {
}); });
} else { } else {
if (action.payload) { if (action.payload) {
console.log(action.payload);
// dispatch errors // dispatch errors
createToast({ createToast({
body: action.payload.msg, body: action.payload.msg,
@@ -298,7 +299,14 @@ const Settings = () => {
{t("settingsWalletDescription")} {t("settingsWalletDescription")}
</Typography> </Typography>
</Box> </Box>
<Box sx={{ display: 'flex', flexWrap: 'wrap', justifyContent: 'flex-start', gap: 2 }}> <Box
sx={{
display: "flex",
flexWrap: "wrap",
justifyContent: "flex-start",
gap: 2,
}}
>
<Stack <Stack
direction="row" direction="row"
spacing={2} spacing={2}
@@ -401,7 +409,6 @@ const Settings = () => {
</ConfigBox> </ConfigBox>
)} )}
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h1">{t("settingsAbout")}</Typography> <Typography component="h1">{t("settingsAbout")}</Typography>
+13 -9
View File
@@ -669,7 +669,7 @@ class NetworkService {
}); });
} }
/** /**
* ************************************ * ************************************
* Test a notification integration * Test a notification integration
* ************************************ * ************************************
@@ -681,14 +681,18 @@ class NetworkService {
* @returns {Promise<AxiosResponse>} The response from the axios POST request. * @returns {Promise<AxiosResponse>} The response from the axios POST request.
*/ */
async testNotification(config) { async testNotification(config) {
return this.axiosInstance.post('/notifications/test-webhook', { return this.axiosInstance.post(
platform: config.platform, "/notifications/test-webhook",
...config.payload {
}, { platform: config.platform,
headers: { ...config.payload,
"Content-Type": "application/json", },
}, {
}); headers: {
"Content-Type": "application/json",
},
}
);
} }
/** /**