mirror of
https://github.com/dstotijn/hetty.git
synced 2025-07-01 18:47:29 -04:00
Add notification when intercept settings are updated
This commit is contained in:
@ -2,12 +2,14 @@ import { useApolloClient } from "@apollo/client";
|
|||||||
import { TabContext, TabPanel } from "@mui/lab";
|
import { TabContext, TabPanel } from "@mui/lab";
|
||||||
import TabList from "@mui/lab/TabList";
|
import TabList from "@mui/lab/TabList";
|
||||||
import {
|
import {
|
||||||
|
Alert,
|
||||||
Box,
|
Box,
|
||||||
Button,
|
Button,
|
||||||
CircularProgress,
|
CircularProgress,
|
||||||
FormControl,
|
FormControl,
|
||||||
FormControlLabel,
|
FormControlLabel,
|
||||||
FormHelperText,
|
FormHelperText,
|
||||||
|
Snackbar,
|
||||||
Switch,
|
Switch,
|
||||||
Tab,
|
Tab,
|
||||||
TextField,
|
TextField,
|
||||||
@ -63,6 +65,7 @@ export default function Settings(): JSX.Element {
|
|||||||
|
|
||||||
setInterceptReqFilter(data.updateInterceptSettings.requestFilter || "");
|
setInterceptReqFilter(data.updateInterceptSettings.requestFilter || "");
|
||||||
setInterceptResFilter(data.updateInterceptSettings.responseFilter || "");
|
setInterceptResFilter(data.updateInterceptSettings.responseFilter || "");
|
||||||
|
setSettingsUpdatedOpen(true);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -140,6 +143,15 @@ export default function Settings(): JSX.Element {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const [tabValue, setTabValue] = useState(TabValue.Intercept);
|
const [tabValue, setTabValue] = useState(TabValue.Intercept);
|
||||||
|
const [settingsUpdatedOpen, setSettingsUpdatedOpen] = useState(false);
|
||||||
|
|
||||||
|
const handleSettingsUpdatedClose = (_: Event | React.SyntheticEvent, reason?: string) => {
|
||||||
|
if (reason === "clickaway") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setSettingsUpdatedOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
const tabSx = {
|
const tabSx = {
|
||||||
textTransform: "none",
|
textTransform: "none",
|
||||||
@ -147,6 +159,12 @@ export default function Settings(): JSX.Element {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box p={4}>
|
<Box p={4}>
|
||||||
|
<Snackbar open={settingsUpdatedOpen} autoHideDuration={3000} onClose={handleSettingsUpdatedClose}>
|
||||||
|
<Alert onClose={handleSettingsUpdatedClose} severity="info">
|
||||||
|
Intercept settings have been updated.
|
||||||
|
</Alert>
|
||||||
|
</Snackbar>
|
||||||
|
|
||||||
<Typography variant="h4" sx={{ mb: 2 }}>
|
<Typography variant="h4" sx={{ mb: 2 }}>
|
||||||
Settings
|
Settings
|
||||||
</Typography>
|
</Typography>
|
||||||
|
Reference in New Issue
Block a user